/* ==========================================================================
   Liquid Glass Bottom Nav — FINAL PLATFORM-NEUTRAL CSS
   - Base = iOS-friendly sticky + safe-area padding
   - Android fixes are applied by JS at runtime (no UA-specific CSS)
   ========================================================================== */

/* ─── Design tokens ───────────────────────────────────────────────────────── */
:root{
  --bar-max: 860px;
  --bar-h: 64px;
  --glass-bg: rgba(255,255,255,0.55);
  --glass-stroke: rgba(255,255,255,0.35);
  --ink: #0b0b0c;
  --ink-dim: #3a3a3c;
}
@media (prefers-color-scheme: dark){
  :root{
    --glass-bg: rgba(18,18,20,0.55);
    --glass-stroke: rgba(255,255,255,0.08);
    --ink: #f5f5f7;
    --ink-dim: #c7c7cc;
  }
}

/* Reserve page space (safe for iOS; Android JS will override body padding) */
body{
  padding-bottom: calc(var(--bar-h) + max(24px, env(safe-area-inset-bottom, 0px)));
}

/* ─── Bar container (base = sticky) ───────────────────────────────────────── */
.ios-glass-tabbar{
  position: sticky;
  bottom: 2px;                         /* sticky trigger */
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 2px);
  z-index: 9999;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(4, 1fr) 0fr;
  align-items: center;
  transition: grid-template-columns 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  gap: 4px;
  max-width: var(--bar-max);
  width: calc(100% - 16px);
  margin-left: auto; margin-right: auto;
  height: var(--bar-h);
  isolation: isolate;
  backface-visibility: hidden;
  will-change: auto;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Frosted glass on its own layer (lighter blur looks sharper on product pages) */
.ios-glass-tabbar::before{
  content:"";
  position:absolute;
  inset:-10px;                          /* bleed hides blur edge; JS may clamp to 0 on Android PDPs */
  border-radius:18px;                   /* tweak e.g. 32px if you want rounder capsule */
  z-index:-1;

  background:var(--glass-bg);
  border:1px solid var(--glass-stroke);
  box-shadow:0 8px 24px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.35);

  /* choose one of these two lines; 6px is crisper, 16px is frosted
     backdrop-filter: saturate(180%) blur(16px); */
  backdrop-filter: saturate(180%) blur(6px);
  -webkit-backdrop-filter: saturate(180%) blur(6px);
}

/* Hide on tablet/desktop */
@media (min-width:768px){
  .ios-glass-tabbar{ display:none; }
}

/* Tabs */
.ios-glass-tabbar .tab{
  position:relative;
  height:var(--bar-h);
  text-decoration:none;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:4px;
  color:var(--ink-dim);
  font:500 11px/1.1 ui-sans-serif, system-ui, -apple-system, "SF Pro", Inter, Roboto, "Segoe UI", sans-serif;
  transition: color .25s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.ios-glass-tabbar .tab:active{ transform: translateY(1px) scale(.98); }
.ios-glass-tabbar .tab.is-active{ color:var(--ink); }

.ios-glass-tabbar .tab svg{
  width:22px; height:22px; display:block; fill:currentColor;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.35));
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.ios-glass-tabbar .tab.is-active svg{ transform: translateY(-2px) scale(1.05); }

/* Badge */
.ios-glass-tabbar .tab .badge,
.ios-glass-tabbar .tab [data-cart-count]{
  position:absolute; top:6px; right:22%;
  min-width:16px; height:16px; padding:0 4px;
  border-radius:999px; background:#ff3b30; color:#fff;
  font-size:10px; line-height:16px; text-align:center;
  box-shadow:0 1px 2px rgba(0,0,0,.3);
}

/* Blob highlight off */
.ios-glass-tabbar .blob{ display:none !important; }

/* Ripple */
.tap-ripple{ position:absolute; inset:0; overflow:hidden; border-radius:14px; pointer-events:none; }
.tap-ripple > span{
  position:absolute; width:12px; height:12px; border-radius:999px;
  background:rgba(255,255,255,.65);
  transform: translate(-50%,-50%) scale(0);
  animation: ripple .5s ease-out forwards;
  mix-blend-mode: soft-light;
}
@keyframes ripple{ to{ transform: translate(-50%,-50%) scale(9); opacity:0; } }

/* No backdrop-filter support */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))){
  .ios-glass-tabbar::before{
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
    background:rgba(240,240,245,.96);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .ios-glass-tabbar, .ios-glass-tabbar .tab{ transition:none !important; animation:none !important; }
}

/* ==========================================================================
   PRODUCT PAGE: 5th "Buy Now" Button – Android-safe
   ========================================================================== */

/* 4 icons + 1 CTA layout */
.ios-glass-tabbar.has-product-action {
    grid-template-columns: repeat(4, 1fr) 2.2fr;
    column-gap: 6px;
    padding-right: 6px;
    align-items: center;    /* don’t stretch vertically */
    overflow: hidden;       /* nothing can poke outside rounded bar */

}

/* === Sticky Buy CTA: show only when bar has .has-product-action === */

/* Smooth animation for the CTA */
.ios-glass-tabbar .tab.action-btn {
  transition:
    opacity .22s ease-out,
    transform .22s ease-out,
    max-width .25s ease-out,
    padding .25s ease-out,
    margin .25s ease-out;
}

/* Hidden state (default): when bar DOES NOT have .has-product-action */
.ios-glass-tabbar:not(.has-product-action) .tab.action-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.9);
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
  overflow: hidden;
}

/* Buy Button – glass variant */
.ios-glass-tabbar .tab.action-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
/*    align-items: flex-start;*/
    text-align: left;

    /* Match base tab height exactly so it can’t be taller than bar */
    height: var(--bar-h);
    box-sizing: border-box;
    padding: 6px 12px;
    /* Glass style */
    background: rgba(0, 0, 0, 0.72); /* darkened glass */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #fff;
    border-radius: 14px; /* similar softness to bar */
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);

    transform: none !important;
    opacity: 0.95;
}

/* Press feedback */
.ios-glass-tabbar .tab.action-btn:active {
    transform: scale(0.98) !important;
    opacity: 0.85;
}

/* Typography */
.ios-glass-tabbar .tab.action-btn .action-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 2px;
}

.ios-glass-tabbar .tab.action-btn .action-price {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.1;
}

/* Tiny width screens tweak */
@media (max-width: 360px) {
    .ios-glass-tabbar .tab.action-btn {
        padding: 5px 10px;
    }
}   
   
   
   /* Optional: if the cart badge feels too noisy on product pages */
/* .ios-glass-tabbar.has-product-action [data-tab="cart"] .badge { display: none; } */

/* Optional: hide cart badge on product pages if it feels too busy */
/* .ios-glass-tabbar.has-product-action [data-tab="cart"] .badge { display: none; } */

/* Hide the cart badge on the cart icon IF we are on product page?
   Optional: keeping it is fine, but visually busy.
   Uncomment below to hide cart badge on product pages only. */
/* .ios-glass-tabbar.has-product-action [data-tab="cart"] .badge { display: none; } */
