/**
 * GTSATech — Acceso (login, olvido, restablecer)
 * Mismo mundo que USER (main.css): azul noche, azul eléctrico del Bloque 1, ámbar del Bloque 2 (verde en claro).
 * La tarjeta es el punto de partida de un mapa fijo de servicios; las líneas las dibuja acceso_mapa.js.
 */

:root {
  --bg-app:        #000b17;
  --bg-app-2:      #031a36;
  --bg-card:       #001429;
  --bg-input:      #000b17;
  --accent:        #4096fb;
  --accent-text:   #5aa6ff;
  --accent-ink:    #00101f;
  --accent-tint:   rgba(64, 150, 251, 0.14);
  --b2:            #f59e0b;
  --b2-tint:       rgba(245, 158, 11, 0.14);
  --text-main:     #d9eaff;
  --text-dim:      #8fa8c8;
  --text-muted:    #6f89aa;
  --border:        #0c2747;
  --border-strong: #154073;
  --danger:        #ff6b74;
  --danger-tint:   rgba(238, 63, 74, 0.12);
  --success:       #2fd3b0;
  --success-tint:  rgba(3, 184, 150, 0.12);
  --shadow:        0 24px 60px rgba(0, 0, 0, 0.5);
  --radius:        10px;
  --radius-sm:     7px;
  --ease:          cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-app:        #f3f7fd;
    --bg-app-2:      #e3eefc;
    --bg-card:       #ffffff;
    --bg-input:      #f7faff;
    --accent:        #2563eb;
    --accent-text:   #1d4ed8;
    --accent-ink:    #ffffff;
    --accent-tint:   rgba(37, 99, 235, 0.1);
    --b2:            #16a34a;
    --b2-tint:       rgba(22, 163, 74, 0.1);
    --text-main:     #0f172a;
    --text-dim:      #475569;
    --text-muted:    #5b6b80;
    --border:        #dbe6f6;
    --border-strong: #b9cff0;
    --danger:        #c81e2b;
    --danger-tint:   rgba(220, 38, 38, 0.08);
    --success:       #0f7a4a;
    --success-tint:  rgba(22, 163, 74, 0.1);
    --shadow:        0 20px 50px rgba(15, 40, 80, 0.12);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse 80% 70% at 30% 45%, var(--bg-app-2) 0%, var(--bg-app) 70%) fixed, var(--bg-app);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* ─── Escena: tarjeta + mapa ─────────────────────────────────── */
.escena {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  column-gap: clamp(72px, 9vw, 160px);
  align-items: center;
  max-width: 1320px;
  margin-inline: auto;
  padding: clamp(48px, 6vh, 80px) clamp(32px, 6vw, 104px);
}

.lineas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

/* ─── Tarjeta ────────────────────────────────────────────────── */
.tarjeta {
  position: relative;
  z-index: 2;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.tarjeta-logo {
  display: block;
  width: 132px;
  height: auto;
  margin: -6px 0 28px -6px;
  mix-blend-mode: lighten;   /* el PNG oscuro trae fondo azul noche: se funde con la tarjeta */
}

@media (prefers-color-scheme: light) {
  .tarjeta-logo { mix-blend-mode: normal; }
}

.tarjeta-titulo {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.tarjeta-intro {
  margin: 8px 0 28px;
  color: var(--text-dim);
  font-size: 15px;
  text-wrap: pretty;
}

.tarjeta-intro b { color: var(--text-main); font-weight: 700; }

.formulario[hidden] { display: none; }

/* ─── Campos ─────────────────────────────────────────────────── */
.campo { margin-bottom: 20px; }

.campo label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
}

.campo input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  color: var(--text-main);
  caret-color: var(--accent);
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.campo input:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }

.campo input:focus-visible,
.campo input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.campo input[aria-invalid="true"] { border-color: var(--danger); }
.campo input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-tint); }

.campo input:-webkit-autofill {
  -webkit-text-fill-color: var(--text-main);
  -webkit-box-shadow: 0 0 0 40px var(--bg-input) inset;
  caret-color: var(--accent);
}

.campo-clave { position: relative; }
.campo-clave input { padding-right: 52px; }

.ver-clave {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}

.ver-clave:hover { color: var(--text-main); background: var(--accent-tint); }

/* ─── Botones ────────────────────────────────────────────────── */
.boton {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: filter 0.18s var(--ease), transform 0.18s var(--ease);
}

.boton:hover { filter: brightness(1.08); }
.boton:active { transform: translateY(1px); }
.boton:disabled { cursor: progress; filter: saturate(0.6); }

