/* ===========================================================================
   templates/legacy/style.css — plantilla CLÁSICA/LEGACY depurada.
   Barras de categoría de color (acordeón) + tarjetas con vista lista/rejilla.
   Tokens: --accent y --font-family los inyecta el motor (:root).
   =========================================================================== */

:root {
  --accent: #c0392b;
  --font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --on-accent: #fff;
}
html[data-theme="light"] { --bg: #eeeeee; --surface: #ffffff; --text: #222; --muted: #777; --line: #e2e2e2; --bar: rgba(255,255,255,.96); }
html[data-theme="dark"]  { --bg: #121212; --surface: #1d1d1f; --text: #f0f0f0; --muted: #9a9a9a; --line: #2c2c2e; --bar: rgba(18,18,18,.96); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Fondo texturado legacy (bg.jpg en mosaico) con el marco blanco de la carta encima. */
body { font-family: var(--font-family); background-color: var(--bg); background-image: url("bg.jpg"); color: var(--text); -webkit-font-smoothing: antialiased; padding: 10px 10px 80px; font-size: calc(1rem * var(--lg-zoom, 1)); }
html[data-theme="dark"] body { background-image: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* Marco blanco que enmarca la carta y la separa del fondo (estética legacy .well). */
.lg-frame { max-width: 900px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 3px 16px rgba(0,0,0,.18); }

/* ---- topbar (barra de color de acento; ocupa el ancho del marco de la carta) ---- */
.lg-topbar { background: var(--accent); }
.lg-topbar-in { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.lg-brand { font-weight: 700; font-size: 1.05rem; flex: 0 0 auto; color: var(--on-accent); }
.lg-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lg-lang { font: inherit; font-size: .85rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
.lg-search { font: inherit; font-size: .9rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); width: 140px; }
.lg-search:focus { outline: 2px solid var(--accent); width: 180px; }

/* ---- logo / portada / mensaje ---- */
/* imagen superior al 100% del ancho del marco de la carta (misma columna, móvil y desktop) */
.lg-logo { text-align: center; padding: 8px 12px 6px; }
.lg-logo img { width: 100%; max-width: 100%; height: auto; margin: 0; object-fit: contain; }
.lg-hero { line-height: 0; }
.lg-hero img { width: 100%; max-height: 220px; object-fit: cover; }
.lg-msg { text-align: center; font-weight: 700; color: var(--text); margin: 8px 0 4px; padding: 0 16px; }

/* ---- layout (dentro del marco) ---- */
.lg-main { padding: 10px 12px; }

/* ---- barra de color colapsable ---- */
.lg-block { margin: 10px 0; }
/* Degradado vertical (claro arriba -> oscuro abajo) derivado del acento: aspecto
   "tridimensional" de las barras legacy. Fallback plano para navegadores sin
   color-mix. El borde oscuro + brillo interno superior refuerzan el relieve. */
.lg-bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--accent);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent), #fff 14%) 0%, color-mix(in srgb, var(--accent), #000 24%) 100%);
  color: var(--on-accent); border: 1px solid color-mix(in srgb, var(--accent), #000 32%); cursor: pointer;
  font: inherit; font-weight: 600; font-size: 1.05rem; text-align: left; padding: 13px 16px; border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.lg-bar-ico { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; flex: 0 0 auto; }
.lg-bar[aria-expanded="false"] .lg-bar-ico { transform: rotate(-45deg); }
.lg-block-body { padding: 10px 2px 2px; }
.lg-block-body[hidden] { display: none; }
.lg-cat-desc { text-align: center; color: var(--muted); margin: 4px 0 12px; }
/* banner de imagen de categoría (estética clásica): foto centrada bajo la barra */
.lg-cat-img { margin: 2px 0 12px; }
.lg-cat-img img { width: 100%; max-width: 100%; height: auto; margin: 0; border-radius: 8px; }

/* ---- items: rejilla / lista ---- */
.lg-items { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 520px) { .lg-items { grid-template-columns: 1fr; } }

.lg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.lg-card-img { position: relative; aspect-ratio: 4 / 3; background: var(--bg); }
.lg-card-img img { width: 100%; height: 100%; object-fit: cover; }
.lg-num { position: absolute; top: 8px; left: 8px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .8rem; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.lg-card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.lg-card-h { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.lg-card-body > .lg-card-h > .lg-num { position: static; }
.lg-card-name { margin: 0; font-size: 1rem; font-weight: 600; flex: 1; }
.lg-card-desc { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.lg-card-price { margin-top: auto; font-weight: 700; color: var(--accent); }
.lg-card-price em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .8rem; }
.lg-allergens { display: inline-flex; gap: 4px; }
.lg-allergens img { width: 16px; height: 16px; object-fit: contain; }

/* vista LISTA (global o forzada por categoría) */
body.lg-view-list .lg-items:not(.lg-force-grid),
.lg-items.lg-force-list { grid-template-columns: 1fr; }
body.lg-view-list .lg-items:not(.lg-force-grid) .lg-card,
.lg-items.lg-force-list .lg-card { flex-direction: row; align-items: stretch; }
body.lg-view-list .lg-items:not(.lg-force-grid) .lg-card-img,
.lg-items.lg-force-list .lg-card-img { flex: 0 0 96px; width: 96px; aspect-ratio: 1 / 1; }

/* ---- menú / plato del día ---- */
.lg-meal { text-align: center; }
.lg-meal-img img { max-height: 200px; margin: 0 auto 10px; border-radius: 8px; }
.lg-meal-course { margin: 8px 0; }
.lg-meal-price { font-weight: 700; color: var(--accent); margin-top: 10px; }
.lg-meal-price em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .82rem; }

.lg-no-results { text-align: center; color: var(--muted); padding: 26px 0; }
.lg-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 22px 0 8px; }
.lg-madeby { margin: 4px 0 0; font-size: .8rem; }
.lg-madeby a { color: var(--accent); font-weight: 600; text-decoration: none; }
.lg-madeby a:hover { text-decoration: underline; }

/* ---- barra inferior fija ---- */
.lg-bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--bar); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.lg-bottombar-in { max-width: 900px; margin: 0 auto; padding: 8px 14px; display: flex; align-items: center; gap: 8px; }
.lg-bb-sp { flex: 1; }
.lg-bb-btn { min-width: 40px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.lg-bb-btn.is-active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.lg-bb-wa { background: #25D366; border-color: #25D366; }
.lg-bb-call { font-size: 1.5rem; }

/* ---- modales ---- */
.lg-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.5); }
@media (min-width: 600px){ .lg-modal { align-items: center; } }
.lg-modal[hidden] { display: none; }
.lg-modal-box { position: relative; width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--surface); color: var(--text); border-radius: 14px 14px 0 0; padding: 22px 18px; }
@media (min-width: 600px){ .lg-modal-box { border-radius: 12px; } }
.lg-modal-box h2 { margin: 0 0 12px; }
.lg-modal-box p { line-height: 1.5; margin: 0 0 12px; }
.lg-modal-x { position: absolute; top: 12px; right: 12px; border: none; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.lg-allergen-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lg-allergen-legend li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.lg-allergen-legend img { width: 22px; height: 22px; object-fit: contain; }
body.lg-modal-open { overflow: hidden; }

/* Subcategorías (Bloque 8): título de grupo + barras hijas sangradas. */
.lg-group-title { font-size: 1.2rem; font-weight: 700; margin: 18px 0 6px; }
.lg-block[data-sub] { margin-left: 14px; }
