/* ==========================================================================
   Pedido y ticket virtual (pedido.js)
   Los colores y fuentes salen de variables: la carta usa los del salón y la
   carta de alérgenos las redefine en alergenos.css.
   ========================================================================== */

:root {
  --pd-fondo: #151413;
  --pd-fondo-2: #1e1d1b;
  --pd-fondo-3: #282624;
  --pd-borde: rgba(255, 255, 255, .08);
  --pd-borde-2: rgba(255, 255, 255, .15);
  --pd-texto: #f1ebe0;
  --pd-suave: #b8afa1;
  --pd-acento: #d9a35b;
  --pd-acento-claro: #f1cd8e;
  --pd-sobre-acento: #1d1206;
  --pd-mal: #ff7a85;
  --pd-papel: #fbf8f1;
  --pd-tinta: #1d1b18;
  --pd-f: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pd-f-titulo: "Fraunces", Georgia, serif;
  --pd-f-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --pd-radio: 22px;
  --pd-curva: cubic-bezier(.32, .72, 0, 1);
}

html.pd-bloqueado { overflow: hidden; }
html.pd-con-pedido body { padding-bottom: 84px; }

.pd-icono {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pd-mono {
  margin: 0;
  font: 500 11px var(--pd-f-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--pd-suave);
}
.pd-sim {
  --c: #888;
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  font: 600 10.5px var(--pd-f-mono);
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent);
  vertical-align: middle;
}
.pd-sim--choca { color: #0b0b0c; background: var(--pd-mal); box-shadow: 0 0 0 3px rgba(255, 122, 133, .2); }

/* Botón flotante */
.pd-flotante {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--pd-acento);
  color: var(--pd-sobre-acento);
  font: 600 15px var(--pd-f);
  cursor: pointer;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .5s var(--pd-curva), background-color .4s var(--pd-curva);
}
.pd-flotante:hover { background: var(--pd-acento-claro); transform: translateY(-2px); }
.pd-flotante:active { transform: scale(.97); }
.pd-flotante__n {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  font: 600 12px var(--pd-f-mono);
  background: rgba(0, 0, 0, .15);
}
.pd-flotante__total {
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border-radius: 999px;
  font: 600 13px var(--pd-f-mono);
  background: rgba(0, 0, 0, .14);
}
.pd-salta { animation: pd-salta .6s var(--pd-curva); }
@keyframes pd-salta { 35% { transform: scale(1.07); } }

/* Velo y cajón */
.pd-velo {
  position: fixed;
  inset: 0;
  z-index: 96;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .45s var(--pd-curva);
}
.pd-velo.pd-visible { opacity: 1; }

.pd-cajon {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 97;
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100vw - 20px));
  border-radius: var(--pd-radio);
  background: var(--pd-fondo);
  color: var(--pd-texto);
  font-family: var(--pd-f);
  box-shadow: inset 0 0 0 1px var(--pd-borde-2), -30px 0 80px -30px rgba(0, 0, 0, .8);
  transform: translateX(calc(100% + 20px));
  transition: transform .6s var(--pd-curva);
  overflow: hidden;
}
.pd-cajon.pd-abierto { transform: none; }
.pd-cajon__cabeza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 16px 22px;
  border-bottom: 1px solid var(--pd-borde);
}
.pd-cajon__cabeza h2 {
  margin: 4px 0 0;
  font: 400 28px/1.05 var(--pd-f-titulo);
  letter-spacing: -.02em;
}
.pd-cerrar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--pd-fondo-2);
  color: var(--pd-texto);
  box-shadow: inset 0 0 0 1px var(--pd-borde);
  cursor: pointer;
}
.pd-cerrar:hover { background: var(--pd-fondo-3); }
.pd-cajon__cuerpo { flex: 1; overflow-y: auto; padding: 18px 18px 22px; }
.pd-cajon__pie { padding: 14px 18px 18px; border-top: 1px solid var(--pd-borde); background: rgba(0, 0, 0, .18); }

.pd-vacio { padding: 50px 14px; text-align: center; color: var(--pd-suave); }
.pd-vacio .pd-icono { width: 40px; height: 40px; margin: 0 auto 14px; stroke-width: 1.1; color: var(--pd-acento); }
.pd-vacio p { margin: 0 0 6px; }
.pd-vacio strong { color: var(--pd-texto); }

