/* ===== foodie — shared styles (dish.html + recipe.html) ===== */

:root {
  --bg: #16140f;
  --card: #211e18;
  --ink: #ece8e1;
  --muted: #9a948a;
  --line: #332f27;
  --accent: #e8924a;
  --accent-soft: #3a2a1a;
  --warn: #e26d5c;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Noto Sans TC", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
a { color: var(--accent); }

.wrap { max-width: 760px; margin: 0 auto; padding: 32px 18px 64px; }
h1 { font-size: 30px; margin: 4px 0 10px; }
footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 36px; }

/* Language toggle (both pages) */
.lang-btn {
  position: fixed; top: 14px; right: 14px; z-index: 10;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow); transition: color .15s, border-color .15s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Header ===== */
.hero { margin-bottom: 24px; }
.hero .brand { font-size: 13px; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.subtitle { color: var(--muted); font-size: 15px; margin: 0; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumb a { text-decoration: none; }
.chef {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted); margin-bottom: 6px;
}
.chef .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 13px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.tag.cookware::before { content: "🍳 "; }

/* Cookware picker — pill buttons that swap the step list */
.cookware-pick { display: inline-flex; flex-wrap: wrap; gap: 6px; }
button.tag.cookware { border: 0; cursor: pointer; font-family: inherit; }
button.tag.cookware:hover { background: var(--accent); color: var(--bg); }
button.tag.cookware[aria-pressed="true"] { background: var(--accent); color: var(--bg); }

/* Serving stepper */
.serving-stepper {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.serving-stepper .ic { font-size: 13px; }
.serving-stepper button {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0;
  display: grid; place-items: center;
}
.serving-stepper button:hover:not(:disabled) { background: var(--accent); color: var(--bg); }
.serving-stepper button:disabled { opacity: .35; cursor: default; }
.serving-stepper .count { min-width: 4.5em; text-align: center; }

/* ===== Cards (dish detail) ===== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-top: 20px;
}
.card h2 {
  font-size: 18px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}
.card h2 .ic { font-size: 18px; }
.card h2 .spacer { flex: 1; }

/* Toggle switch */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; flex: none; border-radius: 999px;
  background: var(--line); position: relative; transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--accent-soft); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Ingredients */
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
ul.list li:last-child { border-bottom: 0; }
ul.list .qty { color: var(--muted); white-space: nowrap; }
.group-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 14px 0 6px;
}
.group-label:first-child { margin-top: 0; }

/* Inline link rows (dish/menu link sections) */
.refs a { display: inline-block; margin-right: 16px; }

/* ===== My ingredients (ingredients.html) ===== */
ul.pantry { list-style: none; margin: 0; padding: 0; }
ul.pantry li { padding: 12px 0; border-bottom: 1px dashed var(--line); }
ul.pantry li:last-child { border-bottom: 0; }
ul.pantry .item-row { display: flex; justify-content: space-between; gap: 16px; }
ul.pantry .name { font-weight: 500; }
ul.pantry .qty { color: var(--muted); white-space: nowrap; }
ul.pantry .desc { color: var(--ink); font-size: 13px; margin-top: 4px; }
ul.pantry .tip { color: var(--muted); font-size: 13px; margin-top: 4px; }
ul.pantry .tip::before { content: "💡 "; }

/* ===== Meat cuts (guide-cuts.html) ===== */
ul.cuts { list-style: none; margin: 0; padding: 0; }
ul.cuts li { padding: 12px 0; border-bottom: 1px dashed var(--line); }
ul.cuts li:last-child { border-bottom: 0; }
ul.cuts .cut-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
ul.cuts .cut-name { font-weight: 600; }
ul.cuts .cut-alt { color: var(--muted); font-size: 13px; }
ul.cuts .cut-desc { color: var(--muted); font-size: 14px; margin-top: 4px; }
ul.cuts .cut-tip { color: var(--muted); font-size: 13px; margin-top: 4px; }
ul.cuts .cut-tip::before { content: "💡 "; }
ul.cuts .cut-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 13px; }
ul.cuts .cut-links a { color: var(--accent); text-decoration: none; }
ul.cuts .cut-links a:hover { text-decoration: underline; }
ul.cuts .cut-cook { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; }
ul.cuts .cook-label {
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 2px;
}
ul.cuts .cook-chip { padding: 2px 9px; border-radius: 999px; font-weight: 500; border: 1px solid var(--line); }
ul.cuts .cook-best .cook-chip { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft); }
ul.cuts .cook-best .cook-chip::before { content: "✓ "; }
ul.cuts .cook-worst .cook-chip { color: var(--warn); border-color: var(--warn); }
ul.cuts .cook-worst .cook-chip::before { content: "✗ "; }

