/* ===== DESIGN TOKENS ===== */
:root {
  --primary: #b61722;
  --primary-dark: #930013;
  --primary-container: #da3437;
  --on-primary: #ffffff;
  --secondary: #855300;
  --secondary-container: #fea619;
  --on-secondary: #ffffff;
  --tertiary: #994100;
  --tertiary-container: #c05400;
  --surface: #fbf8fc;
  --surface-low: #f5f3f6;
  --surface-container: #f0edf1;
  --surface-high: #eae7eb;
  --surface-highest: #e4e1e5;
  --on-surface: #1b1b1e;
  --on-surface-variant: #5b403e;
  --outline: #8f6f6d;
  --outline-variant: #e4beba;
  --error: #ba1a1a;
  --success: #3a7d44;
  --shadow-primary: rgba(182,23,34,0.12);
  --shadow-neutral: rgba(27,27,30,0.10);

  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --navbar-h: 60px;
  --sticky-h: 84px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
  padding-top: var(--navbar-h);
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: var(--font); }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--navbar-h);
  background: rgba(251,248,252,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline-variant);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-md);
}
.navbar-brand {
  display: flex; align-items: center; gap: var(--space-sm);
  font-weight: 700; font-size: 18px; color: var(--on-surface);
}
.brand-icon { font-size: 22px; }
.navbar-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* ===== CONTAINER ===== */
.container {
  max-width: 580px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}
.container--wide { max-width: 820px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius);
  font-size: 16px; font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  cursor: pointer; border: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 4px 16px var(--shadow-primary);
}
.btn--primary:hover { background: var(--primary-dark); box-shadow: 0 6px 20px var(--shadow-primary); }
.btn--secondary {
  background: var(--surface-high);
  color: var(--on-surface);
}
.btn--secondary:hover { background: var(--surface-highest); }
.btn--ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--outline-variant);
}
.btn--ghost:hover { background: rgba(182,23,34,0.06); }
.btn--whatsapp {
  background: #25D366;
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,211,102,0.25);
  font-size: 17px;
}
.btn--whatsapp:hover { background: #1ebe5d; }
.btn--full { width: 100%; }
.btn--pill { border-radius: var(--radius-full); }
.btn--sm { min-height: 36px; padding: 0 var(--space-md); font-size: 14px; }
.btn--icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--radius-full);
  min-height: unset;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 8px var(--shadow-primary), 0 1px 3px rgba(0,0,0,0.04);
  padding: var(--space-md);
  transition: box-shadow 0.2s;
}
.card--flat { box-shadow: none; border: 1px solid var(--outline-variant); }

/* ===== FORM ELEMENTS ===== */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.form-label {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--on-surface-variant);
}
.form-input, .form-textarea {
  background: var(--surface-low);
  border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  font-size: 16px; color: var(--on-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 48px; width: 100%;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(182,23,34,0.12);
  background: #fff;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--outline); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-hint { font-size: 13px; color: var(--on-surface-variant); }

/* Phone prefix row */
.phone-row { display: flex; gap: var(--space-sm); }
.phone-prefix {
  background: var(--surface-high);
  border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 0 var(--space-md);
  min-height: 48px; font-size: 16px; font-weight: 600;
  color: var(--on-surface);
  width: 80px; flex-shrink: 0;
}
.phone-prefix:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(182,23,34,0.12);
}
.phone-input-wrap { flex: 1; }

/* ===== STICKY BAR ===== */
.sticky-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--outline-variant);
  box-shadow: 0 -4px 20px var(--shadow-neutral);
  padding: var(--space-sm) var(--space-md);
  min-height: var(--sticky-h);
  display: flex; align-items: center;
}
.sticky-bar.hidden { display: none; }
.sticky-inner {
  max-width: 580px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
}
.sticky-summary { display: flex; flex-direction: column; gap: 2px; }
.sticky-label { font-size: 13px; color: var(--on-surface-variant); font-weight: 500; }
.sticky-amount { font-size: 18px; font-weight: 700; color: var(--primary); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: calc(var(--sticky-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--on-surface); color: #fff;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 500;
  z-index: 200; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
}
.toast.hidden { display: none; }

/* ===== BADGE / CHIP ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em;
}
.badge--promo {
  background: var(--secondary-container);
  color: var(--secondary);
}
.badge--open {
  background: rgba(58,125,68,0.15);
  color: var(--success);
}
.badge--time {
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--outline-variant); margin: var(--space-md) 0; }

/* ===== PAGE: HOME / LANDING ===== */
.home-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-lg);
  color: #fff; text-align: center;
  margin-bottom: var(--space-xl);
}
.home-hero h1 { font-size: 32px; font-weight: 800; line-height: 1.2; margin-bottom: var(--space-sm); }
.home-hero p { font-size: 16px; opacity: 0.9; margin-bottom: var(--space-xl); line-height: 1.6; }
.home-steps {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md); margin-bottom: var(--space-xl);
}
.home-step {
  text-align: center; padding: var(--space-md);
  background: var(--surface-low); border-radius: var(--radius-lg);
}
.step-icon { font-size: 32px; margin-bottom: var(--space-sm); }
.step-title { font-size: 14px; font-weight: 700; color: var(--on-surface); }
.step-desc { font-size: 13px; color: var(--on-surface-variant); margin-top: 4px; line-height: 1.4; }

