/* Paleta Vinoteca (misma que la app canvas) */
:root {
  --red: #ED2E38; --red-dark: #B81E27; --red-soft: #FDE8E9;
  --black: #111111; --ink: #1F1F1F; --muted: #6B6B6B;
  --bg: #F9F9F9; --card: #FFFFFF; --line: #E5E7EB;
  --ok: #2E7D32; --ok-soft: #DCFCE7; --warn: #F5A623; --warn-soft: #FEF3C7;
  --radius: 18px; --shadow: 0 10px 30px rgba(17, 17, 17, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
       background: var(--bg); color: var(--ink); min-height: 100vh;
       display: flex; flex-direction: column; }
a { color: var(--red); }
.muted { color: var(--muted); }

/* ---------- Encabezado ---------- */
.top { background: var(--black); color: #fff; }
.top-in { max-width: 820px; margin: 0 auto; padding: 14px 16px;
          display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
         font-weight: 700; font-size: 1.25rem; letter-spacing: .5px; }
.brand svg { width: 30px; height: 30px; }
.brand b { color: var(--red); }
.top-tag { font-size: .85rem; opacity: .75; }

main { flex: 1; width: 100%; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px 32px; }

/* ---------- Portada ---------- */
.hero { background: linear-gradient(160deg, var(--black) 0%, #2A0A0C 55%, var(--red-dark) 100%);
        color: #fff; padding: 40px 16px 110px; text-align: center; position: relative; overflow: hidden; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: 0 0 8px; line-height: 1.15; }
.hero p { margin: 0 auto; max-width: 460px; opacity: .85; }
.hero-art { width: min(320px, 85%); margin: 20px auto 0; display: block; }
.hero::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: -60px; height: 120px;
               background: var(--bg); border-radius: 50% 50% 0 0; }

.form-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
             padding: 24px; max-width: 440px; margin: -90px auto 28px; position: relative; z-index: 2; }
.form-card h2 { margin: 0 0 4px; font-size: 1.2rem; }
.field { display: block; margin: 16px 0 0; font-weight: 600; font-size: .9rem; }
.field span { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.field svg { width: 18px; height: 18px; color: var(--red); }
input { width: 100%; padding: 14px 16px; font-size: 1.05rem; border-radius: 12px; font-family: inherit;
        border: 2px solid var(--line); background: var(--bg); color: var(--ink); transition: border-color .15s; }
input:focus { outline: none; border-color: var(--red); background: #fff; }
.btn { width: 100%; padding: 15px; margin-top: 20px; border: 0; border-radius: 12px; cursor: pointer;
       background: var(--red); color: #fff; font: 600 1.05rem/1 inherit; font-family: inherit;
       display: flex; align-items: center; justify-content: center; gap: 10px;
       box-shadow: 0 6px 16px rgba(237, 46, 56, .35); transition: transform .1s, background .15s; }
.btn:hover { background: var(--red-dark); }
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 12px; text-align: center; }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 640px; margin: 0 auto; }
.how div { text-align: center; padding: 16px 8px; }
.how .ic { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; background: var(--red-soft);
           color: var(--red); display: grid; place-items: center; }
.how .ic svg { width: 28px; height: 28px; }
.how strong { display: block; font-size: .95rem; }
.how small { color: var(--muted); }

.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--red-soft); color: var(--red-dark);
         padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-weight: 500; }
.alert svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.alert.warn { background: var(--warn-soft); color: #92400E; }

/* ---------- Estado del pedido ---------- */
.status { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
          margin: 20px 0 16px; overflow: hidden; }
.status-art { padding: 28px 16px 8px; text-align: center; }
.status-art svg.scene { width: min(340px, 100%); height: auto; }
.status-text { text-align: center; padding: 0 20px 24px; }
.status-text h1 { margin: 4px 0 6px; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; }
.status-text p { margin: 0 auto; max-width: 440px; color: var(--muted); }
.order-no { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line);
            border-radius: 999px; padding: 4px 12px; font: 600 .85rem ui-monospace, Consolas, monospace; color: var(--ink);
            white-space: nowrap; max-width: 100%; }
