/* ============================================================
   VAPR — user Mini App · mint/dark design system
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- DARK (default) ---------- */
:root {
  --radius: 1rem;

  --background: oklch(0.16 0.012 270);
  --foreground: oklch(0.98 0.005 270);

  --surface: oklch(0.215 0.014 270);
  --surface-2: oklch(0.255 0.016 270);
  --surface-3: oklch(0.30 0.018 270);
  --hairline: oklch(1 0 0 / 8%);

  --card: var(--surface);
  --muted-foreground: oklch(0.72 0.02 270);

  --primary: oklch(0.86 0.09 172);
  --neon: oklch(0.86 0.09 172);
  --neon-foreground: oklch(0.22 0.03 180);

  --vapor: oklch(0.82 0.08 235);
  --destructive: oklch(0.7 0.13 25);
  --destructive-foreground: oklch(0.98 0 0);
  --warning: oklch(0.85 0.12 85);

  --border: oklch(1 0 0 / 8%);
  --input: oklch(0.27 0.018 270);
  --ring: oklch(0.86 0.09 172);

  --shadow-glow: 0 14px 50px -18px oklch(0.86 0.09 172 / 0.55);
  --shadow-card: 0 8px 30px -16px oklch(0 0 0 / 0.6);
  --gradient-neon: linear-gradient(135deg, oklch(0.88 0.09 168), oklch(0.82 0.08 210));
  --gradient-vapor: linear-gradient(135deg, oklch(0.78 0.08 260), oklch(0.85 0.08 215));
}

/* ---------- LIGHT ---------- */
html.light {
  --background: oklch(0.985 0.005 200);
  --foreground: oklch(0.22 0.02 260);

  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.008 220);
  --surface-3: oklch(0.93 0.012 220);
  --hairline: oklch(0.22 0.02 260 / 9%);

  --card: var(--surface);
  --muted-foreground: oklch(0.48 0.02 260);

  --primary: oklch(0.78 0.10 172);
  --neon: oklch(0.78 0.10 172);
  --neon-foreground: oklch(0.20 0.03 180);

  --border: oklch(0.22 0.02 260 / 10%);
  --input: oklch(0.93 0.012 220);
  --ring: oklch(0.78 0.10 172);

  --shadow-glow: 0 14px 50px -18px oklch(0.78 0.10 172 / 0.40);
  --shadow-card: 0 10px 30px -18px oklch(0.4 0.05 260 / 0.35);
  --gradient-neon: linear-gradient(135deg, oklch(0.82 0.10 168), oklch(0.78 0.09 210));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

html, body {
  background: var(--background);
  color: var(--foreground);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}
body {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 86px; /* space for bottom nav */
}

.font-display { font-family: 'Unbounded', sans-serif; }
.muted { color: var(--muted-foreground); }
.neon { color: var(--neon); }
.hidden { display: none !important; }

/* ---------- Animations ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: none;} }
@keyframes fade-in { from { opacity: 0;} to { opacity: 1;} }
@keyframes scale-in { from { opacity: 0; transform: scale(.96);} to { opacity: 1; transform: scale(1);} }
@keyframes sheet-up { from { transform: translateY(100%);} to { transform: translateY(0);} }
@keyframes pop { 0% { transform: scale(1);} 50% { transform: scale(1.18);} 100% { transform: scale(1);} }
.fade-up { animation: fade-up .5s cubic-bezier(.16,1,.3,1) both; }
.stagger > * { opacity: 0; animation: fade-up .5s cubic-bezier(.16,1,.3,1) forwards; }
.stagger > *:nth-child(1){animation-delay:.04s} .stagger > *:nth-child(2){animation-delay:.09s}
.stagger > *:nth-child(3){animation-delay:.14s} .stagger > *:nth-child(4){animation-delay:.19s}
.stagger > *:nth-child(5){animation-delay:.24s} .stagger > *:nth-child(6){animation-delay:.29s}
.stagger > *:nth-child(7){animation-delay:.34s} .stagger > *:nth-child(8){animation-delay:.39s}

.press { transition: transform .14s ease; }
.press:active { transform: scale(.95); }

/* ============================================================
   Header
   ============================================================ */
