@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  /* --- 7 Crores Family Cafe design tokens --- */
  --cream: #FBF3E4;
  --cream-2: #F3E6CE;
  --espresso: #5C1A1A;
  --espresso-ink: #3A1010;
  --charcoal: #2A211B;
  --gold: #E8A33D;
  --gold-deep: #C97F1D;
  --leaf: #2F6B3D;
  --leaf-light: #E4F0E3;
  --tomato: #C1432B;
  --paper: #FFFDF8;
  --line: rgba(42, 33, 27, 0.12);
  --shadow: 0 10px 24px rgba(92, 26, 26, 0.12);

  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Work Sans', system-ui, sans-serif;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-padding-top: var(--safe-top); -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-top: var(--safe-top);
}
h1, h2, h3, .display { font-family: var(--font-display); color: var(--espresso-ink); margin: 0; }
p { margin: 0 0 0.6em; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; padding-bottom: calc(78px + var(--safe-bottom)); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--espresso) 0%, var(--espresso-ink) 100%);
  color: var(--paper);
  padding: calc(14px) 18px 16px;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.topbar-row { display: flex; align-items: center; gap: 12px; }
.topbar-logo { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--paper); box-shadow: 0 0 0 3px var(--gold); }
.topbar-logo img { width: 100%; height: 100%; object-fit: cover; }
.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles .name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.topbar-titles .tag { font-size: 0.78rem; opacity: 0.8; }
.cart-btn { position: relative; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); color: var(--paper); border-radius: 999px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; }
.cart-badge { position: absolute; top: -4px; right: -4px; background: var(--tomato); color: #fff; font-size: 0.68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.locate-pill { margin-top: 12px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 999px; padding: 8px 14px; font-size: 0.82rem; display: flex; align-items: center; gap: 8px; }
.locate-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }

