/* GharBazaar storefront — premium dark header/hero/footer, light cards.
   Plain CSS, no build step. Mobile-first: category chips wrap, no
   horizontal overflow at 390px. */
:root {
  --navy: #141d33;
  --navy-2: #1e2a47;
  --navy-3: #0d1424;
  --accent: #f85606; /* Daraz-style orange */
  --accent-dark: #d94804;
  --gold: #b8860b;
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1c2433;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #15803d;
  --red: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.45;
}
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
a { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.wordmark {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark span { color: #ffb37a; }
.search-box { flex: 1 1 220px; display: flex; min-width: 0; }
.search-box input {
  flex: 1;
  min-width: 0;
  padding: .55rem .8rem;
  border: none;
  border-radius: 8px 0 0 8px;
}
.search-box button {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: .55rem 1rem;
  border-radius: 0 8px 8px 0;
}
.header-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.header-link {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: .45rem .6rem;
  border-radius: 8px;
  white-space: nowrap;
}
.header-link:hover { background: var(--navy-2); }
.cart-btn {
  position: relative;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem .9rem;
  font-weight: 700;
  white-space: nowrap;
}
.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #fff;
  color: var(--accent-dark);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  font-size: .75rem;
  font-weight: 800;
  text-align: center;
  padding: 0 4px;
  box-shadow: var(--shadow);
}
.main-nav {
  background: var(--navy-2);
}
.main-nav .nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
.main-nav a {
  color: #dbe2f0;
  text-decoration: none;
  font-weight: 600;
  padding: .55rem .8rem;
  border-radius: 8px 8px 0 0;
}
.main-nav a:hover, .main-nav a.active { color: #fff; background: var(--navy); }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 1rem 2rem; }
.view { display: none; }
.view.active { display: block; }
h1 { font-size: 1.5rem; margin: 1.25rem 0 .5rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(120deg, var(--navy-3) 0%, var(--navy) 55%, #3a2b12 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 .35rem; font-size: clamp(1.4rem, 4.5vw, 2.1rem); }
.hero p { margin: .2rem 0; color: #dbe2f0; }
.hero .hero-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  border-radius: 999px;
  padding: .2rem .8rem;
  margin-bottom: .6rem;
  font-size: .85rem;
}

/* ---------- Category chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 1rem 0;
}
.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-size: .9rem;
  font-weight: 600;
  white-space: normal;
  text-align: left;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip .count { color: var(--muted); font-weight: 400; font-size: .8rem; }
.chip.active .count { color: #cdd6e8; }

/* ---------- Flash sale rail ---------- */
.flash-rail {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  -webkit-overflow-scrolling: touch;
}
.flash-rail .product-card { flex: 0 0 190px; }
.flash-tag {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  border-radius: 4px;
  padding: .1rem .4rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ---------- Product grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .9rem;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: var(--text);
}
.product-card:hover { border-color: var(--accent); }
.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #eceef1;
}
.card-body { padding: .6rem .7rem .75rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card-name {
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.card-cat { font-size: .78rem; color: var(--muted); }
.price-row { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.price { font-size: 1.08rem; font-weight: 800; color: var(--accent-dark); }
.compare { font-size: .85rem; color: var(--muted); text-decoration: line-through; }
.discount { font-size: .78rem; font-weight: 700; color: var(--green); }
.stock { font-size: .8rem; }
.stock.in { color: var(--green); }
.stock.low { color: #b45309; }
.stock.out { color: var(--red); }
.add-btn {
  margin-top: auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem;
  font-weight: 700;
}
.add-btn:hover { background: var(--accent-dark); }
.add-btn:disabled { background: #9ca3af; cursor: not-allowed; }
.load-more-wrap { text-align: center; margin: 1.25rem 0; }
.btn {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .6rem 1.2rem;
  font-weight: 700;
}
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Product detail ---------- */
.detail {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 1rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(220px, 420px) 1fr;
  gap: 1.25rem;
}
.detail img { width: 100%; border-radius: 8px; background: #eceef1; }
.detail .desc { white-space: pre-wrap; color: #374151; }
.qty-row { display: flex; align-items: center; gap: .5rem; margin: .8rem 0; }
.qty-row button {
  width: 36px; height: 36px;
  border: 1px solid var(--border); background: #fff;
  border-radius: 8px; font-size: 1.1rem; font-weight: 700;
}
.qty-row input { width: 56px; text-align: center; padding: .4rem; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- Drawer (cart) ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 30, .55);
  z-index: 60;
  display: none;
}
.overlay.open { display: block; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  background: #fff;
  z-index: 61;
  transform: translateX(105%);
  transition: transform .2s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, .25);
}
.drawer.open { transform: translateX(0); }
.drawer header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem; border-bottom: 1px solid var(--border);
  background: var(--navy); color: #fff;
}
.drawer header h2 { margin: 0; color: #fff; }
.drawer .close-x { background: none; border: none; color: #fff; font-size: 1.4rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1rem; }
.drawer footer { border-top: 1px solid var(--border); padding: 1rem; }
.cart-line {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #eceef1; }
.cart-line .line-info { flex: 1; min-width: 0; }
.cart-line .line-name { font-weight: 600; font-size: .9rem; }
.totals { font-size: .95rem; }
.totals .row { display: flex; justify-content: space-between; padding: .2rem 0; }
.totals .row.total { font-weight: 800; font-size: 1.1rem; border-top: 1px solid var(--border); margin-top: .4rem; padding-top: .5rem; }
.free-note { color: var(--green); font-weight: 600; font-size: .88rem; margin: .4rem 0; }

/* ---------- Forms ---------- */
.form-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem; margin-top: 1rem;
  max-width: 640px;
}
.form-card label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .25rem; }
.form-card input, .form-card select, .form-card textarea {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 8px;
}
.form-card input.invalid { border-color: var(--red); }
.field-error { color: var(--red); font-size: .82rem; font-weight: 600; }
.notice {
  border-radius: 8px; padding: .7rem .9rem; margin: .8rem 0; font-size: .92rem;
}
.notice.info { background: #eef4ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.notice.warn { background: #fef3c7; border: 1px solid #fcd34d; color: #78350f; }
.notice.error { background: #fee2e2; border: 1px solid #fca5a5; color: #7f1d1d; }
.notice.success { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }

/* Payment method cards */
.pay-methods { display: flex; flex-direction: column; gap: .6rem; margin-top: .5rem; }
.pay-method {
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: .8rem .9rem; cursor: pointer; background: #fff;
}
.pay-method.selected { border-color: var(--accent); background: #fff7f2; }
.pay-method .pay-title { font-weight: 800; display: flex; gap: .5rem; align-items: center; }
.pay-method .pay-sub { color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.pay-detail { margin-top: .7rem; }
.pay-detail .acct {
  background: var(--navy); color: #fff; border-radius: 8px;
  padding: .7rem .9rem; font-size: .95rem; margin: .4rem 0;
}
.pay-detail .acct b { font-size: 1.05rem; }
.screenshot-preview { max-width: 220px; border-radius: 8px; margin-top: .5rem; border: 1px solid var(--border); }

/* ---------- Tracking / orders ---------- */
.status-steps { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0; }
.step {
  padding: .35rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 700;
  background: #e5e7eb; color: var(--muted);
}
.step.done { background: var(--green); color: #fff; }
.step.current { background: var(--accent); color: #fff; }
.order-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .9rem 1rem; margin: .7rem 0;
}
.order-card .order-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.order-card code { font-weight: 800; }
.badge {
  display: inline-block; border-radius: 999px; padding: .15rem .6rem;
  font-size: .78rem; font-weight: 800; text-transform: capitalize;
}
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.confirmed { background: #dbeafe; color: #1e40af; }
.badge.shipped { background: #e0e7ff; color: #3730a3; }
.badge.delivered { background: #dcfce7; color: #166534; }
.badge.cancelled { background: #fee2e2; color: #991b1b; }
.order-items { margin: .5rem 0; padding-left: 1.1rem; font-size: .92rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-3); color: #cdd6e8; margin-top: 2rem; }
.site-footer .footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem;
}
.site-footer h3 { color: #fff; margin: 0 0 .5rem; font-size: 1rem; }
.site-footer a { color: #cdd6e8; text-decoration: none; display: block; padding: .15rem 0; }
.site-footer a:hover { color: #fff; }
.site-footer .fine { grid-column: 1 / -1; font-size: .82rem; color: #8b98b3; border-top: 1px solid #26314d; padding-top: .8rem; }

/* ---------- WhatsApp float ---------- */
.wa-float {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  background: #25d366; color: #fff;
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-weight: 800; font-size: 1.5rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.wa-float:hover { background: #1eb856; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 15, 30, .6);
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal.open { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); max-width: 560px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 1.2rem;
}
.modal-box img { width: 100%; border-radius: 8px; }

/* ---------- Seller panel (loaded only via #seller) ---------- */
.seller-banner {
  background: var(--red); color: #fff; font-weight: 800;
  padding: .7rem 1rem; border-radius: 8px; margin: .8rem 0;
  display: none;
}
.seller-banner.show { display: block; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin: .8rem 0; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); }
.stat-card .stat-label { color: var(--muted); font-size: .85rem; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 800; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.tab-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: .5rem 1rem; font-weight: 700;
}
.tab-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.inline-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-row select, .inline-row input { padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
  .header-inner { gap: .5rem; }
  .wordmark { font-size: 1.3rem; }
  .search-box { order: 3; flex-basis: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
  .flash-rail .product-card { flex-basis: 160px; }
}
