/* Asad Traders — Ivory White + Navy Blue theme.
   Layout follows the Ghorer Bazar system (style guide only, own code).
   Palette: ivory #FDFBF3, navy #16265E, gold #C9A227. */
:root {
  --ivory: #FDFBF3;
  --ivory-2: #F5EFDD;
  --navy: #16265E;
  --navy-dark: #0F1B45;
  --gold: #C9A227;
  --gold-soft: #E8D9A0;
  --ink: #22262E;
  --muted: #6B7280;
  --line: #E5DFC8;
  --green: #1E7A34;
  --green-soft: #E6F4EA;
  --red: #B42318;
  --radius: 12px;
}
* { box-sizing: border-box; }
/* Never let the page scroll sideways on mobile: the off-canvas drawers sit
   translated off-screen and would otherwise widen the page (content looked
   cut off on one side until zoomed out). `clip` keeps sticky headers working. */
html, body { overflow-x: hidden; overflow-x: clip; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; background: var(--ivory); color: var(--ink); }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { color: var(--navy); font-family: Georgia, "Times New Roman", serif; }
h2.section-title { font-size: 1.6rem; margin: 28px 0 4px; }
h2.section-title.center { text-align: center; }
.section-sub { color: var(--muted); margin: 0 0 18px; }
.section-sub.center { text-align: center; }