/* ---------- home banner slider ---------- */
.banner-slider { position: relative; margin: 14px 18px 0; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow); }
.banner-track { display: flex; transition: transform 0.45s ease; aspect-ratio: 16/8; }
.banner-track a, .banner-track .banner-slide { flex: 0 0 100%; display: block; }
.banner-track img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.banner-dots button { width: 7px; height: 7px; border-radius: 50%; border: none; background: rgba(255,255,255,0.55); padding: 0; }
.banner-dots button.active { background: #fff; width: 18px; border-radius: 4px; }

/* ---------- offer popup modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(42,20,10,0.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--paper); border-radius: var(--radius-lg); padding: 26px 22px 22px; max-width: 360px; width: 100%; text-align: center; position: relative; box-shadow: var(--shadow); }
.modal-box img { width: 100%; border-radius: var(--radius-sm); margin-bottom: 14px; max-height: 180px; object-fit: cover; }
.modal-box h2 { font-size: 1.25rem; margin-bottom: 8px; }
.modal-box p { color: rgba(42,33,27,0.7); font-size: 0.92rem; }
.modal-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 1.4rem; line-height: 1; color: rgba(42,33,27,0.5); width: 30px; height: 30px; }

/* ---------- category pills ---------- */
.cat-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 16px 18px 4px; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-pill { flex-shrink: 0; border: 1px solid var(--line); background: var(--paper); color: var(--espresso-ink); padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.cat-pill.active { background: var(--espresso); color: var(--paper); border-color: var(--espresso); }

/* ---------- menu item cards ---------- */
.menu-list { padding: 6px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.category-heading { font-family: var(--font-display); font-size: 1.05rem; margin: 18px 2px 2px; color: var(--espresso-ink); }
.item-card { display: flex; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; }
.item-thumb { width: 76px; height: 76px; border-radius: var(--radius-sm); background: var(--cream-2) center/cover no-repeat; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-top { display: flex; align-items: flex-start; gap: 8px; }
.veg-dot { width: 12px; height: 12px; border: 1.5px solid var(--leaf); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 3px; }
.veg-dot.nonveg { border-color: var(--tomato); }
.veg-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); }
.veg-dot.nonveg::after { background: var(--tomato); }
.item-name { font-weight: 600; font-size: 0.98rem; }
.item-desc { font-size: 0.82rem; color: rgba(42,33,27,0.65); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.item-price { font-family: var(--font-display); font-weight: 700; color: var(--gold-deep); }
.qty-add { border: 1.5px solid var(--gold-deep); background: var(--paper); color: var(--gold-deep); border-radius: var(--radius-sm); padding: 6px 14px; font-weight: 700; font-size: 0.85rem; }
.qty-stepper { display: flex; align-items: center; gap: 10px; background: var(--espresso); color: var(--paper); border-radius: var(--radius-sm); padding: 4px 10px; }
.qty-stepper button { background: none; border: none; color: inherit; font-size: 1.1rem; width: 22px; }
.empty-note { text-align: center; padding: 40px 20px; color: rgba(42,33,27,0.6); }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 560px; margin: 0 auto;
  background: var(--paper); border-top: 1px solid var(--line);
  display: flex; padding: 8px 6px calc(8px + var(--safe-bottom));
  box-shadow: 0 -6px 20px rgba(92,26,26,0.08);
}
.nav-btn { flex: 1; background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: rgba(42,33,27,0.5); font-size: 0.68rem; font-weight: 600; position: relative; }
.nav-btn.active { color: var(--espresso); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-badge { position: absolute; top: 0; right: 22%; background: var(--tomato); color: #fff; font-size: 0.6rem; min-width: 15px; height: 15px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }

/* ---------- generic screen / sheet ---------- */
.screen { padding: 18px; }
.screen h2 { font-size: 1.3rem; margin-bottom: 14px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 5px; color: var(--espresso-ink); }
.field input, .field textarea, .field select {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px;
  font-family: inherit; font-size: 0.95rem; background: var(--paper); color: var(--charcoal);
}
.field textarea { resize: vertical; min-height: 70px; }
.btn { border: none; border-radius: var(--radius-sm); padding: 13px 18px; font-weight: 700; font-size: 0.95rem; width: 100%; }
.btn-primary { background: var(--espresso); color: var(--paper); }
.btn-gold { background: var(--gold); color: var(--espresso-ink); }
.btn-outline { background: var(--paper); border: 1.5px solid var(--espresso); color: var(--espresso); }
.btn-text { background: none; color: var(--gold-deep); font-weight: 600; padding: 8px; width: auto; }
.btn[disabled] { opacity: 0.55; }
.msg { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.85rem; }
.msg-error { background: #FBE6E1; color: var(--tomato); }
.msg-ok { background: var(--leaf-light); color: var(--leaf); }
.hidden { display: none !important; }
.offer-banner { background: var(--gold); color: var(--espresso-ink); font-weight: 700; font-size: 0.88rem; text-align: center; padding: 9px 16px; }

/* ---------- cart ---------- */
.cart-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; }
.cart-row .name { font-weight: 600; font-size: 0.9rem; }
.cart-row .sub { color: rgba(42,33,27,0.55); font-size: 0.78rem; }
.totals-row { display: flex; justify-content: space-between; font-size: 0.88rem; padding: 3px 0; }
.totals-row.grand { font-family: var(--font-display); font-size: 1.1rem; color: var(--espresso-ink); border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }

/* ---------- orders / tracking ---------- */
.order-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.status-chip { font-size: 0.72rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.status-placed, .status-confirmed { background: #FDEBD0; color: var(--gold-deep); }
.status-preparing { background: #FCE3D6; color: var(--tomato); }
.status-ready, .status-out_for_delivery { background: var(--leaf-light); color: var(--leaf); }
.status-delivered { background: #E7E1F5; color: #5B3DA6; }
.status-cancelled { background: #EFE9E2; color: rgba(42,33,27,0.55); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; z-index: 1; }
.timeline li.done .dot { background: var(--leaf); }
.timeline li.current .dot { background: var(--gold-deep); }
.timeline .label { font-weight: 600; font-size: 0.9rem; }
.timeline .time { font-size: 0.76rem; color: rgba(42,33,27,0.5); }

/* ---------- auth ---------- */
.brand-hero { text-align: center; padding: 22px 0 6px; }
.brand-hero img { width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 0 0 4px var(--gold), var(--shadow); }
.brand-hero h1 { font-size: 1.4rem; margin-top: 12px; }
.brand-hero p { color: rgba(42,33,27,0.6); font-size: 0.88rem; }
.tab-toggle { display: flex; background: var(--cream-2); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 16px; }
.tab-toggle button { flex: 1; border: none; background: none; padding: 9px; border-radius: 8px; font-weight: 600; font-size: 0.88rem; color: rgba(42,33,27,0.6); }
.tab-toggle button.active { background: var(--paper); color: var(--espresso); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.profile-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.profile-row:last-child { border-bottom: none; }

/* ---------- sheet overlay (cart / confirmations) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(42,20,10,0.4); z-index: 40; }

.totals-row.discount { color: var(--leaf); }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input { flex: 1; }
.coupon-row button { width: auto; padding: 11px 16px; }

/* ===========================================================================
   Desktop layout — same screens/data, laid out as a full website instead of
   a single narrow phone column. Kicks in above ~860px; phones/tablets below
   that keep the app-style bottom nav untouched.
   =========================================================================== */
@media (min-width: 860px) {
  .app { max-width: 1180px; padding-bottom: 40px; }

  .topbar { border-radius: 0 0 var(--radius-lg) var(--radius-lg); position: sticky; padding: 14px 32px 14px; }
  .topbar-row { max-width: 1180px; margin: 0 auto; width: 100%; }
  .locate-pill { max-width: 1180px; margin: 12px auto 0; }

  /* bottom tab bar becomes a horizontal top navbar under the header */
  .bottom-nav {
    position: sticky; top: 0; bottom: auto; max-width: none; margin: 0;
    justify-content: center; gap: 6px; padding: 10px 20px; box-shadow: 0 2px 10px rgba(92,26,26,0.06);
  }
  .nav-btn { flex: none; flex-direction: row; gap: 7px; padding: 9px 18px; border-radius: 999px; font-size: 0.85rem; }
  .nav-btn svg { width: 18px; height: 18px; }
  .nav-btn.active { background: var(--cream-2); }
  .nav-badge { position: static; margin-left: 2px; }
  .app { padding-bottom: 40px; }

  .screen, #screen-home { padding-left: 32px; padding-right: 32px; }
  .cat-scroll { padding-left: 32px; padding-right: 32px; }
  .menu-list { padding-left: 32px; padding-right: 32px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-items: start; }
  .category-heading { grid-column: 1 / -1; }
  .item-card { flex-direction: column; }
  .item-thumb { width: 100%; height: 140px; }
  .banner-slider { margin-left: 32px; margin-right: 32px; }
  .banner-track { aspect-ratio: 21/6; }

  #screen-cart .stack, #screen-orders .stack { max-width: 640px; margin: 0 auto; }
  #screen-profile { max-width: 480px; margin: 0 auto; }
  #screen-order-detail { max-width: 640px; margin: 0 auto; }
}
