/* Multi-pedidos · «Noche cálida» · estilos compartidos (ver docs/DISENO.md). Prefijo de clases: mp- */

/* ---------- Tokens: tema oscuro (por defecto) ---------- */
:root {
  --nf: 60px; /* espacio libre abajo para la insignia «Powered by Netlify»: no quitar */
  --fondo: #0E0E10; --tarjeta: #17171A; --elevado: #1F1F24; --linea: #2A2A30;
  --borde-campo: #6B6862;                 /* 3:1 sobre --tarjeta */
  --texto: #F4F1EA; --texto-2: #A8A59E;
  --error: #F26B5B; --error-texto: #141210;
  --acento: #FB923C; --acento-texto: #141210;
  --acento-suave: rgba(251, 146, 60, .14); --acento-foco: rgba(251, 146, 60, .6);
  --sombra: 0 0 0 1px rgba(255, 255, 255, .02);
  --velo: rgba(0, 0, 0, .6);
  --e-pendiente: #F5B73B; --e-preparando: #6AA9FF; --e-listo: #4ADE80;
  --e-en_camino: #B79CFF; --e-entregado: #9A968E; --e-cancelado: #F26B5B;
  --r-p: 10px; --r-m: 16px; --r-g: 24px; --r-pill: 999px;
  --serif: Fraunces, Georgia, serif;
  --sans: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --abajo: calc(var(--nf) + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}
/* ---------- Tema claro ---------- */
[data-tema="claro"] {
  --fondo: #FAF7F2; --tarjeta: #FFFFFF; --elevado: #FFFFFF; --linea: #E6E1D8;
  --borde-campo: #8C877D;
  --texto: #1B1B1D; --texto-2: #6B675F;
  --error: #B42318; --error-texto: #FFFFFF;
  --acento: #C2410C; --acento-texto: #FFFFFF;
  --acento-suave: rgba(194, 65, 12, .12); --acento-foco: rgba(194, 65, 12, .5);
  --sombra: 0 6px 24px rgba(27, 27, 29, .08);
  --velo: rgba(27, 27, 29, .45);
  --e-pendiente: #92600A; --e-preparando: #1D4ED8; --e-listo: #15803D;
  --e-en_camino: #6D28D9; --e-entregado: #5F5B54; --e-cancelado: #B42318;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--fondo); color: var(--texto);
  font: 400 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--acento-foco); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.mp-i { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.mp-i.g { width: 24px; height: 24px; }
.mp-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.mp-sub { color: var(--texto-2); font-size: 14px; }
.mp-error { color: var(--error); font-size: 14px; font-weight: 700; min-height: 1.4em; }
.mp-fila { display: flex; gap: 8px; align-items: center; }
.mp-crece { flex: 1 1 auto; min-width: 0; }
.mp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Página y cabecera ---------- */
.mp-pagina { max-width: 640px; margin: 0 auto; padding: 0 16px calc(var(--abajo) + 96px); }
.mp-pagina.ancha { max-width: 1280px; }
.mp-cabecera {
  position: sticky; top: 0; z-index: 20; background: var(--fondo);
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  margin: 0 -16px; border-bottom: 1px solid var(--linea);
}
.mp-cabecera h1 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-centro { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding-top: 24px; }

/* ---------- Botones ---------- */
.mp-boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-pill);
  background: var(--acento); color: var(--acento-texto); font-weight: 800; text-align: center;
  transition: transform .12s ease-out, opacity .12s ease-out;
}
.mp-boton:active { transform: scale(.97); }
.mp-boton:disabled { opacity: .4; pointer-events: none; }
.mp-boton.sec { background: var(--tarjeta); color: var(--texto); border: 1px solid var(--borde-campo); }
.mp-boton.peligro { background: var(--error); color: var(--error-texto); }
.mp-boton.grande { min-height: 56px; font-size: 18px; }
.mp-boton.bloque { width: 100%; }
.mp-boton.chico { min-height: 40px; padding: 0 16px; font-size: 14px; }
.mp-icono {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: var(--r-pill); color: var(--texto); border: 1px solid var(--linea);
}
.mp-icono:active { transform: scale(.95); }
.mp-enlace { color: var(--acento); font-weight: 800; min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Campos ---------- */
.mp-campo { display: grid; gap: 6px; margin-bottom: 16px; font-size: 14px; font-weight: 700; color: var(--texto-2); }
.mp-campo input, .mp-campo select, .mp-campo textarea, .mp-entrada {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 16px; font-weight: 500;
  background: var(--tarjeta); color: var(--texto);
  border: 1px solid var(--borde-campo); border-radius: var(--r-m); -webkit-appearance: none; appearance: none;
}
.mp-campo textarea, textarea.mp-entrada { min-height: 80px; resize: vertical; }
.mp-campo input:focus, .mp-campo select:focus, .mp-campo textarea:focus, .mp-entrada:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-foco); }
.mp-campo .opc { font-weight: 500; }
.mp-buscador { position: relative; }
.mp-buscador svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--texto-2); pointer-events: none; }
.mp-buscador input { padding-left: 46px; border-radius: var(--r-pill); }
/* Selector de dos o tres opciones (ej. Mostrador / WhatsApp) */
.mp-opciones { display: flex; gap: 8px; flex-wrap: wrap; }
.mp-opciones button {
  min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); font-weight: 700;
  border: 1px solid var(--borde-campo); color: var(--texto-2); background: var(--tarjeta);
}
.mp-opciones button[aria-pressed="true"] { background: var(--acento-suave); color: var(--texto); border-color: var(--acento); }

