/* Tech Store - Professional UI (no external dependencies) */

:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --brand:#14532d;
  --brand2:#16a34a;
  --danger:#ef4444;
  --warn:#f59e0b;
  --shadow: 0 10px 25px rgba(17,24,39,.08);
  --radius:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans Bengali", sans-serif;
  color:var(--text);
  background:var(--bg);
}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 18px;
  background:#fff;
  border-bottom:1px solid var(--line);
}

.brand{display:flex; align-items:center; gap:12px;}
.brand-badge{
  width:42px; height:42px; border-radius:14px;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:800;
}
.brand-title{font-weight:800}
.brand-sub{font-size:12px; color:var(--muted); margin-top:2px}

.nav{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.nav-link{
  text-decoration:none;
  color:var(--text);
  font-weight:700;
  padding:10px 12px;
  border-radius:999px;
}
.nav-link:hover{background:rgba(20,83,45,.08)}
.nav-pill{
  background:rgba(20,83,45,.12);
  color:var(--brand);
}

.container{
  max-width:1100px;
  margin:0 auto;
  padding:18px;
}

/* Buttons */
.btn{
  border:none;
  cursor:pointer;
  font-weight:800;
  border-radius:12px;
  padding:12px 14px;
  transition:.15s transform, .15s opacity, .15s background;
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  text-decoration:none;
}
.btn:active{transform:scale(.98)}
.btn-primary{background:var(--brand); color:#fff}
.btn-primary:hover{opacity:.93}
.btn-outline{
  background:#fff;
  border:1px solid var(--line);
  color:var(--text);
}
.btn-outline:hover{background:rgba(229,231,235,.4)}
.btn-ghost{
  background:transparent;
  color:var(--text);
  border:1px solid transparent;
}
.btn-ghost:hover{background:rgba(229,231,235,.45); border-color:rgba(229,231,235,.45)}
.btn-danger{background:var(--danger); color:#fff}
.btn-pill{border-radius:999px; background:rgba(20,83,45,.12); color:var(--brand)}
.btn-block{width:100%}
.btn-sm{padding:8px 10px; border-radius:10px; font-weight:800; font-size:13px}

.inline{display:inline}
.badge{
  background:#fff;
  border:1px solid var(--line);
  padding:3px 8px;
  border-radius:999px;
  margin-left:6px;
  font-size:12px;
  font-weight:800;
}

/* Flash */
.flash-wrap{display:flex; flex-direction:column; gap:10px; margin-bottom:14px}
.flash{
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow: 0 6px 14px rgba(17,24,39,.06);
}
.flash-success{border-color:rgba(22,163,74,.3)}
.flash-warning{border-color:rgba(245,158,11,.3)}
.flash-danger{border-color:rgba(239,68,68,.3)}
.flash-info{border-color:rgba(59,130,246,.25)}

/* Hero */
.hero{
  display:flex;
  gap:16px;
  justify-content:space-between;
  align-items:stretch;
  padding:18px;
  border-radius:var(--radius);
  background:linear-gradient(135deg, rgba(20,83,45,.12), rgba(22,163,74,.08));
  border:1px solid rgba(20,83,45,.12);
  box-shadow: var(--shadow);
  margin-bottom:16px;
}
.hero-mini{align-items:center}
.hero-title{margin:0; font-size:44px; letter-spacing:-.02em}
.hero-sub{margin:10px 0 0; color:var(--muted); font-weight:600}
.hero-actions{display:flex; gap:10px; margin-top:14px; flex-wrap:wrap}
.hero-right{display:flex; gap:12px; align-items:stretch}
.kpi{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px 14px;
  min-width:180px;
}
.kpi-label{color:var(--muted); font-size:12px; font-weight:800}
.kpi-value{font-weight:900; margin-top:6px}

@media (max-width: 820px){
  .hero{flex-direction:column}
  .hero-right{flex-wrap:wrap}
  .kpi{min-width:unset; flex:1}
  .hero-title{font-size:34px}
}

/* Panels */
.panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
  margin-bottom:16px;
}
.panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.panel-title{font-weight:900; font-size:18px}
.panel-sub{color:var(--muted); font-weight:600; font-size:13px; margin-top:4px}

.page-title{margin:0; font-size:26px}

.muted{color:var(--muted)}
.small{font-size:12px}
.strong{font-weight:900}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace}
.link{color:var(--brand); font-weight:800; text-decoration:none}
.link:hover{text-decoration:underline}

/* Filters */
.filters{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.filters-form{display:flex; gap:10px; flex-wrap:wrap; flex:1}

/* Inputs */
.label{display:block; font-weight:800; font-size:13px; margin-top:10px; margin-bottom:6px}
.input{
  width:100%;
  padding:12px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  outline:none;
  background:#fff;
}
.input:focus{border-color:rgba(20,83,45,.45); box-shadow:0 0 0 4px rgba(20,83,45,.10)}
.input-sm{padding:8px 10px; border-radius:10px}

/* Grid cards */
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap:14px;
}
.card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
}
.card-img{position:relative; height:180px; background:rgba(229,231,235,.25)}
.card-img img{width:100%; height:100%; object-fit:cover; display:block}
.img-placeholder{height:100%; display:flex; align-items:center; justify-content:center; color:var(--muted); font-weight:900}
.tag{
  position:absolute; top:10px; left:10px;
  padding:6px 10px; border-radius:999px;
  font-weight:900; font-size:12px;
  color:#111;
  background:#fff;
  border:1px solid var(--line);
}
.tag-warn{border-color:rgba(245,158,11,.4); background:rgba(245,158,11,.18)}
.card-body{padding:14px}
.card-title{font-weight:900; font-size:16px}
.card-meta{display:flex; align-items:center; justify-content:space-between; margin-top:8px}
.price{font-weight:900; color:var(--brand)}
.stock{color:var(--muted); font-weight:700}
.card-details{color:var(--muted); font-size:13px; margin-top:10px; line-height:1.35; max-height:3.8em; overflow:hidden}
.card-actions{display:flex; gap:10px; margin-top:12px}
.card-actions .btn{flex:1}

