/* css/style.css — Table Order customer app
   ================================================================
   Design notes:
   - Warm neutral background, not the cream+terracotta combo — this
     restaurant's own primary/accent colors (set in admin settings)
     carry the brand identity, so the base palette stays quiet.
   - System font stack only, deliberately. Restaurant WiFi/mobile data
     is often slow — a webfont means a flash of unstyled text on every
     first load, which matters more here than on a dashboard.
   - Signature: the Table N pill stays visible in the header across
     every screen. It's the one piece of context ("who am I, where
     am I") that must never get lost in a shared-device ordering flow.
   ================================================================ */

:root {
  --primary: #2C5AA0;
  --accent: #2F8F5B;
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --border: #EDE9E3;
  --text: #1C1917;
  --text-muted: #78716C;
  --danger: #DC2626;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--text-muted); }

/* ---------------- Header ---------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.header-name { font-weight: 800; font-size: 1.02rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-pill {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ---------------- Screen shell (login/otp flow) ---------------- */

.screen-wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 1.5rem;
}

.screen { width: 100%; }
.screen-wide { max-width: none; padding: 1rem; margin: 0; }

h1 { font-size: 1.4rem; font-weight: 800; margin: 0 0 0.5rem; letter-spacing: -0.01em; }

/* ---------------- Start / brand block ---------------- */

.brand-block { text-align: center; margin: 2rem 0 2rem; }

.brand-logo { width: 68px; height: 68px; border-radius: var(--radius); object-fit: cover; margin: 0 auto 1rem; display: block; }

.start-actions { display: flex; flex-direction: column; gap: 0.75rem; }

/* ---------------- Buttons ---------------- */

button.big { width: 100%; padding: 0.9rem; font-size: 1rem; border-radius: var(--radius); font-weight: 700; cursor: pointer; border: none; }
button.primary { background: var(--primary); color: white; }
button.primary:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 0.65rem 1rem; font-weight: 700; cursor: pointer; }

button.link-btn, .link-btn {
  background: none; border: none; color: var(--primary); font-size: 0.9rem;
  font-weight: 700; cursor: pointer; padding: 0.75rem 0; text-decoration: underline;
  display: block; width: 100%; text-align: center;
}

.back-btn {
  background: none; border: none; color: var(--text-muted); font-size: 0.9rem;
  cursor: pointer; padding: 0.4rem 0; margin-bottom: 1rem; font-weight: 600;
}

/* ---------------- Forms (phone / otp) ---------------- */

#phone-form, #otp-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.25rem; }

#phone-input, #otp-input {
  padding: 0.9rem; font-size: 1.1rem; border: 1.5px solid var(--border);
  border-radius: var(--radius); text-align: center; letter-spacing: 0.05em;
  background: var(--surface);
}
#phone-input:focus, #otp-input:focus { outline: none; border-color: var(--primary); }
#otp-input { letter-spacing: 0.4em; font-size: 1.4rem; }

.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 0.85rem; text-align: center; }

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: white; padding: 0.65rem 1.1rem; border-radius: 999px;
  font-size: 0.85rem; z-index: 200; box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.toast.error { background: var(--danger); }

/* ================================================================
   Menu screen
   ================================================================ */

.category-chip-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.9rem 0;
  position: sticky;
  top: 61px;
  background: var(--bg);
  z-index: 40;
  scrollbar-width: none;
}
.category-chip-bar::-webkit-scrollbar { display: none; }

.category-chip {
  flex-shrink: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.category-chip.active { background: var(--accent); border-color: var(--accent); color: white; }

.menu-list { padding-bottom: 6rem; }

.menu-category-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 1.25rem 0 0.75rem;
  scroll-margin-top: 120px;
}

.menu-item-grid { display: flex; flex-direction: column; gap: 0.7rem; }