/* ---------- Tarjetas ---------- */
.mp-tarjeta { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--r-m); padding: 16px; box-shadow: var(--sombra); }
.mp-lista > * + * { border-top: 1px solid var(--linea); }

/* ---------- Pestañas ---------- */
.mp-pestanas {
  display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--linea); -webkit-overflow-scrolling: touch;
}
.mp-pestanas::-webkit-scrollbar { display: none; }
.mp-pestanas button {
  flex: 0 0 auto; min-height: 44px; padding: 0 2px; font-weight: 700; color: var(--texto-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.mp-pestanas button[aria-selected="true"] { color: var(--texto); border-bottom-color: var(--acento); }
.mp-insignia {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  margin-left: 6px; border-radius: var(--r-pill); background: var(--acento); color: var(--acento-texto); font-size: 12px; font-weight: 800;
}

/* ---------- Selector − 2 + ---------- */
.mp-cantidad { display: inline-flex; align-items: center; height: 40px; border-radius: var(--r-pill); background: var(--acento); color: var(--acento-texto); }
.mp-cantidad button { width: 44px; height: 44px; margin: -2px 0; display: inline-flex; align-items: center; justify-content: center; }
.mp-cantidad span { min-width: 24px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Estados de pedido: color + ícono + palabra ---------- */
.mp-estado {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill); font-size: 14px; font-weight: 800; white-space: nowrap;
}
.mp-estado::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: .14; z-index: -1; }
.mp-estado svg.mp-i { width: 16px; height: 16px; }
.e-pendiente { color: var(--e-pendiente); } .e-preparando { color: var(--e-preparando); } .e-listo { color: var(--e-listo); }
.e-en_camino { color: var(--e-en_camino); } .e-entregado { color: var(--e-entregado); } .e-cancelado { color: var(--e-cancelado); }

/* ---------- Hoja inferior ---------- */
.mp-hoja { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.mp-hoja-fondo { position: absolute; inset: 0; background: var(--velo); animation: mp-aparece .18s ease-out; }
.mp-hoja-panel {
  position: relative; display: flex; flex-direction: column; width: 100%; max-width: 640px; margin: 0 auto;
  max-height: 92vh; max-height: 92dvh; background: var(--elevado); border-radius: var(--r-g) var(--r-g) 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .25); animation: mp-sube .22s ease-out;
}
.mp-hoja-asa { display: block; width: 100%; height: 24px; position: relative; flex: 0 0 auto; }
.mp-hoja-asa::after { content: ""; position: absolute; left: 50%; top: 10px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--borde-campo); }
.mp-hoja-cab { display: flex; align-items: center; gap: 8px; padding: 0 16px 12px; }
.mp-hoja-cuerpo { overflow-y: auto; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mp-hoja-pie { padding: 12px 16px calc(12px + var(--abajo)); border-top: 1px solid var(--linea); background: var(--elevado); }
@keyframes mp-sube { from { transform: translateY(100%); } to { transform: none; } }
@keyframes mp-aparece { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Barra flotante «Mi pedido» ---------- */
.mp-barra {
  position: fixed; left: 16px; right: 16px; bottom: calc(12px + var(--abajo)); z-index: 30;
  max-width: 608px; margin: 0 auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

/* ---------- Avisos ---------- */
.mp-toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 90;
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: var(--r-pill);
  background: var(--texto); color: var(--fondo); font-weight: 700; text-align: center;
  transform: translate(-50%, -160%); transition: transform .2s ease-out; pointer-events: none;
}
.mp-toast.on { transform: translate(-50%, 0); }
.mp-toast.mal { background: var(--error); color: var(--error-texto); }
.mp-red {
  position: fixed; left: 0; right: 0; top: 0; z-index: 80; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--error); color: var(--error-texto); text-align: center; font-weight: 800; font-size: 14px;
}
.mp-vacio { text-align: center; padding: 48px 16px; color: var(--texto-2); display: grid; justify-items: center; gap: 12px; }
.mp-vacio svg.mp-i { width: 40px; height: 40px; stroke-width: 1.6; }
.mp-esqueleto { background: var(--tarjeta); border-radius: var(--r-m); min-height: 72px; margin: 12px 0; animation: mp-late 1.2s ease-in-out infinite alternate; }
@keyframes mp-late { from { opacity: .5; } to { opacity: 1; } }

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