/* ══════════════════════════════════════════════════════════════════════════
   Sala · Card Editor — throwaway clickable mockup
   Reuses the staff dish-card visual language from web/style.css
   (dish-card block) + web/menu-core.js dishCardHTML. Mock data only.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Sala dark theme (actual app values, web/style.css :root) ── */
  --bg-deep: #121212;
  --bg: #161616;
  --bg-top: #1a1a1a;
  --card-bg: #1e1e1e;
  --card-elevated: #252525;
  --card-active: #2a2a2a;
  --text: #f0ece6;
  --text-muted: #9a9590;
  --accent: #d4b88c;
  --accent-dim: rgba(201, 169, 110, 0.12);
  --border: rgba(255,255,255,0.06);
  --border-accent: rgba(255,255,255,0.10);
  --green: #81c784;
  --green-dim: rgba(129,199,132,0.14);
  --danger: #e57373;

  /* ── Allergen colors (web/style.css :root) ── */
  --allergen-gluten: #d4a44a;
  --allergen-dairy: #7aaccc;
  --allergen-eggs: #d4c44a;
  --allergen-fish: #5aacab;
  --allergen-shellfish: #cc6b6b;
  --allergen-nuts: #b08a5a;
  --allergen-sesame: #c4a87a;
  --allergen-soy: #7aab6a;
  --allergen-alcohol: #b07aaa;
  --allergen-allium: #aa8a6a;
  --allergen-nightshade: #cc7a5a;
  --allergen-none: #6aab7a;

  /* ── Spacing / radius / type ── */
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-weight: 300;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 30%, var(--bg-deep) 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Phone stage ---- */
.stage {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}
.phone {
  position: relative;
  width: 100%;
  max-width: 400px;
}
@media (min-width: 480px) {
  .stage { align-items: flex-start; padding: 36px 0; }
  .phone {
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 28px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.55);
  }
}

/* ---- Sticky top: app header + draft/live banner ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-top);
  border-bottom: 1px solid var(--border);
}
.apphead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}
.apphead-title { font-family: var(--font-serif); font-size: 18px; }
.apphead-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.03em; }
.mock-pill {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  padding: 3px 7px;
}

/* ---- Draft / Live banner (the UX call) ---- */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  transition: background 0.3s ease;
}
.banner.draft { background: rgba(201,169,110,0.10); border-top: 1px solid rgba(201,169,110,0.18); }
.banner.live  { background: rgba(129,199,132,0.10); border-top: 1px solid rgba(129,199,132,0.20); }
.banner-body { min-width: 0; }
.banner-text { font-size: 14px; font-weight: 600; }
.banner.draft .banner-text { color: var(--accent); }
.banner.live  .banner-text { color: var(--green); }
.banner-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.banner-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #121212;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.banner-btn:hover { opacity: 0.9; }
.banner-btn.ghost {
  background: transparent;
  border: 1px solid var(--border-accent);
  color: var(--text-muted);
}
.banner.flip { animation: bannerPulse 0.5s ease; }
@keyframes bannerPulse {
  0%   { filter: brightness(1.7); }
  100% { filter: brightness(1); }
}

