/* ============================================================
   Bam Sweets — Design System (main.css)
   Palette: warm mithai — deep maroon, saffron, cream, cardamom
   Typography: Fraunces (display) + Manrope (body)
   Character: soft, warm, festive; premium but easy to read.
   ============================================================ */

:root {
  /* Core palette */
  --maroon:      #7a1626;   /* primary brand */
  --maroon-700:  #5f0e1c;
  --maroon-100:  #f5d9df;
  --saffron:     #f2a03d;   /* accent */
  --saffron-600: #d97e18;
  --saffron-100: #ffe6c4;
  --pistachio:   #7a9d3e;
  --cream:       #fff6ec;
  --cream-2:     #fbeedb;
  --ink:         #221913;
  --ink-2:       #4b3b30;
  --muted:       #8a7568;
  --line:        #efe1cf;
  --danger:      #c53f2e;
  --success:     #2e7d4f;

  /* Surfaces */
  --bg:          var(--cream);
  --surface:     #ffffff;
  --surface-2:   var(--cream-2);
  --overlay:     rgba(34,25,19,.55);

  /* Radii & shadow */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  16px;
  --r-lg:  22px;
  --r-xl:  30px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(34,25,19,.06), 0 2px 8px rgba(34,25,19,.05);
  --sh-2: 0 8px 24px rgba(34,25,19,.10);
  --sh-3: 0 18px 40px rgba(34,25,19,.14);

  /* Fonts */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body:    'Manrope', system-ui, sans-serif;

  /* Layout */
  --appbar-h: 62px;
  --bottomnav-h: 68px;
  --max-w: 520px;

  /* Motion */
  --ease: cubic-bezier(.22,.9,.28,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #17110d;
    --surface:   #221913;
    --surface-2: #2b201a;
    --ink:       #f7ecdf;
    --ink-2:     #d8c6b3;
    --muted:     #a08977;
    --line:      #3a2b22;
    --cream:     #17110d;
    --cream-2:   #221913;
    --maroon-100: #45161e;
    --overlay:   rgba(0,0,0,.65);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--bottomnav-h) + var(--fc-h, 0px));
  overflow-x: hidden;
  transition: padding-bottom .28s var(--ease);
}

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin:0; letter-spacing:-.01em; }
h1 { font-weight: 800; font-size: 26px; }
h2 { font-weight: 700; font-size: 20px; }
h3 { font-weight: 700; font-size: 16px; }
p  { margin:0; }
a  { color: var(--maroon); text-decoration: none; }

button {
  font-family: inherit; font-size: 15px; border: 0; background: none; color: inherit;
  cursor: pointer;
}

/* ------------------------------------------------------------
   Splash
   ------------------------------------------------------------ */
.splash {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, var(--maroon), var(--maroon-700) 60%, #390810);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--cream);
  z-index: 9999;
  transition: opacity .35s var(--ease), visibility .35s;
}
.splash.hidden { opacity: 0; visibility: hidden; }
.splash-logo { text-align: center; }
.splash-badge {
  width: 88px; height: 88px; border-radius: 50%;
  margin: 0 auto 16px;
  background: linear-gradient(145deg, var(--saffron), var(--saffron-600));
  color: var(--maroon-700);
  font-family: var(--font-display); font-weight: 800; font-size: 44px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px rgba(0,0,0,.35), inset 0 0 20px rgba(255,255,255,.25);
}
.splash-name { font-family: var(--font-display); font-size: 30px; font-weight: 800; }
.splash-tag  { color: var(--saffron-100); margin-top: 4px; font-size: 14px; }
.splash-loader {
  margin-top: 36px; width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--saffron);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   App bar
   ------------------------------------------------------------ */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-top)) 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
  min-height: var(--appbar-h);
}
.appbar-address { flex: 1; text-align: left; padding: 6px 4px; }
.appbar-label { font-size: 11px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.appbar-value { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--ink); font-size: 15px; margin-top: 2px; }
.appbar-value .chev { width: 18px; height: 18px; color: var(--maroon); }
.appbar-actions { display: flex; gap: 4px; }
.icon-btn {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink);
  transition: background .2s var(--ease);
}
.icon-btn:hover, .icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--saffron); border: 2px solid var(--surface);
}

/* Delivering-from strip */
.delivering-from {
  position: sticky; top: var(--appbar-h); z-index: 30;
  background: linear-gradient(180deg, var(--maroon) 0%, var(--maroon-700) 100%);
  color: var(--cream);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 6px 12px rgba(0,0,0,.08);
}
.df-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.df-branch { color: var(--saffron-100); font-weight: 700; display: flex; align-items: center; gap: 4px; font-size: 15px; }
.df-branch .chev { width: 16px; height: 16px; }
.df-right { font-size: 13px; background: rgba(255,255,255,.12); border-radius: var(--r-pill); padding: 6px 12px; font-weight: 600; }

/* ------------------------------------------------------------
   Main view
   ------------------------------------------------------------ */
.view {
  max-width: var(--max-w); margin: 0 auto; padding: 12px 14px 24px;
}
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; margin: 20px 4px 10px;
}
.section-title h2 { font-size: 20px; }
.section-title a { font-size: 13px; font-weight: 600; }

/* ------------------------------------------------------------
   Bottom container (holds floating cart + bottom nav)
   ------------------------------------------------------------ */
.bottom-container {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-container > * { pointer-events: auto; }

/* ------------------------------------------------------------
   Bottom Nav (now a child of .bottom-container, not fixed itself)
   ------------------------------------------------------------ */
.bottomnav {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: var(--bottomnav-h);
}
.bn-item span:not(.cart-badge) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); position: relative;
  font-size: 11px; font-weight: 600;
  transition: color .2s var(--ease);
}
.bn-item svg { width: 22px; height: 22px; }
.bn-item.active, .bn-item:hover { color: var(--maroon); }
.bn-item.active::before {
  content:''; position: absolute; top: 6px;
  width: 26px; height: 3px; border-radius: 2px;
  background: var(--saffron);
}
.cart-badge {
  position: absolute; top: 8px; right: calc(50% - 22px);
  background: var(--maroon); color: white;
  font-size: 10px; font-weight: 800;
  padding: 2px 5px; border-radius: 999px;
  min-width: 16px; text-align: center;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 15px;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.btn-primary {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-700));
  color: white;
  box-shadow: 0 8px 20px rgba(122,22,38,.35);
}
.btn-primary:active { transform: translateY(1px) scale(.98); }
.btn-secondary {
  background: var(--saffron); color: var(--maroon-700);
  box-shadow: 0 6px 16px rgba(217,126,24,.25);
}
.btn-ghost {
  background: transparent; color: var(--maroon); border: 1px solid var(--maroon);
}
.btn-block { display: flex; width: 100%; }

/* Utility */
.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; }
.hidden { display: none !important; }
.center { text-align: center; }
.flex   { display: flex; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8   { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
