/* =====================================================================
   ADVAITHAAT — MOBILE RESPONSIVE FIXES
   File: assets/css/mobile-fixes.css
   Load this AFTER every other stylesheet. NOTE: the site links style.css a
   second time inside <body>, so put this <link> just before </body>
   (next to main.js), not in <head>, or style.css will override it.
   Only affects screens 768px wide and below — desktop is untouched.
   No content, links or features are changed; layout only.
   ===================================================================== */

@media (max-width: 768px) {

  /* ---------- 0. Header offset (fixes header covering the hero) ----------
     The header is fixed; body used a hard-coded 175px top padding while the
     mobile header is ~320px tall. mobile-fixes.js measures the real header
     height into --adv-header-h; 196px is the fallback if JS hasn't run. */
  body {
    padding-top: var(--adv-header-h, 196px) !important;
  }

  /* ---------- 1. Brand strip: ADVAITHAAT + ADVAITMEDIA on ONE line ---------- */
  .premium-top-strip { position: relative; }

  .premium-strip-wrap {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 8px;
    min-height: 0;
    padding: 6px 10px !important;
  }

  /* "Explore Plus / Premium Deals" placeholder links (href="#") are hidden on
     phones only — there is no room for them on one line. Desktop unchanged. */
  .premium-medium-links { display: none !important; }

  .brand-tabs,
  .premium-right-links {
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
    padding: 0 !important;
    overflow: visible !important;
  }
  .premium-right-links { justify-content: flex-end !important; }

  .brand-tab {
    min-width: 0 !important;
    width: 100%;
    gap: 7px;
    padding: 4px 6px;
    box-sizing: border-box;
  }
  .premium-right-links .brand-tab { justify-content: flex-start; }

  .brand-icon-circle { width: 28px; height: 28px; font-size: 14px; }
  .brand-details { min-width: 0; }
  .brand-title-row { gap: 5px; }
  .brand-name { font-size: 12.5px; letter-spacing: 0; white-space: nowrap; }
  .premium-badge { font-size: 8.5px; padding: 1px 5px; }
  .brand-subtitle {
    font-size: 9.5px;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .active-line { left: 8px; }

  /* ---------- 2. Top bar: logo + actions on row 1, full-width search on row 2 ---------- */
  .site-header .topbar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand  actions"
      "search search";
    align-items: center;
    gap: 8px 8px;
    padding: 8px 12px !important;
  }
  .site-header .topbar .brand { grid-area: brand; line-height: 0; }
  .site-logo { height: 32px; }

  .search-bar {
    grid-area: search;
    width: 100%;
    flex: none;
  }
  .search-bar input {
    display: block;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    padding: 0 14px;
    font-size: 16px;            /* 16px stops iPhone auto-zoom on focus */
    border-radius: 10px;
  }

  .header-right {
    grid-area: actions;
    justify-content: flex-end;
    gap: 1px;
    min-width: 0;
    position: relative;          /* dropdowns anchor here so they stay on-screen */
  }
  .header-btn,
  .header-link,
  .cart-btn {
    font-size: 12px;
    padding: 6px 5px;
    white-space: nowrap;
    line-height: 1.2;
  }
  /* "Become a Seller" sits on two short lines so all 4 actions fit beside the logo */
  .header-right .header-link {
    white-space: normal;
    max-width: 64px;
    text-align: center;
    line-height: 1.15;
    font-size: 11.5px;
  }

  /* Login / More dropdowns: open right-aligned inside the screen */
  .header-right .dropdown-wrap { position: static; }
  .header-right .dropdown-menu {
    left: auto !important;
    right: 0;
    top: calc(100% + 6px);
    min-width: 230px;
    max-width: calc(100vw - 24px);
  }

  /* ---------- 3. Category bar: clearly swipeable, all categories reachable ---------- */
  .category-bar {
    top: auto;
    position: relative;          /* anchor for sub-category panel + scroll hint */
  }
  /* ROOT CAUSE of "only 4 categories visible": style.css has
     `.site-header .wrap { overflow: visible !important }`, and the category
     strip is also a .wrap — so it could never scroll; the rest ran off-screen.
     This re-enables sideways swiping. */
  .site-header .category-bar .category-container {
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  .category-container {
    gap: 2px !important;
    padding: 8px 10px !important;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .category-item {
    flex: 0 0 78px !important;
    min-width: 0 !important;
    position: static !important;
    scroll-snap-align: start;
  }
  .category-item::after { display: none; }
  .category-link { gap: 4px; }
  .category-icon { width: 40px !important; height: 40px !important; }
  .cat-name {
    display: block;
    font-size: 11px !important;
    line-height: 1.2;
    white-space: normal !important;
    text-align: center;
    max-width: 78px;
  }
  .category-item.active .category-icon { border-radius: 8px; }

  /* right-edge fade = "there are more, swipe" */
  .category-bar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 85%);
  }

  /* sub-category list opens as a full-width panel under the bar
     (it no longer stretches the bar or hides inside the scroller) */
  .category-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    transform: none !important;
    display: none;
    background: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14) !important;
    border-radius: 0 0 12px 12px !important;
    padding: 4px 0 !important;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 100000;
  }
  .category-item.show-dropdown .category-dropdown { display: block; }
  .category-dropdown a {
    padding: 13px 18px;
    font-size: 14px;
    border-bottom: 1px solid #f2f2f2;
  }
  .category-dropdown a:last-child { border-bottom: 0; }

  /* when scrolling down (existing "compact" mode) also tuck away the brand strip */
  .site-header:has(.category-bar.compact) .premium-top-strip { display: none; }
  .category-bar.compact .category-container { padding: 6px 10px !important; }
  .category-bar.compact .cat-name { font-size: 12px !important; }

  /* ---------- 4. Banner slider ---------- */
  .banner-container { margin: 12px auto; padding: 0 12px; }
  .multi-btn { width: 32px; height: 32px; font-size: 14px; }
  .multi-btn.prev { left: 6px; }
  .multi-btn.next { right: 6px; }
}