/* Drawer */
.drawer{position:fixed; inset:0; display:none; z-index:5000}
.drawer[aria-hidden="false"]{display:block}
/* Keep the backdrop and panel in their own fixed layers for reliable click/touch behavior */
.drawer-backdrop{position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:5000; pointer-events:auto}
.drawer-panel{
  position:fixed; top:0; right:0; height:100%; width:min(420px, 92vw);
  background:#fff;
  border-left:1px solid var(--line);
  box-shadow: -10px 0 30px rgba(0,0,0,.18);
  padding:14px;
  display:flex; flex-direction:column;
  /* Ensure the drawer is clickable (backdrop must stay behind panel) */
  z-index:5001;
  pointer-events:auto;
}
.drawer-panel, .drawer-panel *{pointer-events:auto}
.drawer-head{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.drawer-title{font-weight:900; font-size:18px}
.drawer-sub{color:var(--muted); font-size:13px; margin-top:4px}
.drawer-body{overflow:auto; padding:10px 0; flex:1; display:flex; flex-direction:column; gap:10px; -webkit-overflow-scrolling: touch}
.drawer-total{
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line);
  margin-bottom:12px;
  font-weight:900;
}
.total-amount{font-weight:900; font-size:20px; color:var(--brand)}
.drawer-form{padding-top:6px}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width: 520px){ .form-grid{grid-template-columns:1fr} }

.cart-item{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
}
.cart-row{display:flex; justify-content:space-between; gap:10px}
.cart-name{font-weight:900}
.cart-sub{color:var(--muted); font-size:13px; margin-top:4px}
.qty-wrap{display:flex; align-items:center; gap:8px}
.qty-btn{
  width:32px; height:32px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer; font-weight:900;
}
.qty-input{
  width:62px;
  padding:8px 8px;
  border-radius:10px;
  border:1px solid var(--line);
  text-align:center;
}
.remove-link{color:var(--danger); font-weight:900; cursor:pointer}

/* Prevent background page from scrolling when drawers/modals are open (mobile friendly) */
.no-scroll{overflow:hidden}

/* Tables */
.table-wrap{overflow:auto}
.table{width:100%; border-collapse:collapse}
.table th, .table td{padding:12px 10px; border-bottom:1px solid var(--line); vertical-align:top}
.table th{background:rgba(229,231,235,.25); text-align:left; font-size:13px; font-weight:900}
.table .right{text-align:right}
.sep{border:none; border-top:1px solid var(--line); margin:14px 0}

/* Chips */
.chip{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:44px;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  border:1px solid var(--line);
  background:#fff;
}
.chip-ok{border-color:rgba(22,163,74,.35); background:rgba(22,163,74,.10)}
.chip-warn{border-color:rgba(245,158,11,.35); background:rgba(245,158,11,.12)}

/* Status pills */
.status-pill{
  display:inline-flex; align-items:center; justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  border:1px solid var(--line);
  background:#fff;
  font-size:12px;
}
.status-pending{border-color:rgba(245,158,11,.35); background:rgba(245,158,11,.12)}
.status-approved{border-color:rgba(59,130,246,.25); background:rgba(59,130,246,.10)}
.status-packed{border-color:rgba(168,85,247,.25); background:rgba(168,85,247,.10)}
.status-delivered{border-color:rgba(22,163,74,.35); background:rgba(22,163,74,.10)}
.status-cancelled{border-color:rgba(239,68,68,.35); background:rgba(239,68,68,.10)}
.status-sold{border-color:rgba(22,163,74,.35); background:rgba(22,163,74,.10)}

