/* Mostrador Digital - estilos del catálogo.
   Los colores y tipografías de cada cliente se cambian en index.html (bloque :root). */

:root {
  --c-fondo: #ffffff;
  --c-superficie: #f2f2f0;
  --c-texto: #1d1d1b;
  --c-suave: #66645e;
  --c-linea: rgba(0, 0, 0, .1);
  --c-linea-fuerte: rgba(0, 0, 0, .22);
  --c-primario: #1d1d1b;
  --c-sobre-primario: #ffffff;
  --c-acento: #e9e4d8;
  --c-sobre-acento: #1d1d1b;
  --c-papel: #fffefb;
  --c-comanda: #1d1d1b;
  --c-wa: #128c4a;
  --f-titulos: system-ui, sans-serif;
  --f-texto: system-ui, sans-serif;
  --peso-titulos: 800;
  --tt-titulos: none;
  --track-titulos: -0.02em;
  --radio: 14px;
  --foto-grilla: 4 / 5;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  font-family: var(--f-texto);
  font-size: 16px;
  line-height: 1.5;
  background: var(--c-fondo);
  color: var(--c-texto);
  -webkit-font-smoothing: antialiased;
}
body.con-pedido { padding-bottom: 96px; }
body.bloqueado { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--c-primario); outline-offset: 2px; }
[hidden] { display: none !important; }

.contenedor { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 18px; }

/* ---------- aviso de demostración ---------- */
.demo-aviso {
  margin: 0;
  padding: 7px 16px;
  font-size: 13px;
  text-align: center;
  background: var(--c-texto);
  color: var(--c-fondo);
}

/* ---------- portada ---------- */
.portada {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(58vh, 520px);
  background: var(--c-comanda);
  color: #fff;
  overflow: hidden;
}
.portada-foto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portada::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, .78) 100%);
}
.portada-contenido {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px 26px;
}
.portada-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 14px; background: #fff; }
.portada h1 {
  margin: 0 0 10px;
  font-family: var(--f-titulos);
  font-weight: var(--peso-titulos);
  text-transform: var(--tt-titulos);
  letter-spacing: var(--track-titulos);
  font-size: clamp(46px, 14vw, 112px);
  line-height: .88;
  text-wrap: balance;
}
.portada p { margin: 0; max-width: 34ch; font-size: 17px; line-height: 1.4; opacity: .92; }

/* ---------- datos del local ---------- */
.info { border-bottom: 1px solid var(--c-linea); }
.info-interior { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 18px; }
.info-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; color: var(--c-suave); }
.info-lista li { display: flex; gap: 10px; align-items: flex-start; }
.info-lista svg { width: 18px; height: 18px; margin-top: 2px; color: var(--c-texto); }
.info-lista a { text-underline-offset: 3px; }
.info-acciones { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- botones ---------- */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.boton:disabled { opacity: .5; cursor: not-allowed; }
.boton-primario { flex: 1; justify-content: space-between; background: var(--c-primario); color: var(--c-sobre-primario); }
.boton-primario:disabled { justify-content: center; }
.boton-precio { font-variant-numeric: tabular-nums; }
.boton-wa { background: var(--c-wa); color: #fff; }
.boton-sec { background: transparent; color: var(--c-texto); box-shadow: inset 0 0 0 1.5px var(--c-linea-fuerte); }
.boton.ancho { width: 100%; }

/* ---------- barra de categorías ---------- */
.barra {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--c-fondo);
  border-bottom: 1px solid var(--c-linea);
}
.barra-interior { display: flex; align-items: center; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.barra-buscar, .buscador-cerrar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--c-superficie);
  cursor: pointer;
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: var(--c-suave);
  background: var(--c-superficie);
}
.chip[aria-current="true"] { background: var(--c-texto); color: var(--c-fondo); }
.buscador { display: flex; gap: 8px; flex: 1; }
.buscador input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 16px;
  border: 1.5px solid var(--c-linea-fuerte);
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
  background: var(--c-fondo);
  color: var(--c-texto);
}