.menu-item-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.menu-item-thumb { width: 60px; height: 60px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.menu-item-thumb-empty { display: flex; align-items: center; justify-content: center; background: #F3F1EC; font-size: 1.4rem; }

.menu-item-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.menu-item-name { font-weight: 700; font-size: 0.95rem; }
.menu-item-desc { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item-price { font-weight: 700; color: var(--primary); font-size: 0.88rem; font-variant-numeric: tabular-nums; }

.menu-item-add {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}

/* ---------------- Floating cart bar ---------------- */

.floating-cart-bar {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 448px;
  margin: 0 auto;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 60;
  font-family: inherit;
}
.floating-cart-bar span { font-weight: 700; font-size: 0.9rem; }
.floating-cart-cta { margin-left: auto; text-decoration: underline; }

/* ================================================================
   Item detail sheet
   ================================================================ */

.sheet-overlay {
  position: fixed; inset: 0; background: rgba(28,25,23,0.5);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}

.sheet-card {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 1.25rem;
  position: relative;
  animation: sheet-up 0.2s ease-out;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-close {
  position: absolute; top: 0.9rem; right: 1rem; background: #F3F1EC; border: none;
  width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; line-height: 1;
  color: var(--text-muted); cursor: pointer;
}

.sheet-image { width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius); margin-bottom: 0.9rem; }
.sheet-title { font-size: 1.2rem; margin: 0 0 0.3rem; padding-right: 2.5rem; }
.sheet-desc { margin: 0 0 0.5rem; font-size: 0.88rem; }
.sheet-base-price { font-weight: 800; color: var(--primary); font-size: 1.05rem; margin: 0 0 1.1rem; }

.modifier-group-block { margin-bottom: 1.1rem; }
.modifier-group-label { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; }
.required-tag { color: var(--danger); font-size: 0.72rem; font-weight: 700; margin-left: 0.3rem; }

.modifier-options { display: flex; flex-direction: column; gap: 0.5rem; }
.modifier-option {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.88rem; cursor: pointer;
}
.modifier-option input { accent-color: var(--primary); width: 17px; height: 17px; }
.modifier-option-price { margin-left: auto; color: var(--text-muted); font-size: 0.82rem; }

.sheet-field { margin-bottom: 1.1rem; }
.sheet-field label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.4rem; }
.sheet-field textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.88rem; resize: vertical;
}

.sheet-qty-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; font-weight: 700; font-size: 0.9rem; }

.qty-stepper { display: flex; align-items: center; gap: 0.9rem; }
.qty-stepper button {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface); font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.qty-stepper span { min-width: 1.2rem; text-align: center; font-weight: 700; }

/* ================================================================
   Cart screen
   ================================================================ */

.cart-line {
  display: flex; align-items: center; gap: 0.75rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem; margin-bottom: 0.7rem;
}
.cart-line-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.cart-line-name { font-weight: 700; font-size: 0.92rem; }
.cart-line-modifiers, .cart-line-notes { font-size: 0.78rem; color: var(--text-muted); }
.cart-line-price { font-weight: 700; color: var(--primary); font-size: 0.85rem; margin-top: 0.15rem; }
.cart-line-remove {
  background: none; border: none; color: var(--text-muted); font-size: 1.3rem;
  cursor: pointer; line-height: 1; padding: 0.2rem;
}

.cart-summary-row { display: flex; justify-content: space-between; font-size: 0.95rem; padding: 0.4rem 0; }
.cart-summary-note { font-size: 0.78rem; margin: 0.3rem 0 1.2rem; }

/* ================================================================
   Order tracking
   ================================================================ */

.tracking-stepper { display: flex; justify-content: space-between; margin: 1.5rem 0; }
.stepper-step { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; flex: 1; position: relative; }
.stepper-step:not(:last-child)::after {
  content: ""; position: absolute; top: 8px; left: 55%; width: 90%; height: 2px; background: var(--border); z-index: 0;
}
.stepper-done:not(:last-child)::after { background: var(--accent); }

.stepper-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--border); z-index: 1; }
.stepper-done .stepper-dot { background: var(--accent); }
.stepper-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-align: center; }
.stepper-done .stepper-label { color: var(--text); }

.tracking-items-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; }
.tracking-item-row { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 0.3rem 0; }
.tracking-item-modifiers { font-size: 0.78rem; margin: -0.15rem 0 0.4rem; }

.tracking-actions { display: flex; gap: 0.6rem; margin: 1.25rem 0 0.5rem; }
.tracking-actions button { flex: 1; }