/* ============================================================
   Chiya Bari Loyalty — Design System
   Premium tea-inspired palette with dark mode support
   ============================================================ */

/* ---- CSS Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ---- Design Tokens ---- */
:root {
  /* ---- Chiya Bari warm tea-house palette (matches chiyabaripokhara.com) ---- */
  /* Espresso base + turmeric/brass gold accent. The DEFAULT theme is the dark
     espresso look so the loyalty app matches the main website out of the box.
     A warm-cream [data-theme="light"] variant is defined below for the toggle. */
  --forest-green: #3a2a15;   /* legacy name → warm espresso-gold */
  --forest-green-light: #4a3620;
  --forest-green-dark: #241703;
  --tea-brown: #8b5e3c;
  --tea-brown-light: #a67c52;
  --tea-brown-dark: #6b4423;
  --warm-cream: #F3E9D8;
  --warm-cream-dark: #EADCC4;
  --soft-gold: #D9A441;      /* turmeric gold (amber-400) */
  --soft-gold-light: #E7C46B;/* champagne (yellow-400)    */
  --soft-gold-dark: #BE8A30; /* brass (amber-500)         */
  --rust: #B5532A;
  --white: #ffffff;
  --black: #1A120B;

  /* Glass system (warm amber glass — ported from the website) */
  --glass-bg: rgba(46, 32, 19, 0.45);
  --glass-bg-strong: rgba(33, 22, 12, 0.72);
  --glass-bg-light: rgba(255, 255, 255, 0.055);
  --glass-border: rgba(231, 196, 107, 0.20);
  --glass-border-soft: rgba(255, 255, 255, 0.10);
  --glass-border-hi: rgba(231, 196, 107, 0.42);
  --glass-blur: 16px;
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12);

  /* Semantic colors (dark espresso — default) */
  --bg: #1A120B;
  --bg-secondary: #1F1509;
  --surface: #261A10;
  --surface-elevated: #2E2013;
  --text: #F3E9D8;
  --text-secondary: #C7B594;
  --text-muted: #8C7A5E;
  --border: #3A2A1A;
  --border-strong: #4A3620;
  --accent: #D9A441;
  --accent-light: #E7C46B;
  --accent-dark: #BE8A30;
  --gold: #D9A441;
  --gold-light: #E7C46B;
  --success: #5BD17A;
  --success-bg: #17331d;
  --error: #E08A6E;
  --error-bg: #3d2018;
  --warning: #E7C46B;
  --warning-bg: #3a2e14;
  --info: #6BB3C9;
  --info-bg: #13272e;

  /* Shadows (deep, warm — matches the site's glass depth) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 10px 34px -12px rgba(0, 0, 0, 0.62);
  --shadow-lg: 0 22px 48px -16px rgba(0, 0, 0, 0.70);
  --shadow-xl: 0 28px 60px -18px rgba(0, 0, 0, 0.76);
  --shadow-glow: 0 0 26px rgba(217, 164, 65, 0.28);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Spacing scale */
  --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;
  --sp-16: 64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-devanagari: 'Tiro Devanagari Hindi', 'Playfair Display', serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 2rem;
  --fs-4xl: 2.5rem;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur: 250ms;
  --dur-slow: 400ms;

  /* Z-index */
  --z-toast: 9000;
  --z-modal: 8000;
  --z-nav: 7000;
  --z-dropdown: 6000;
  --z-sticky: 5000;
}

/* ---- Dark Mode (espresso — same family as the default; matches the site) ---- */
[data-theme="dark"] {
  --bg: #1A120B;
  --bg-secondary: #1F1509;
  --surface: #261A10;
  --surface-elevated: #2E2013;
  --text: #F3E9D8;
  --text-secondary: #C7B594;
  --text-muted: #8C7A5E;
  --border: #3A2A1A;
  --border-strong: #4A3620;
  --accent: #D9A441;
  --accent-light: #E7C46B;
  --accent-dark: #BE8A30;
  --gold: #D9A441;
  --gold-light: #E7C46B;
}