/* ---------- secciones ---------- */
.contenido { padding-bottom: 40px; }
.categoria, .destacados { padding-top: 40px; }
.cat-titulo {
  margin: 0 0 6px;
  font-family: var(--f-titulos);
  font-weight: var(--peso-titulos);
  text-transform: var(--tt-titulos);
  letter-spacing: var(--track-titulos);
  font-size: clamp(30px, 8.5vw, 46px);
  line-height: 1;
}
.cat-desc { margin: 0 0 6px; max-width: 60ch; color: var(--c-suave); }
.destacados .cat-titulo { margin-bottom: 16px; }

/* ---------- producto (común) ---------- */
.prod { position: relative; }
.prod-nombre { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 700; }
.prod-abrir {
  all: unset;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.prod-abrir::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radio); }
.prod-abrir:focus-visible::after { outline: 3px solid var(--c-primario); outline-offset: 4px; }
.prod-desc {
  margin: 4px 0 0;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--c-suave);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-precio { margin: 8px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.precio-anterior { font-weight: 500; color: var(--c-suave); margin-right: 4px; }
.prod-media { position: relative; background: var(--c-superficie); border-radius: var(--radio); overflow: hidden; }
.prod-foto { width: 100%; height: 100%; object-fit: cover; }
.foto-vacia { display: grid; place-items: center; width: 100%; height: 100%; font-family: var(--f-titulos); font-size: 34px; font-weight: var(--peso-titulos); color: var(--c-suave); }
.prod-mas {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c-fondo);
  color: var(--c-texto);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.prod-mas:active { transform: scale(.92); }
.agotado .prod-foto { filter: grayscale(1); opacity: .55; }
.agotado .prod-precio { color: var(--c-suave); }

.etiquetas { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.etiqueta {
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--c-acento);
  color: var(--c-sobre-acento);
}
.etiqueta-agotado { background: var(--c-texto); color: var(--c-fondo); }

/* ---------- estilo lista (menús) ---------- */
.cat-lista .productos { display: grid; grid-template-columns: 1fr; }
.prod-lista {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 16px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--c-linea);
}
.prod-lista .prod-media { width: 112px; height: 112px; }
@media (min-width: 900px) {
  .cat-lista .productos { grid-template-columns: 1fr 1fr; column-gap: 56px; }
  .prod-lista { grid-template-columns: 1fr 128px; }
  .prod-lista .prod-media { width: 128px; height: 128px; }
}

/* ---------- estilo grilla (tiendas) ---------- */
.cat-grilla .productos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; margin-top: 18px; }
@media (min-width: 720px) { .cat-grilla .productos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 20px; } }
@media (min-width: 1040px) { .cat-grilla .productos { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.prod-grilla, .prod-destacado { display: flex; flex-direction: column; }
.prod-grilla .prod-media, .prod-destacado .prod-media { order: -1; margin-bottom: 10px; }
.prod-grilla .prod-media { aspect-ratio: var(--foto-grilla); }
.prod-grilla .prod-nombre { font-size: 15.5px; }
.prod-grilla .prod-desc { font-size: 13.5px; }
.prod-grilla .prod-precio { margin-top: 4px; }
.prod-grilla .etiquetas, .prod-destacado .etiquetas { position: absolute; top: 8px; left: 8px; margin: 0; z-index: 2; }

/* ---------- destacados ---------- */
.destacados-fila {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(74%, 280px);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -18px;
  padding: 0 18px 4px;
  scroll-padding: 0 18px;
}
.destacados-fila::-webkit-scrollbar { display: none; }
.prod-destacado { scroll-snap-align: start; }
.prod-destacado .prod-media { aspect-ratio: 4 / 3; }
.prod-destacado .prod-desc { -webkit-line-clamp: 1; }

/* ---------- sin resultados ---------- */
.sin-resultados { padding: 48px 0 24px; text-align: center; color: var(--c-suave); }
.sin-resultados p { margin: 0 0 16px; }

/* ---------- pie ---------- */
.pie { padding: 36px 0 44px; background: var(--c-superficie); font-size: 14.5px; color: var(--c-suave); }
.pie p { margin: 0 0 4px; }
.pie-nombre { font-family: var(--f-titulos); font-weight: var(--peso-titulos); text-transform: var(--tt-titulos); font-size: 24px; color: var(--c-texto); margin-bottom: 8px !important; }
.pie-fecha { margin-top: 12px !important; font-size: 13px; }
.firma { margin-top: 22px !important; font-size: 12.5px; opacity: .8; }

/* ---------- barra inferior del pedido ---------- */
.barra-pedido {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px 0 10px;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: var(--c-primario);
  color: var(--c-sobre-primario);
  font-weight: 700;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .55);
  cursor: pointer;
  animation: aparecer .3s ease-out;
}
.bp-cant {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .2);
  font-variant-numeric: tabular-nums;
}
.bp-texto { flex: 1; text-align: left; }
.bp-total { font-variant-numeric: tabular-nums; }