/* ===== PAGE: CREATOR ===== */
.creator-header { text-align: center; margin-bottom: var(--space-xl); }
.creator-header h1 { font-size: 28px; font-weight: 800; margin-bottom: var(--space-xs); }
.creator-header p { color: var(--on-surface-variant); }

.section-card { background: #fff; border-radius: var(--radius-lg); padding: var(--space-lg); margin-bottom: var(--space-md); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: var(--space-md); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-md); }

/* Dish item in creator */
.dish-item {
  display: flex; align-items: flex-start; gap: var(--space-sm);
  background: var(--surface-low); border-radius: var(--radius-md);
  padding: var(--space-md); margin-bottom: var(--space-sm);
  position: relative; border: 1px solid var(--outline-variant);
  transition: border-color 0.2s;
}
.dish-item:hover { border-color: var(--primary); }
.dish-emoji-btn {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  background: var(--surface-container); border: 1.5px dashed var(--outline-variant);
  font-size: 28px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.dish-emoji-btn:hover { background: var(--surface-high); }
.dish-fields { flex: 1; display: flex; flex-direction: column; gap: var(--space-sm); }
.dish-name-input { font-size: 16px; font-weight: 600; }
.price-row { display: flex; align-items: center; gap: var(--space-sm); }
.price-symbol { color: var(--on-surface-variant); font-weight: 600; }
.price-input { width: 100px; font-weight: 600; color: var(--primary); }
.dish-remove {
  position: absolute; top: var(--space-sm); right: var(--space-sm);
  width: 28px; height: 28px; border-radius: var(--radius-full);
  background: transparent; color: var(--outline);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.dish-remove:hover { background: rgba(186,26,26,0.1); color: var(--error); }

/* Emoji picker dropdown */
.emoji-picker-wrap { position: relative; }
.emoji-picker-popup {
  position: absolute; top: 64px; left: 0; z-index: 50;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  padding: var(--space-md);
  display: grid; grid-template-columns: repeat(6,1fr); gap: 4px;
  width: 220px;
}
.emoji-picker-popup button {
  width: 32px; height: 32px; font-size: 20px;
  border-radius: var(--radius-sm); background: transparent;
  transition: background 0.1s;
}
.emoji-picker-popup button:hover { background: var(--surface-container); }

/* Generated link box */
.link-box {
  background: var(--surface-low); border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius); padding: var(--space-md);
  display: flex; align-items: center; gap: var(--space-sm);
  word-break: break-all;
}
.link-box span { flex: 1; font-size: 14px; color: var(--primary); font-weight: 500; }

/* ===== PAGE: MENU VIEW ===== */
.menu-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  color: #fff; margin-bottom: var(--space-lg);
}
.menu-hero h1 { font-size: 28px; font-weight: 800; line-height: 1.2; margin-bottom: 4px; }
.menu-hero .tagline { font-size: 15px; opacity: 0.88; margin-bottom: var(--space-md); }
.menu-hero-badges { display: flex; gap: var(--space-sm); flex-wrap: wrap; }

.menu-section-title {
  font-size: 22px; font-weight: 800;
  margin-bottom: var(--space-md); color: var(--on-surface);
}

/* Promo card (featured wide) */
.promo-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 4px 8px var(--shadow-primary);
  padding: var(--space-md); position: relative;
  display: flex; align-items: center; gap: var(--space-md);
  margin-bottom: var(--space-lg); overflow: hidden;
}
.promo-badge {
  position: absolute; top: var(--space-sm); right: var(--space-sm);
  background: var(--secondary-container); color: var(--secondary);
  font-size: 11px; font-weight: 800; padding: 2px 8px;
  border-radius: var(--radius-full); letter-spacing: 0.04em;
}
.promo-emoji { font-size: 52px; line-height: 1; flex-shrink: 0; }
.promo-info { flex: 1; }
.promo-name { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.promo-desc { font-size: 13px; color: var(--on-surface-variant); margin-bottom: var(--space-sm); line-height: 1.4; }
.promo-price { font-size: 18px; font-weight: 800; color: var(--primary); }

/* Menu grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
@media (max-width: 400px) { .menu-grid { grid-template-columns: 1fr; } }

.menu-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 4px 8px var(--shadow-primary), 0 1px 2px rgba(0,0,0,0.04);
  padding: var(--space-md);
  display: flex; flex-direction: column; gap: var(--space-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.menu-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--shadow-primary); }
.menu-card-top { display: flex; align-items: flex-start; gap: var(--space-sm); }
.menu-card-emoji {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--surface-container); display: flex; align-items: center;
  justify-content: center; font-size: 26px; flex-shrink: 0;
}
.menu-card-name { font-size: 15px; font-weight: 700; line-height: 1.3; }
.menu-card-footer { display: flex; align-items: center; justify-content: space-between; }
.menu-card-price { font-size: 16px; font-weight: 800; color: var(--primary); }
.add-btn {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--primary); color: #fff;
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px var(--shadow-primary);
  transition: transform 0.15s, background 0.15s;
}
.add-btn:hover { transform: scale(1.1); background: var(--primary-dark); }
.add-btn:active { transform: scale(0.95); }
.qty-controls {
  display: flex; align-items: center; gap: 6px;
}
.qty-btn {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  font-size: 18px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-container); color: var(--on-surface);
  transition: background 0.15s;
}
.qty-btn:hover { background: var(--surface-high); }
.qty-num { font-size: 15px; font-weight: 700; min-width: 20px; text-align: center; }

/* ===== PAGE: CHECKOUT ===== */
.checkout-header { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-lg); }
.back-btn {
  background: transparent; padding: 0;
  font-size: 22px; color: var(--on-surface);
  min-height: unset;
}
.checkout-title { font-size: 24px; font-weight: 800; }

