/* =============================================================
   TIFFIN — Customer App
   Design tokens: warm paper base, saffron brand accent, curry-leaf
   green for success/veg, chili red for alerts. Fraunces for display
   type (menu-card personality), Inter for UI/body text.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink:        #1C1B19;
  --ink-soft:    #6B6660;
  --paper:      #FFFFFF;
  --surface:    #F4F0E8;
  --surface-2:  #EAE3D4;
  --line:       #E4DFD3;
  --brand:      #E8631A;
  --brand-dark: #C24E0E;
  --brand-tint: #FCE7D8;
  --green:      #2F5233;
  --green-tint: #E4EEE1;
  --chili:      #C81E3A;
  --chili-tint: #FBE6E9;
  --gold:       #C89B3C;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow: 0 1px 2px rgba(28,27,25,.06), 0 8px 24px -12px rgba(28,27,25,.18);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- App shell ---------- */
#app { max-width: 480px; margin: 0 auto; min-height: 100%; background: var(--paper); position: relative; padding-bottom: 76px; }
@media (min-width: 720px) { #app { max-width: 600px; box-shadow: var(--shadow); } }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
}
.topbar h1 { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 0; flex: 1; letter-spacing: -.2px; }
.icon-btn {
  border: none; background: var(--surface); width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); position: relative;
}
.icon-btn:active { background: var(--surface-2); }
.badge {
  position: absolute; top: -4px; right: -4px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.screen { padding: 18px; animation: fadeIn .18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--paper); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 20;
}
@media (min-width: 720px) { .bottom-nav { max-width: 600px; } }
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px; color: var(--ink-soft); font-size: 11.5px; font-weight: 600;
}
.bottom-nav a.active { color: var(--brand); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ---------- Search ---------- */
.search-box {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border-radius: var(--radius-m); padding: 12px 14px; margin-bottom: 16px;
}
.search-box input { flex: 1; border: none; background: transparent; color: var(--ink); }
.search-box input:focus { outline: none; }

/* ---------- Restaurant card ---------- */
.rest-card { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.rest-card:last-child { border-bottom: none; }
.rest-card img { width: 92px; height: 92px; border-radius: var(--radius-m); object-fit: cover; background: var(--surface); }
.rest-card .info { flex: 1; min-width: 0; }
.rest-card h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.rest-card p.meta { margin: 0 0 6px; font-size: 13px; color: var(--ink-soft); }
.rating-pill {
  display: inline-flex; align-items: center; gap: 4px; background: var(--green-tint); color: var(--green);
  font-size: 12.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.closed-pill { background: var(--chili-tint); color: var(--chili); }

.section-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink-soft); margin: 22px 0 10px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; }
.chip {
  white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: var(--surface);
  font-size: 13px; font-weight: 600; border: 1px solid transparent; cursor: pointer;
}
.chip.active { background: var(--brand); color: #fff; }

/* ---------- Restaurant detail / menu ---------- */
.rest-hero { position: relative; margin: -18px -18px 14px; }
.rest-hero img { width: 100%; height: 190px; object-fit: cover; }
.rest-hero .back-btn {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px;
  background: rgba(255,255,255,.92); border-radius: 50%; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
}
.rest-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.rest-sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 14px; }

.menu-cat-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.menu-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.veg-dot { width: 13px; height: 13px; border: 1.5px solid var(--green); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.veg-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.veg-dot.nonveg { border-color: var(--chili); }
.veg-dot.nonveg::after { background: var(--chili); }
.menu-item .mi-info { flex: 1; min-width: 0; }
.menu-item h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.menu-item .price { font-size: 14px; color: var(--ink-soft); margin: 0 0 4px; }
.menu-item .desc { font-size: 12.5px; color: var(--ink-soft); margin: 0; }
.menu-item img { width: 78px; height: 78px; border-radius: var(--radius-s); object-fit: cover; background: var(--surface); flex-shrink: 0; }

.qty-stepper { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--brand); border-radius: 999px; padding: 4px 6px; }
.qty-stepper button { width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; font-size: 15px; cursor: pointer; }
.add-btn { border: 1px solid var(--brand); color: var(--brand); background: var(--paper); font-weight: 700; font-size: 13px; border-radius: 999px; padding: 7px 18px; cursor: pointer; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: var(--radius-m); border: none;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
}
.btn:active { background: var(--brand-dark); }
.btn.secondary { background: var(--surface); color: var(--ink); }
.btn.outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--chili); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-s); border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); outline: none; }
.field textarea { resize: vertical; min-height: 70px; }

/* ---------- Cart / checkout ---------- */
.cart-line { display: flex; justify-content: space-between; padding: 10px 0; font-size: 14.5px; }
.cart-line.total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.cart-line span:last-child { color: var(--ink-soft); }
.cart-line.total span:last-child { color: var(--ink); }
.floating-bar {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); width: calc(100% - 36px); max-width: 444px;
  background: var(--green); color: #fff; border-radius: var(--radius-m); padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); z-index: 25; cursor: pointer;
}
@media (min-width: 720px) { .floating-bar { max-width: 564px; } }

.addr-card { border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 14px; margin-bottom: 10px; cursor: pointer; }
.addr-card.selected { border-color: var(--brand); background: var(--brand-tint); }
.addr-card strong { display: block; margin-bottom: 3px; }
.addr-card p { margin: 0; font-size: 13px; color: var(--ink-soft); }

/* ---------- Order tracking ---------- */
.status-track { list-style: none; margin: 20px 0; padding: 0; }
.status-track li { display: flex; gap: 12px; padding-bottom: 22px; position: relative; }
.status-track li::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex-shrink: 0; margin-top: 3px;
}
.status-track li::after {
  content: ''; position: absolute; left: 5px; top: 18px; bottom: 0; width: 2px; background: var(--line);
}
.status-track li:last-child::after { display: none; }
.status-track li.done::before { background: var(--green); }
.status-track li.done::after { background: var(--green); }
.status-track li.current::before { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.status-track .st-label { font-weight: 600; font-size: 14.5px; }
.status-track .st-time { font-size: 12px; color: var(--ink-soft); }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: 14px; opacity: .5; }
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 11px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600; z-index: 60; box-shadow: var(--shadow);
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px);} to { opacity: 1; transform: translate(-50%, 0);} }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-s); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.order-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; margin-bottom: 12px; cursor: pointer; }
.order-card .row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.status-tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface); color: var(--ink-soft); }
.status-tag.live { background: var(--brand-tint); color: var(--brand-dark); }
.status-tag.done { background: var(--green-tint); color: var(--green); }
.status-tag.bad { background: var(--chili-tint); color: var(--chili); }
.link-btn { background: none; border: none; color: var(--brand); font-weight: 700; font-size: 14px; padding: 0; cursor: pointer; }
.center-notice { text-align: center; padding: 40px 20px; }