/* ---------- hojas (ventanas) ---------- */
dialog.hoja {
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--c-fondo);
  color: var(--c-texto);
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.hoja[open] { animation: subir .28s cubic-bezier(.2, .8, .2, 1); }
dialog.hoja::backdrop { background: rgba(10, 8, 6, .55); }
@media (min-width: 720px) {
  dialog.hoja { margin: auto; max-width: 520px; border-radius: 22px; max-height: 88vh; }
}
.hoja-cuerpo { position: relative; }
.cerrar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: #1d1d1b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  cursor: pointer;
}
.hoja-foto { width: 100%; aspect-ratio: 4 / 3; max-height: 48vh; object-fit: cover; background: var(--c-superficie); }
.hoja-texto { padding: 22px 20px 8px; }
.hoja-texto h2 {
  margin: 0 48px 4px 0;
  font-family: var(--f-titulos);
  font-weight: var(--peso-titulos);
  letter-spacing: var(--track-titulos);
  font-size: 30px;
  line-height: 1.05;
}
.hoja-desc { margin: 10px 0 0; color: var(--c-suave); }
.hoja-detalle { margin: 8px 0 0; font-size: 14px; color: var(--c-suave); }
.hoja-texto .prod-precio { font-size: 20px; margin-top: 12px; }
.hoja-pie {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 12px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--c-fondo);
  border-top: 1px solid var(--c-linea);
}
.hoja-pie .boton-wa { flex: 1; }