.order-summary-card { background: #fff; border-radius: var(--radius-lg); box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; margin-bottom: var(--space-md); }
.order-summary-head {
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-low);
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--on-surface-variant); text-transform: uppercase;
  display: flex; align-items: center; gap: var(--space-sm);
}
.order-item {
  padding: var(--space-md);
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-md);
  border-bottom: 1px solid var(--outline-variant);
}
.order-item:last-of-type { border-bottom: none; }
.order-item-left { display: flex; align-items: center; gap: var(--space-sm); }
.order-qty-badge {
  background: rgba(182,23,34,0.12); color: var(--primary);
  border-radius: var(--radius-full); padding: 2px 8px;
  font-size: 12px; font-weight: 800;
}
.order-item-name { font-size: 15px; font-weight: 600; }
.order-item-price { font-size: 15px; font-weight: 700; }
.order-totals { padding: var(--space-md); }
.order-row { display: flex; justify-content: space-between; font-size: 15px; color: var(--on-surface-variant); margin-bottom: var(--space-sm); }
.order-total-row { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; color: var(--on-surface); }
.total-amount { color: var(--primary); }

/* Customer name card */
.customer-card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: var(--space-lg); margin-bottom: var(--space-md);
}
.customer-card-header { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-md); }
.customer-card-icon { font-size: 24px; }
.customer-card-title { font-size: 17px; font-weight: 700; }

/* Checkout sticky */
.checkout-sticky {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
}
.checkout-sticky .wa-hint {
  text-align: center; font-size: 12px; color: var(--on-surface-variant);
  display: flex; align-items: center; justify-content: center; gap: 4px;
}

/* ===== SHARE LINK PAGE ===== */
.share-page { text-align: center; padding: var(--space-2xl) var(--space-md); }
.share-icon { font-size: 64px; margin-bottom: var(--space-md); }
.share-page h2 { font-size: 24px; font-weight: 800; margin-bottom: var(--space-sm); }
.share-page p { color: var(--on-surface-variant); margin-bottom: var(--space-lg); }

/* ===== EMPTY / ERROR STATES ===== */
.empty-state { text-align: center; padding: var(--space-2xl) var(--space-md); }
.empty-icon { font-size: 56px; margin-bottom: var(--space-md); }
.empty-title { font-size: 20px; font-weight: 700; margin-bottom: var(--space-sm); }
.empty-desc { color: var(--on-surface-variant); margin-bottom: var(--space-lg); }

/* ===== CREATOR BOTTOM CTA ===== */
.creator-cta {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(16px);
  border-top: 1px solid var(--outline-variant);
  padding: var(--space-md);
  z-index: 90;
}
.creator-cta-inner { max-width: 580px; margin: 0 auto; }

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeSlideUp 0.35s ease both; }

@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.pop { animation: pop 0.25s ease; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast { animation: toastIn 0.25s ease both; }

/* ===== RESPONSIVE ===== */
@media (min-width: 640px) {
  .home-steps { grid-template-columns: repeat(3,1fr); }
  .creator-header h1 { font-size: 32px; }
}
@media (max-width: 480px) {
  .home-steps { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: 1fr; }
  .promo-emoji { font-size: 40px; }
}

/* Body padding for sticky creator CTA */
body.has-creator-cta { padding-bottom: calc(var(--sticky-h) + 8px); }
body.has-sticky { padding-bottom: var(--sticky-h); }
