/* =========================================================
   Palmora Foods — Design System
   Shared design tokens + base components used across every
   storefront page (index, products, product detail, cart,
   checkout, account, wholesale, about, contact...).

   Load order on every page:
   1. design-system.css   (tokens + base components — this file)
   2. storefront.css      (page-level layout & sections)
   ========================================================= */

/* -----------------------------------------------------------
   Fonts
   'Inter' (Latin UI font) and 'Playfair Display' (serif used
   for the wordmark / hero headings) are pulled from Google
   Fonts with a system-font fallback baked into the stack, so
   text never disappears if the request is blocked/offline.
   Noto Sans Devanagari is self-hosted for Hindi copy.
----------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

@font-face {
  font-family: 'Noto Sans Devanagari';
  src: url('/assets/fonts/NotoSansDevanagari-Regular.woff2') format('woff2'),
       url('/assets/fonts/NotoSansDevanagari-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans Devanagari';
  src: url('/assets/fonts/NotoSansDevanagari-SemiBold.woff2') format('woff2'),
       url('/assets/fonts/NotoSansDevanagari-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans Devanagari';
  src: url('/assets/fonts/NotoSansDevanagari-Bold.woff2') format('woff2'),
       url('/assets/fonts/NotoSansDevanagari-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

/* =========================================================
   CSS Custom Properties
   ========================================================= */
:root {
  /* Brand Colors — sourced from the Palmora mark & landing mock */
  --primary: #7A2E1D;
  --primary-dark: #5C2115;
  --primary-light: #9B4A3A;
  --gold: #C9982E;
  --gold-dark: #A67C24;
  --gold-light: #D4A84A;
  --success: #1E7A46;
  --success-dark: #155A33;
  --success-light: #2E9A5A;
  --danger: #C0392B;
  --danger-dark: #96281B;
  --danger-light: #D44A3D;
  --warning: #E67E22;
  --info: #2980B9;

  /* Deep teal — used only for the landing screen background */
  --teal-deep: #004141;
  --teal-deeper: #003232;

  /* Neutral Colors */
  --bg: #FAF6F0;
  --bg-dark: #F0E8D8;
  --surface: #FFFFFF;
  --surface-dark: #1A120B;
  --text: #103820;
  --text-secondary: #5C4F45;
  --text-muted: #8A7A6D;
  --border: #EDE5DA;
  --border-dark: #D4C8B4;

  /* Typography */
  --font-latin: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-devanagari: 'Noto Sans Devanagari', var(--font-latin);

  --fs-xs: 0.6875rem;    /* 11px — meta, labels, timestamps */
  --fs-sm: 0.8125rem;    /* 13px — body copy */
  --fs-base: 0.875rem;   /* 14px — default */
  --fs-md: 0.9375rem;    /* 15px — card titles */
  --fs-lg: 1.125rem;     /* 18px — section headers */
  --fs-xl: 1.375rem;     /* 22px — page titles */
  --fs-2xl: 1.75rem;     /* 28px — hero titles */
  --fs-3xl: 2.25rem;     /* 36px — landing wordmark (desktop) */
  --fs-price: 1.0625rem; /* 17px — price */

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Border Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Elevation / Shadows */
  --shadow-xs: 0 1px 3px rgba(36, 24, 18, 0.04);
  --shadow-sm: 0 2px 6px rgba(36, 24, 18, 0.06);
  --shadow-md: 0 4px 12px rgba(36, 24, 18, 0.08);
  --shadow-lg: 0 8px 24px rgba(36, 24, 18, 0.12);
  --shadow-xl: 0 12px 32px rgba(36, 24, 18, 0.16);
  --shadow-float: 0 6px 20px rgba(36, 24, 18, 0.14);

  /* Layout
     The app-shell mimics a phone-app "card" up through tablet
     widths (matches the mockups you shared), then opens up to
     a normal full-bleed desktop storefront at 1024px+, where
     --container-max governs the inner content width instead. */
  --app-max-width: 480px;
  --container-max: 1280px;
  --tabbar-height: 60px;
  --tabbar-center-size: 54px;
  --header-height: 64px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.35s ease;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =========================================================
   Reset
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-latin);
  font-size: var(--fs-base);
  line-height: 1.35;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[lang="hi"] body {
  font-family: var(--font-devanagari);
  line-height: 1.5;
}

img {
  max-width: 108%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--primary-dark);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }

/* Visually-hidden but screen-reader accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus ring — kept consistent across every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
/* ── Product Card Footer — Mobile-friendly stacked layout ── */
.product-card-footer {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    align-items: flex-start;
}