/* phones: most banners are 1600x800 (2:1) — show them at that shape so the
   artwork isn't cropped at the sides (was a fixed 140px-tall strip) */
@media (max-width: 480px) {
  .multi-item img {
    height: auto !important;
    aspect-ratio: 2 / 1;
  }
  .multi-dots { flex-wrap: wrap; row-gap: 6px; padding: 0 16px; }
  .multi-dot { width: 8px; height: 8px; }
  .multi-dot.active { width: 18px; }
}

/* ---------- 5. Product grid: 2 per row on phones (was 1 huge card per row) ---------- */
@media (max-width: 520px) {
  .products { margin: 16px 0 40px; }
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .product-card { padding: 8px; border-radius: 12px; }
  .product-card img { height: 130px; padding: 6px; }
  .product-card h3 {
    font-size: 12.5px;
    line-height: 1.35;
    min-height: 34px;
    height: auto;
    margin: 8px 0 4px;
  }
  .retail-price { font-size: 16px !important; margin: 4px 0 8px; }
  .retail-actions { flex-direction: column; gap: 6px; }
  .btn-cart,
  .btn-buy { height: 36px; font-size: 12px; border-radius: 8px; }
  .wishlist-float { top: 8px; right: 8px; width: 30px; height: 30px; font-size: 14px; }
  .stock-text { font-size: 11px; margin-top: 8px; }
}

/* ---------- 6. Very small phones (320–360px) ---------- */
@media (max-width: 360px) {
  .header-btn,
  .header-link,
  .cart-btn { font-size: 11px; padding: 5px 4px; }
  .header-right .header-link { font-size: 11px; max-width: 58px; }
  .site-logo { height: 28px; }
  .brand-name { font-size: 11.5px; }
  .brand-subtitle { display: none; }
}