/* ---- Light Mode (warm cream / parchment — still on-brand Chiya Bari) ---- */
[data-theme="light"] {
  --bg: #F3E9D8;
  --bg-secondary: #EADCC4;
  --surface: #FBF6EC;
  --surface-elevated: #FFFFFF;
  --text: #2A1B0F;
  --text-secondary: #5C4A38;
  --text-muted: #8C7A5E;
  --border: #E2D4BE;
  --border-strong: #D2BE9C;
  --accent: #BE8A30;
  --accent-light: #D9A441;
  --accent-dark: #9c6f22;
  --gold: #BE8A30;
  --gold-light: #D9A441;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.80);
  --glass-bg-light: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(190, 138, 48, 0.28);
  --glass-border-soft: rgba(42, 27, 15, 0.10);
  --glass-border-hi: rgba(190, 138, 48, 0.45);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.55);

  --shadow-xs: 0 1px 2px rgba(58, 42, 26, 0.06);
  --shadow-sm: 0 2px 10px rgba(58, 42, 26, 0.10);
  --shadow-md: 0 8px 28px -10px rgba(58, 42, 26, 0.20);
  --shadow-lg: 0 18px 40px -14px rgba(58, 42, 26, 0.26);
  --shadow-xl: 0 26px 56px -18px rgba(58, 42, 26, 0.30);
  --shadow-glow: 0 0 24px rgba(190, 138, 48, 0.28);

  --success: #3d8b5a;
  --success-bg: #e8f5ec;
  --error: #c84a3a;
  --error-bg: #fcebe8;
  --warning: #b07d1e;
  --warning-bg: #fdf3df;
  --info: #3a7a9a;
  --info-bg: #e8f0f5;
}

/* ---- Base Styles ---- */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* ---- Layout Utilities ---- */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--sp-4);
  min-height: 100vh;
}
.app-container.wide { max-width: 1200px; }
.app-container.medium { max-width: 768px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card-elevated {
  box-shadow: var(--shadow-md);
}
.card-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
[data-theme="dark"] .card-glass {
  background: rgba(42, 34, 24, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--soft-gold-dark));
  color: var(--black);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.1); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-secondary); }

.btn-danger {
  background: var(--error);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }

.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: var(--sp-2); border-radius: var(--r-sm); }

/* ---- Inputs ---- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.input-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}
.input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.12);
}
[data-theme="dark"] .input:focus {
  box-shadow: 0 0 0 3px rgba(61, 122, 82, 0.2);
}
.input::placeholder { color: var(--text-muted); }

/* ---- Typography ---- */
.h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.h2 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
.h3 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.h4 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-gold { color: var(--gold); }
.fw-bold { font-weight: var(--fw-bold); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-medium { font-weight: var(--fw-medium); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gold { background: rgba(212, 168, 67, 0.15); color: var(--soft-gold-dark); }
[data-theme="dark"] .badge-gold { color: var(--gold-light); }
.badge-neutral { background: var(--bg-secondary); color: var(--text-secondary); }

/* ---- Skeleton Loaders ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.lg { height: 20px; }
.skeleton-text.xl { height: 28px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { padding: var(--sp-6); border-radius: var(--r-lg); }

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  max-width: 400px;
  padding: 0 var(--sp-4);
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  animation: toast-in var(--dur-slow) var(--ease-spring);
  pointer-events: auto;
  border: 1px solid var(--border);
}
.toast.removing { animation: toast-out var(--dur) var(--ease) forwards; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }
.toast-icon { font-size: var(--fs-lg); flex-shrink: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

/* ---- Animations ---- */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes bounce-in {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 67, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(212, 168, 67, 0); }
}
@keyframes tea-steam {
  0% { opacity: 0; transform: translateY(0) scaleX(1); }
  50% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-20px) scaleX(1.5); }
}
@keyframes confetti-fall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes stamp-fill {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in { animation: fade-in var(--dur-slow) var(--ease); }
.animate-fade-in-up { animation: fade-in-up var(--dur-slow) var(--ease); }
.animate-scale-in { animation: scale-in var(--dur-slow) var(--ease-spring); }
.animate-bounce-in { animation: bounce-in var(--dur-slow) var(--ease-spring); }
.animate-slide-in { animation: slide-in-right var(--dur) var(--ease); }

/* ---- Empty States ---- */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: 0.5;
}
.empty-state-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}
.empty-state-desc {
  font-size: var(--fs-sm);
}