/* Price takes full width on mobile */
.price-container {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
}

/* Add to cart button — full width on mobile, auto on desktop */
.product-card-footer .stepper {
    align-self: stretch;
    justify-content: center;
    height: 34px;
}

.product-card-footer .stepper .stepper-label {
    font-size: 0.7rem;
    padding: 0 14px;
}

.product-card-footer .stepper .stepper-plus {
    font-size: var(--fs-md);
    width: 25px;
    line-height: 34px;
}

/* Desktop: Price and button side by side */
@media (min-width: 768px) {
    .product-card-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: var(--sp-2);
    }
    
    .price-container {
        width: auto;
        flex: 1;
        min-width: 0;
    }
    
    .product-card-footer .stepper {
        align-self: center;
        flex-shrink: 0;
    }
}

/* Extra small screens — make price smaller */
@media (max-width: 360px) {
    .product-card .price {
        font-size: 0.9rem;
    }
    
    .product-card-footer .stepper .stepper-label {
        font-size: 0.65rem;
        padding: 0 10px;
    }
}
/* =========================================================
   App Shell
   Phone-card look on mobile/tablet → full-bleed on desktop.
   ========================================================= */
.app-shell {
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

@media (min-width: 560px) {
  :root { --app-max-width: 560px; }
  .app-shell {
    box-shadow: var(--shadow-xl);
    min-height: 100vh;
  }
}

@media (min-width: 1024px) {
  :root { --app-max-width: 100%; }

  .app-shell {
    box-shadow: none;
    padding-bottom: 0 !important;
  }

  .tabbar {
    display: none !important;
  }
}

/* Shared inner content container for desktop rows (header,
   footer, and any full-bleed section) — keeps text readable
   on very wide monitors while the shell itself stays edge to
   edge. */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

@media (min-width: 1024px) {
  .container { padding: 0 var(--sp-8); }
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: none;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 10px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--success);
  color: #fff;
}
.btn-primary:hover {
  background: var(--success-dark);
  color: #fff;
}

.btn-gold {
  background: var(--gold);
  color: #fff;
}
.btn-gold:hover {
  background: var(--gold-dark);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-dark);
  color: #fff;
}

.btn-lg {
  padding: 8px 17px;
  font-size: var(--fs-base);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--fs-xs);
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.625rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-dark);
}

/* =========================================================
   Forms
   ========================================================= */
.form-group {
  margin-bottom: var(--sp-4);
}

.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-1);
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(122, 46, 29, 0.1);
}

.form-group input.error {
  border-color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

/* =========================================================
   Product Card
   ========================================================= */
.product-card {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--bg);
}

.product-card-image {
  display: block;
  position: relative;
}

.product-card-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border-dark);
}

.product-card-info {
  padding: var(--sp-3);
}

.product-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--sp-1);
}

