/* Wok N Wanted – mobile-first styles (phones first, wider layouts via min-width queries) */
:root {
  --bg: #fffaf3;
  --card: #ffffff;
  --text: #1f1a17;
  --muted: #6f645b;
  --brand: #c62828;
  --brand-dark: #8e1b1b;
  --line: #eadfd3;
  --veg: #2e7d32;
  --egg: #e0a000;
  --radius: 14px;
  --gutter: 16px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--egg); outline-offset: 2px; }

/* ---------- Header ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  text-align: center;
  padding: calc(18px + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) 16px calc(var(--gutter) + var(--safe-l));
}
.hero h1 { margin: 0; font-size: clamp(1.6rem, 7vw, 2.4rem); letter-spacing: 0.3px; }
.hero p { margin: 4px 0 0; font-size: 0.9rem; opacity: 0.9; }
.hero-sm { padding-bottom: 12px; }
.hero-sm h1 { font-size: clamp(1.35rem, 5.5vw, 1.8rem); }

/* ---------- Section tabs: one swipeable row on phones ---------- */
.tabs {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: none;
  padding: 10px calc(var(--gutter) + var(--safe-r)) 10px calc(var(--gutter) + var(--safe-l));
  background: rgba(255, 250, 243, 0.96);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; scroll-snap-align: center;
  min-height: 48px; padding: 6px 16px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.15; border-radius: 999px;
  border: 1px solid var(--brand); background: #fff; color: var(--brand);
  transition: background-color 0.15s, color 0.15s;
}
/* centre the row when it fits, scroll from the left edge when it doesn't */
.tab:first-child { margin-left: auto; }
.tab:last-child { margin-right: auto; }
.tab-title { font-size: 0.95rem; font-weight: 600; white-space: nowrap; }
.tab-sub { font-size: 0.7rem; opacity: 0.8; white-space: nowrap; }
.tab.active { background: var(--brand); color: #fff; }

/* ---------- Menu ---------- */
.menu {
  max-width: 1080px; margin: 0 auto;
  padding: 14px calc(var(--gutter) + var(--safe-r)) 8px calc(var(--gutter) + var(--safe-l));
}
.section-head { text-align: center; margin: 2px 0 14px; }
.section-head h2 { margin: 0; font-size: clamp(1.25rem, 5.5vw, 1.6rem); color: var(--brand-dark); }
.section-sub {
  display: inline-block; margin-top: 2px;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--brand);
}
.section-desc { margin: 6px auto 0; max-width: 34em; color: var(--muted); font-size: 0.92rem; }

.items { display: grid; grid-template-columns: 1fr; gap: 10px; animation: fade-in 0.18s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column;
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h3 { margin: 0; font-size: 1.02rem; line-height: 1.3; display: flex; align-items: flex-start; gap: 8px; }
.card h3 .dot { margin-top: 4px; }
.price { font-weight: 700; font-size: 1.05rem; color: var(--brand); white-space: nowrap; }
.subtitle { margin: 2px 0 0 20px; font-size: 0.85rem; font-weight: 600; opacity: 0.75; }
.desc { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.spice { margin-top: 6px; font-size: 0.8rem; letter-spacing: 1px; }

/* Veg / egg marker */
.dot {
  display: inline-block; flex: none; position: relative;
  width: 12px; height: 12px; border-radius: 2px; border: 2px solid var(--veg);
}
.dot::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--veg); }
.dot.egg { border-color: var(--egg); }
.dot.egg::after { background: var(--egg); }

.muted { color: var(--muted); text-align: center; }
.legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  padding: 16px var(--gutter) 8px;
  color: var(--muted); font-size: 0.82rem;
}
/* Credit line at the very bottom of every page */
.powered {
  text-align: center; font-size: 0.78rem; color: var(--muted);
  margin-top: 8px; padding: 12px var(--gutter) calc(16px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.powered a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.powered a:hover { text-decoration: underline; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Tablets / desktops: more cards per row */
@media (min-width: 640px) {
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .card { padding: 14px 16px; }
  .spice { margin-top: auto; padding-top: 6px; }
}
@media (min-width: 1000px) {
  .items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { padding-top: 26px; padding-bottom: 22px; }
}

/* ---------- Admin ---------- */
.admin {
  max-width: 900px; margin: 0 auto;
  padding: 14px calc(var(--gutter) + var(--safe-r)) 24px calc(var(--gutter) + var(--safe-l));
}
/* 16px+ inputs stop iOS from zooming in on focus */
.admin input, .admin select {
  font-size: 16px; min-height: 44px; width: 100%; min-width: 0;
  padding: 8px 10px; border: 1px solid #d9cbbd; border-radius: 10px; background: #fff;
}
.admin button {
  min-height: 44px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600;
}
.admin button.secondary { background: #fff; color: var(--brand); }
.link { color: var(--brand); font-weight: 600; text-decoration: none; white-space: nowrap; }

.key-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.key-row input { flex: 1 1 180px; width: auto; }

.add-box { margin: 14px 0 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.add-box summary {
  list-style: none; cursor: pointer; padding: 12px 14px; min-height: 48px;
  font-weight: 700; color: var(--brand);
}
.add-box summary::-webkit-details-marker { display: none; }
.add-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 14px; }
.add-form .span-2, .add-form .span-full { grid-column: 1 / -1; }

.admin-section h2 { margin: 22px 0 8px; font-size: 1.1rem; color: var(--brand-dark); }
.admin-section h2 small { font-weight: 500; font-size: 0.8rem; color: var(--muted); }

.admin-item {
  display: grid; align-items: center; gap: 8px 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "name name name" "price avail del";
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.admin-item.is-off { opacity: 0.6; }
.ai-name { grid-area: name; min-width: 0; }
.ai-name strong { display: flex; align-items: flex-start; gap: 8px; font-size: 0.98rem; }
.ai-name strong .dot { margin-top: 4px; }
.ai-name small { display: block; margin-left: 20px; color: var(--muted); }
.ai-price { grid-area: price; display: flex; align-items: center; gap: 6px; max-width: 150px; }
.ai-price span { font-weight: 700; color: var(--brand); }
.ai-avail { grid-area: avail; }
.ai-del { grid-area: del; }

.icon-btn.ai-del {
  width: 44px; padding: 0; background: #fff; color: var(--muted); border-color: var(--line); font-weight: 400;
}

/* Toggle switch for available / sold out */
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider {
  position: relative; width: 46px; height: 28px; flex: none;
  border-radius: 999px; background: #cfc3b8; transition: background-color 0.15s;
}
.slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.switch input:checked + .slider { background: var(--veg); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 3px solid var(--egg); outline-offset: 2px; }
.switch-text { font-size: 0.85rem; min-width: 4.6em; }

/* Status messages float above the bottom edge, where thumbs are */
.toast {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: #1f1a17; color: #fff; font-size: 0.92rem; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--brand); }
.admin + .powered { padding-bottom: calc(72px + var(--safe-b)); } /* room for the toast */

@media (min-width: 640px) {
  .add-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .add-form .span-2 { grid-column: span 2; }
  .admin-item {
    grid-template-columns: minmax(0, 1fr) 150px auto auto;
    grid-template-areas: "name price avail del";
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