/* ---- Loading Screen ---- */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: var(--sp-4);
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Confetti ---- */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: var(--z-modal);
  animation: confetti-fall 3s linear forwards;
  pointer-events: none;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-4);
  animation: fade-in var(--dur) var(--ease);
  /* The overlay itself scrolls when a modal is taller than the screen
     (e.g. the welcome modal on an iPhone 8). Keeps every button reachable. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: scale-in var(--dur-slow) var(--ease-spring);
  /* Center vertically when it fits; scroll from the top (no clipping) when
     it doesn't. Do NOT cap height with vh — iOS vh excludes the toolbars. */
  margin: auto;
}

/* ---- Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--sp-2);
  z-index: var(--z-nav);
  box-shadow: 0 -2px 12px rgba(42, 32, 24, 0.06);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  transition: color var(--dur) var(--ease);
  border-radius: var(--r-md);
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:hover { color: var(--text-secondary); }
.bottom-nav-icon { font-size: var(--fs-xl); }

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: var(--z-sticky);
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  transition: all var(--dur) var(--ease);
}
.theme-toggle:hover { box-shadow: var(--shadow-md); }

/* ---- Scrollbar ---- */
/* Hide the page-level scrollbar for a clean, native-app feel. Scrolling still
   works normally (touch / wheel / keyboard); only the visible bar is removed.
   Inner scrollable panels (tables, modals) keep a thin, unobtrusive bar. */
html, body { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Utility ---- */
.divider { height: 1px; background: var(--border); margin: var(--sp-6) 0; }
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin: var(--sp-6) 0;
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.spin { animation: spin 0.8s linear infinite; }
.pulse-glow { animation: pulse-glow 2s infinite; }

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .app-container { padding: var(--sp-8); }
}
@media (min-width: 1024px) {
  .app-container { padding: var(--sp-10); }
}

/* ---- Print ---- */
@media print {
  .bottom-nav, .theme-toggle, .toast-container { display: none !important; }
}

/* ============================================================
   Welcome Modal — first-time member greeting animation
   ============================================================ */
@keyframes welcome-pop {
  0%   { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes welcome-rise {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
#welcomeModal .modal.welcome-modal {
  animation: bounce-in 0.55s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1));
}
.welcome-emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: var(--sp-3);
  display: inline-block;
  transform-origin: center;
  animation: welcome-pop 0.9s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1)) both;
}
.welcome-title { animation: welcome-rise 0.5s var(--ease) 0.15s both; }
.welcome-sub   { animation: welcome-rise 0.5s var(--ease) 0.28s both; }
.welcome-dob   { animation: welcome-rise 0.5s var(--ease) 0.42s both; }

/* ============================================================
   Modal scroll-lock + small-screen fixes (iPhone 8 etc.)
   ============================================================ */
/* Lock the page behind any open modal so touch-scroll can't "leak"
   to the background. Toggled by the observer in utils.js. */
html.modal-open, body.modal-open {
  overflow: hidden;
  touch-action: none;
}

/* Date input needs to be full-width and tappable on mobile Safari,
   which otherwise renders it as a small intrinsic-width pill. */
.input[type="date"] {
  width: 100%;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}

/* Short viewports: tighten the welcome modal so the buttons sit closer
   to the fold and the whole thing scrolls comfortably. */
