/* La tienda web del bar (PF5). El color es el del bar (--color, lo pone tienda.js); lo demás, igual para todos. */
:root {
  --color: #b3261e;
  --fondo: #faf8f5;
  --papel: #ffffff;
  --tinta: #1d1b19;
  --suave: #6b6560;
  --linea: #e7e2dc;
  --radio: 14px;
  --sombra: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 6%);
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fondo); color: var(--tinta); padding-bottom: 96px; }
img { display: block; }
a { color: var(--color); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--color); outline-offset: 2px; }

.saltar { position: absolute; left: -999px; top: 8px; background: var(--papel); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.saltar:focus { left: 8px; }

/* La cabecera, con el color del bar. */
.cabecera { background: var(--color); color: #fff; }
.cabecera-dentro { max-width: 760px; margin: 0 auto; padding: 20px 16px 22px; display: flex; gap: 14px; align-items: center; }
.logo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #fff; border: 3px solid rgb(255 255 255 / 70%); }
.bar { margin: 0; font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.01em; }
.donde { margin: 2px 0 0; opacity: 0.9; font-size: 0.9rem; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.cargando, .vacio, .cerrado { text-align: center; color: var(--suave); padding: 32px 8px; }
.cerrado { background: #fff4e5; color: #6a4300; border-radius: var(--radio); padding: 14px 16px; margin: 16px 0; }

/* La mesa, o cómo lo quieres. */
.mesa { margin: 16px 0; padding: 14px 16px; border-radius: var(--radio); background: var(--papel); box-shadow: var(--sombra); }
.mesa strong { font-size: 1.15rem; }
.mesa span { display: block; color: var(--suave); font-size: 0.92rem; margin-top: 2px; }
.una-puerta { margin: 16px 0 4px; color: var(--suave); }
.una-puerta strong { color: var(--tinta); }
.puertas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 16px 0 6px; padding: 4px; background: #efebe6; border-radius: 999px; }
.puerta { border: 0; background: transparent; border-radius: 999px; padding: 10px 8px; font-weight: 600; display: grid; line-height: 1.2; }
.puerta small { font-weight: 400; color: var(--suave); font-size: 0.8rem; }
.puerta.activa { background: var(--papel); box-shadow: var(--sombra); color: var(--color); }

/* Filtrar por alérgenos. */
.filtro { margin: 10px 0; }
.filtro summary { cursor: pointer; color: var(--suave); font-size: 0.95rem; padding: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.chip { border: 1px solid var(--linea); background: var(--papel); border-radius: 999px; padding: 6px 12px; font-size: 0.9rem; }
.chip.activo { background: var(--color); border-color: var(--color); color: #fff; }

/* Las familias, pegadas arriba al bajar. */
.familias {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; margin: 0 -16px;
  background: rgb(250 248 245 / 94%); backdrop-filter: blur(6px); border-bottom: 1px solid var(--linea); scrollbar-width: none;
}
.familias::-webkit-scrollbar { display: none; }
.familias a { flex: none; text-decoration: none; color: var(--tinta); font-weight: 600; padding: 8px 14px; border-radius: 999px; background: var(--papel); border: 1px solid var(--linea); }
.familias a:hover { border-color: var(--color); color: var(--color); }

.familia { scroll-margin-top: 64px; }
.familia h2 { font-size: 1.3rem; margin: 26px 0 10px; }
.productos { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 700px) { .productos { grid-template-columns: 1fr 1fr; } }

.producto {
  width: 100%; height: 100%; text-align: left; border: 0; background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start;
}
.producto:hover:not(:disabled) { box-shadow: 0 0 0 2px var(--color), var(--sombra); }
.producto .texto { display: grid; gap: 4px; min-width: 0; }
.producto .nombre { font-weight: 700; font-size: 1.02rem; }
.producto .descripcion { color: var(--suave); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.producto .precio { font-weight: 700; color: var(--color); margin-top: 2px; }
.producto .foto { width: 104px; height: 104px; object-fit: cover; border-radius: 10px; background: #eee; }
.producto.agotado { opacity: 0.55; }
.producto.agotado .precio { color: var(--suave); }

.alergenos { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.alergenos li { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; padding: 2px 6px; border-radius: 6px; background: #f3e8d7; color: #6a4300; }
.alergenos li.trazas { background: transparent; border: 1px dashed #c9a46a; }

/* La barra del pedido, abajo. */
.barra-pedido { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--fondo) 30%); z-index: 10; }
.ver-pedido {
  max-width: 728px; margin: 0 auto; width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  border: 0; border-radius: 999px; background: var(--color); color: #fff; font-weight: 700; padding: 14px 20px; box-shadow: 0 6px 20px rgb(0 0 0 / 20%);
}
.ver-pedido .cuantos { background: rgb(255 255 255 / 25%); border-radius: 999px; min-width: 28px; padding: 2px 8px; }
.ver-pedido .ver { text-align: left; }

/* Las hojas (un producto, el pedido). */
.hoja { border: 0; padding: 0; width: min(560px, 100%); max-height: 92vh; border-radius: 20px 20px 0 0; margin: auto auto 0; background: var(--papel); color: var(--tinta); }
@media (min-width: 640px) { .hoja { border-radius: 20px; margin: auto; } }
.hoja::backdrop { background: rgb(0 0 0 / 45%); }
.dentro { padding: 20px 18px 18px; display: grid; gap: 12px; position: relative; }
.dentro h2 { margin: 0; font-size: 1.35rem; padding-right: 36px; }
.cerrar { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f0ece7; font-size: 1.4rem; line-height: 1; }
.foto-grande { width: calc(100% + 36px); margin: -20px -18px 0; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 20px 20px 0 0; }
.dentro .descripcion, .lleva, .nota { color: var(--suave); margin: 0; font-size: 0.92rem; }

.grupo { border: 0; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.grupo legend { font-weight: 700; padding: 0; margin-bottom: 4px; width: 100%; display: flex; justify-content: space-between; }
.grupo legend small { font-weight: 400; color: var(--suave); }
.opcion { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--linea); border-radius: 10px; }
.opcion:has(input:checked) { border-color: var(--color); background: color-mix(in srgb, var(--color) 6%, white); }
.opcion input { accent-color: var(--color); width: 20px; height: 20px; margin: 0; }
.opcion small { color: var(--suave); }
.opcion .extra { color: var(--suave); font-size: 0.92rem; }

.campo { display: grid; gap: 4px; font-size: 0.92rem; font-weight: 600; }
.campo input, .campo select { font-weight: 400; padding: 11px 12px; border: 1px solid var(--linea); border-radius: 10px; background: #fff; width: 100%; }
.datos { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.datos legend { font-weight: 700; margin-bottom: 4px; padding: 0; }

.pie-hoja { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; position: sticky; bottom: 0; background: var(--papel); padding-top: 8px; }
.cantidad { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--linea); border-radius: 999px; padding: 2px; }
.cantidad button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f0ece7; font-size: 1.15rem; }
.cantidad span { min-width: 24px; text-align: center; font-weight: 700; }
.principal { border: 0; border-radius: 999px; background: var(--color); color: #fff; font-weight: 700; padding: 13px 18px; }
.principal:disabled { background: #cfc9c2; }
.principal.grande { width: 100%; font-size: 1.05rem; padding: 15px; }

.lineas { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lineas li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.lineas .que { display: grid; }
.lineas small { color: var(--suave); }
.lineas .importe { font-weight: 600; min-width: 72px; text-align: right; }
.lineas .cantidad button { width: 30px; height: 30px; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0; font-size: 1.05rem; }
.total strong { font-size: 1.3rem; }
.error { color: #b3261e; font-weight: 600; margin: 0; }

.seguimiento { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 20px 18px; margin: 20px 0; display: grid; gap: 10px; }
.seguimiento h2 { margin: 0; }
.estado { font-size: 1.25rem; font-weight: 700; color: var(--color); margin: 0; }
.estado.malo { color: #6b6560; }
.boton { display: inline-block; text-decoration: none; border-radius: 999px; padding: 10px 18px; border: 1px solid var(--color); font-weight: 600; }

.legal { background: var(--papel); border-radius: var(--radio); padding: 4px 18px 18px; margin: 20px 0; }
.legal h2 { font-size: 1.15rem; margin: 18px 0 6px; }
.legal p { margin: 0 0 8px; }

.pie { max-width: 760px; margin: 32px auto 0; padding: 0 16px; color: var(--suave); font-size: 0.85rem; text-align: center; }
.pie a { color: var(--suave); }
.hecho { opacity: 0.7; }

.aviso { position: fixed; left: 16px; right: 16px; bottom: 90px; max-width: 520px; margin: 0 auto; background: #1d1b19; color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 30; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* El buscador y, en el escritorio, tres columnas: las familias | la carta | tu pedido, siempre a la vista. */
.lateral { margin: 14px 0 4px; }
.lateral ul { display: none; }
.buscador { width: 100%; padding: 11px 16px; border: 1px solid var(--linea); border-radius: 999px; background: var(--papel); }
.buscador:focus { outline: 2px solid var(--color); outline-offset: 1px; }
.tu-pedido .dentro { padding: 18px 16px; }
.tu-pedido h2 { font-size: 1.2rem; }

@media (min-width: 1000px) {
  main, .cabecera-dentro, .pie { max-width: 1400px; }
  body { padding-bottom: 32px; }
  .tres { display: grid; grid-template-columns: 220px minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
  .lateral { position: sticky; top: 16px; margin: 20px 0 0; max-height: calc(100vh - 32px); overflow: auto; }
  .lateral ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
  .lateral a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--tinta); text-decoration: none; font-weight: 600; }
  .lateral a:hover { background: color-mix(in srgb, var(--color) 8%, white); color: var(--color); }
  .centro .familias { display: none; }
  .tu-pedido { position: sticky; top: 16px; margin-top: 20px; background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); max-height: calc(100vh - 32px); overflow: auto; }
  .barra-pedido { display: none; }
}
