/* ============================================================
   DON SEGUNDO SOMBRA — MENÙ APP
   Mobile-first, zero framework, dark mode, WCAG AA
   ============================================================ */

/* ── CUSTOM PROPERTIES ────────────────────────────────────── */
:root {
  /* Paleta unificada con donsegundosombra.it (26/07/2026).
     Antes la carta tenia sus propios azules y dorados, heredados de la
     epoca de Odoo, y no se parecia al sitio.
       --gold / --celeste  -> SOLO sobre fondo oscuro
       --gold-ink / --cel-ink -> texto sobre fondo claro (cumplen AA)
       --cel-solid -> relleno con texto blanco encima            */
  --gold:      #EFA800;   /* 9,3:1 sobre la cabecera */
  --gold-ink:  #925D00;   /* 5,5:1 sobre blanco */
  --celeste:   #4E94C3;   /* 5,7:1 sobre la cabecera */
  --cel-ink:   #00649A;   /* 6,4:1 sobre blanco */
  --cel-solid: #0070AB;   /* blanco encima: 5,4:1 */
  --ink:     #001126;
  --cream:   #F7FAFC;
  --card-bg: #FFFFFF;
  --card-border: #E2E8F0;
  --text:    #1A2636;
  --text-soft: #5A7186;
  --footer-bg: #001126;
  --footer-text: #E8F0F7;
  --header-bg: #001126;
  --header-text: #FFFFFF;
  --search-bg: rgba(255,255,255,0.15);
  --search-text: #FFFFFF;
  --filter-bg: rgba(255,255,255,0.12);
  --filter-active: var(--gold);
  --sheet-bg: #FFFFFF;
  --sheet-text: #1A2636;
  --allergen-yes: #C53030;
  --allergen-may: #C05621;
  --allergen-no:  #276749;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,17,38,0.12);
  --transition: 200ms ease-out;
}

[data-theme="dark"] {
  --cream:     #0F1E2E;
  --card-bg:   #1A2D3E;
  --card-border: #2A3D52;
  --text:      #E8F0F7;
  --text-soft: #8BAABF;
  --sheet-bg:  #1A2D3E;
  --sheet-text: #E8F0F7;
  --search-bg: rgba(255,255,255,0.1);
  /* En oscuro las "tintas" tienen que volver a ser claras o desaparecen
     sobre la tarjeta: oro 6,9:1 y celeste 6,3:1 sobre #1A2D3E. */
  --gold-ink:  #EFA800;
  --cel-ink:   #7FB3DA;
  --cel-solid: #0070AB;
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Ensure [hidden] always wins over display:flex/block in components */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  /* Misma tipografia que donsegundosombra.it */
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ── HEADER ───────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  color: var(--header-text);
  padding: env(safe-area-inset-top, 0) 0 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 8px;
}
/* El Sol de Mayo del logo, igual que en la cabecera del sitio */
.brand { display: flex; align-items: center; gap: 9px; line-height: 1.2; }
.brand-sol { width: 32px; height: auto; flex-shrink: 0; }
.brand-txt { display: flex; flex-direction: column; }
@media (max-width: 360px) { .brand-sol { width: 26px; } }
.brand-name {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.brand-sub {
  font-size: 0.7rem;
  opacity: 0.75;
  color: #CFE3F5;
}
.header-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Lang switcher */
.lang-switcher { display: flex; gap: 2px; }
.lang-btn {
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  transition: all var(--transition);
  letter-spacing: 0.04em;
}
.lang-btn.active, .lang-btn:hover {
  color: var(--gold);
  background: rgba(239,168,0,0.18);
}

/* Icon button */
.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  transition: all var(--transition);
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Mesa bar */
.mesa-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--gold);
  color: #1A1000;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Search */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 12px 8px;
  background: var(--search-bg);
  border-radius: 10px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.1);
}
.search-icon { color: rgba(255,255,255,0.5); flex-shrink: 0; }
#search {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--search-text);
  font-size: 0.9rem;
  padding: 9px 0;
}
#search::placeholder { color: rgba(255,255,255,0.4); }
.search-clear {
  color: rgba(255,255,255,0.5);
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}
.search-clear:hover { color: #fff; }

/* Filters */
.filters-wrap {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters-wrap::-webkit-scrollbar { display: none; }
.filter-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  color: rgba(255,255,255,0.65);
  background: var(--filter-bg);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all var(--transition);
  flex-shrink: 0;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--gold);
  color: #1A1000;
  border-color: var(--gold);
}