@media (max-height: 720px) {
  .modal { padding: var(--sp-5); }
  .welcome-emoji { font-size: 3rem; margin-bottom: var(--sp-2); }
  .welcome-dob { margin-top: var(--sp-4) !important; }
}

/* ============================================================
   Chiya Bari — Warm Glass Theme
   Ports the look of chiyabaripokhara.com onto the loyalty app:
   espresso base, turmeric-gold accents, Playfair headings, and a
   warm amber glassmorphism system with drifting ambient orbs.
   ============================================================ */

/* ---- Page background: espresso + warm radial glow (dark default) ---- */
body {
  background-color: #1A120B;
  background-image:
    radial-gradient(1100px 700px at 50% 0%, rgba(217, 164, 65, 0.10), transparent 60%),
    radial-gradient(900px 600px at 90% 100%, rgba(181, 83, 42, 0.08), transparent 55%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
[data-theme="light"] body {
  background-color: #F3E9D8;
  background-image:
    radial-gradient(1100px 700px at 50% 0%, rgba(217, 164, 65, 0.16), transparent 60%),
    radial-gradient(900px 600px at 90% 100%, rgba(181, 83, 42, 0.07), transparent 55%);
}

/* ---- Ambient drifting orbs (injected by utils.js) ---- */
#ambient-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#ambient-bg span { position: absolute; display: block; border-radius: 9999px; filter: blur(70px); opacity: 0.5; will-change: transform; }
#ambient-bg .orb-1 { width: 60vw; height: 60vw; max-width: 520px; max-height: 520px; top: -12vw; left: -14vw;
  background: radial-gradient(circle at 30% 30%, rgba(217, 164, 65, 0.50), transparent 70%); animation: orbDrift1 24s ease-in-out infinite; }
#ambient-bg .orb-2 { width: 52vw; height: 52vw; max-width: 480px; max-height: 480px; bottom: -14vw; right: -16vw;
  background: radial-gradient(circle at 50% 50%, rgba(190, 138, 48, 0.40), transparent 70%); animation: orbDrift2 30s ease-in-out infinite; }
#ambient-bg .orb-3 { width: 44vw; height: 44vw; max-width: 420px; max-height: 420px; top: 45%; left: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(181, 83, 42, 0.30), transparent 70%); animation: orbDrift3 27s ease-in-out infinite; }
[data-theme="light"] #ambient-bg span { opacity: 0.30; }
@keyframes orbDrift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(6vw,5vw) scale(1.12); } }
@keyframes orbDrift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-5vw,-4vw) scale(1.1); } }
@keyframes orbDrift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-4vw,4vw) scale(1.15); } }


/* ---- Playfair Display headings (matches the website) ---- */
.h1, .h2, .h3, .h4, .heading-font { font-family: var(--font-display); letter-spacing: -0.01em; }
.devanagari { font-family: var(--font-devanagari); }
#greeting, #cardName { font-family: var(--font-display); }

/* ---- Glass cards ---- */
.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), var(--glass-highlight);
}
.card-elevated { box-shadow: var(--shadow-lg), var(--glass-highlight); }
.card-hover:hover, .card.card-hover:hover {
  transform: translateY(-6px);
  border-color: var(--glass-border-hi);
  box-shadow: var(--shadow-lg), var(--glass-highlight);
}
[data-theme="light"] .card {
  background: var(--surface);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 1px solid var(--border);
}

/* ---- Buttons: gold primary, glass secondary ---- */
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #1A120B;
  box-shadow: 0 8px 22px -8px rgba(217, 164, 65, 0.5);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); background: linear-gradient(135deg, var(--gold-light), var(--gold)); }
.btn-secondary {
  background: var(--glass-bg-light);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--glass-border);
  color: var(--text);
  box-shadow: var(--glass-highlight);
}
.btn-secondary:hover:not(:disabled) { background: rgba(231, 196, 107, 0.14); border-color: var(--glass-border-hi); color: #E7C46B; }
[data-theme="light"] .btn-secondary { background: var(--bg-secondary); color: var(--text); border-color: var(--border-strong); }
[data-theme="light"] .btn-secondary:hover:not(:disabled) { background: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--glass-bg-light); color: var(--gold-light); }

