/* ===== BLAC × Nestlé — Declaración de Viajes — UI espectacular ===== */
:root {
  --blue: #2196f3;
  --blue-bright: #00b0ff;
  --blue-deep: #0d47a1;
  --nestle: #0a3d91;
  --ink: #0a0e1a;
  --ink-soft: #1a2238;
  --white: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.9);
  --gray: #6b7794;
  --line: rgba(120, 140, 180, 0.22);
  --red: #ff3b5c;
  --green: #00c896;
  --radius: 22px;
  --radius-sm: 13px;
  --shadow-xl: 0 30px 80px -20px rgba(13, 40, 90, 0.45), 0 12px 30px -10px rgba(13, 40, 90, 0.3);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  /* cubre el área de overscroll / rubber-band en móvil para que NUNCA se vea negro */
  background: #06122b;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  /* degradado que cubre TODO el documento (no solo el viewport) -> sin negro al hacer scroll */
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 176, 255, 0.20), transparent 42%),
    radial-gradient(circle at 84% 88%, rgba(10, 61, 145, 0.30), transparent 48%),
    linear-gradient(160deg, #071029 0%, #0a1838 55%, #06122b 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ===== Fondo animado ===== */
.bg-wrap { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-gradient {
  position: absolute; inset: -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 176, 255, 0.5), transparent 42%),
    radial-gradient(circle at 80% 25%, rgba(10, 61, 145, 0.55), transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(33, 150, 243, 0.45), transparent 50%),
    linear-gradient(135deg, #071029 0%, #0a1838 50%, #06122b 100%);
  animation: bgFloat 18s ease-in-out infinite alternate;
  filter: saturate(1.15);
}
@keyframes bgFloat {
  0%   { transform: scale(1) translate(0, 0); }
  50%  { transform: scale(1.12) translate(-2%, 2%); }
  100% { transform: scale(1.05) translate(2%, -1%); }
}
#bg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(120, 180, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 255, 0.06) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
  animation: gridDrift 30s linear infinite;
}
@keyframes gridDrift { to { background-position: 54px 54px; } }

/* ===== Orbes flotantes de luz ===== */
.orb {
  position: absolute; border-radius: 50%; z-index: 0;
  filter: blur(64px); opacity: 0.55; pointer-events: none;
  mix-blend-mode: screen; will-change: transform;
}
.orb-1 {
  width: 360px; height: 360px; top: -80px; left: -60px;
  background: radial-gradient(circle, rgba(0,176,255,0.85), transparent 70%);
  animation: orbFloat1 16s ease-in-out infinite;
}
.orb-2 {
  width: 300px; height: 300px; bottom: -70px; right: -50px;
  background: radial-gradient(circle, rgba(33,150,243,0.8), transparent 70%);
  animation: orbFloat2 20s ease-in-out infinite;
}
.orb-3 {
  width: 240px; height: 240px; top: 45%; left: 55%;
  background: radial-gradient(circle, rgba(10,61,145,0.9), transparent 70%);
  animation: orbFloat3 24s ease-in-out infinite;
}
@keyframes orbFloat1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(40px,60px) scale(1.18)} }
@keyframes orbFloat2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-50px,-40px) scale(1.22)} }
@keyframes orbFloat3 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(-60px,30px) scale(1.1)} 66%{transform:translate(30px,-50px) scale(0.9)} }

/* ===== Escenario ===== */
.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 18px 60px;
}

/* ===== Tarjeta glass ===== */
.card {
  width: 100%; max-width: 560px;
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
  animation:
    cardIn 0.9s var(--ease) both,
    cardFloat 7s ease-in-out 1.1s infinite,
    cardGlow 5s ease-in-out 1.1s infinite alternate;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent);
  z-index: 5;
}
/* línea de luz que recorre el borde superior */
.card::after {
  content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue-bright), transparent);
  animation: borderScan 4.5s ease-in-out infinite; z-index: 6;
}
@keyframes borderScan { 0%,60%{left:-40%} 100%{left:140%} }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.97); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes cardFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
@keyframes cardGlow {
  from { box-shadow: var(--shadow-xl), 0 0 38px -12px rgba(0,176,255,0.25); }
  to   { box-shadow: var(--shadow-xl), 0 0 72px -6px rgba(0,176,255,0.6); }
}

