/* ============================================================= *
 *  DuckInn Menu — design system
 * ============================================================= */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1f1a17;
  --muted: #7a7068;
  --line: #e7e0d6;
  --accent: #b8762e;
  --accent-ink: #fff;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(40, 30, 20, 0.08);
  --shadow-lg: 0 18px 50px rgba(40, 30, 20, 0.16);
  --font-head: "Georgia", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* ---- buttons & inputs ---- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; transition: 0.15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: #b4231c; border-color: #f0c9c6; background: #fff6f5; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }

input, textarea, select {
  font: inherit; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 999px; background: #f0ebe2; color: var(--muted);
}
.tag-veg { background: #e7f3e3; color: #2f7d32; }
.tag-vegan { background: #e3f3ec; color: #1d7a55; }
.tag-gf { background: #fef0e0; color: #a35d12; }
.tag-spicy { background: #fde6e3; color: #c0392b; }
.tag-chef { background: #efe7f7; color: #6f42c1; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 9999; opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; bottom: 36px; }
.toast.err { background: #b4231c; }

/* ============================================================= *
 *  PUBLIC MENU
 * ============================================================= */
/* The public menu mirrors the printable "sheet" look (themed background,
   serif headings, centered accent category titles, dotted price rows) but
   is laid out for a phone. Colours come from the active theme (--t-*). */
.menu-page { min-height: 100vh; color: var(--t-ink); }
.menu {
  max-width: 680px; margin: 0 auto; padding: 0 18px 48px;
  font-family: var(--t-head, var(--font-head));
}

.m-head { text-align: center; padding: 40px 10px 4px; }
.m-logo { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; margin: 0 auto 16px; box-shadow: 0 6px 22px rgba(0,0,0,.22); }
.m-head h1 { font-size: clamp(32px, 8vw, 46px); letter-spacing: 1px; }
.m-tagline { color: var(--t-muted); margin-top: 6px; font-style: italic; }
.m-divider { width: 90px; height: 2px; background: var(--t-accent); margin: 16px auto 0; }

/* sticky search + jump-to-group nav, themed to blend with the background */
.m-tools { position: sticky; top: 0; z-index: 50; padding: 12px 0 8px;
  background: var(--t-bg); backdrop-filter: saturate(1.1); }
.m-search input {
  font-family: var(--font-body); max-width: 440px; margin: 0 auto;
  background: rgba(255,255,255,.14); color: var(--t-ink);
  border: 1px solid var(--t-line);
}
.m-search input::placeholder { color: var(--t-muted); }
.m-catnav { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.m-catnav::-webkit-scrollbar { display: none; }
.m-catnav a {
  flex: 0 0 auto; font-family: var(--font-body); text-decoration: none; font-weight: 600; font-size: 13px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--t-line);
  color: var(--t-ink); background: transparent; white-space: nowrap;
}

.m-cat { margin-top: 30px; scroll-margin-top: 96px; }
.m-cat > h2 {
  font-size: 23px; color: var(--t-accent); text-transform: uppercase; letter-spacing: 2px;
  text-align: center; margin-bottom: 4px;
}
.m-cdesc { text-align: center; color: var(--t-muted); font-style: italic; margin: 0 auto 10px; font-size: 14px; }

.m-dish {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 2px; border-bottom: 1px dotted var(--t-line);
}
.m-dish:last-child { border-bottom: none; }
.m-dish.sold-out { opacity: .5; }
.m-dish .thumb {
  flex: 0 0 74px; width: 74px; height: 74px; border-radius: 10px; object-fit: cover;
  background: rgba(128,128,128,.18); cursor: zoom-in;
}
.m-dish .body { flex: 1; min-width: 0; }
.m-dish .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.m-dish .name { font-weight: 700; font-size: 18px; flex: 1 1 auto; min-width: 0; }

/* labelled variant prices wrap inline under the name (e.g. Pork K145 · Beef K160) */
.m-dish .m-variants { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.m-dish .m-variants .v { font-weight: 700; font-size: 15px; white-space: nowrap; }
.m-dish .m-variants .vlabel { color: var(--t-muted); font-weight: 400; font-style: italic; font-family: var(--font-body); font-size: 13px; }
.m-dish .desc { color: var(--t-muted); font-size: 14px; font-style: italic; font-family: var(--font-body); margin: 3px 0 0; }
.m-dish .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.m-dish .prices { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.m-dish .price-row { font-size: 16px; font-weight: 700; }
.m-dish .price-row .plabel { color: var(--t-muted); font-size: 12px; font-style: italic; font-weight: 400; font-family: var(--font-body); margin-right: 6px; }
.m-dish .soldtag { font-size: 11px; font-weight: 700; color: #c0392b; text-transform: uppercase; }

.m-foot { text-align: center; color: var(--t-muted); padding: 40px 16px 0; font-style: italic; font-size: 14px; }

/* image lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; align-items: center; justify-content: center; z-index: 9998; padding: 20px; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; }

/* floating actions */
.fab { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.fab .btn { box-shadow: var(--shadow-lg); }

/* ============================================================= *
 *  ADMIN
 * ============================================================= */
.topbar { background: var(--ink); color: #fff; padding: 12px 0; position: sticky; top: 0; z-index: 100; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar .brand { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.topbar .brand span { color: var(--accent); }
.topbar a, .topbar .btn { color: #fff; }
.topbar .btn { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.06); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 22px 0; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 600; background: none; border: none; cursor: pointer;
  padding: 10px 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--ink); border-color: var(--accent); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h3 { margin-bottom: 4px; }
.panel .sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* admin list items (categories / dishes) */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.item .reorder { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.item .rbtn { padding: 4px 9px; line-height: 1; font-size: 13px; }
.item .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #f0ebe2; flex: 0 0 52px; }
.item .meta { flex: 1; min-width: 0; }
.item .meta .t { font-weight: 700; }
.item .meta .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge-off { font-size: 11px; font-weight: 700; color: #b4231c; }

/* price editor rows */
.price-rows { display: flex; flex-direction: column; gap: 8px; }
.price-rows .prow { display: grid; grid-template-columns: 1fr 120px 38px; gap: 8px; align-items: center; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,15,10,.5); display: none; align-items: flex-start; justify-content: center; z-index: 200; padding: 30px 16px; overflow: auto; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; padding: 22px; }
.modal h3 { margin-bottom: 16px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* image dropzone */
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone:hover { border-color: var(--accent); }
.dropzone img { max-height: 130px; margin: 8px auto 0; border-radius: 8px; }

/* QR + theme picker */
.qr-card { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.qr-card img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px; }
.theme-swatch { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; text-align: center; }
.theme-swatch.active { border-color: var(--accent); }
.theme-swatch .prev { height: 70px; }
.theme-swatch .nm { padding: 6px; font-size: 13px; font-weight: 600; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #2b2017, #3f2d1d); }
.login-card { background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px; width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; margin-bottom: 4px; }
.login-card h1 span { color: var(--accent); }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }

/* ============================================================= *
 *  Phone / touch refinements — the whole admin works one-handed
 * ============================================================= */
@media (max-width: 600px) {
  .container { padding: 0 14px; }
  .topbar .brand { font-size: 16px; }
  .topbar .container { gap: 8px; }

  /* each list row: reorder + thumb + name on line 1, actions wrap to line 2 */
  .item { flex-wrap: wrap; }
  .item .meta { flex: 1 1 120px; }
  .item .meta .s { white-space: normal; }
  .item .actions { flex: 1 0 100%; }

  /* bigger tap targets on dish/group cards */
  .item .rbtn { padding: 8px 14px; font-size: 15px; }
  .item .actions .btn { flex: 1; min-width: 0; }

  /* modals fill the screen with comfortable room */
  .modal-bg { padding: 14px 10px; }
  .modal { padding: 18px; }
  .price-rows .prow { grid-template-columns: 1fr 96px 40px; }

  /* the public-menu print button shouldn't cover content */
  .fab .btn { padding: 11px 14px; }
}

/* avoid iOS auto-zoom on focus: inputs must be >=16px */
@media (max-width: 600px) {
  input, textarea, select { font-size: 16px; }
}