.product-card .name {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: var(--sp-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .short-desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .meta-chip {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text-muted);
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.price-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-card .price {
  font-size: var(--fs-price);
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.product-card .wholesale-price {
  display: block;
  font-size: var(--fs-xs);
  color: var(--gold-dark);
  font-weight: 600;
  white-space: nowrap;
}

/* Stepper (Quantity selector / add-to-cart pill) */
.stepper {
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: var(--r-pill);
  background: var(--success);
  height: 30px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}

.stepper:hover {
  background: var(--success-dark);
}

.stepper:active {
  transform: scale(0.95);
}

.stepper .stepper-label {
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 0 10px;
  white-space: nowrap;
}

.stepper .stepper-plus {
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 700;
  width: 30px;
  text-align: center;
  line-height: 30px;
}

/* Discount Badge */
.badge-discount {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  background: var(--gold);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  z-index: 2;
}

/* =========================================================
   Bottom Tab Bar — floating pill, inset from edges, with a
   raised center action button (Register → Shop once wholesale
   verified), matching the reference mock.
   ========================================================= */
.tabbar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 420px;
  height: var(--tabbar-height);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(36, 24, 18, 0.14), 0 2px 8px rgba(36, 24, 18, 0.06);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--sp-2);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}

.tabbar .tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  padding: var(--sp-1) var(--sp-2);
  position: relative;
  min-width: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.tabbar .tab.active { color: var(--primary); }
.tabbar .tab.active svg { stroke: var(--primary); }
.tabbar .tab:not(.active) svg { stroke: var(--text-muted); fill: none; }

.tabbar .tab-label {
  font-size: 0.625rem;
  font-weight: 600;
}

.tabbar .tab-badge {
  position: absolute;
  top: -2px;
  right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Raised center action (Register / Shop) */
.tabbar .tab-center {
  min-width: var(--tabbar-center-size);
  gap: 2px;
}

.tab-center-circle {
  width: var(--tabbar-center-size);
  height: var(--tabbar-center-size);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: calc(var(--tabbar-center-size) / -2 - 8px);
  border: 4px solid var(--bg);
  box-shadow: 0 6px 16px rgba(122, 46, 29, 0.4);
  transition: transform var(--transition-fast);
}

.tabbar .tab-center:active .tab-center-circle {
  transform: scale(0.94);
}

.tabbar .tab-center svg { stroke: #fff; }

.tab-label--center {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.tabbar .tab-center.active .tab-label--center { color: var(--primary); }

/* =========================================================
   Sticky CTA Bar
   ========================================================= */
.sticky-cta {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-float);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  z-index: 40;
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
}

.sticky-cta-info {
  flex: 1;
  min-width: 0;
}

.sticky-cta-name {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-cta-price {
  font-size: var(--fs-price);
  font-weight: 700;
  color: var(--primary);
}

/* =========================================================
   Sidecart — compact, modern, minimal padding
   ========================================================= */
.sidecart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 56, 32, 0.5);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.sidecart-overlay.open { opacity: 1; visibility: visible; }

.sidecart {
  position: fixed;
  border-radius: 10px;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--transition-base);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.sidecart.open { transform: translateX(0); }

.sidecart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidecart-header h3 {
  font-size: var(--fs-md);
  font-weight: 700;
}

.sidecart-header h3 .sidecart-count {
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-xs);
}

/* Unlock-discount progress strip */
.sidecart-progress {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidecart-progress-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-dark);
  margin-bottom: 7px;
}

.sidecart-progress-track {
  position: relative;
  height: 5px;
  background: var(--border);
  border-radius: var(--r-pill);
  margin-bottom: 4px;
}

.sidecart-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: var(--r-pill);
  transition: width var(--transition-base);
}

.sidecart-progress-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Cart item list */
.sidecart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--sp-4);
}

.sidecart-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}

.sidecart-item:last-child { border-bottom: none; }

.sidecart-item-img {
  width: 52px;
  height: 52px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.sidecart-item-info { flex: 1; min-width: 0; }

.sidecart-item-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidecart-item-variant {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidecart-qty-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
}

.sidecart-qty-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.sidecart-qty-value {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}

.sidecart-item-price {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  text-align: right;
}

.sidecart-empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--text-muted);
}

.sidecart-empty svg { color: var(--border); margin-bottom: var(--sp-2); }
.sidecart-empty p { font-size: var(--fs-sm); margin: 0; }

/* Sticky total + checkout footer */
.sidecart-footer {
  padding: var(--sp-3) var(--sp-4);
  padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.sidecart-savings {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(30, 122, 70, 0.08);
  padding: 5px var(--sp-2);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-2);
  width: fit-content;
}

.cart-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}

.cart-total-amount {
  color: var(--primary);
  font-size: var(--fs-lg);
  font-weight: 700;
}

/* =========================================================
   Cart item rows — matches the markup actually rendered by
   app.js's cartItemHtml() (.cart-item / .cart-item-thumb /
   .cart-item-body / .cart-item-row / .cart-item-stepper /
   .cart-qty-btn / .cart-qty-value / .cart-item-price /
   .cart-item-remove). These are DIFFERENT class names than the
   older .sidecart-item-* rules above — both are kept since
   nothing else in the app still renders the old markup, but
   removing the old block isn't necessary and avoids regressions
   if some other page still uses it.
   ========================================================= */
.cart-item-list {
  display: flex;
  flex-direction: column;
}

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  transition: opacity var(--transition-fast);
}

.cart-item:last-child { border-bottom: none; }

.cart-item.is-updating { opacity: 0.5; pointer-events: none; }

.cart-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.cart-item-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.cart-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cart-item-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cart-item-variant {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: var(--sp-2);
}

.cart-item-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px 4px;
}

.cart-qty-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition-fast);
}

.cart-qty-btn:hover { background: var(--bg); color: var(--primary); }

.cart-qty-value {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}

.cart-item-price {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.cart-item-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.cart-item-remove:hover { background: rgba(192, 57, 43, 0.08); color: var(--danger); }

.sidecart-empty-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  margin: var(--sp-3) 0 2px;
}

.sidecart-empty-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0 0 var(--sp-4);
}