/* "What you can cook" suggestions (ingredients.html) */
ul.cook-suggest { list-style: none; margin: 0; padding: 0; }
ul.cook-suggest li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
ul.cook-suggest li:last-child { border-bottom: 0; }
ul.cook-suggest .cook-dish { font-weight: 600; text-decoration: none; }
ul.cook-suggest .cook-dish:hover { text-decoration: underline; }
ul.cook-suggest .cook-ok { font-size: 12px; color: var(--accent); }
ul.cook-suggest .cook-ok::before { content: "✓ "; }
ul.cook-suggest .cook-missing {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
ul.cook-suggest .miss-chip {
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
ul.cook-suggest .miss-chip::before { content: "✗ "; color: var(--warn); }

/* Click a row to edit its storage and amount */
.edit-hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.est-hint { display: inline-block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.edit-hint::before { content: "✎ "; }
.view-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.view-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-right: 2px;
}
ul.pantry li { cursor: pointer; }
ul.pantry li:hover .name { color: var(--accent); }
ul.pantry .row-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.type-chip {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
ul.pantry .meta-row {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 6px; font-size: 12px; color: var(--muted);
}
ul.pantry .meta-row .m-expiry.soon { color: var(--accent); }
ul.pantry .meta-row .m-expiry.expired { color: var(--warn); font-weight: 600; }

/* Edit dialog (click a row) */
.edit-dialog {
  width: min(420px, calc(100vw - 32px));
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px;
}
.edit-dialog::backdrop { background: rgba(0,0,0,.55); }
.edit-dialog h2 { font-size: 20px; margin: 0 0 16px; }
.edit-dialog .field { margin-bottom: 18px; }
.edit-dialog .field-label {
  display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 8px;
}
.amount-input { display: flex; align-items: center; gap: 10px; }
.amount-input input {
  width: 7em; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit;
}
.amount-input input:focus { outline: none; border-color: var(--accent); }
.amount-unit { color: var(--muted); font-size: 14px; }
.edit-dialog input[type="date"] {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit;
}
.edit-dialog input[type="date"]:focus { outline: none; border-color: var(--accent); }
.edit-dialog input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
.edit-updated { font-size: 13px; color: var(--muted); margin: -4px 0 4px; }
.edit-updated .val { color: var(--ink); }
.edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.edit-actions .spacer { flex: 1; }
.btn-ghost, .btn-primary {
  border-radius: 999px; padding: 8px 18px; font: inherit; font-weight: 600;
  font-size: 14px; cursor: pointer; border: 1px solid var(--line);
}
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn-danger:hover { background: var(--warn); color: var(--bg); cursor: pointer; }

/* Add-item button + create/edit dialog modes */
.add-btn {
  margin-top: 20px; background: var(--accent); color: var(--bg);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 10px 22px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: filter .15s;
}
.add-btn:hover { filter: brightness(1.08); }
#editNameInput, .unit-input {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit;
}
#editNameInput { width: 100%; }
.unit-input { width: 5em; }
#editNameInput:focus, .unit-input:focus { outline: none; border-color: var(--accent); }
#editTypeSelect {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit; cursor: pointer;
}
#editTypeSelect:focus { outline: none; border-color: var(--accent); }
.edit-dialog form.mode-create .edit-only { display: none; }
.edit-dialog form.mode-edit .create-only { display: none; }

/* Name autocomplete dropdown */
.suggest-wrap { position: relative; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5;
  margin-top: 4px; max-height: 220px; overflow: auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.suggest button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--ink); font: inherit; padding: 8px 12px; cursor: pointer;
}
.suggest button:hover, .suggest button.active { background: var(--accent-soft); color: var(--accent); }
.suggest .s-unit { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Steps */
.phase { font-size: 14px; font-weight: 600; color: var(--accent); margin: 22px 0 12px; }
.phase:first-of-type { margin-top: 4px; }
ol.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
ol.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 36px 1fr; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line);
}
ol.steps li:first-child { border-top: 0; }
ol.steps li::before {
  content: counter(step);
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 600;
}
.step-body p { margin: 0 0 10px; }
.step-body img {
  width: 100%; max-width: 360px; border-radius: 10px; display: block;
  border: 1px solid var(--line);
}
.photo-ph {
  width: 100%; max-width: 360px; aspect-ratio: 4 / 3; border-radius: 10px;
  background: repeating-linear-gradient(45deg, #2a261f, #2a261f 10px, #322d25 10px, #322d25 20px);
  display: grid; place-items: center; color: var(--muted); font-size: 13px;
  border: 1px solid var(--line);
}

/* ===== Recipe listing ===== */
.grid { display: grid; gap: 16px; margin-top: 28px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }

.dish-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.dish-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.dish-card .meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dish-card .ic {
  width: 40px; height: 40px; flex: none; border-radius: 10px;
  background: var(--accent-soft); display: grid; place-items: center; font-size: 20px;
}
.dish-card .name { font-size: 16px; font-weight: 600; }
.dish-card .nav-desc { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.dish-card .arrow { color: var(--accent); font-size: 20px; flex: none; }

/* ===== Map (maps.html) ===== */
#map {
  height: 380px; margin-top: 28px;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  background: var(--card);
}
/* Tame Leaflet's default light chrome to fit the dark theme */
.leaflet-container { background: var(--card); font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content .pop-name { display: block; font-weight: 600; }
.leaflet-popup-content .pop-cuisine { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.leaflet-popup-content .pop-addr { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.leaflet-popup-content .pop-links { display: grid; gap: 4px; margin-top: 8px; }
.leaflet-popup-content .pop-link { font-size: 13px; font-weight: 600; }
.leaflet-popup-content-wrapper a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--card); color: var(--ink); border-bottom-color: var(--line);
}

/* ===== Filters (maps.html) ===== */
.filters { margin-top: 24px; display: grid; gap: 10px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); min-width: 72px;
}
.filter-chip {
  font-size: 12px; padding: 4px 12px; border-radius: 999px; font-weight: 500;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* ===== Menu (menu.html) ===== */
.eatery-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.eatery-head .ic {
  width: 48px; height: 48px; flex: none; border-radius: 12px;
  background: var(--accent-soft); display: grid; place-items: center; font-size: 24px;
}
.eatery-head h1 { margin: 0; font-size: 26px; }
.hero .addr { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.hero .branches { display: grid; gap: 4px; margin: 6px 0 10px; }
.hero .branch { color: var(--muted); font-size: 14px; }
.hero .branch-name { font-weight: 600; color: var(--ink); margin-right: 6px; }
.menu-name .sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
#menuBody .empty { color: var(--muted); font-size: 14px; }
#menuBody .menu-updated { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ===== Eatery listing (maps.html) ===== */
.eatery-card .empty, .grid .empty { color: var(--muted); font-size: 14px; }
.eatery-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; text-align: left; width: 100%;
  color: var(--ink); cursor: pointer; font: inherit; text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.eatery-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.eatery-card.active { border-color: var(--accent); }
.eatery-card .ic {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  background: var(--accent-soft); display: grid; place-items: center; font-size: 22px;
}
.eatery-card .body { min-width: 0; }
.eatery-card .name { font-size: 16px; font-weight: 600; }
.eatery-card .cuisine { color: var(--accent); font-size: 13px; margin: 2px 0 6px; }
.eatery-card .addr { color: var(--muted); font-size: 13px; }
.eatery-card .note { color: var(--muted); font-size: 13px; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 500;
}
.chip-area {
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
}
.chip-tag { background: var(--accent-soft); color: var(--accent); }
.chip-meal {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.chip-service { background: var(--line); color: var(--ink); }
.chip-dist { background: var(--accent); color: var(--bg); }
.chip-price { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.chip-party { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.chip-branch { background: var(--accent); color: var(--bg); }
