/* ═══════════════════════════════════════════════════════════════
   QR Menu Panel — Dark Theme
   Mobile-first, CSS custom properties throughout
═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f0f0f;
  --surface:     #1a1a1a;
  --surface-2:   #222222;
  --surface-3:   #2a2a2a;
  --border:      #333333;
  --accent:      #f5a623;
  --accent-dark: #c8861a;
  --accent-soft: rgba(245, 166, 35, 0.12);
  --green:       #27ae60;
  --green-soft:  rgba(39, 174, 96, 0.15);
  --red:         #e74c3c;
  --blue:        #3b82f6;
  --text-1:      #f0f0f0;
  --text-2:      #aaaaaa;
  --text-3:      #666666;
  --white:       #ffffff;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 24px;

  --cart-h: 72px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

mark.search-highlight {
  background: rgba(245, 166, 35, 0.25);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 2px;
}


/* ══════════════════════════════════════════════════════════════
   OTP MODAL (Phone verification — slides up on "Place Order")
══════════════════════════════════════════════════════════════ */
.otp-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: otpFadeIn 0.25s ease;
}

@keyframes otpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.otp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.otp-sheet {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #1E2235;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 28px 28px 0 0;
  padding: 28px 24px 44px;
  animation: otpSlideUp 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
}

@keyframes otpSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ── Brand inside sheet ──────────────────────────────────────── */
.otp-brand {
  text-align: center;
  margin-bottom: 28px;
}

.otp-brand-icon {
  font-size: 44px;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 12px rgba(245,166,35,0.25));
}

.otp-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.4px;
  margin-bottom: 5px;
}

.otp-brand-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ── Phone input row ──────────────────────────────────────────── */
.otp-name-input {
  display: block;
  flex: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  transition: border-color 0.2s, background 0.2s;
}

.otp-name-input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

.otp-phone-row {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.otp-phone-row:focus-within {
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

.otp-country-code {
  padding: 14px 12px 14px 16px;
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  border-right: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
  user-select: none;
}

.otp-field-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-size: 17px;
  font-weight: 500;
  padding: 14px 16px;
  outline: none;
  -webkit-appearance: none;
  width: 100%;
  letter-spacing: 0.5px;
}

.otp-field-input::placeholder { color: rgba(255,255,255,0.2); }

/* ── OTP code input ──────────────────────────────────────────── */
.otp-code-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 22px;
  font-weight: 700;
  padding: 14px 16px;
  outline: none;
  width: 100%;
  margin-bottom: 10px;
  text-align: center;
  letter-spacing: 8px;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
}

.otp-code-input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

.otp-code-input::placeholder {
  color: rgba(255,255,255,0.2);
  letter-spacing: 2px;
  font-size: 14px;
}

/* ── Code step subtitle ──────────────────────────────────────── */
.otp-code-subtitle {
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 16px;
}

/* ── Error message ───────────────────────────────────────────── */
.otp-error {
  font-size: 12px;
  color: #f87171;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
  line-height: 1.4;
}

/* ── Primary action button ────────────────────────────────────── */
.otp-btn-primary {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--r-md);
  padding: 15px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
  margin-top: 4px;
}

.otp-btn-primary:hover   { background: var(--accent-dark); }
.otp-btn-primary:active  { transform: scale(0.98); }
.otp-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Secondary link button ────────────────────────────────────── */
.otp-btn-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  cursor: pointer;
  padding: 12px;
  text-align: center;
  transition: color 0.15s;
}

.otp-btn-link:hover { color: rgba(255,255,255,0.7); }

/* ── Hint text ───────────────────────────────────────────────── */
.otp-hint {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  margin-top: 12px;
  line-height: 1.5;
}

/* ── Wide screens: center-modal instead of bottom sheet ─────── */
@media (min-width: 600px) {
  .otp-modal { align-items: center; padding: 24px; }
  .otp-sheet { border-radius: 28px; max-width: 420px; padding: 36px 32px 48px; }
}