/* ---- Inputs & selects: dark amber glass with gold focus ring ---- */
.input {
  background: rgba(20, 13, 7, 0.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border-soft);
  color: var(--text);
}
.input:focus { border-color: var(--glass-border-hi); box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.18); background: rgba(26, 18, 11, 0.66); }
[data-theme="light"] .input { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border: 1px solid var(--border-strong); }
[data-theme="light"] .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(190, 138, 48, 0.18); background: var(--surface); }
select.input {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23B6A487' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
  padding-right: 34px;
}
select.input option { background: #1F1509; color: var(--text); }
[data-theme="light"] select.input option { background: #FBF6EC; color: var(--text); }

/* ---- Modal: strong warm glass ---- */
.modal-overlay { background: rgba(10, 7, 4, 0.55); }
.modal {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-xl), var(--glass-highlight);
}
[data-theme="light"] .modal { background: var(--surface-elevated); -webkit-backdrop-filter: none; backdrop-filter: none; border: 1px solid var(--border); }

/* ---- Header chrome: glass theme toggle + glass bottom nav ---- */
.theme-toggle {
  background: var(--glass-bg-light);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--glass-border);
}
.bottom-nav {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-top: 1px solid var(--glass-border-soft);
}
[data-theme="light"] .bottom-nav { background: var(--surface); }

/* ---- Gold badge tuned for the espresso backdrop ---- */
.badge-gold { background: rgba(217, 164, 65, 0.16); color: var(--gold-light); }
[data-theme="light"] .badge-gold { background: rgba(190, 138, 48, 0.14); color: var(--soft-gold-dark); }

/* ---- Graceful fallback where backdrop-filter is unsupported ---- */
@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .card, .modal, .btn-secondary, .bottom-nav, .theme-toggle { background: var(--glass-bg-strong); }
  .input { background: rgba(20, 13, 7, 0.92); }
  [data-theme="light"] .card, [data-theme="light"] .modal,
  [data-theme="light"] .btn-secondary, [data-theme="light"] .bottom-nav,
  [data-theme="light"] .input { background: var(--surface); }
}

/* ---- Respect reduced-motion for the ambient orbs ---- */
@media (prefers-reduced-motion: reduce) {
  #ambient-bg span { animation: none !important; }
  .card-hover:hover { transition: none !important; }
}

/* ---- Smaller blur on phones for smooth scrolling (matches the site) ---- */
@media (max-width: 640px) {
  :root { --glass-blur: 12px; }
  #ambient-bg span { filter: blur(54px); }
}

/* ============================================================
   v5 additions — card animations, charts, PWA install, dropdowns
   ============================================================ */

/* ---- Live membership card (subtle, professional) ----
   1) A slow diagonal sheen that sweeps across the card.
   2) A very gentle idle float/lift.
   3) A soft animated gold glow on the top hairline.
   All kept low-amplitude so it reads premium, not gimmicky. */
#membershipCard {
  animation: cardFloat 7s ease-in-out infinite;
  will-change: transform;
}
#membershipCard::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -35%;
  width: 45%;
  height: 220%;
  background: linear-gradient(100deg,
    rgba(231, 196, 107, 0) 0%,
    rgba(231, 196, 107, 0.10) 45%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(231, 196, 107, 0.10) 55%,
    rgba(231, 196, 107, 0) 100%);
  transform: rotate(8deg);
  pointer-events: none;
  z-index: 0;
  animation: cardSheen 6.5s ease-in-out infinite;
}
#membershipCard::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  box-shadow: inset 0 1px 0 rgba(231, 196, 107, 0.14);
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(231, 196, 107, 0.12), transparent 60%);
  opacity: 0.9;
  animation: cardGlow 5s ease-in-out infinite alternate;
}
@keyframes cardSheen {
  0%   { transform: translateX(0) rotate(8deg); }
  55%  { transform: translateX(340%) rotate(8deg); }
  100% { transform: translateX(340%) rotate(8deg); }
}
@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes cardGlow {
  0%   { opacity: 0.55; }
  100% { opacity: 1; }
}
/* Gentle shimmer on the QR tile so the card never feels static */
#cardQrCanvas { transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease); }
#cardQrCanvas:hover { transform: scale(1.04); box-shadow: 0 6px 20px -6px rgba(0,0,0,0.5); }
@media (prefers-reduced-motion: reduce) {
  #membershipCard, #membershipCard::before, #membershipCard::after { animation: none !important; }
}