/* Admin */
.admin-head{display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:14px}
.admin-actions{display:flex; gap:10px; flex-wrap:wrap}

.tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.tab{
  text-decoration:none;
  color:var(--text);
  font-weight:900;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
}
.tab.active{background:rgba(20,83,45,.12); border-color:rgba(20,83,45,.22); color:var(--brand)}

/* Thumbs / QR */
.row-flex{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.thumb{
  /* Larger product photo in admin product list (requested) */
  width:92px; height:92px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid var(--line);
}
.thumb.placeholder{background:rgba(229,231,235,.35)}
/* Barcode + QR row in Products list */
.code-row{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:nowrap;
  overflow-x:auto;
}

.qr{
  /* Balanced size: easy scan, fits in one row with 1D barcode */
  width:140px; height:140px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  object-fit:contain;
}

/* 1D Barcode (Code128) */
.barcode1d{
  /* Balanced size: easy scan, fits in one row with QR */
  width:360px;
  height:140px;
  object-fit:contain;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
}

@media (max-width: 520px){
  .thumb{width:72px; height:72px}
  .qr{width:120px; height:120px}
  .barcode1d{width:300px; height:120px}
}
.check-row{display:flex; align-items:center; gap:10px; margin-top:12px}

/* Buyer modal */
.modal{position:fixed; inset:0; display:none; z-index:80}
.modal-high{z-index:6000}
.modal[aria-hidden="false"]{display:block}
.modal-backdrop{position:absolute; inset:0; background:rgba(0,0,0,.45); z-index:1}
.modal-panel{
  position:relative;
  width:min(820px, 92vw);
  margin:6vh auto;
  background:#fff;
  border-radius:18px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
  /* Ensure modal is clickable (backdrop must stay behind panel) */
  z-index:2;
}
.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 14px;
  border-bottom:1px solid var(--line);
}
.modal-title{font-weight:900}
.modal-body{padding:14px}
.hidden{display:none}

/* Buyer card */
.buyer-card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
}
.buyer-head{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:10px}
.buyer-title{font-weight:900; font-size:18px}
.buyer-sub{color:var(--muted); font-size:12px; margin-top:4px}

.two-col{display:grid; grid-template-columns:1fr 1fr; gap:14px}
@media (max-width: 800px){ .two-col{grid-template-columns:1fr} }
.info{border:1px solid var(--line); border-radius:14px; padding:12px}
.info-row{display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px dashed rgba(229,231,235,.8)}
.info-row:last-child{border-bottom:none}
.info-row span:first-child{color:var(--muted); font-weight:800}

/* Billing page */
.scan-row{display:flex; gap:10px; align-items:center}
.scan-row .input{flex:1}
.product-box{
  margin-top:12px;
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  display:flex;
  gap:14px;
  align-items:flex-start;
}
.product-img{
  width:120px; height:120px;
  border-radius:16px;
  border:1px solid var(--line);
  object-fit:cover;
  background:rgba(229,231,235,.25);
}
.product-info{flex:1}
.product-title{font-weight:900; font-size:18px}
.product-meta{display:flex; gap:10px; flex-wrap:wrap; margin-top:8px}
.product-actions{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px}
.checkout-row{display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap}
.search-row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.order-id{font-size:12px}


.scan-result{margin-top:12px}

/* Receipt */
.receipt-wrap{
  display:flex;
  justify-content:center;
  padding:10px;
}
.receipt-img{
  width:min(900px, 100%);
  border-radius:16px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  background:#fff;
}

/* Auth */
.auth{display:flex; justify-content:center; padding:30px 0}
.auth-card{
  width:min(420px, 92vw);
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:18px;
  box-shadow: var(--shadow);
}
.auth-title{font-weight:900; font-size:22px}
.auth-sub{color:var(--muted); font-weight:600; margin-top:6px; margin-bottom:10px}

/* Footer */
.footer{
  padding:16px;
  text-align:center;
  color:var(--muted);
  font-weight:700;
}

/* Alerts */
.alert{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow: var(--shadow);
  margin-bottom:14px;
}
.alert.success{border-color:rgba(22,163,74,.35); background:rgba(22,163,74,.08)}

/* Print */
@media print{
  body{background:#fff}
  .topbar, .footer, .panel-head, details, .flash-wrap {display:none !important}
  .container{max-width:none; padding:0}
  .panel{border:none; box-shadow:none; padding:0}
  .receipt-img{border:none; box-shadow:none}
}