/* ===== Header ===== */
.header {
  text-align: center;
  padding: 34px 26px 24px;
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.5), transparent);
}
/* destello diagonal que recorre el header */
.header::after {
  content: ""; position: absolute; top: 0; left: -35%; width: 35%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-18deg); pointer-events: none;
  animation: headerSheen 6.5s ease-in-out infinite;
}
@keyframes headerSheen { 0%,68%{left:-35%} 100%{left:135%} }
.logos {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-bottom: 18px; position: relative; z-index: 1;
}
.logo { height: 34px; width: auto; object-fit: contain; }
.logo-blac { height: 34px; animation: logoIn 1s var(--ease) 0.15s both, logoFloat 5s ease-in-out 1.2s infinite; }
.logo-nestle { height: 26px; animation: logoIn 1s var(--ease) 0.3s both, logoFloat 5.6s ease-in-out 1.45s infinite; }
.logo-divider { width: 1px; height: 28px; background: var(--line); animation: dividerPulse 3s ease-in-out infinite; }
@keyframes logoIn { from { opacity: 0; transform: translateY(-10px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes logoFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }
@keyframes dividerPulse { 0%,100%{opacity:0.4; transform:scaleY(0.8)} 50%{opacity:1; transform:scaleY(1.1)} }

.title {
  position: relative; z-index: 1;
  font-size: 27px; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(110deg, var(--ink) 15%, var(--blue) 45%, var(--blue-bright) 60%, var(--ink) 85%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: fadeUp 0.8s var(--ease) 0.3s both, titleShine 6s linear 1s infinite;
}
@keyframes titleShine { to { background-position: 220% center; } }
.subtitle {
  font-size: 13.5px; color: var(--gray); margin-top: 7px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  animation: fadeUp 0.8s var(--ease) 0.42s both;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(0, 200, 150, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 200, 150, 0.6); }
  70% { box-shadow: 0 0 0 9px rgba(0, 200, 150, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 200, 150, 0); }
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== Formulario ===== */
.form { padding: 8px 26px 26px; }
.field { margin-bottom: 17px; position: relative; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 440px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

.reveal { animation: revealField 0.7s var(--ease) both; animation-delay: calc(0.45s + var(--i) * 0.05s); }
@keyframes revealField { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.field label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  margin-bottom: 7px; letter-spacing: 0.01em;
}
.req { color: var(--blue); font-weight: 700; }

.input-wrap { position: relative; }
.field input {
  width: 100%; padding: 13px 15px; font-size: 15px; font-family: inherit;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.15s;
}
.field input::placeholder { color: #9aa6c2; }
.field input:focus {
  outline: none; border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.12), 0 8px 22px -10px rgba(33,150,243,0.5);
  transform: translateY(-1px);
}
.field label { transition: color 0.2s, transform 0.2s var(--ease); }
.field:focus-within label { color: var(--blue); transform: translateX(2px); }
.field input.invalid { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 59, 92, 0.1); }
.input-line {
  position: absolute; bottom: 0; left: 50%; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright));
  border-radius: 2px; transform: translateX(-50%);
  transition: width 0.35s var(--ease);
}
.field input:focus ~ .input-line { width: 100%; }

.error-msg {
  display: block; color: var(--red); font-size: 11.5px; margin-top: 5px;
  min-height: 13px; font-weight: 500;
  animation: shake 0.3s;
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

/* ===== Autocomplete ===== */
.autocomplete-field { position: relative; }
/* el campo activo se eleva sobre los campos siguientes para que la lista no se encime */
.autocomplete-field:focus-within { z-index: 60; }
.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  max-height: 230px; overflow-y: auto; z-index: 60;
  display: none;
  box-shadow: 0 18px 40px -12px rgba(13, 40, 90, 0.35);
}
.suggestions.show { display: block; animation: popIn 0.22s var(--ease); }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }
.suggestion-item {
  padding: 11px 15px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid rgba(120, 140, 180, 0.1);
  transition: background 0.15s, padding-left 0.2s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.active {
  background: linear-gradient(90deg, var(--blue), var(--blue-bright)); color: #fff;
  padding-left: 20px;
}
.suggestion-item .sub { display: block; font-size: 11.5px; color: var(--gray); margin-top: 2px; }
.suggestion-item:hover .sub, .suggestion-item.active .sub { color: rgba(255,255,255,0.85); }
.suggestion-empty { padding: 13px 15px; color: var(--gray); font-size: 13.5px; }

/* ===== Ruta visual origen → destino ===== */
.route-viz {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 18px; padding: 12px 14px;
  background: linear-gradient(135deg, rgba(33,150,243,0.12), rgba(0,176,255,0.05), rgba(33,150,243,0.12));
  background-size: 220% 220%;
  border: 1px dashed rgba(33,150,243,0.35); border-radius: var(--radius-sm);
  animation: popIn 0.4s var(--ease), routeShift 6s ease infinite;
}
@keyframes routeShift { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }
.route-pt {
  font-size: 12px; font-weight: 700; color: var(--blue-deep);
  background: #fff; padding: 5px 10px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(13,40,90,0.1); white-space: nowrap;
  max-width: 38%; overflow: hidden; text-overflow: ellipsis;
}
.route-track {
  flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--blue) 0 6px, transparent 6px 12px);
  position: relative; border-radius: 2px;
}
.route-truck { position: absolute; top: -11px; left: 0; font-size: 16px; animation: drive 2.6s var(--ease) infinite; }
@keyframes drive { 0%{left:0} 100%{left:calc(100% - 16px)} }