.app-header { padding: 16px 18px 6px; position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--background) 70%, transparent); }
.greet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.greet small { font-size: 12px; color: var(--muted-foreground); }
.greet h1 { font-family: 'Unbounded', sans-serif; font-size: 21px; font-weight: 900; line-height: 1.1; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  height: 42px; width: 42px; display: grid; place-items: center;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--hairline);
  font-size: 18px; cursor: pointer; color: var(--foreground); position: relative;
  transition: transform .14s ease, background .2s ease;
}
.icon-btn:active { transform: scale(.92); }
.cart-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px; background: var(--neon);
  color: var(--neon-foreground); font-size: 10px; font-weight: 800;
}
.cart-badge.bump { animation: pop .3s ease; }

.searchbar {
  margin-top: 14px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 11px 14px;
}
.searchbar span { color: var(--muted-foreground); }
.searchbar input {
  flex: 1; border: none; background: transparent; color: var(--foreground);
  font-size: 14px; outline: none; font-family: inherit;
}
.searchbar input::placeholder { color: var(--muted-foreground); }

/* ---------- Category chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px 4px; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 999px; padding: 8px 13px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--muted-foreground);
  cursor: pointer; transition: all .2s ease; white-space: nowrap;
}
.chip.active { background: var(--neon); color: var(--neon-foreground); border-color: transparent; font-weight: 700; }
.chip:active { transform: scale(.95); }

/* ---------- Promo banner ---------- */
.promo-banner {
  margin: 14px 18px 0; border-radius: 24px; padding: 16px 18px;
  background-image: var(--gradient-neon); color: var(--neon-foreground);
  box-shadow: var(--shadow-glow); position: relative; overflow: hidden;
}
.promo-banner .tag { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.promo-banner h3 { font-family: 'Unbounded', sans-serif; font-size: 18px; font-weight: 900; margin-top: 4px; line-height: 1.1; }
.promo-banner p { font-size: 12px; opacity: .85; margin-top: 4px; }
.promo-code { background: oklch(0 0 0 / .22); padding: 2px 7px; border-radius: 6px; font-family: ui-monospace, monospace; font-weight: 700; }

/* ============================================================
   Views / sections
   ============================================================ */
.view { padding: 4px 0 8px; animation: fade-in .35s ease; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px; }
.section-head h2 { font-size: 15px; font-weight: 800; }
.section-head .link { font-size: 12px; color: var(--muted-foreground); }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 18px 8px; }
.product {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 20px;
  overflow: hidden; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease;
}
.product:active { transform: scale(.97); }
.product .thumb { height: 104px; display: grid; place-items: center; font-size: 40px;
  background: var(--surface-2); position: relative; overflow: hidden; }
.product .thumb img { display: block; width: 100%; height: 104px; object-fit: cover; }
.product .pbody { padding: 11px 12px 12px; }
.product .pbrand { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-foreground); }
.product .pname { font-size: 13px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product .prow { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product .pprice { font-size: 14px; font-weight: 800; color: var(--neon); }
.add-btn {
  height: 30px; width: 30px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--neon); color: var(--neon-foreground); font-size: 18px; line-height: 1;
  display: grid; place-items: center; transition: transform .14s ease;
}
.add-btn:active { transform: scale(.85); }

.empty { text-align: center; color: var(--muted-foreground); padding: 48px 24px; font-size: 14px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--hairline); border-top-color: var(--neon);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Generic card ---------- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 20px;
  padding: 16px; margin: 12px 18px 0; box-shadow: var(--shadow-card); }
.card h3 { font-size: 15px; font-weight: 800; }

/* ============================================================
   Bottom navigation
   ============================================================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 40;
  background: oklch(from var(--surface) l c h / .9); backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav .nav-row { display: grid; grid-template-columns: repeat(4, 1fr); }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0;
  font-size: 10px; font-weight: 600; color: var(--muted-foreground); cursor: pointer;
  border: none; background: none; transition: color .2s ease;
}
.nav-item .ico { font-size: 19px; transition: transform .2s ease; }
.nav-item.active { color: var(--neon); }
.nav-item.active .ico { transform: translateY(-1px) scale(1.06); }

/* ============================================================
   Bottom sheet (product / cart)
   ============================================================ */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: oklch(0 0 0 / .55); backdrop-filter: blur(2px); animation: fade-in .25s ease; }
