/* ============================================================
   Mobile experience — modern floating bottom navigation + polish
   Loaded after storefront-redesign.css
   ============================================================ */

/* ------------------------------------------------------------
   0. Container gutters on small screens
   The desktop `--desktop-padding` (40px at <=1200px) must not
   apply as left/right gutters on phones; use a small gutter
   instead. Loaded last, so this :root override wins.
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  :root {
    --desktop-padding: 16px;
  }
}

/* ------------------------------------------------------------
   1. Modern floating bottom tab bar (mobile only)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  /* Shell: drop the old full-width bar, float a pill instead */
  .bottom-tabbar {
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 12px calc(10px + env(safe-area-inset-bottom));
    background: transparent;
    border: none;
    z-index: 990;
    pointer-events: none;
  }

  .tabbar-inner {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 2px;
    width: min(100%, 460px);
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: var(--bg-nav, rgba(255, 255, 255, 0.92));
    border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    border-radius: 22px;
    box-shadow: 0 14px 38px -10px var(--shadow-strong, rgba(0, 0, 0, 0.35));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: translateY(0);
    transition: background var(--transition, 0.35s), border-color var(--transition, 0.35s);
  }
  /* Remove the legacy center notch */
  .tabbar-inner::before { display: none !important; }

  /* Base tab */
  .tab-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 46px;
    padding: 5px 8px;
    color: var(--text-muted, #6b5256);
    font-size: 0.64rem;
    font-weight: 600;
    border-radius: 14px;
    transition: color 0.25s ease, transform 0.25s ease;
  }
  .tab-item:hover,
  .tab-item:focus-visible {
    color: var(--primary, #b91c3a);
    outline: none;
  }
  .tab-item.active { color: var(--primary, #b91c3a); }

  /* Icon tile */
  .tab-ic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 28px;
    border-radius: 10px;
    transition: background 0.3s ease, transform 0.3s ease;
  }
  .tab-ic svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: transform 0.3s ease;
  }
  .tab-item.active .tab-ic { background: var(--primary-alpha-12, rgba(185, 28, 58, 0.14)); }
  .tab-item.active .tab-ic svg { transform: translateY(-1px); }
  .tab-item.active .tab-lbl { font-weight: 800; }

  /* Elevate the label slightly for active state */
  .tab-lbl { line-height: 1.15; }

  /* Center HOME FAB */
  .tab-item.tab-home { margin: -30px 4px 0; }
  .tab-item.tab-home .tab-home-icon {
    width: 57px;
    height: 57px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary, #b91c3a), var(--primary-dark, #8f1229));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 3px solid var(--bg-card, #ffffff);
    box-shadow: 0 12px 26px -6px var(--primary-alpha-50, rgba(185, 28, 58, 0.55));
    margin-bottom: 2px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  }
  .tab-item.tab-home:hover .tab-home-icon,
  .tab-item.tab-home.active .tab-home-icon {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -6px var(--primary-alpha-50, rgba(185, 28, 58, 0.6));
  }
  .tab-item.tab-home svg { width: 24px; height: 24px; }
  .tab-item.tab-home .tab-lbl { color: var(--text, #1a1214); font-weight: 700; }

  /* Dark-mode surfacing for the pill */
  [data-theme="dark"] .tabbar-inner {
    background: var(--bg-nav, rgba(22, 22, 34, 0.9));
    border-color: var(--border, rgba(255, 255, 255, 0.08));
  }
  [data-theme="dark"] .tab-item.tab-home .tab-home-icon { border-color: var(--bg-card, #141624); }
  [data-theme="dark"] .tab-item.tab-home .tab-lbl { color: var(--text, #f0e8ea); }

  /* Extra breathing room so the elevated FAB never overlaps content */
  main { padding-bottom: 96px !important; }
}

/* ------------------------------------------------------------
   1b. Mobile & tablet: category drawer via hamburger menu button
   Categories open as a slide-out panel from the right when the
   ☰ menu button is tapped (desktop strip hidden on these sizes).
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  /* Show the hamburger button (hidden by default for desktop) */
  .mobile-menu-btn {
    display: flex !important;
  }
  /* Hide the desktop category strip — categories live in the drawer */
  .navbar-bottom {
    display: none !important;
  }
  /* Move ALL top-bar actions into the drawer: hide search, theme,
     favorites, cart and account buttons; only the ☰ button stays */
  #navbar .nav-search,
  #navbar .theme-toggle-btn,
  #navbar .cart-dropdown-wrap,
  #navbar .nav-actions .nav-btn {
    display: none !important;
  }
  /* Navbar is shorter without the strip, so tighten main's offset */
  main {
    padding-top: 72px !important;
  }
  /* Ensure the drawer never overflows very small phones */
  .mobile-sidebar {
    width: min(320px, 86vw);
  }
}

/* Drawer: action buttons row (theme / favorites / cart / account) */
.mobile-nav-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.mobile-nav-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: var(--radius);
  background: var(--bg-card2);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.mobile-nav-action:hover {
  background: var(--primary);
  color: var(--white);
}
.mobile-nav-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   1c. Mobile category navigation (tap-friendly top strip)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .navbar-bottom {
    overflow: hidden;
  }
  .navbar-bottom .nav-cats {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 0 6px;
    align-items: stretch;
  }
  .navbar-bottom .nav-cats::-webkit-scrollbar {
    display: none;
  }
  .navbar-bottom .nav-cat-item {
    flex: 0 0 auto;
  }
  .navbar-bottom .nav-cat-link {
    padding: 14px 16px;
    font-size: 0.85rem;
    white-space: nowrap;
    min-height: 48px;
  }
  /* No hover dropdowns on touch — click toggles a slide-down panel */
  .navbar-bottom .nav-dropdown {
    display: none;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--bg-card2, var(--surf2, #f2eded));
  }
  .navbar-bottom .nav-dropdown a {
    padding: 14px 24px;
    min-height: 48px;
    font-size: 0.9rem;
  }
  .navbar-bottom .nav-cat-item.open .nav-dropdown {
    display: block;
  }
  /* Nested tree submenus behave like the top-level panels on touch */
  .navbar-bottom .nav-sub-item > a {
    padding: 14px 24px;
    min-height: 48px;
    font-size: 0.9rem;
  }
  .navbar-bottom .nav-dropdown-sub {
    display: none;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--bg-card2, var(--surf2, #f2eded));
  }
  .navbar-bottom .nav-dropdown-sub a {
    padding: 14px 32px;
    min-height: 48px;
    font-size: 0.9rem;
  }
  .navbar-bottom .nav-sub-item.open .nav-dropdown-sub {
    display: block;
  }
}

/* ------------------------------------------------------------
   1c. Listing pages: product cards stack as a single column
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  /* Products / search / wishlist listing grids — one card per row */
  #all-prod-grid,
  #search-grid,
  #wishlist-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}

/* ------------------------------------------------------------
   1d. Promo section: dual banners stack vertically on mobile
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  #promo-section .dual-banners {
    grid-template-columns: 1fr;
  }
  #promo-section .dual-banner {
    width: 100%;
  }
}

/* ------------------------------------------------------------
   2. Responsive polish & safety for small viewports
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .bottom-tabbar { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .tabbar-inner { border-radius: 20px; gap: 0; }
  .tab-item { min-width: 40px; padding: 4px 6px; }
  .tab-ic { width: 38px; height: 26px; }
  .tab-item.tab-home .tab-home-icon { width: 52px; height: 52px; }
}

/* ------------------------------------------------------------
   3. Checkout stepper (ck-steps) — swipeable + compact on phones
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .ck-steps {
    flex-wrap: nowrap;
    gap: 2px;
    margin-bottom: 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ck-steps::-webkit-scrollbar { display: none; }
  .ck-step {
    flex: 0 0 auto;
    gap: 5px;
    padding: 8px 2px 6px;
    font-size: 0.78rem;
  }
  .step-num { width: 24px; height: 24px; font-size: 0.7rem !important; }
  .ck-step:not(:last-child)::after { margin: 0 5px; font-size: 0.68rem; }
  /* Step text labels: let them breathe but never wrap the row */
  .ck-step span:last-child { white-space: nowrap; line-height: 1.2; }
}

/* ------------------------------------------------------------
   4. Footer — single-column layout for mobile
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  footer { padding: 44px 0 0; }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-bottom: 30px;
  }
  .footer-brand .logo { font-size: 1.25rem; margin-bottom: 12px; }
  .footer-brand p { margin-bottom: 16px; }
  .footer-trust { margin-bottom: 16px; }
  /* Trust badges spread nicely on mobile, same size as desktop */
  .footer-trust .trust-badge { width: 64px; height: 64px; }
  .footer-col h4,
  .footer-col h3 { margin-bottom: 14px; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 20px 4px;
  }
  .footer-bottom > div { justify-content: center; }
}
@media (max-width: 400px) {
  .footer-trust { gap: 8px; }
  .footer-trust .trust-badge { width: 58px; height: 58px; }
}
/* Spotlight slider: compact stacked card + tucked side previews */
@media(max-width:900px){
  .spotlight-section .container{padding:0 18px}
  .spotlight-viewport{height:262px}
  .spotlight-slide{flex-direction:column;width:min(58%,430px)}
  .spotlight-slide.edge-prev{left:calc(50% + 42%);transform:translate(-50%,-50%) scale(.58)}
  .spotlight-slide.edge-next{left:calc(50% - 42%);transform:translate(-50%,-50%) scale(.58)}
  .spotlight-info{order:2;padding:12px 16px;gap:5px;flex:0 0 auto}
  .spotlight-info::after{display:none}
  .spotlight-cat{display:none}
  .spotlight-title{font-size:.86rem}
  .spotlight-stars svg{width:12px;height:12px}
  .spotlight-price{font-size:.92rem}
  .spotlight-old{display:none}
  .spotlight-disc{display:none}
  .spotlight-cta{display:none}
  .spotlight-media{flex:1 1 auto;min-height:0;width:100%}
  .spotlight-num{font-size:1.5rem}
  .spotlight-badge{top:8px;right:8px;font-size:.6rem;padding:3px 8px}
  .spotlight-thumb{width:46px;height:46px;border-radius:10px}
}
@media(max-width:480px){
  .spotlight-viewport{height:240px}
  .spotlight-slide.edge-prev{left:calc(50% + 44%);transform:translate(-50%,-50%) scale(.5)}
  .spotlight-slide.edge-next{left:calc(50% - 44%);transform:translate(-50%,-50%) scale(.5)}
}[data-theme="dark"] .mobile-sidebar{background:var(--bg-card,#141624)!important;background-color:var(--bg-card,#141624)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;opacity:1!important}[data-theme="dark"] .mobile-sidebar-header{background:#141624!important;border-color:rgba(255,255,255,.08)!important}[data-theme="dark"] .mobile-overlay{background:rgba(0,0,0,.65)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}.mobile-sidebar{background:var(--bg-card);backdrop-filter:none!important;-webkit-backdrop-filter:none!important}

/* ------------------------------------------------------------
   5. Products page on mobile — collapsible filter panel
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  #page-products .listing-filters {
    position: static;
    padding: 0;
    overflow: hidden;
  }
  #page-products .listing-filters-title { display: none; }
  #page-products .listing-filters-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--txt, var(--text));
    cursor: pointer;
    text-align: right;
  }
  #page-products .listing-filters-toggle:hover { color: var(--pri, var(--primary)); }
  #page-products .listing-filters-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-alpha-08, rgba(185, 28, 58, 0.08));
    color: var(--pri, var(--primary));
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: transform 0.3s var(--eOut);
  }
  #page-products .listing-filters.open .listing-filters-arrow { transform: rotate(180deg); }
  #page-products .listing-filters-body { display: none; padding: 0 16px 18px; }
  #page-products .listing-filters.open .listing-filters-body { display: block; }
}

/* ------------------------------------------------------------
   6. Products page on mobile — bigger main product images
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  #page-products .pcard-h .pcard-main-img { max-height: 300px; }
  #page-products .pcard-h .pcard-emoji { font-size: 4.5rem; }
}