/* ===== Botón ===== */
.btn-submit {
  position: relative; overflow: hidden;
  width: 100%; margin-top: 8px; padding: 16px;
  font-family: inherit; font-size: 16px; font-weight: 700; color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: linear-gradient(120deg, var(--blue-deep), var(--blue) 40%, var(--blue-bright) 60%, var(--blue-deep));
  background-size: 220% 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 14px 30px -8px rgba(33, 150, 243, 0.6);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  animation: btnFlow 5s ease infinite;
}
@keyframes btnFlow { 0%,100%{background-position:0% 0} 50%{background-position:100% 0} }
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -8px rgba(33, 150, 243, 0.7); background-position: 100% 0; }
.btn-submit:active { transform: translateY(0) scale(0.99); }
.btn-submit:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.btn-arrow { transition: transform 0.25s var(--ease); }
.btn-submit:hover .btn-arrow { transform: translateX(5px); }
.btn-shine {
  position: absolute; top: 0; left: -60%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-20deg); animation: shine 4s infinite;
}
@keyframes shine { 0%,60%{left:-60%} 100%{left:160%} }
.btn-spinner {
  width: 19px; height: 19px; border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-secondary {
  margin-top: 18px; padding: 13px 26px; font-family: inherit;
  font-size: 14.5px; font-weight: 600; color: var(--blue);
  background: rgba(33,150,243,0.08); border: 1.5px solid rgba(33,150,243,0.3);
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: var(--blue); color: #fff; transform: translateY(-2px); }

/* ===== Resultado ===== */
.resultado { padding: 50px 26px; text-align: center; animation: cardIn 0.6s var(--ease); }
.resultado-icon { width: 84px; height: 84px; margin: 0 auto 20px; }
.checkmark { width: 84px; height: 84px; }
.checkmark-circle {
  stroke: var(--green); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: drawCircle 0.6s var(--ease) forwards;
}
.checkmark-check {
  stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: drawCheck 0.4s var(--ease) 0.5s forwards;
}
.checkmark-cross {
  stroke: var(--red); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 46; stroke-dashoffset: 46;
  animation: drawCheck 0.45s var(--ease) 0.45s forwards;
}
.resultado-icon.err .checkmark-circle { stroke: var(--red); }
.resultado-icon.err .checkmark-check { stroke: var(--red); }
@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
.resultado h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.resultado p { color: var(--gray); margin-bottom: 18px; font-size: 14.5px; }
.resultado-id {
  font-size: 26px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--blue-deep), var(--blue-bright));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  padding: 14px; margin-bottom: 16px;
}
.resultado-link { display: inline-block; margin-bottom: 18px; color: var(--blue); font-weight: 700; text-decoration: none; font-size: 14.5px; }
.resultado-link:hover { text-decoration: underline; }

/* ===== Footer ===== */
.footer {
  padding: 18px 26px; text-align: center; font-size: 11.5px; color: var(--gray);
  border-top: 1px solid var(--line); letter-spacing: 0.03em;
}
.footer span { font-weight: 700; color: var(--ink-soft); }
.footer strong { color: var(--blue); }

/* ===== Confetti ===== */
.confetti { position: fixed; width: 9px; height: 9px; z-index: 100; pointer-events: none; will-change: transform; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .stage { padding: 20px 12px 40px; }
  .header { padding: 28px 20px 20px; }
  .form { padding: 6px 18px 22px; }
  .title { font-size: 23px; }
}

/* Respeta usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .bg-gradient, .bg-grid, .btn-shine, .route-truck, .pulse-dot,
  .orb, .card, .card::after, .header::after, .title, .logo-blac, .logo-nestle,
  .logo-divider, .route-viz, .btn-submit { animation: none !important; }
  .card { transform: none !important; box-shadow: var(--shadow-xl) !important; }
}