/* Smoother native momentum scroll on touch for the cross-sell row */
.cross-sell-row {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.cross-sell-card { scroll-snap-align: start; }

.cross-sell-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* =========================================================
   Toast Notifications
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: calc(var(--tabbar-height) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: calc(100% - var(--sp-8));
  max-width: 400px;
  pointer-events: none;
}

@media (min-width: 1024px) {
  .toast-container { bottom: var(--sp-6); }
}

.toast {
  background: var(--surface-dark);
  color: #fff;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  pointer-events: auto;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* =========================================================
   Skeleton Loaders
   ========================================================= */
.skeleton-loader {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
  height: 16px;
  margin-bottom: var(--sp-2);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================================
   WhatsApp Widget
   ========================================================= */
.whatsapp-widget {
  position: fixed;
  bottom: calc(var(--tabbar-height) + var(--sp-4));
  right: var(--sp-4);
  width: 54px;
  height: 54px;
  background: #25D366;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 45;
  transition: transform var(--transition-fast);
}

.whatsapp-widget:hover {
  transform: scale(1.08);
  color: #fff;
}

@media (min-width: 1024px) {
  .whatsapp-widget { bottom: var(--sp-6); }
}

/* =========================================================
   Language Switcher (in-app header pill — small EN/HI toggle)
   ========================================================= */
.lang-switch {
  display: inline-flex;
  border-radius: var(--r-pill);
  background: var(--bg);
  padding: 2px;
  gap: 2px;
}

.lang-switch a {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  text-decoration: none;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.lang-switch a.active {
  background: var(--primary);
  color: #fff;
}

/* Language Splash (legacy full-screen picker — kept for
   pages reached directly without going through the landing
   screen, e.g. a shared product link) */
.lang-splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-splash-content {
  text-align: center;
  padding: var(--sp-6);
}

.lang-splash-logo {
  margin: 0 auto var(--sp-4);
}

.lang-splash h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-2);
}

.lang-splash p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-6);
}

.lang-splash-choices {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
}

.lang-splash-choices .btn {
  min-width: 140px;
  padding: 14px 24px;
  font-size: var(--fs-base);
}

/* =========================================================
   Alerts
   ========================================================= */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}

.alert-error {
  background: #FDE8E8;
  color: var(--danger);
  border: 1px solid #F5C6C6;
}

.alert-success {
  background: #E8F5E9;
  color: var(--success);
  border: 1px solid #C8E6C9;
}

.alert-info {
  background: #E3F2FD;
  color: var(--info);
  border: 1px solid #BBDEFB;
}

/* =========================================================
   Status Badges
   ========================================================= */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: capitalize;
}

.status-pending { background: #FFF3E0; color: #E65100; }
.status-confirmed { background: #E3F2FD; color: #1565C0; }
.status-processing { background: #F3E5F5; color: #7B1FA2; }
.status-shipped { background: #E8F5E9; color: #2E7D32; }
.status-delivered { background: #E0F2F1; color: #00695C; }
.status-cancelled { background: #FFEBEE; color: #C62828; }
.status-failed { background: #FFF3E0; color: #E65100; }
.status-paid { background: #E8F5E9; color: #2E7D32; }
.status-refunded { background: #FFF8E1; color: #F57F17; }

/* =========================================================
   Utilities
   ========================================================= */
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.hidden { display: none !important; }

/* =========================================================
   Sidecart — cart-badge, cross-sell shelf, mobile bottom sheet
   ========================================================= */
.cart-icon,
.tabbar .tab { position: relative; }

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--surface);
  line-height: 1;
}

.cart-badge.hidden,
.tab-badge.hidden {
  display: none !important;
}
.sidecart-handle {
  display: none;
}

.sidecart-cross-sell {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidecart-section-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}

.cross-sell-row {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  cursor: grab;
}

.cross-sell-row::-webkit-scrollbar { display: none; }

.cross-sell-card {
  flex: 0 0 auto;
  width: 100px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cross-sell-thumb {
  width: 100px;
  height: 100px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--bg);
  pointer-events: none;
}

.cross-sell-name {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cross-sell-price {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
}

.cross-sell-add-btn {
  margin-top: 2px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 0;
  cursor: pointer;
}

.cross-sell-add-btn:hover { border-color: var(--primary); }

/* Mobile: sidecart becomes a draggable bottom sheet */
@media (max-width: 768px) {
  .sidecart {
    max-width: 100%;
    top: auto;
    bottom: 0;
    height: 88vh;
    max-height: 88dvh;
    transform: translateY(100%);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }

  .sidecart.open { transform: translateY(0); }

  .sidecart-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: var(--r-pill);
    background: var(--border);
    margin: 10px auto 2px;
    flex-shrink: 0;
    cursor: grab;
  }
}
/* =========================================================
   Variation Selection Bottom Sheet
   ========================================================= */
.variation-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 56, 32, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;  /* ← ADD THIS - prevents blocking clicks when hidden */
    transition: all 0.25s ease;
}

.variation-sheet-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;  /* ← ADD THIS - allows clicks when visible */
}

.variation-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    max-height: 75vh;
    max-height: 75dvh;
    background: var(--surface);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    z-index: 151;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    visibility: hidden;  /* ← ADD THIS - hides sheet when closed */
    pointer-events: none;  /* ← ADD THIS - prevents blocking clicks when hidden */
}

.variation-sheet.is-open {
    transform: translateX(-50%) translateY(0);
    visibility: visible;  /* ← ADD THIS - shows sheet when open */
    pointer-events: auto;  /* ← ADD THIS - allows clicks when visible */
}

.variation-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: var(--r-pill);
    background: var(--border-dark);
    margin: 10px auto 4px;
    flex-shrink: 0;
    cursor: grab;
}

.variation-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.variation-sheet-product {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
    flex: 1;
}

.variation-sheet-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
}

.variation-sheet-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.variation-sheet-price {
    font-size: var(--fs-price);
    font-weight: 700;
    color: var(--primary);
    margin-top: 1px;
}

.variation-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4);
    -webkit-overflow-scrolling: touch;
}