/* Notice bar (admin-editable) */
.notice-bar { background: var(--navy); color: #fff; text-align: center; padding: 8px 12px; font-size: .9rem; }

/* ---- Desktop header: logo left / wide search centre / actions right ---- */
.site-header { background: #fff; border-bottom: 2px solid var(--gold); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 18px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 52px; width: auto; }
.brand-text strong { display: block; font-size: 1.35rem; color: var(--navy); letter-spacing: .5px; }
.brand-text small { color: var(--muted); font-size: .75rem; }
.header-search { flex: 1; max-width: 560px; margin: 0 auto; display: flex; }
.header-search input { flex: 1; min-width: 0; padding: 11px 18px; border: 2px solid var(--navy); border-right: 0; border-radius: 999px 0 0 999px; font-size: 1rem; background: var(--ivory); }
.header-search input:focus { outline: none; border-color: var(--gold); }
.header-search button { border: 2px solid var(--navy); background: var(--navy); color: #fff; border-radius: 0 999px 999px 0; padding: 0 18px; cursor: pointer; font-size: 1.05rem; }
.header-actions { display: flex; gap: 14px; align-items: center; flex: none; margin-left: auto; white-space: nowrap; }
.header-actions a { font-weight: 600; }
.lang-switch { border: 1px solid var(--navy); border-radius: 999px; padding: 4px 10px; font-size: .85rem; }
.cart-link { font-weight: 700; }
.cart-count { background: var(--gold); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .8rem; }

/* Sticky dark-navy category nav bar */
.cat-nav { background: var(--navy); }
.cat-nav-inner { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-nav a { color: #D8DEFF; padding: 10px 12px; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.cat-nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.08); }
.cat-nav a.active { color: #fff; background: var(--navy-dark); box-shadow: inset 0 -3px 0 var(--gold); }
.cat-nav-pages { margin-left: auto; display: flex; border-left: 1px solid rgba(255,255,255,.25); padding-left: 6px; }

/* ---- Mobile top bar / bottom nav / drawers / overlays (hidden on desktop) ---- */
.mobile-topbar, .bottom-nav { display: none; }
.icon-btn { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--navy); padding: 6px; line-height: 1; position: relative; }
.icon-btn .cart-count { position: absolute; top: -2px; right: -6px; }
.link-btn { background: none; border: 0; cursor: pointer; color: var(--navy); font-weight: 700; font-size: .95rem; }
.overlay { position: fixed; inset: 0; background: rgba(15,27,69,.45); z-index: 90; display: none; }
.overlay.show { display: block; }
.drawer, .cart-drawer { position: fixed; top: 0; height: 100%; width: min(340px, 88vw); background: #fff; z-index: 100; overflow-y: auto; padding: 14px 16px 90px; transition: transform .25s ease, visibility .25s; box-shadow: 0 0 30px rgba(0,0,0,.25); visibility: hidden; }
.drawer { left: 0; transform: translateX(-105%); }
.cart-drawer { right: 0; width: min(420px, 92vw); transform: translateX(105%); }
.drawer.open, .cart-drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.drawer-head h3 { margin: 0; font-size: 1.05rem; }
.drawer h4 { color: var(--navy); margin: 16px 0 6px; font-size: .95rem; text-transform: uppercase; letter-spacing: .5px; }
.drawer-cats, .drawer-links { list-style: none; margin: 0; padding: 0; }
.drawer-cats a, .drawer-links a { display: flex; justify-content: space-between; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--ivory-2); color: var(--ink); font-weight: 600; }
.drawer-cats a:hover, .drawer-links a:hover { color: var(--navy); text-decoration: none; }
.cd-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--ivory-2); }
.cd-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.cd-line-body { flex: 1; min-width: 0; font-size: .92rem; }
.cd-qty { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0; }
.cd-qty button { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 1rem; }
.cd-suggest { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.cd-suggest-card { flex: 0 0 140px; scroll-snap-align: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.cd-suggest-card img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; }
.cd-suggest-card strong { display: block; }
.cd-total { display: flex; justify-content: space-between; font-size: 1.1rem; padding: 14px 0 4px; border-top: 2px solid var(--line); margin-top: 12px; }
.cd-checkout { display: block; text-align: center; width: 100%; }
.empty-cart { color: var(--muted); padding: 20px 0; }
.search-overlay { position: fixed; inset: 0; background: rgba(253,251,243,.98); z-index: 110; display: none; flex-direction: column; align-items: center; padding: 90px 20px 20px; }
.search-overlay.open { display: flex; }
.search-overlay form { display: flex; width: 100%; max-width: 560px; }
.search-overlay input { flex: 1; min-width: 0; padding: 14px 18px; border: 2px solid var(--navy); border-right: 0; border-radius: 999px 0 0 999px; font-size: 1.1rem; }
.search-overlay .btn { border-radius: 0 999px 999px 0; }
.search-close { position: absolute; top: 16px; right: 16px; font-size: 1.6rem; }
.search-cats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; max-width: 560px; }
.search-cats a { border: 1px solid var(--navy); border-radius: 999px; padding: 6px 14px; font-size: .9rem; font-weight: 600; }

/* ---- Hero: carousel 2:1 + promo tile ---- */
.hero { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 20px 0 8px; align-items: stretch; }
.hero-carousel { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 340px; background: var(--ivory-2); }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; }
.hero-slide.active { opacity: 1; position: relative; }
.hero-slide img { width: 100%; height: 340px; object-fit: cover; display: block; }
.hero-caption { position: absolute; left: 18px; bottom: 18px; right: 18px; max-width: 520px; background: rgba(253,251,243,.94); border-radius: var(--radius); padding: 18px 20px; }
.hero-kicker { color: var(--gold); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: .85rem; }
.hero-caption h1 { font-size: 2.2rem; margin: 6px 0; line-height: 1.15; }
.hero-caption h1 span { color: var(--gold); }
.hero-caption p { color: var(--muted); font-size: 1rem; margin: 0 0 14px; }
.hero-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 2; }
.hero-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; background: rgba(255,255,255,.7); cursor: pointer; padding: 0; }
.hero-dots button.active { background: var(--gold); }
.hero-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; background: rgba(22,38,94,.75); color: #fff; border: 0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.hero-arrow.prev { left: 10px; }
.hero-arrow.next { right: 10px; }