/* ---- Redesigned analytics charts (admin) ---- */
.cb-chart { width: 100%; }
.cb-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.cb-chart .cb-grid line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.cb-chart .cb-axis { fill: var(--text-muted); font-size: 10px; }
.cb-chart .cb-area { opacity: 0.9; }
.cb-chart .cb-line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.cb-chart .cb-dot { fill: var(--surface); stroke: var(--gold); stroke-width: 2; }
.cb-chart .cb-dot-hit { fill: transparent; cursor: pointer; }
.cb-chart .cb-bar { fill: url(#cbBarGrad); rx: 4; transition: opacity 0.2s var(--ease); }
.cb-chart .cb-bar:hover { opacity: 0.82; }
.cb-chart .cb-vlabel { fill: var(--text-secondary); font-size: 10px; font-weight: 600; }
.cb-chart-legend { display:flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-3); }
.cb-chart-legend span { display:inline-flex; align-items:center; gap:6px; font-size: var(--fs-xs); color: var(--text-muted); }
.cb-chart-legend i { width:10px; height:10px; border-radius:3px; display:inline-block; }
.cb-chart-summary { display:flex; gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.cb-chart-summary .cb-stat { display:flex; flex-direction:column; }
.cb-chart-summary .cb-stat b { font-size: var(--fs-xl); color: var(--text); font-weight: var(--fw-bold); line-height:1.1; }
.cb-chart-summary .cb-stat small { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---- "See more / See full" inline action ---- */
.link-more {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: var(--sp-3);
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  padding: 8px 14px; border-radius: var(--r-full);
  cursor: pointer; transition: all var(--dur) var(--ease);
}
.link-more:hover { border-color: var(--glass-border-hi); transform: translateY(-1px); }
[data-theme="light"] .link-more { background: rgba(190,138,48,0.10); color: var(--soft-gold-dark); }

/* ---- Forgot PIN disclosure (login) ---- */
.disclosure { margin-top: var(--sp-4); }
.disclosure summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--accent); font-weight: var(--fw-medium);
  padding: var(--sp-2);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .chev { transition: transform 0.25s var(--ease); font-size: 0.8em; }
.disclosure[open] summary .chev { transform: rotate(180deg); }
.disclosure .disclosure-body {
  margin-top: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  animation: fade-in 0.25s var(--ease);
}
[data-theme="light"] .disclosure .disclosure-body { background: rgba(190,138,48,0.08); }

/* ---- PWA install prompt (banner + modal) ---- */
.install-banner {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: linear-gradient(135deg, rgba(217,164,65,0.16), rgba(190,138,48,0.10));
  border: 1px solid var(--glass-border-hi);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-6);
}
.install-banner .ib-icon { font-size: 1.6rem; flex-shrink: 0; }
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-steps { text-align: left; margin-top: var(--sp-2); }
.install-steps li { margin: var(--sp-2) 0; font-size: var(--fs-sm); line-height: 1.5; }
.install-kbd {
  display:inline-flex; align-items:center; gap:4px;
  padding: 1px 6px; border-radius: 6px;
  background: var(--glass-bg-light); border: 1px solid var(--glass-border);
  font-weight: var(--fw-semibold);
}
