/* ============================================================
   Login de Bluetrace — rediseño (2026-10-13).
   Formulario de ancho fijo a la izquierda; el mapa vivo ocupa el resto.
   Colores y tipografía iguales al home y las landings.
   ============================================================ */

@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin.woff2) format("woff2"); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/jakarta-latin.woff2) format("woff2"); }

:root {
  --ink: #0a223b;
  --blue: #1e6bf5;
  --blue-hover: #1860e0;
  --sky: #eaf5ff;
  --line: #dce5ed;
  --muted: #617084;
  --rojo: #d93a3a;
  --form-w: 460px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-pop: cubic-bezier(.34, 1.4, .64, 1);
}

.login, .login * { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; }
body {
  background: #fff;
  color: var(--ink);
  font: 400 15px/1.55 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

/* ─── Estructura ─────────────────────────────────────────────── */
.login {
  /* Azul del login: #1e6bf5 (el de la animación, --traza #1f6fff, apenas más oscuro para que el texto blanco pase
     4.5:1; Daniel 2026-10-14). Cursor encima: #1860e0 (5.54:1). Se repite aquí porque globals.css también
     define --blue (#1DA1F2) en :root, carga después y le ganaba al de arriba: «PLATAFORMA BLUETRACE», el
     botón y las ligas salían azul cielo. En .login gana sin tocar el resto de bluetrace. */
  --blue: #1e6bf5;
  --blue-hover: #1860e0;
  position: relative;
  background: #fff;                 /* blanco de la propuesta: globals.css pinta html/body de gris (--bg) */
  display: grid;
  grid-template-columns: var(--form-w) 1fr;
  min-height: 100vh; min-height: 100dvh;
}

/* ─── Formulario ─────────────────────────────────────────────── */
.lg-form {
  display: flex; flex-direction: column;
  background: #fff;
  padding: 32px 48px 28px;
  min-height: 100vh; min-height: 100dvh;
}
.lg-top { display: flex; align-items: center; justify-content: space-between; }
.lg-logo { display: block; height: 29px; width: auto; }
.lg-volver { font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; transition: color .2s; }

.lg-cuerpo { margin: auto 0; padding: 48px 0; }
.lg-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 12px;
}
.lg-h1 {
  font: 800 36px/1.1 'Plus Jakarta Sans', Inter, sans-serif;
  letter-spacing: -1.2px; color: var(--ink);
}
.lg-sub { margin-top: 10px; font-size: 15px; color: var(--muted); text-wrap: pretty; }

.lg-alerta {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 24px; padding: 12px 14px;
  border-radius: 12px; background: #fdeeee; border: 1px solid #f6caca;
  color: #8f2323; font-size: 13.5px; line-height: 1.45;
}
.lg-alerta[hidden] { display: none; }
.lg-alerta svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--rojo); stroke-width: 1.8; stroke-linecap: round; }