/* ══════════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: 600px;
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon { font-size: 22px; }

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-1);
}

.table-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-chip {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-history {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.btn-history:hover { border-color: var(--accent); color: var(--accent); }

/* Logout icon button */
.btn-icon-sm {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-3);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.btn-icon-sm:hover { border-color: var(--red); color: var(--red); }


/* ══════════════════════════════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════════════════════════════ */
.search-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  position: sticky;
  top: 57px;
  z-index: 35;
}

.search-inner {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 13px;
  color: var(--text-3);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-1);
  font-size: 15px;
  padding: 9px 40px 9px 40px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
  border-color: var(--accent);
  background: var(--surface-2);
}

.search-clear {
  position: absolute;
  right: 10px;
  background: var(--surface-2);
  border: none;
  color: var(--text-2);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.search-clear:hover { background: var(--border); color: var(--text-1); }

.menu-empty-msg {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.6;
}


/* ══════════════════════════════════════════════════════════════
   CATEGORY NAV
══════════════════════════════════════════════════════════════ */
.category-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 104px;
  z-index: 30;
}

.category-scroll {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 600px;
  margin: 0 auto;
}
.category-scroll::-webkit-scrollbar { display: none; }

.cat-btn {
  flex-shrink: 0;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}


/* ══════════════════════════════════════════════════════════════
   ACTIVE ORDERS SECTION
══════════════════════════════════════════════════════════════ */
.active-orders-section {
  margin-bottom: 20px;
  animation: fadeSlideIn 0.35s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.aos-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
}

.aos-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.aos-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: aosGlow 1.8s ease-in-out infinite;
}

@keyframes aosGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(39,174,96,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(39,174,96,0); }
}

/* ── Order card ───────────────────────────────────────────── */
.aos-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color 0.3s;
}

.aos-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.aos-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aos-table-tag {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

.aos-item-count {
  font-size: 12px;
  color: var(--text-3);
}

.aos-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
}

/* ── Status rows ──────────────────────────────────────────── */
.aos-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.aos-pending {
  background: rgba(245,166,35,0.07);
  border: 1px solid rgba(245,166,35,0.2);
  color: var(--accent);
}

.aos-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.aos-dot-pend {
  background: var(--accent);
  animation: pendPulse 1.6s ease-in-out infinite;
}

@keyframes pendPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.aos-status-label { font-weight: 700; }

.aos-status-sub {
  font-size: 12px;
  color: var(--accent);
  opacity: 0.65;
  font-weight: 400;
}

.aos-preparing {
  background: rgba(39,174,96,0.08);
  border: 1px solid rgba(39,174,96,0.25);
  color: var(--green);
}

.aos-dot-prep {
  background: var(--green);
  animation: prepPulse 1.2s ease-in-out infinite;
}

@keyframes prepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(39,174,96,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(39,174,96,0); }
}

.aos-timer {
  font-size: 13px;
  font-weight: 500;
  color: var(--green);
  opacity: 0.8;
}

/* ── Items list ───────────────────────────────────────────── */
.aos-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aos-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aos-item-name {
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.aos-item-qty {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════════ */
.main-content {
  padding: 16px 16px calc(var(--cart-h) + 24px);
  max-width: 600px;
  margin: 0 auto;
}


/* ══════════════════════════════════════════════════════════════
   MENU GRID & CARDS
══════════════════════════════════════════════════════════════ */
.menu-grid { display: flex; flex-direction: column; gap: 2px; }

.menu-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.menu-empty span { font-size: 36px; }

.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 14px 14px 16px;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 10px;
}

.menu-card:hover { border-color: var(--surface-3); background: var(--surface-2); }
.menu-card.in-cart { border-color: var(--accent); }

.card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-img {
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-3);
}