.order-no svg { width: 16px; height: 16px; color: var(--red); flex: none; }
.st-entregado .status-art { background: linear-gradient(180deg, var(--ok-soft), #fff); }
.st-en_ruta .status-art { background: linear-gradient(180deg, var(--red-soft), #fff); }
.st-incidencia .status-art { background: linear-gradient(180deg, var(--warn-soft), #fff); }
.st-recibido .status-art { background: linear-gradient(180deg, #F3F4F6, #fff); }

.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); }
.meta div { padding: 14px 18px; display: flex; gap: 10px; align-items: center; }
.meta div + div { border-left: 1px solid var(--line); }
.meta svg { width: 22px; height: 22px; color: var(--red); flex: none; }
.meta small { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; }
.meta strong { font-size: .95rem; }

/* Barra de pasos */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }
.card h2 { margin: 0 0 16px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card h2 svg { width: 20px; height: 20px; color: var(--red); }
.steps { list-style: none; padding: 0; margin: 0; display: flex; }
.steps li { flex: 1; text-align: center; position: relative; font-size: .85rem; color: var(--muted); font-weight: 500; }
.steps li::before { content: ""; position: absolute; top: 27px; right: 50%; width: 100%; height: 4px;
                    background: var(--line); border-radius: 4px; }
.steps li:first-child::before { display: none; }
.steps .ic { width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center;
             background: #fff; border: 3px solid var(--line); color: #B0B0B0; position: relative; z-index: 1; }
.steps .ic svg { width: 26px; height: 26px; }
.steps li.done, .steps li.current { color: var(--ink); }
.steps li.done::before, .steps li.current::before { background: var(--red); }
.steps li.done .ic { background: var(--red); border-color: var(--red); color: #fff; }
.steps li.current .ic { background: var(--red); border-color: var(--red); color: #fff;
                        box-shadow: 0 0 0 6px rgba(237, 46, 56, .18); animation: pulse 2s infinite; }
.st-entregado .steps li .ic, .st-entregado .steps li::before { background: var(--ok); border-color: var(--ok); color: #fff; animation: none; box-shadow: none; }
.st-entregado .steps li { color: var(--ink); }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(237, 46, 56, 0); } }

/* Mapa */
.pin { width: 40px; height: 40px; }

/* Historial */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .ic { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
                background: var(--bg); color: var(--muted); border: 2px solid var(--line); }
.timeline .ic svg { width: 20px; height: 20px; }
.timeline li:first-child .ic { background: var(--red); border-color: var(--red); color: #fff; }
.st-entregado .timeline li:first-child .ic { background: var(--ok); border-color: var(--ok); }
.st-incidencia .timeline li:first-child .ic { background: var(--warn); border-color: var(--warn); }
.timeline strong { display: block; padding-top: 2px; }
.timeline small { color: var(--muted); }

.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; margin-top: 4px; }
.back svg { width: 18px; height: 18px; }

/* Animaciones de la ilustración */
.vehicle { animation: bounce .6s ease-in-out infinite alternate; }
.road-lines { animation: road 1s linear infinite; }
.wheel { transform-box: fill-box; transform-origin: center; animation: spin .6s linear infinite; }
.pop { transform-box: fill-box; transform-origin: center; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.float { animation: float 3s ease-in-out infinite; }
@keyframes bounce { to { transform: translateY(-3px); } }
@keyframes road { to { transform: translateX(-40px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes float { 50% { transform: translateY(-6px); } }
/* Preparando: botellas que caen en la caja */
.drop { animation: drop 3s ease-in infinite both; }
.d2 { animation-delay: .5s; } .d3 { animation-delay: 1s; }
@keyframes drop { 0% { transform: translateY(-80px); opacity: 0; } 25% { transform: translateY(0); opacity: 1; }
                  85% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(0); opacity: 0; } }
.flap-l, .flap-r { transform-box: fill-box; animation: flap 1.5s ease-in-out infinite alternate; }
.flap-l { transform-origin: right bottom; } .flap-r { transform-origin: left bottom; animation-direction: alternate-reverse; }
@keyframes flap { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; }
.t2 { animation-delay: .5s; } .t3 { animation-delay: 1s; }
@keyframes twinkle { 50% { transform: scale(.3); opacity: .3; } }

/* Entregado: confeti, caja que aterriza y check que late */
.confetti rect { transform-box: fill-box; transform-origin: center; animation: confetti 3s linear infinite; }
.confetti rect:nth-child(2) { animation-delay: .4s; } .confetti rect:nth-child(3) { animation-delay: 1.1s; }
.confetti rect:nth-child(4) { animation-delay: .7s; } .confetti rect:nth-child(5) { animation-delay: 1.6s; }
.confetti rect:nth-child(6) { animation-delay: .2s; } .confetti rect:nth-child(7) { animation-delay: 2s; }
.confetti rect:nth-child(8) { animation-delay: 2.4s; }
@keyframes confetti { 0% { transform: translateY(-20px) rotate(0); opacity: 0; } 10% { opacity: 1; }
                      100% { transform: translateY(150px) rotate(540deg); opacity: 0; } }
.land { animation: land .9s cubic-bezier(.3, 1.5, .5, 1) .2s both; }
@keyframes land { from { transform: translateY(-90px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.beat { transform-box: fill-box; transform-origin: center; animation: beat 1.8s ease-in-out .8s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } }

/* Fotos del repartidor */
.foto-estado { display: block; position: relative; margin: 18px auto 0; padding: 0; border: 0; cursor: zoom-in;
               width: min(320px, 100%); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: var(--bg); }
.foto-estado img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
/* Mientras ENVIA entrega la foto (tarda unos segundos) se ve un brillo de "cargando" */
.foto-estado, .foto-mini { background: linear-gradient(100deg, #EFEFEF 30%, #FAFAFA 50%, #EFEFEF 70%) 0 0 / 300% 100%;
                           animation: cargando 1.4s linear infinite; }
@keyframes cargando { to { background-position: -150% 0; } }
.foto-estado span { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
                    background: rgba(17, 17, 17, .75); color: #fff; font: 500 .8rem inherit; font-family: inherit;
                    padding: 5px 10px; border-radius: 999px; }
.foto-estado span svg { width: 14px; height: 14px; }
.timeline li > span:nth-child(2) { flex: 1; }
.foto-mini { flex: none; width: 52px; height: 52px; padding: 0; border: 2px solid var(--line); border-radius: 10px;
             overflow: hidden; cursor: zoom-in; background: var(--bg); }
.foto-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.visor { border: 0; padding: 0; border-radius: 16px; max-width: min(92vw, 720px); background: #000; color: #fff; }
.visor::backdrop { background: rgba(0, 0, 0, .75); }
.visor img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; }
.visor p { margin: 0; padding: 10px 14px; font-size: .9rem; }
.visor form { position: absolute; top: 8px; right: 8px; margin: 0; }
.galeria { margin-top: 18px; }
.galeria .foto-estado { margin-top: 0; }
.fotos-previas { display: flex; justify-content: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.foto-previa { width: 96px; padding: 0; border: 2px solid var(--line); border-radius: 12px; overflow: hidden;
               cursor: zoom-in; position: relative; }
.foto-previa img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.foto-previa small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(17, 17, 17, .7); color: #fff;
                     font-size: .65rem; padding: 2px 4px; text-align: center; }
.visor .nav { display: none; position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
              border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: var(--black);
              font-size: 1.6rem; line-height: 1; cursor: pointer; }
.visor.varias .nav { display: grid; place-items: center; }
.visor .prev { left: 8px; } .visor .next { right: 8px; }
.visor .cerrar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9);
                 color: var(--black); font-size: 1rem; cursor: pointer; }

/* Cambio de estado en vivo */
.wrap.saliendo .status-art svg { animation: salir .45s ease-in forwards; }
.wrap.saliendo .status-text, .wrap.saliendo .meta { transition: opacity .45s; opacity: 0; }
.wrap.entrando .status-art svg { animation: entrar .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.wrap.entrando .status-text { animation: subir .6s ease-out .15s both; }
.wrap.entrando .steps li.current .ic { animation: entrar .6s cubic-bezier(.2, 1.6, .4, 1) .3s both, pulse 2s 1s infinite; }
@keyframes salir { to { transform: scale(.85) translateY(10px); opacity: 0; } }
@keyframes entrar { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes subir { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.steps li::before, .steps .ic { transition: background .5s, border-color .5s, color .5s; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); z-index: 10;
         background: var(--black); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 500;
         box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center;
         transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); }
.toast.show { transform: translate(-50%, 0); }

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

.foot { text-align: center; padding: 24px 16px; color: var(--muted); font-size: .85rem; }

@media (max-width: 520px) {
  .how { grid-template-columns: 1fr; }
  .how div { display: flex; gap: 14px; text-align: left; align-items: center; padding: 8px 0; }
  .how .ic { margin: 0; flex: none; }
  .steps li { font-size: .75rem; }
  .steps .ic { width: 48px; height: 48px; }
  .steps li::before { top: 22px; }
  .meta div + div { border-left: 0; border-top: 1px solid var(--line); }
}