/* ── CAT NAV ──────────────────────────────────────────────── */
#cat-nav {
  position: sticky;
  top: var(--header-h, 140px);
  z-index: 90;
  background: var(--cream);
  border-bottom: 1px solid var(--card-border);
  transition: top var(--transition);
}
#cat-nav-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
}
#cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-soft);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}
.cat-tab:hover { color: var(--cel-ink); }
.cat-tab.active { color: var(--cel-ink); border-bottom-color: var(--cel-ink); }
.cat-emoji { font-size: 1rem; }

/* ── MAIN / MENU CONTENT ──────────────────────────────────── */
#main { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0)); }

/* Loading */
.loading-msg {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 60px 16px;
  color: var(--text-soft); font-size: 0.9rem;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--card-border);
  border-top-color: var(--cel-ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* No results */
.no-results {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 60px 16px;
  color: var(--text-soft);
}
.no-results svg { opacity: 0.35; }
.no-results p { font-size: 0.9rem; }

/* Category section */
.menu-section { margin-bottom: 8px; }
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 12px;
  scroll-margin-top: 180px;
}
.section-emoji { font-size: 1.4rem; line-height: 1; }
.section-title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.section-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-soft);
  background: var(--card-border);
  padding: 2px 7px;
  border-radius: 10px;
}

/* Dish card */
.dish-list { display: flex; flex-direction: column; gap: 1px; }
.dish-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 60px;
}
.dish-card:active { background: rgba(61,139,196,0.06); }
.dish-img-thumb {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}
.dish-img-thumb.has-img {
  background: #f0ede8;
}
.dish-img-thumb.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.dish-info { flex: 1; min-width: 0; }
.dish-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}
.dish-subtitle {
  font-size: 0.71rem;
  color: var(--text-soft);
  font-style: italic;
  margin-bottom: 3px;
  line-height: 1.3;
  opacity: 0.85;
}
.dish-portion {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.dish-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag--veg { background: #EBF8F0; color: #276749; }
.tag--gf  { background: #FFF3E0; color: #744210; }
.tag--kid { background: #EBF4FF; color: #1A4F8A; }
.tag--rec { background: #FFF8E7; color: #7A4900; }
.dish-desc-preview {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.88rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.dish-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-ink);
  flex-shrink: 0;
  text-align: right;
  min-width: 46px;
}
.dish-fav-indicator {
  color: var(--gold-ink);
  font-size: 0.7rem;
  margin-top: 2px;
  text-align: right;
}

/* Classico card (special) */
.dish-card--classico {
  background: linear-gradient(135deg, rgba(201,155,63,0.08), rgba(61,139,196,0.06));
  border: 1px solid rgba(201,155,63,0.3);
  border-radius: var(--radius);
  margin: 0 12px;
  margin-bottom: 8px;
}

/* ── BOTTOM SHEET ─────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22,52,77,0.6);
  z-index: 200;
  backdrop-filter: blur(2px);
  animation: fade-in 200ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 201;
  background: var(--sheet-bg);
  color: var(--sheet-text);
  border-radius: var(--radius) var(--radius) 0 0;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  animation: slide-up 250ms cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-handle-wrap { display: flex; justify-content: center; padding: 10px 0 4px; flex-shrink: 0; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--card-border); }

.sheet-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.sheet-img-placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, rgba(61,139,196,0.1), rgba(201,155,63,0.1));
}
.sheet-img-hero {
  height: 220px;
  overflow: hidden;
  background: #f0ede8;
}
.sheet-img-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sheet-body { padding: 16px 20px 8px; }

.sheet-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--sheet-text);
  flex: 1;
}
.fav-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--card-border);
  transition: all var(--transition);
  margin-top: -4px;
}
.fav-btn.active { color: var(--gold-ink); fill: var(--gold-ink); }
.fav-btn.active svg { fill: var(--gold-ink); }
.fav-btn:hover { background: rgba(201,155,63,0.1); }

.sheet-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.sheet-portion { font-size: 0.8rem; color: var(--text-soft); }
.sheet-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-ink);
}
.sheet-desc {
  font-family: "EB Garamond", Georgia, serif;
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-soft);
}
.sheet-served-with {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--cel-ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sheet-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--card-border); }
.sheet-section--soft { background: rgba(61,139,196,0.04); border-radius: var(--radius-sm); padding: 12px 14px; margin: 16px 0 0; border-top: none; }
.sheet-section-h {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 10px;
}

/* Ingredients */
.ingredient-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ingredient-list li {
  font-size: 0.8rem;
  background: var(--card-border);
  padding: 4px 10px;
  border-radius: 20px;
  color: var(--text);
}
.remove-list { display: flex; flex-wrap: wrap; gap: 6px; }
.remove-list li {
  font-size: 0.8rem;
  background: rgba(0,100,154,0.08);
  border: 1px solid rgba(0,100,154,0.28);
  color: var(--cel-ink);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex; align-items: center; gap: 5px;
}
.remove-list li::before { content: "∅"; font-size: 0.75rem; opacity: 0.7; }

/* Allergen grid */
.allergen-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.allergen-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
}
.allergen-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}
.allergen-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.allergen-icon--yes  { background: rgba(197,48,48,0.12); }
.allergen-icon--may  { background: rgba(192,86,33,0.12); }
.allergen-icon--no   { background: rgba(39,103,73,0.08); opacity: 0.5; }
.allergen-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  color: var(--text-soft);
}

/* Cooking buttons */
.cooking-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cooking-btn {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--card-border);
  color: var(--text-soft);
  background: var(--card-bg);
  transition: all var(--transition);
  cursor: pointer;
}
.cooking-btn.selected {
  border-color: var(--gold-ink);
  color: var(--gold-ink);
  background: rgba(239,168,0,0.10);
}
.cooking-btn:hover { border-color: var(--gold-ink); color: var(--gold-ink); }