.lg-campos { display: grid; gap: 18px; margin-top: 30px; }
.campo label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.campo-fila { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lg-link { color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none; }

.entrada { position: relative; }
.entrada > svg {
  position: absolute; left: 15px; top: 50%; translate: 0 -50%;
  width: 19px; height: 19px; pointer-events: none;
  fill: none; stroke: #93a3b4; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .2s;
}
.entrada input {
  display: block; width: 100%; height: 52px;
  padding: 0 46px 0 45px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 15px; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.entrada input::placeholder { color: #9aa8b6; }
.entrada input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px #1e6bf51f; }
.entrada:focus-within > svg { stroke: var(--blue); }
.lg-form.con-error .entrada input { border-color: #eaa3a3; }
.lg-form.con-error .entrada input:focus { border-color: var(--rojo); box-shadow: 0 0 0 4px #d93a3a1a; }

.ver {
  position: absolute; right: 6px; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 9px; background: none; cursor: pointer;
  transition: background .2s;
}
.ver svg { width: 20px; height: 20px; fill: none; stroke: #7d8da0; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ver .ojo-no, .ver[aria-pressed="true"] .ojo { display: none; }
.ver[aria-pressed="true"] .ojo-no { display: block; }
.ver:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.lg-boton {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; margin-top: 6px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--blue); color: #fff;
  font: 600 15.5px Inter, sans-serif;
  box-shadow: 0 8px 20px #1e6bf533;
  transition: background .2s, transform .15s var(--ease-out), box-shadow .2s;
}
.lg-boton .flecha { display: inline-block; font-size: 1.15em; transition: transform .2s var(--ease-out); }
.lg-boton:active { transform: scale(.985); }
.lg-boton:focus-visible { outline: 3px solid #1e6bf555; outline-offset: 2px; }
.lg-boton .giro {
  display: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2.4px solid #ffffff55; border-top-color: #fff;
  animation: giro .7s linear infinite;
}
.lg-boton.cargando { pointer-events: none; }
.lg-boton.cargando .txt, .lg-boton.cargando .flecha { display: none; }
.lg-boton.cargando .giro { display: block; }
@keyframes giro { to { transform: rotate(1turn); } }

.lg-planes { margin-top: 26px; padding-top: 22px; border-top: 1px solid #edf1f5; font-size: 14px; color: var(--muted); }
.lg-planes .lg-link { font-size: 14px; }

.lg-pie { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lg-ayuda { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); text-decoration: none; }
.lg-ayuda svg { width: 20px; height: 20px; fill: #1fa855; flex: none; }
.lg-ayuda b { font-weight: 600; color: var(--ink); }
.lg-pie small { font-size: 12px; color: #9aa8b6; }

@media (hover: hover) {
  .lg-volver:hover { color: var(--blue); }
  .lg-link:hover, .lg-ayuda:hover b { text-decoration: underline; }
  .lg-boton:hover { background: var(--blue-hover); box-shadow: 0 10px 24px #1e6bf540; }
  .lg-boton:hover .flecha { transform: translateX(3px); }
  .ver:hover { background: #f1f5f9; }
}

/* ─── Panel del mapa (estilo maqueta: blanco, edificios 3D, un solo azul) ─ */
.lg-panel {
  --traza: #1f6fff;
  position: relative; overflow: hidden;
  background: #eceff3;
  isolation: isolate;
}
.lg-panel .mapa { position: absolute; inset: 0; }   /* gana sobre .mapboxgl-map de mapbox-gl.css (más específico) */
/* El mapa se funde con el blanco de la página en los bordes */
.lg-panel::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, #fff 0, #ffffff00 150px),
    linear-gradient(#fff 0, #ffffff00 90px),
    linear-gradient(0deg, #fff 0, #ffffff00 110px);
}

/* Disco con flecha (como las apps de navegación): plano sobre el mapa */
.puck { width: 40px; height: 40px; pointer-events: none; }
.puck > * { transition: opacity .5s var(--ease-out); }   /* Mapbox fija la opacidad del marcador en línea: se oculta por dentro */
.puck .halo { position: absolute; inset: -12px; border-radius: 50%; background: radial-gradient(circle, #1f6fff40 0 45%, #1f6fff00 70%); }
.puck .disco {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--traza); border: 3px solid #fff;
  box-shadow: 0 0 0 1px #1f6fff33, 0 6px 16px #1f6fff66;
}
.puck svg { position: absolute; inset: 9px; width: 22px; height: 22px; fill: #fff; }
.puck .onda { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--traza); opacity: 0; }
.puck.llega .onda { animation: onda 1.1s var(--ease-out) forwards; }
.puck.llega .onda + .onda { animation-delay: .22s; }
.puck.sale > * { opacity: 0; }
@keyframes onda { from { transform: scale(1); opacity: .8; } to { transform: scale(3.2); opacity: 0; } }

/* Ciudad actual */
.ciudad {
  position: absolute; left: 40px; top: 30px; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}
.ciudad.cambia { opacity: 0; transform: translateY(-6px); }
.ciudad svg { width: 30px; height: 30px; flex: none; }
.ciudad b { display: block; font: 800 22px/1.15 'Plus Jakarta Sans', sans-serif; letter-spacing: -.6px; color: var(--ink); }
.ciudad small { display: block; font-size: 12.5px; color: var(--muted); }

/* Tarjeta de la ruta en curso (línea de tiempo origen → destino) */
.ruta-card {
  position: absolute; left: 40px; bottom: 44px; z-index: 3;
  width: 290px; padding: 18px 20px 16px;
  background: #ffffffe6; backdrop-filter: blur(10px);
  border-radius: 20px; box-shadow: 0 18px 40px #0a223b1f, 0 0 0 1px #0a223b0d;
  transition: opacity .4s var(--ease-out);
}
.ruta-card.cambia { opacity: 0; }
.rc-quien { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rc-quien .rc-unidad { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* una sola línea */
.rc-quien i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--traza); }
.rc-quien i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 1.6s ease-out infinite; }
.ruta-card.llego .rc-quien i { background: #18b26b; }
@keyframes ping { to { transform: scale(2.8); opacity: 0; } }
.rc-linea { list-style: none; margin: 14px 0 0; position: relative; }
.rc-linea::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 14px; border-left: 2px dashed #bcd3f5; }
.rc-linea li { position: relative; display: flex; gap: 12px; align-items: center; padding: 5px 0; }
.rc-linea li > i { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--traza); box-shadow: 0 0 0 4px #1f6fff26; }
.rc-linea li.d > i { background: #fff; border: 3px solid var(--traza); box-shadow: 0 0 0 4px #1f6fff1a; }
.rc-linea small { display: block; font-size: 11px; color: var(--muted); }
.rc-linea b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.rc-dato { display: flex; align-items: baseline; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e6ebf0; color: var(--muted); font-size: 13px; }
.rc-ejemplo { display: block; margin-top: 8px; font-size: 10px; color: #a3afbb; letter-spacing: .02em; }
.rc-dato b { font: 800 28px/1 'Plus Jakarta Sans', sans-serif; letter-spacing: -1px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2ch; }

/* Atribución del mapa (obligatoria), discreta */
.lg-panel .mapboxgl-ctrl-attrib { font-size: 10px; background: #ffffffb3; }
.lg-panel .mapboxgl-ctrl-bottom-right, .lg-panel .mapboxgl-ctrl-bottom-left { z-index: 3; }

/* ─── Entrada al cargar ──────────────────────────────────────── */
@keyframes wipe-in {
  from { clip-path: inset(-20% 100% -20% -4%); transform: translateX(-18px); }
  to   { clip-path: inset(-20% -4% -20% -4%); transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes desde-izq { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes desde-der { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* El mapa llega después del formulario: aparece suave cuando ya cargó */
.mapa { opacity: 0; transition: opacity 1.2s var(--ease-out); }
.con-mapa .mapa { opacity: 1; }
.lg-panel:not(.con-mapa) .ciudad, .lg-panel:not(.con-ruta) .ruta-card { visibility: hidden; }
.login .lg-eyebrow { animation: fade-in .5s var(--ease-out) .2s backwards; }
.login .lg-h1 { animation: wipe-in .8s var(--ease-out) .3s backwards; }
.login .lg-sub { animation: fade-in .6s var(--ease-out) .6s backwards; }
.login .lg-campos > * { animation: desde-izq .6s var(--ease-out) backwards; }
.login .lg-campos > :nth-child(1) { animation-delay: .7s; }
.login .lg-campos > :nth-child(2) { animation-delay: .8s; }
.login .lg-campos > :nth-child(3) { animation-delay: .9s; }
.login .lg-planes, .login .lg-pie { animation: fade-in .6s var(--ease-out) 1.05s backwards; }
.con-mapa .ciudad { animation: desde-izq .6s var(--ease-out) .4s backwards; }
.con-ruta .ruta-card { animation: desde-der .7s var(--ease-out) .3s backwards; }

.lg-alerta.entra { animation: desde-izq .45s var(--ease-out); }
.lg-campos.sacude { animation: sacude .4s ease; }
@keyframes sacude { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ─── Pantallas medianas ─────────────────────────────────────── */
@media (max-width: 1180px) {
  :root { --form-w: 420px; }
  .lg-form { padding: 28px 36px 24px; }
}

/* ─── Móvil: banda del mapa arriba, formulario abajo ─────────── */
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lg-panel { order: -1; height: 250px; }
  .lg-panel::before {
    background: linear-gradient(#ffffffd9 0, #ffffff80 44px, #ffffff00 84px), linear-gradient(0deg, #fff 0, #ffffff00 44px);
  }
  .lg-form { min-height: 0; padding: 0 20px 22px; }
  .lg-top { position: absolute; top: 16px; left: 20px; right: 20px; z-index: 5; }
  .lg-logo { height: 24px; }
  .ciudad { left: 20px; top: auto; bottom: 12px; gap: 8px; }   /* abajo de la banda: el logo respira arriba */
  .ciudad svg { width: 24px; height: 24px; }
  .ciudad b { font-size: 17px; }
  .ciudad small { font-size: 11.5px; }
  .ruta-card { display: none; }
  .lg-cuerpo { margin: 0; padding: 14px 0 30px; }
  .lg-eyebrow { display: none; }            /* en el celular, más espacio para el mapa */
  .lg-h1 { font-size: 30px; letter-spacing: -1px; }
  .lg-sub { display: none; }               /* celular: más corto, sin subtítulo (Daniel 2026-10-14) */
  .lg-campos { margin-top: 20px; gap: 14px; }
  .entrada input { font-size: 16px; }      /* evita el zoom de iOS */
  .lg-pie { justify-content: flex-start; text-align: left; }   /* WhatsApp a la izquierda, como «Ver planes» */
  .lg-pie small { flex-basis: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