.card-info { flex: 1; min-width: 0; }

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.card-category {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pizza / variant size chips */
.size-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.size-chip {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.card-action { flex-shrink: 0; }

/* ── Add / Qty buttons ─────────────────────────────────────── */
.btn-add {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--r-md);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-add:active { transform: scale(0.95); }
.btn-add:hover  { background: var(--accent-dark); }

.qty-control {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  overflow: hidden;
}

.qty-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  width: 34px;
  height: 36px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.qty-btn:hover  { background: var(--accent-soft); }
.qty-btn:active { background: var(--accent); color: #000; }

.qty-display {
  min-width: 28px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  user-select: none;
}


/* ══════════════════════════════════════════════════════════════
   LOADING SKELETONS
══════════════════════════════════════════════════════════════ */
.loading-state {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ══════════════════════════════════════════════════════════════
   ERROR STATE
══════════════════════════════════════════════════════════════ */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 24px;
  text-align: center;
}

.error-icon { font-size: 40px; }

.error-text {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.6;
}

.btn-retry {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-retry:hover { background: var(--accent-dark); }


/* ══════════════════════════════════════════════════════════════
   CART BAR
══════════════════════════════════════════════════════════════ */
.cart-bar {
  position: fixed;
  bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 600px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); }
  to   { transform: translateX(-50%) translateY(0); }
}

.cart-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cart-count {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-count-badge {
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.cart-count-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.cart-total {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
}

.btn-place-order {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--r-md);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
}
.btn-place-order:hover  { background: var(--accent-dark); }
.btn-place-order:active { transform: scale(0.97); }
.btn-place-order:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}


/* ══════════════════════════════════════════════════════════════
   OVERLAYS (Success / Error)
══════════════════════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 28px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.overlay-icon {
  font-size: 48px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-weight: 800;
}

.success-icon {
  background: rgba(39,174,96,0.15);
  color: var(--green);
  font-size: 36px;
  border: 2px solid var(--green);
}

.overlay-card.error-card { border-color: var(--red); }

.error-icon-lg {
  background: rgba(231,76,60,0.15);
  color: var(--red);
  font-size: 28px;
  border: 2px solid var(--red);
}

.overlay-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 10px;
}

.overlay-msg {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 24px;
}

.btn-overlay-close {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--r-md);
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-overlay-close:hover { background: var(--accent-dark); }


/* ══════════════════════════════════════════════════════════════
   HISTORY DRAWER
══════════════════════════════════════════════════════════════ */
.history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.history-panel {
  position: fixed;
  bottom: 0;
  z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  animation: slideUpDrawer 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 600px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}

@keyframes slideUpDrawer {
  from { transform: translateX(-50%) translateY(100%); }
  to   { transform: translateX(-50%) translateY(0); }
}

.history-drag-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
}

.history-close-btn {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.history-close-btn:hover { background: var(--surface-2); color: var(--text-1); }

.history-list {
  overflow-y: auto;
  flex: 1;
  padding: 12px 16px 24px;
  overscroll-behavior: contain;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.history-empty-icon { font-size: 40px; }

.history-empty p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.history-order {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 10px;
}

.history-order-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.history-order-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-order-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}

.history-table-tag {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.history-order-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.history-date {
  font-size: 11px;
  color: var(--text-3);
}

.history-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.history-items {
  list-style: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.history-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.history-item-name {
  color: var(--text-2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.history-item-detail {
  color: var(--text-1);
  font-weight: 600;
  flex-shrink: 0;
  font-size: 12px;
}

.history-order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-footer-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-status-badge {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(39,174,96,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
}

.history-completed-time {
  font-size: 11px;
  color: var(--text-3);
}

.history-total {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — larger screens
══════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  .menu-grid { gap: 0; }
  .history-panel { bottom: 24px; border-radius: 20px; }
}

/* ── Safe-area insets (notched phones) ──────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .cart-bar    { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .history-list { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .otp-sheet   { padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
}