/* Included list (classico) */
.included-list { display: flex; flex-direction: column; gap: 8px; }
.included-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.87rem; color: var(--text);
  line-height: 1.4;
}
.included-list li::before { content: "✦"; color: var(--gold-ink); font-size: 0.7rem; margin-top: 3px; flex-shrink: 0; }

.sheet-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--card-border);
  flex-shrink: 0;
}
.sheet-close-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--cel-solid);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  transition: all var(--transition);
}
.sheet-close-btn:hover { background: #2E6FA0; }

/* ── FOOTER ───────────────────────────────────────────────── */
#app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 80;
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -4px 20px rgba(22,52,77,0.25);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.footer-hours {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 0.72rem; line-height: 1.4;
  color: rgba(232,240,247,0.75);
  flex: 1; min-width: 0;
}
.footer-hours svg { flex-shrink: 0; margin-top: 2px; }
.footer-links { display: flex; gap: 8px; flex-shrink: 0; }
.footer-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: var(--footer-text);
  transition: all var(--transition);
  white-space: nowrap;
}
.footer-btn:hover { background: rgba(255,255,255,0.2); }
.footer-btn--wa { background: rgba(37,211,102,0.2); color: #25D366; }
.footer-btn--wa:hover { background: rgba(37,211,102,0.3); }

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: #1A2636;
  color: #fff;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  animation: toast-in 200ms ease-out;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
@keyframes toast-in { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── ACCESSIBILITY ────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--cel-solid);
  outline-offset: 2px;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── DESKTOP ──────────────────────────────────────────────── */
@media (min-width: 640px) {
  .dish-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
  }
  .dish-card--classico { grid-column: 1 / -1; }
  .sheet { max-width: 480px; left: 50%; right: auto; transform: translateX(-50%); }
  @keyframes slide-up { from { transform: translateX(-50%) translateY(100%); } to { transform: translateX(-50%) translateY(0); } }
}
@media (min-width: 960px) {
  #main { max-width: 960px; margin: 0 auto; }
  .dish-list { grid-template-columns: repeat(3, 1fr); }
  #app-footer { display: none; }
}

/* ── Image notice bar ── */
.img-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: oklch(97% 0.02 85);
  border-bottom: 1px solid oklch(90% 0.03 85);
  font-size: 0.72rem;
  color: oklch(45% 0.05 70);
  line-height: 1;
}
.img-notice svg { flex-shrink: 0; opacity: 0.7; }
.img-notice span { flex: 1; }
.img-notice-close {
  background: none; border: none; cursor: pointer;
  font-size: 0.75rem; color: inherit; opacity: 0.5;
  padding: 2px 4px; line-height: 1;
}
.img-notice-close:hover { opacity: 1; }