.variation-sheet-footer {
    padding: var(--sp-3) var(--sp-4);
    padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

/* Variation options in sheet */
.variation-option-group {
    margin-bottom: var(--sp-4);
}

.variation-option-group:last-child {
    margin-bottom: 0;
}

.variation-option-group-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    display: block;
    margin-bottom: var(--sp-2);
}

.variation-option-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.variation-option-btn {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    transition: all 0.15s;
    text-align: center;
    min-width: 80px;
}

.variation-option-btn:hover {
    border-color: var(--primary);
}

.variation-option-btn.is-selected {
    border-color: var(--primary);
    background: rgba(122, 46, 29, 0.04);
    box-shadow: 0 0 0 2px rgba(122, 46, 29, 0.15);
}

.variation-option-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

.variation-option-btn .var-name {
    display: block;
    font-weight: 600;
}

.variation-option-btn .var-price {
    display: block;
    font-size: var(--fs-xs);
    color: var(--primary);
    font-weight: 600;
    margin-top: 2px;
}

.variation-option-btn .var-stock {
    display: block;
    font-size: 0.6rem;
    color: var(--danger);
    margin-top: 2px;
}

/* Desktop: centered modal */
@media (min-width: 769px) {
    .variation-sheet {
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%) scale(0.94);
        border-radius: var(--r-lg);
        max-height: 80vh;
        opacity: 0;
        transition: transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.2s ease;
    }
    
    .variation-sheet.is-open {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    
    .variation-sheet-handle {
        display: none;
    }
}
/* =========================================================
   Sidecart Coupon Offers
   ========================================================= */
.sidecart-coupon-section {
    margin-bottom: var(--sp-2);
    padding-bottom: var(--sp-2);
    border-bottom: 1px dashed var(--border);
}

.sidecart-coupon-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px dashed var(--border-dark);
    border-radius: var(--r-sm);
    color: var(--primary);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sidecart-coupon-toggle:hover {
    background: rgba(122, 46, 29, 0.04);
    border-color: var(--primary);
}

.sidecart-coupons-list {
    margin-top: var(--sp-2);
    max-height: 160px;
    overflow-y: auto;
}

.sidecart-offer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-2) var(--sp-3);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.sidecart-offer-item:hover {
    border-color: var(--gold);
    background: rgba(201, 152, 46, 0.05);
}

.sidecart-offer-code {
    font-weight: 700;
    font-size: 0.65rem;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.sidecart-offer-desc {
    font-size: 0.55rem;
    color: var(--text-muted);
}

.sidecart-offer-apply-btn {
    padding: 4px 10px;
    background: var(--gold);
    color: #fff;
    border: none;
    border-radius: var(--r-pill);
    font-size: 0.58rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.sidecart-offer-apply-btn:hover {
    background: var(--gold-dark);
}

.sidecart-applied-coupon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-2) var(--sp-3);
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
    border-radius: var(--r-sm);
    margin-top: var(--sp-2);
    font-size: 0.65rem;
}

.sidecart-applied-coupon-code {
    font-weight: 700;
    color: #2E7D32;
}

.sidecart-applied-coupon-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.6rem;
    cursor: pointer;
    text-decoration: underline;
}

.cart-discount-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--success);
    padding: 4px 0;
}

.cart-discount-row span:last-child {
    font-weight: 700;
}