.pd-lineas { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pd-linea {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 13px 12px 13px 14px;
  border-radius: 16px;
  background: var(--pd-fondo-2);
  box-shadow: inset 0 0 0 1px var(--pd-borde);
}
.pd-linea__texto { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pd-linea h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.pd-precio { font: 500 13px var(--pd-f-mono); color: var(--pd-acento-claro); white-space: nowrap; }
.pd-linea__alergenos { display: flex; flex-wrap: wrap; gap: 4px; grid-column: 1; }
.pd-pendiente, .pd-sin { font: 500 11px var(--pd-f-mono); padding: 3px 8px; border-radius: 6px; }
.pd-pendiente { color: #fbbf24; background: rgba(251, 191, 36, .1); }
.pd-sin { color: #4ade80; background: rgba(74, 222, 128, .1); }
.pd-cantidad { display: flex; align-items: center; gap: 2px; grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.pd-cantidad button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: var(--pd-fondo-3);
  color: var(--pd-texto);
  cursor: pointer;
}
.pd-cantidad button:hover { background: var(--pd-acento); color: var(--pd-sobre-acento); }
.pd-cantidad span { min-width: 26px; text-align: center; font: 600 13px var(--pd-f-mono); }

.pd-aviso {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--pd-texto);
  text-decoration: none;
  background: color-mix(in srgb, var(--pd-acento) 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pd-acento) 35%, transparent);
  transition: background-color .4s var(--pd-curva);
}
a.pd-aviso:hover { background: color-mix(in srgb, var(--pd-acento) 16%, transparent); }
.pd-aviso .pd-icono { color: var(--pd-acento); margin-top: 1px; }
.pd-aviso p { margin: 0; }
.pd-aviso--mal { background: rgba(255, 122, 133, .08); box-shadow: inset 0 0 0 1px rgba(255, 122, 133, .35); }
.pd-aviso--mal .pd-icono { color: var(--pd-mal); }
.pd-bloque { margin-top: 20px; }
.pd-resumen { margin: 10px 0 0; font-size: 13.5px; line-height: 2; color: var(--pd-suave); }

.pd-pie__fila { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.pd-mesa { display: grid; gap: 6px; }
.pd-mesa input {
  width: 84px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: var(--pd-fondo-2);
  color: var(--pd-texto);
  font: 600 16px var(--pd-f-mono);
  box-shadow: inset 0 0 0 1px var(--pd-borde-2);
}
.pd-mesa input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--pd-acento); }
.pd-total { display: grid; gap: 4px; text-align: right; }
.pd-total strong { font: 600 26px var(--pd-f-mono); letter-spacing: -.02em; }
.pd-pie__acciones { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.pd-boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  font: 600 14.5px var(--pd-f);
  cursor: pointer;
  transition: background-color .4s var(--pd-curva), transform .4s var(--pd-curva);
}
.pd-boton:active { transform: scale(.98); }
.pd-boton--primario { background: var(--pd-acento); color: var(--pd-sobre-acento); }
.pd-boton--primario:hover { background: var(--pd-acento-claro); }
.pd-boton--secundario { background: var(--pd-fondo-2); color: var(--pd-texto); box-shadow: inset 0 0 0 1px var(--pd-borde-2); }
.pd-boton--secundario:hover { background: var(--pd-fondo-3); }
.pd-boton--claro { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.pd-boton--claro:hover { background: rgba(255, 255, 255, .16); }
.pd-boton--ancho { width: 100%; }

/* --------------------------------------------------------------------------
   Ticket virtual
   -------------------------------------------------------------------------- */

.pd-capa {
  position: fixed;
  inset: 0;
  z-index: 99;
  overflow-y: auto;
  padding: clamp(28px, 6vh, 64px) 16px 40px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(217, 163, 91, .18), transparent 70%),
    rgba(10, 10, 10, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .4s var(--pd-curva);
}
.pd-capa.pd-abierto { opacity: 1; }
.pd-capa__interior { width: min(400px, 100%); margin-inline: auto; }

.pd-ticket {
  position: relative;
  margin: 12px 0 18px;
  padding: 26px 24px 22px;
  background: var(--pd-papel);
  color: var(--pd-tinta);
  font: 400 13.5px/1.45 var(--pd-f-mono);
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .55));
}
/* Bordes dentados de papel de ticket */
.pd-ticket::before,
.pd-ticket::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background-size: 14px 10px;
  background-repeat: repeat-x;
}
.pd-ticket::before { top: -10px; background-image: radial-gradient(circle at 7px 0, transparent 5px, var(--pd-papel) 5.5px); }
.pd-ticket::after { bottom: -10px; background-image: radial-gradient(circle at 7px 10px, transparent 5px, var(--pd-papel) 5.5px); }
.pd-capa.pd-abierto .pd-ticket { animation: pd-imprimir 1.1s var(--pd-curva) both; }
@keyframes pd-imprimir {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-24px); }
  to { clip-path: inset(-12px 0 -12px 0); transform: none; }
}