.boton > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 10px; }
.boton .boton-cargando { visibility: hidden; }
.boton.cargando .boton-texto { visibility: hidden; }
.boton.cargando .boton-cargando { visibility: visible; }

.enlace {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.enlace:hover { text-decoration: underline; text-underline-offset: 3px; }

:is(.boton, .enlace, .ver-clave):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ─── Aviso ──────────────────────────────────────────────────── */
.aviso {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  border: 1px solid;
  border-radius: var(--radius-sm);
}

.aviso[hidden] { display: none; }
.aviso-icono { margin-top: 2px; }
.aviso.error { color: var(--danger); background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.aviso.exito { color: var(--success); background: var(--success-tint); border-color: color-mix(in srgb, var(--success) 40%, transparent); }

/* ─── Mapa de servicios ─────────────────────────────────────── */
.mapa {
  position: relative;
  z-index: 1;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 40px;
  min-width: 0;
}

.mapa-nombre {
  font-size: clamp(44px, 4.6vw, 72px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}

.mapa-lema {
  margin-top: 12px;
  max-width: 34ch;
  font-size: 18px;
  color: var(--text-dim);
  text-wrap: balance;
}

.mapa-pie { font-size: 13px; color: var(--text-muted); }

.arbol {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(36px, 6vh, 64px);
}

.rama {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(48px, 6vw, 112px);
}

.nodo {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.nodo-bloque {
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.rama[data-bloque="1"] .nodo-bloque { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.rama[data-bloque="2"] .nodo-bloque { color: var(--b2); border-color: color-mix(in srgb, var(--b2) 60%, transparent); }

.servicios {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nodo-servicio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100%, 340px);
  padding: 14px 18px;
}

.nodo-nombre { font-size: 18px; font-weight: 700; }

.nodo-estado {
  flex: none;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 999px;
}

.nodo-servicio.pendiente {
  background: color-mix(in srgb, var(--bg-card) 55%, transparent);
  border-style: dashed;
}

.nodo-servicio.pendiente .nodo-nombre { color: var(--text-dim); font-weight: 600; }

/* Al entrar, los nodos alcanzados se encienden */
.conectado .rama[data-bloque="1"] :is(.nodo-bloque, .nodo-servicio:not(.pendiente)) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.conectado .rama[data-bloque="2"] :is(.nodo-bloque, .nodo-servicio:not(.pendiente)) {
  border-color: var(--b2);
  box-shadow: 0 0 0 3px var(--b2-tint);
}

/* ─── Líneas (SVG) ───────────────────────────────────────────── */
.lineas .l { fill: none; stroke-width: 1.5; }
.lineas .l.b1 { stroke: var(--accent); stroke-opacity: 0.55; }
.lineas .l.b2 { stroke: var(--b2); stroke-opacity: 0.5; }
.lineas .l.pendiente { stroke-opacity: 0.3; stroke-dasharray: 4 6; }
.lineas .l.luz { stroke-opacity: 1; stroke-width: 2.5; stroke-linecap: round; }

.lineas .p { stroke: none; }
.lineas .p.b1, .lineas .p.origen { fill: var(--accent); }
.lineas .p.b2 { fill: var(--b2); }
.lineas .p.pendiente { fill-opacity: 0.4; }

/* ─── Pantallas medianas: árbol más compacto ────────────────── */
@media (max-width: 1180px) {
  .escena { grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); column-gap: 64px; }
  .rama { column-gap: 48px; }
  .nodo-servicio { padding: 12px 14px; }
  .nodo-nombre { font-size: 16px; }
}

/* ─── Móvil y ventanas estrechas: tarjeta y servicios como etiquetas ── */
@media (max-width: 900px) {
  .escena {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
    align-content: start;
    padding: 48px 16px 32px;
    max-width: 520px;
    margin: 0 auto;
  }

  .lineas { display: none; }

  .mapa { display: contents; }
  .mapa-cabecera { order: -1; }
  .mapa-nombre { font-size: 36px; }
  .mapa-lema { font-size: 15px; margin-top: 8px; }

  .tarjeta { padding: 28px 22px; }
  .tarjeta-logo { width: 104px; margin-bottom: 20px; }
  .tarjeta-titulo { font-size: 24px; }

  .arbol { gap: 14px; }
  .rama { grid-template-columns: 1fr; row-gap: 8px; }
  .nodo-bloque { justify-self: start; padding: 0; background: none; border: 0; font-size: 13px; }
  .servicios { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .nodo-servicio { width: auto; gap: 10px; padding: 8px 12px; }
  .nodo-nombre { font-size: 14px; }
  .nodo-estado { font-size: 12px; padding: 2px 8px; }
  .mapa-pie { text-align: center; }
}

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