/* Buttons — labels never wrap */
.btn { display: inline-block; background: var(--navy); color: #fff; padding: 11px 22px; border-radius: 999px; font-weight: 700; border: 0; cursor: pointer; font-size: 1rem; white-space: nowrap; }
.btn:hover { background: var(--navy-dark); text-decoration: none; }
.btn-gold { background: var(--gold); color: #fff; }

/* Toast for AJAX add-to-cart */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: .95rem; box-shadow: 0 6px 24px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; z-index: 200; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.btn-gold:hover { background: #A9851D; }
.btn-outline { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn-small { padding: 8px 14px; font-size: .88rem; }
.btn-danger { background: var(--red); }
.btn-add { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn-add:hover { background: var(--navy); color: #fff; }

/* Trust strip — horizontal scroll on mobile so no orphan item */
.trust-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 26px 0; }
.trust-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; text-align: center; font-size: .88rem; font-weight: 600; color: var(--navy); }
.trust-item span { display: block; font-size: 1.4rem; }

/* Featured categories — horizontal scroll tiles */
.cat-scroll-wrap { position: relative; }
.cat-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-tile { flex: 0 0 128px; scroll-snap-align: start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: center; padding-bottom: 10px; }
.cat-tile img { width: 100%; height: 110px; object-fit: cover; display: block; }
.cat-tile strong { display: block; margin-top: 8px; color: var(--navy); font-size: .92rem; }
.cat-tile span { font-size: .82rem; }
.scroll-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; cursor: pointer; font-size: 1.1rem; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.scroll-arrow.prev { left: -8px; }
.scroll-arrow.next { right: -8px; }

/* Section rows: heading left + VIEW ALL right */
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 4px; }
.row-head h2 { margin: 0; font-size: 1.6rem; }
.row-head h2::after { content: ""; display: block; width: 48px; height: 3px; background: var(--gold); margin-top: 6px; border-radius: 2px; }
.row-head a { font-weight: 700; font-size: .9rem; white-space: nowrap; text-transform: uppercase; letter-spacing: .4px; }

/* Product grid + cards */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.product-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.product-img { position: relative; display: block; }
.product-img img { width: 100%; height: 210px; object-fit: cover; display: block; }
.product-card-horiz { flex-direction: row; }
.product-card-horiz .product-img { flex: 0 0 200px; }
.product-card-horiz .product-img img { height: 100%; min-height: 170px; }
.product-card-horiz .badge { font-size: .68rem; padding: 2px 7px; }
.product-card-horiz .product-body { flex: 1; }
.badges-tl, .badges-tr { position: absolute; top: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.badges-tl { left: 8px; }
.badges-tr { right: 8px; align-items: flex-end; }
.product-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-body h3 { margin: 0; font-size: 1.02rem; }
.product-body h3 a { color: var(--navy); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.price small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: .9rem; margin-left: 6px; }
.save-text { display: inline-block; align-self: flex-start; background: var(--green-soft); color: var(--green); font-weight: 700; font-size: .85rem; padding: 2px 10px; border-radius: 999px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; white-space: nowrap; }
.badge-sale { background: var(--red); color: #fff; }
.badge-new { background: var(--navy); color: #fff; }
.badge-sample { background: var(--gold); color: #fff; }
.badge-oos { background: #666; color: #fff; }
.badge-low { background: #B45309; color: #fff; }
.badge-best { background: var(--red); color: #fff; }
.badge-savepct { background: var(--green); color: #fff; }
.product-actions { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.product-actions form { display: flex; }
.product-card .product-actions form { flex: 1; }
.product-card .product-actions .btn { width: 100%; text-align: center; }
.qty-input { width: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.stock-note { font-size: .82rem; color: var(--muted); }
.wholesale-note { font-size: .82rem; color: var(--green); font-weight: 600; }

/* Top Selling — desktop 2-col horizontal cards */
.top-selling-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Category rows — 5-across desktop, horizontal scroll mobile */
.cat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }

/* Just For You */
.jfy-item { display: flex; }
.jfy-item > .product-card { flex: 1; }
.jfy-hidden, .jfy-item.jfy-hidden { display: none; }
.load-more-wrap { text-align: center; margin: 22px 0 8px; }

/* Shop page layout */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; padding: 20px 0; }
.sidebar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; height: fit-content; }
.sidebar h3 { margin-top: 0; }
.sidebar ul { list-style: none; padding: 0; margin: 0 0 16px; }
.sidebar li a { display: block; padding: 6px 0; }
.sidebar li a.active { font-weight: 800; }
.sidebar .price-inputs input { width: 100%; padding: 9px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.page-hero { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 26px; margin: 20px 0; }
.page-hero h1 { color: #fff; margin: 0 0 4px; }
.page-hero p { margin: 0; color: #D8DEFF; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin: 16px 0 0; }

/* Product details */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 20px 0; }
.detail-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.detail-meta { font-size: .92rem; color: var(--muted); }
.tabs { margin: 10px 0 30px; }
.tab-btns { display: flex; gap: 6px; border-bottom: 2px solid var(--line); }
.tab-btns button { background: none; border: 0; padding: 10px 16px; font-weight: 700; color: var(--navy); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab-btns button.active { border-color: var(--gold); }
.tab-panel { padding: 16px 0; }

/* Tables / forms */
/* Grid children must be allowed to shrink below wide content (e.g. admin
   tables) — otherwise the whole page grows past the phone screen and
   everything looks cut off at the right edge. Wide tables then scroll
   inside .table-scroll instead of stretching the page. */
.admin-layout > *, .shop-layout > *, .detail-grid > *, .cart-layout > *, .checkout-layout > * { min-width: 0; }
.table-scroll { overflow-x: auto; max-width: 100%; }
/* Keep the first column (photo / name) pinned while a wide table scrolls sideways on phones */
.table-scroll .data th:first-child,
.table-scroll .data td:first-child { position: sticky; left: 0; z-index: 1; }
.table-scroll .data td:first-child { background: #fff; box-shadow: 1px 0 0 var(--line); }
table.data { width: 100%; border-collapse: collapse; background: #fff; }
table.data th, table.data td { border: 1px solid var(--line); padding: 9px 10px; text-align: left; font-size: .92rem; }
table.data th { background: var(--navy); color: #fff; }
table.data tr.low td { background: #FEF3C7; }
.form-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 560px; margin: 20px 0; }
.form-box label { display: block; font-weight: 700; margin: 12px 0 4px; }
.form-box input, .form-box select, .form-box textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert { padding: 12px 16px; border-radius: 8px; margin: 16px 0; }
.alert-error { background: #FDECEA; color: var(--red); border: 1px solid #F5C6C2; }
.alert-ok { background: #E6F4EA; color: var(--green); border: 1px solid #A3D9B1; }
.alert-info { background: #E8EEFB; color: var(--navy); border: 1px solid #B9C6F2; }
.muted { color: var(--muted); }
.mt { margin-top: 20px; }

/* Cart / checkout */
.cart-table img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.summary-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.summary-box .row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; }
.summary-box .row.total { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--line); margin-top: 8px; padding-top: 12px; }
.pay-methods label { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 6px 0; cursor: pointer; }
.pay-methods input { width: auto; }
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin-top: 20px; }
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.auth-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px 0; }
.about-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; padding: 20px 0; }
.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 20px 0; }

/* Blog */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.blog-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.blog-card img { width: 100%; height: 170px; object-fit: cover; }
.blog-card .blog-body { padding: 14px; }
.blog-card h3 { margin: 0 0 6px; }

/* Footer — white, brand + information only */
.site-footer { background: #fff; border-top: 2px solid var(--gold); margin-top: 40px; padding: 28px 0 0; }
.site-footer a { color: var(--navy); }
.site-footer h4 { margin: 0 0 10px; font-size: 1rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; padding-bottom: 24px; }
.footer-grid a { display: block; padding: 3px 0; }
.footer-brand p { color: var(--muted); font-size: .92rem; }
.footer-brand .brand-text strong { font-size: 1.2rem; }
.pay-chip { display: inline-block; border: 1px solid var(--line); background: var(--ivory-2); border-radius: 8px; padding: 6px 10px; font-weight: 700; color: var(--navy); margin: 2px; font-size: .85rem; }
.footer-bottom { background: var(--navy); color: #D8DEFF; text-align: center; padding: 12px; font-size: .85rem; }
.footer-bottom a { color: #fff; }

/* Floating WhatsApp button */
.wa-float { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; align-items: center; gap: 8px; background: #25D366; color: #fff; font-weight: 800; padding: 12px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.wa-float:hover { text-decoration: none; background: #1EBE5B; }
.wa-icon { font-size: 1.3rem; }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; padding: 20px 0; }
.admin-nav { background: var(--navy); border-radius: var(--radius); padding: 14px; height: fit-content; }
.admin-nav a { display: block; color: #D8DEFF; padding: 9px 10px; border-radius: 8px; }
.admin-nav a:hover, .admin-nav a.active { background: #fff; color: var(--navy); text-decoration: none; }
.admin-nav .admin-title { color: #fff; font-weight: 800; margin-bottom: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-card strong { font-size: 1.6rem; color: var(--navy); display: block; }
/* Admin product photos: big square thumbs, tap for a large preview.
   max-width:none beats the global img{max-width:100%} rule, which
   squeezed the thumb to the narrow photo column and made thin strips. */
.admin-thumb { width: 72px; height: 72px; max-width: none; object-fit: cover; border-radius: 8px; cursor: zoom-in; display: block; }
.img-preview { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.img-preview[hidden] { display: none; }
.img-preview-box { position: relative; background: #fff; border-radius: 12px; padding: 12px; max-width: 92vw; }
.img-preview-box img { max-width: 86vw; max-height: 70vh; border-radius: 8px; display: block; }
.img-preview-close { position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; font-size: 16px; cursor: pointer; }
.scan-box video, .scan-box canvas { width: 100%; max-width: 480px; border-radius: var(--radius); background: #000; }
.match-card { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 8px 0; cursor: pointer; }
.match-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.match-card:hover { border-color: var(--gold); }

/* Colour variants: card images stack and rotate; product-page picker */
.product-img.has-colors img { opacity: 0; transition: opacity .6s ease; }
.product-img.has-colors img:not(:first-child) { position: absolute; inset: 0; width: 100%; height: 100%; }
.product-img.has-colors img.active { opacity: 1; }
.color-picker { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.color-pick { border: 2px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.color-pick img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }
.color-pick.active { border-color: var(--navy); box-shadow: 0 0 0 2px var(--gold); }
.color-picked-name { font-weight: 700; margin: 8px 0 0; }
.qty-modal-colors { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.qty-modal-colors button { border: 1.5px solid var(--navy); background: #fff; color: var(--navy); border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; }
.qty-modal-colors button.active { background: var(--navy); color: #fff; }
.color-admin-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.color-admin-row a { color: #B91C1C; }

/* Qty popup before Add to Cart / Buy Now */
.qty-modal { position: fixed; inset: 0; z-index: 300; background: rgba(10, 15, 40, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.qty-modal[hidden] { display: none; }
.qty-modal-box { position: relative; background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.qty-modal-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.qty-modal-box h3 { margin: 0 0 4px; font-size: 1.25rem; padding-right: 28px; }
.qty-modal-price { color: var(--navy); font-weight: 800; font-size: 1.1rem; margin: 0 0 14px; }
.qty-modal-label { font-weight: 700; margin: 0 0 10px; }
.qty-modal-stepper { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 12px; }
.qty-modal-step { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--navy); background: #fff; color: var(--navy); font-size: 1.4rem; font-weight: 700; cursor: pointer; flex: none; }
.qty-modal-stepper input { width: 90px; text-align: center; font-size: 1.2rem; font-weight: 700; padding: 10px 8px; border: 2px solid var(--line); border-radius: 10px; }
.qty-modal-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.qty-modal-chips button { border: 1.5px solid var(--navy); background: #fff; color: var(--navy); border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; }
.qty-modal-chips button.active { background: var(--navy); color: #fff; }
.qty-modal-total { text-align: center; font-size: 1.05rem; margin: 0 0 14px; }
.qty-modal-confirm { width: 100%; }

/* ---------- Narrow desktop / tablet (861–1100px): the 4-col grid + sidebar
   squeeze cards to ~150px and the nowrap "কার্টে যোগ করুন" button (min ~190px)
   forces the grid wider than the page — buttons get cut at the card edge.
   3 columns + a slightly smaller button fit, and horizontal cards stack. ---------- */
@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .product-card .product-actions .btn { font-size: .92rem; padding: 10px 12px; }
  .product-card .product-actions form { min-width: 0; }
  .product-card-horiz { flex-direction: column; }
  .product-card-horiz .product-img { flex: none; }
  .product-card-horiz .product-img img { height: 190px; min-height: 0; }
}

/* ---------- Mobile (≤860px): Ghorer Bazar mobile system ---------- */
@media (max-width: 860px) {
  body { padding-bottom: 60px; } /* room for the fixed bottom nav */
  /* Desktop header replaced by the mobile top bar */
  .site-header.public-header { display: none; }
  .mobile-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-bottom: 2px solid var(--gold); position: sticky; top: 0; z-index: 50; padding: 8px 12px; }
  .mobile-topbar .brand-logo { height: 40px; }
  .mobile-topbar .brand-text strong { font-size: 1.15rem; }
  .mobile-topbar .brand-text small { display: none; }
  /* Admin header must fit a phone — brand + View Site + Logout were cut off */
  .admin-header .header-inner { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .admin-header .brand-logo { height: 36px; }
  .admin-header .brand-text strong { font-size: 1.1rem; }
  .admin-header .brand-text small { display: none; }
  .admin-header .header-actions { gap: 10px; font-size: .88rem; }
  /* Bottom fixed nav */
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80; background: var(--navy); height: 60px; }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #D8DEFF; background: none; border: 0; font-size: 1.15rem; cursor: pointer; font-family: inherit; position: relative; }
  .bottom-nav a span, .bottom-nav button span { font-size: .68rem; font-weight: 600; }
  .bottom-nav a:hover, .bottom-nav button:hover { color: #fff; text-decoration: none; }
  .bottom-nav .cart-count { position: absolute; top: 4px; right: calc(50% - 22px); }
  /* Toast sits above the bottom nav on phones */
  .toast { bottom: 76px; }
  /* WhatsApp float sits above the bottom nav, icon only */
  .wa-float { bottom: 74px; right: 12px; padding: 11px; }
  .wa-float .wa-text { display: none; }
  /* Hero stacks; caption becomes a static block under the image */
  .hero { grid-template-columns: 1fr; padding-top: 14px; }
  .hero-carousel { min-height: 0; }
  .hero-slide img { height: 210px; }
  .hero-caption { position: static; max-width: none; background: var(--ivory-2); border-radius: 0 0 var(--radius) var(--radius); }
  .hero-caption h1 { font-size: 1.65rem; }
  .hero-arrow { display: none; }
  /* Trust strip scrolls horizontally — no orphan item */
  .trust-strip { display: flex; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .trust-item { flex: 0 0 150px; scroll-snap-align: start; }
  /* Category tiles scroll; arrows hidden (swipe) */
  .scroll-arrow { display: none; }
  /* Top Selling becomes a 2-col vertical grid; horizontal cards stack */
  .top-selling-grid { grid-template-columns: 1fr 1fr; }
  .product-card-horiz { flex-direction: column; }
  .product-card-horiz .product-img { flex: none; }
  .product-card-horiz .product-img img { height: 190px; min-height: 0; }
  /* Category rows scroll horizontally */
  .cat-row { display: flex; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
  .cat-row .product-card { flex: 0 0 172px; scroll-snap-align: start; }
  /* Grids collapse */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-img img { height: 180px; }
  .product-body h3 { font-size: .95rem; }
  .price { font-size: 1.02rem; }
  /* Card buttons must fit a ~150px card on mobile — "কার্টে যোগ করুন" was
     spilling past the button/card edge at 1rem */
  .product-card .product-actions .btn { font-size: .88rem; padding: 10px 8px; }
  .product-card .product-actions form { min-width: 0; }
  /* Add to Cart + Buy Now must STACK full-width on mobile, not sit side by
     side at half width (both labels were cut off) */
  .product-card .product-actions { flex-direction: column; }
  .product-card .product-actions form { flex: none; width: 100%; }
  .shop-layout, .detail-grid, .admin-layout, .cart-layout, .checkout-layout, .auth-layout, .about-layout, .contact-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; } /* admin + checkout forms stack on phones */
  .blog-grid { grid-template-columns: 1fr 1fr; }
  /* Stat cards: 2 per row on phones. !important beats the inline
     repeat(3,1fr) on the Suppliers / Stock pages, which kept 3 narrow
     cards in one row and cut the third one off the screen. */
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
  h2.section-title, .row-head h2 { font-size: 1.3rem; }
  .page-hero { padding: 20px; }
}