.pd-ticket__cabeza { text-align: center; }
.pd-ticket__cabeza img { width: 150px; height: auto; margin: 0 auto 10px; display: block; }
.pd-ticket__cabeza p { margin: 0; font-size: 12px; color: #6b645a; }
.pd-ticket__titulo {
  margin: 18px 0 12px;
  padding: 10px 0;
  border-block: 1.5px dashed rgba(29, 27, 24, .35);
  text-align: center;
  font: 600 14px var(--pd-f-mono);
  letter-spacing: .28em;
  text-transform: uppercase;
}
.pd-ticket__meta { display: grid; gap: 4px; margin: 0 0 14px; }
.pd-ticket__meta div { display: flex; justify-content: space-between; gap: 12px; }
.pd-ticket__meta dt { color: #6b645a; }
.pd-ticket__meta dd { margin: 0; font-weight: 600; }
.pd-ticket__alerta {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fde7ea;
  color: #8a1430;
  box-shadow: inset 0 0 0 1.5px #d61f45;
}
.pd-ticket__alerta .pd-icono { color: #d61f45; margin-top: 2px; }
.pd-ticket__alerta b { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.pd-ticket__alerta span { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; }
.pd-ticket__lineas {
  margin: 0;
  padding: 12px 0;
  list-style: none;
  border-top: 1.5px dashed rgba(29, 27, 24, .35);
}
.pd-ticket__lineas li { padding: 7px 0; }
.pd-ticket__fila { display: flex; gap: 8px; align-items: baseline; }
.pd-ticket__cant { min-width: 26px; font-weight: 600; }
.pd-ticket__nombre { flex: 1; font-weight: 600; }
.pd-ticket__importe { font-weight: 600; white-space: nowrap; }
.pd-ticket__alerg { margin: 2px 0 0 34px; font-size: 11.5px; color: #6b645a; }
.pd-ticket__alerg mark { background: #d61f45; color: #fff; padding: 0 3px; border-radius: 3px; }
.pd-ticket__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1.5px dashed rgba(29, 27, 24, .35);
  border-bottom: 1.5px dashed rgba(29, 27, 24, .35);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.pd-ticket__total b { font-size: 22px; letter-spacing: -.01em; }
.pd-ticket__nota { margin: 12px 0 0; font-size: 11.5px; color: #8a5a22; }
.pd-ticket__codigo { margin: 18px auto 0; width: 78%; text-align: center; }
.pd-ticket__codigo svg { display: block; width: 100%; height: 46px; fill: var(--pd-tinta); }
.pd-ticket__codigo span { display: block; margin-top: 6px; font-size: 12px; letter-spacing: .4em; }
.pd-ticket__pie { margin: 14px 0 0; text-align: center; font-size: 11.5px; color: #6b645a; }
.pd-ticket__acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }

/* Aviso flotante */
.pd-tostada {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 14px;
  background: var(--pd-papel);
  color: var(--pd-tinta);
  font: 500 14px var(--pd-f);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .6);
  transform: translate(-50%, calc(100% + 120px));
  transition: transform .5s var(--pd-curva);
  pointer-events: none;
}
.pd-tostada.pd-visible { transform: translate(-50%, 0); }
.pd-tostada .pd-icono { color: #2f8a3a; }

@media (max-width: 640px) {
  .pd-flotante { left: 12px; right: 12px; bottom: 12px; justify-content: space-between; }
  .pd-flotante > span:first-of-type { margin-right: auto; }
  .pd-cajon { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 92dvh; transform: translateY(calc(100% + 20px)); }
  .pd-tostada { bottom: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .pd-cajon, .pd-velo, .pd-capa, .pd-flotante, .pd-tostada { transition-duration: .01ms; }
  .pd-capa.pd-abierto .pd-ticket, .pd-salta { animation: none; }
}