.sheet-card {
  position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 28px 28px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid var(--hairline); animation: sheet-up .35s cubic-bezier(.16,1,.3,1);
}
.sheet-card::before { content: ''; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 42px; height: 4px; border-radius: 999px; background: var(--hairline); }
.sheet-close { position: absolute; top: 14px; right: 14px; height: 34px; width: 34px; border-radius: 999px;
  border: none; background: var(--surface-2); color: var(--foreground); font-size: 15px; cursor: pointer; z-index: 2; }
.sheet-hero { width: 100%; height: 190px; border-radius: 20px; object-fit: cover; background: var(--surface-2);
  display: grid; place-items: center; font-size: 64px; margin-top: 10px; }
.sheet-card h2 { font-family: 'Unbounded', sans-serif; font-size: 20px; font-weight: 800; margin-top: 6px; }

.opt-group { margin-top: 16px; }
.opt-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-foreground); margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  border: 1px solid var(--hairline); background: var(--surface-2); color: var(--foreground);
  border-radius: 12px; padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .18s ease; font-family: inherit;
}
.opt.active { background: oklch(from var(--neon) l c h / .15); color: var(--neon); border-color: oklch(from var(--neon) l c h / .45); }
.opt:active { transform: scale(.95); }

.row { display: flex; align-items: center; justify-content: space-between; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.stepper button { height: 34px; width: 34px; border: none; border-radius: 10px; background: var(--surface-3);
  color: var(--foreground); font-size: 18px; cursor: pointer; }
.stepper span { min-width: 30px; text-align: center; font-weight: 700; }
.big-price { font-family: 'Unbounded', sans-serif; font-size: 22px; font-weight: 800; color: var(--neon); }

/* ---------- Buttons ---------- */
.btn {
  width: 100%; border: none; border-radius: 16px; padding: 15px; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: transform .14s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.accent { background: var(--neon); color: var(--neon-foreground); box-shadow: var(--shadow-glow); }
.btn.ghost { background: var(--surface-2); color: var(--foreground); border: 1px solid var(--hairline); }
.btn.danger { background: oklch(from var(--destructive) l c h / .14); color: var(--destructive); }
.btn.sm { width: auto; padding: 9px 16px; font-size: 13px; border-radius: 12px; }

/* ---------- Cart ---------- */
.cart-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.cart-item .meta { flex: 1; }
.cart-item .t { font-size: 14px; font-weight: 700; }
.cart-item .s { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.cart-item .p { font-weight: 800; color: var(--neon); white-space: nowrap; }
.promo-row { display: flex; gap: 8px; margin-top: 16px; }
.field {
  width: 100%; border: 1px solid var(--hairline); background: var(--surface-2); color: var(--foreground);
  border-radius: 14px; padding: 13px 14px; font-size: 14px; outline: none; font-family: inherit;
}
.field:focus { border-color: oklch(from var(--neon) l c h / .5); }
.field::placeholder { color: var(--muted-foreground); }
.delivery-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.summary { margin-top: 16px; border-top: 1px solid var(--hairline); padding-top: 12px; }
.summary .line { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; color: var(--muted-foreground); }
.summary .line.total { color: var(--foreground); font-weight: 800; font-size: 17px; padding-top: 8px; }
.err { color: var(--destructive); font-size: 13px; margin-top: 8px; }
.ok { color: var(--neon); font-size: 13px; margin-top: 8px; }

/* ---------- Floating cart bar ---------- */
.cart-fab {
  position: fixed; bottom: calc(78px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 36px); max-width: 484px; z-index: 45;
  background: var(--neon); color: var(--neon-foreground); border: none; border-radius: 18px;
  padding: 15px 20px; font-size: 15px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-glow);
  animation: fade-up .3s ease;
}

/* ---------- Orders ---------- */
.order-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 14px 16px; margin: 12px 18px 0; }
.order-card .oh { display: flex; align-items: center; justify-content: space-between; }
.order-card .oid { font-weight: 800; }
.order-card .odate { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.order-card .oitems { font-size: 13px; color: var(--muted-foreground); margin-top: 8px; line-height: 1.5; }
.status-pill { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.status-new { background: oklch(from var(--vapor) l c h / .2); color: var(--vapor); }
.status-processing { background: oklch(from var(--warning) l c h / .2); color: var(--warning); }
.status-done { background: oklch(from var(--neon) l c h / .18); color: var(--neon); }
.status-cancelled { background: oklch(from var(--destructive) l c h / .18); color: var(--destructive); }

/* ---------- Referral ---------- */
.ref-hero { margin: 14px 18px 0; border-radius: 24px; padding: 22px; background-image: var(--gradient-vapor);
  color: oklch(0.18 0.03 250); box-shadow: var(--shadow-card); }
.ref-hero h2 { font-family: 'Unbounded', sans-serif; font-size: 22px; font-weight: 900; }
.ref-hero p { margin-top: 6px; font-size: 13px; opacity: .85; }
.ref-stat { display: flex; gap: 12px; margin: 14px 18px 0; }
.ref-stat .box { flex: 1; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 16px; text-align: center; }
.ref-stat .v { font-family: 'Unbounded', sans-serif; font-size: 24px; font-weight: 900; color: var(--neon); }
.ref-stat .l { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }
.copy-row { display: flex; gap: 8px; margin-top: 14px; }
.copy-row .code { flex: 1; background: var(--surface-2); border: 1px dashed var(--hairline); border-radius: 14px;
  padding: 13px 14px; font-family: ui-monospace, monospace; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Profile / auth ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; margin: 14px 18px 0; }
.avatar { height: 60px; width: 60px; border-radius: 20px; background-image: var(--gradient-neon);
  display: grid; place-items: center; font-size: 26px; color: var(--neon-foreground); font-weight: 800; box-shadow: var(--shadow-glow); }
.profile-head .pn { font-family: 'Unbounded', sans-serif; font-size: 19px; font-weight: 800; }
.profile-head .pe { font-size: 13px; color: var(--muted-foreground); margin-top: 2px; }
.stat-2 { display: flex; gap: 12px; margin: 14px 18px 0; }
.stat-2 .box { flex: 1; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 16px; }
.stat-2 .v { font-family: 'Unbounded', sans-serif; font-size: 20px; font-weight: 900; }
.stat-2 .l { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }
.menu-list { margin: 14px 18px 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 15px 16px; cursor: pointer; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.menu-item:last-child { border-bottom: none; }
.menu-item .ml { flex: 1; }
.menu-item .ico { font-size: 18px; }
.menu-item .chev { color: var(--muted-foreground); }

.auth-wrap { padding: 8px 18px 24px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); border-radius: 16px; padding: 5px; margin-top: 18px; }
.auth-tab { padding: 11px; text-align: center; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--muted-foreground); }
.auth-tab.active { background: var(--neon); color: var(--neon-foreground); }
.form-field { margin-top: 14px; }
.form-field label { display: block; font-size: 12px; color: var(--muted-foreground); margin-bottom: 6px; }
.auth-hero { text-align: center; padding: 28px 0 6px; }
.auth-hero .logo { font-size: 44px; }
.auth-hero h2 { font-family: 'Unbounded', sans-serif; font-size: 24px; font-weight: 900; margin-top: 8px; }
.auth-hero p { font-size: 13px; color: var(--muted-foreground); margin-top: 6px; }

/* ---------- Success overlay ---------- */
.success { position: fixed; inset: 0; z-index: 80; background: var(--background); display: grid; place-items: center; padding: 24px; animation: fade-in .3s ease; }
.success-inner { text-align: center; max-width: 320px; animation: scale-in .4s cubic-bezier(.16,1,.3,1); }
.success .check { font-size: 64px; }
.success h2 { font-family: 'Unbounded', sans-serif; font-size: 24px; font-weight: 900; margin-top: 12px; }
.success p { color: var(--muted-foreground); margin-top: 8px; font-size: 14px; }
.order-no { font-family: 'Unbounded', sans-serif; font-size: 34px; font-weight: 900; color: var(--neon); margin: 14px 0; }
.order-confirmation {
  text-align: left; white-space: pre-wrap; word-break: break-word;
  font-family: 'Inter', sans-serif; font-size: 13px; line-height: 1.6; color: var(--foreground);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 14px 16px; margin: 6px 0 4px; max-height: 46vh; overflow-y: auto;
}

/* ---------- Checkout fields ---------- */
.form-field { margin-top: 10px; }
.form-field .opt-label { margin-bottom: 6px; }
.delivery-form { display: grid; gap: 2px; }
.req { color: #ff6b6b; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--surface-3); color: var(--foreground); border: 1px solid var(--hairline);
  padding: 12px 18px; border-radius: 14px; font-size: 13px; font-weight: 600; z-index: 90;
  box-shadow: var(--shadow-card); animation: fade-up .25s ease; max-width: 90%; }