/* ---- Dish picker ---- */
.picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
}
.picker-arrow {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.picker-arrow:hover { border-color: var(--accent); color: var(--accent); }
.picker-center { flex: 1; text-align: center; min-width: 0; }
.picker-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker-meta {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.picker-status { padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.picker-status.live  { background: var(--green-dim); color: var(--green); }
.picker-status.draft { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════════════
   Staff dish card — ported from web/style.css dish-card block
   ════════════════════════════════════════════════════════════════════════ */

.card-canvas { padding: 4px 14px 0; }

.dish-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.dish-header {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.dish-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge-row  { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.dish-title-row { display: flex; align-items: flex-start; gap: 8px; }

.dish-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

.dish-price {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.dish-talk {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
}

.dish-detail {
  padding: var(--space-2) var(--space-5) var(--space-6);
  border-top: 1px solid var(--border);
}

.detail-section { margin-top: var(--space-5); }

.detail-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.detail-text {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  line-height: 1.7;
}
.detail-text.muted { color: var(--text-muted); font-style: italic; }

.ingredients-list { list-style: none; padding: 0; }
.ingredients-list li {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.ingredients-list li::before {
  content: '\00B7';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: bold;
  font-size: 18px;
}

/* ---- Allergen badges ---- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-allergen {
  color: var(--badge-color, var(--text-muted));
  background: color-mix(in srgb, var(--badge-color, var(--text-muted)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color, var(--text-muted)) 30%, transparent);
}
.badge-allergen.badge-removable {
  background: transparent;
  border-style: dashed;
  opacity: 0.8;
}
@supports not (background: color-mix(in srgb, red 12%, transparent)) {
  .badge-allergen {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
  }
}
.badge-none {
  background: rgba(106,171,122,0.12);
  color: var(--allergen-none);
  border: 1px solid rgba(106,171,122,0.22);
}

/* ════════════════════════════════════════════════════════════════════════
   Editor bubbles — the card IS the canvas
   Dashed outline = tappable bubble. Editing = solid gold outline.
   ════════════════════════════════════════════════════════════════════════ */

.bubble {
  position: relative;
  outline: 1px dashed rgba(201,169,110,0.30);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;                 /* touch floor */
  transition: outline-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.bubble:hover,
.bubble:active { outline-color: var(--accent); background: var(--accent-dim); }
.bubble.editing {
  outline: 2px solid var(--accent);
  background: transparent;
  cursor: default;
}

.dish-name.bubble,
.dish-price.bubble,
.dish-badges.bubble { display: flex; align-items: center; }
.dish-name.bubble { flex: 1; min-width: 0; }
.dish-price.bubble { flex: none; }
.dish-talk.bubble { display: block; }
.detail-section.bubble { display: block; }

.bubble-hint {
  font-size: 10px;
  opacity: 0.55;
  margin-left: 4px;
  font-style: normal;
}
.derived-tag {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* Placeholder for empty bubbles */
.bubble-value:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  opacity: 0.55;
  font-style: italic;
}

/* ---- Inline text editors (≥16px so iOS never zooms) ---- */
.edit-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  width: 100%;
  padding: 0;
  margin: 0;
}
.edit-input-name  { font-family: var(--font-serif); font-size: 20px; font-weight: 600; line-height: 1.3; }
.edit-input-price { font-size: 20px; font-weight: 500; color: var(--accent); width: 120px; }
.edit-input-talk  { font-size: 16px; color: var(--text-muted); }

/* ---- Allergen chip toggles (rendered into the badge row) ---- */
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.18);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.chip.active {
  background: color-mix(in srgb, var(--chip-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--chip-color) 45%, transparent);
  color: var(--chip-color);
}
.chip-done {
  border: 1px solid var(--border-accent);
  color: var(--text);
  background: var(--bg);
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* ---- Ingredient tags + glossary autocomplete ---- */
.ing-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ing-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 8px 8px 14px;
  font-size: 14px;
}
.tag-x {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 6px;
}
.tag-x:hover { opacity: 1; color: #fff; }
.ing-add { margin-bottom: 10px; }
.ing-input {
  width: 100%;
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  padding: 10px 12px;
}
.ing-input:focus { outline: none; border-color: var(--accent); }

/* ---- Bottom sheet (background editor) ---- */
.sheet-backdrop {
  position: fixed;
  top: 0;
  bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
}
.sheet {
  position: fixed;
  bottom: 0;
  z-index: 41;
  background: var(--card-elevated);
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 30px rgba(0,0,0,0.5);
}
.sheet-handle {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.15);
  margin: 0 auto 12px;
}
.sheet-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 4px;
}
.sheet-input {
  width: 100%;
  min-height: 150px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  padding: 12px;
  resize: vertical;
  margin: 10px 0 14px;
}
.sheet-input:focus { outline: none; border-color: var(--accent); }
.sheet-done {
  width: 100%;
  min-height: 48px;
  background: var(--accent);
  color: #121212;
  border: none;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Footnote + toast ---- */
.footnote {
  padding: 6px 16px 28px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-elevated);
  border: 1px solid var(--border-accent);
  color: var(--text);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 60;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.hidden { display: none !important; }