.grupo { margin: 22px 0 0; padding: 0; border: 0; min-width: 0; }
.grupo legend { display: flex; gap: 10px; align-items: baseline; padding: 0; margin-bottom: 10px; font-weight: 700; }
.grupo-ayuda { font-size: 13px; font-weight: 500; color: var(--c-suave); }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.opcion span {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 46px;
  padding: 11px 15px;
  border-radius: 11px;
  box-shadow: inset 0 0 0 1.5px var(--c-linea-fuerte);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.opcion small { font-weight: 500; font-size: 13px; opacity: .75; font-variant-numeric: tabular-nums; }
.opcion input:checked + span { background: var(--c-texto); color: var(--c-fondo); box-shadow: none; }
.opcion input:focus-visible + span { outline: 3px solid var(--c-primario); outline-offset: 2px; }
.opcion input:disabled + span { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
.error-form { margin: 14px 0 0; min-height: 1px; color: #c0281b; font-weight: 600; font-size: 14.5px; }
.error-form:empty { margin: 0; }

.cantidad { display: flex; align-items: center; flex: none; border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--c-linea-fuerte); }
.cantidad button { display: grid; place-items: center; width: 44px; height: 48px; padding: 0; border: 0; background: none; cursor: pointer; }
.cantidad button:disabled { opacity: .3; cursor: default; }
.cantidad output { min-width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- comanda: el ticket del pedido ---------- */
.hoja-comanda { background: var(--c-comanda) !important; color: #fff !important; }
.comanda-cabecera { position: relative; padding: 22px 20px 26px; }
.comanda-cabecera h2 { margin: 0; font-family: var(--f-titulos); font-weight: var(--peso-titulos); text-transform: var(--tt-titulos); letter-spacing: var(--track-titulos); font-size: 30px; line-height: 1; }
.comanda-cabecera .cerrar { top: 14px; }
.ticket {
  position: relative;
  margin: 0 16px;
  padding: 22px 18px 22px;
  background: var(--c-papel);
  color: #24211e;
}
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 9px;
  background-size: 18px 9px;
  background-repeat: repeat-x;
}
.ticket::before { top: -9px; background-image: conic-gradient(from 135deg at 50% 0, var(--c-papel) 90deg, transparent 0); }
.ticket::after { bottom: -9px; background-image: conic-gradient(from -45deg at 50% 100%, var(--c-papel) 90deg, transparent 0); }
.ticket-local { margin: 0; text-align: center; font-family: var(--f-titulos); font-weight: var(--peso-titulos); text-transform: var(--tt-titulos); font-size: 20px; }
.ticket-fecha { margin: 2px 0 14px; padding-bottom: 14px; text-align: center; font-size: 13px; color: #85807a; border-bottom: 1.5px dashed #d6d0c8; }
.ticket-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.linea { display: flex; align-items: baseline; gap: 6px; }
.linea-nombre { font-weight: 700; }
.puntos { flex: 1; min-width: 14px; border-bottom: 2px dotted #c9c2b8; transform: translateY(-4px); }
.linea-precio { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.linea-detalle { margin: 2px 0 0; font-size: 13.5px; color: #77716a; }
.cantidad.mini { display: inline-flex; margin-top: 8px; box-shadow: inset 0 0 0 1.5px #ddd6cc; border-radius: 10px; }
.cantidad.mini button { width: 38px; height: 36px; }
.cantidad.mini svg { width: 16px; height: 16px; }
.ticket-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1.5px dashed #d6d0c8;
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ticket-nota { margin: 6px 0 0; font-size: 13px; color: #85807a; }

.datos-cliente { display: grid; gap: 4px; padding: 30px 20px calc(26px + env(safe-area-inset-bottom)); }
.campo { display: grid; gap: 7px; margin-top: 16px; font-size: 14.5px; font-weight: 600; }
.campo:first-child { margin-top: 0; }
.opcional { font-weight: 400; opacity: .7; }
.campo input, .campo textarea {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  background: #fff;
  color: #1d1d1b;
  resize: vertical;
}
.grupo-oscuro { margin-top: 18px; }
.grupo-oscuro legend { font-size: 14.5px; font-weight: 600; }
.grupo-oscuro .opcion span { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3); }
.grupo-oscuro .opcion input:checked + span { background: #fff; color: #1d1d1b; }
.grupo-oscuro .opcion input:focus-visible + span, .datos-cliente :focus-visible { outline-color: #fff; }
.datos-cliente .error-form { color: #ffb4a8; }
.datos-cliente .boton-wa { margin-top: 18px; min-height: 54px; font-size: 16px; }
.comanda-ayuda { margin: 8px 0 0; font-size: 13px; text-align: center; opacity: .7; }
.vaciar { justify-self: center; margin-top: 10px; padding: 8px 12px; border: 0; background: none; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; opacity: .75; cursor: pointer; }

/* ---------- aviso flotante ---------- */
.aviso {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 40;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--c-texto);
  color: var(--c-fondo);
  font-size: 14.5px;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.aviso.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- error de datos ---------- */
.error-datos { max-width: 560px; margin: 15vh auto; padding: 24px; font-family: system-ui, sans-serif; }
.error-datos code { background: #f1f1f1; padding: 2px 6px; border-radius: 4px; }

@keyframes subir { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
