/*
 * El login de Coopen (2026-09-29). Estilo de la casa (Plugins/Estilos/CoopenStyleGuide.md) con
 * la paleta de Coopen (§9): cian #00E5FF, violeta #8866FF, destello #67F0FF, fondo #050D1A.
 * Reemplaza a la estética de terminal «C.O.O.P.E.N.» (login.css + tokens.css, borrados).
 */

:root {
  --cian: #00e5ff;
  --violeta: #8866ff;
  --destello: #67f0ff;
  --tinta: #050d1a;
  --superficie: #0b1a2e;
  --texto: #eef4fb;
  --texto-2: #b3c2d6;
  --texto-3: #7d8da3;
  --rojo: #f87171;
  --degrade: linear-gradient(135deg, var(--cian), var(--violeta));
  --curva: cubic-bezier(.2, 0, 0, 1);
  color-scheme: dark;
}

/* Una clase con `display` le gana al atributo `hidden` (gotcha §5 del manual): las dos vistas
   se verían apiladas con el JS funcionando perfecto. */
[hidden] { display: none !important; }

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

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--tinta);
  color: var(--texto);
  font: 400 16px/1.5 'Space Grotesk', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* El fondo cubre TODA la ventana (guía §5), detrás de todo. */
.fondo { position: fixed; inset: 0; z-index: 0; }
.fondo::after {
  /* Viñeta: el centro, donde está la tarjeta, queda más oscuro que los bordes. */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 55% at 50% 48%, rgba(5, 13, 26, .78), rgba(5, 13, 26, .25) 70%, transparent);
}

.escena {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(24px, 4.5vh, 44px);
  padding: 40px 16px 24px;
}

/* ── Logo protagonista (guía §3) ── */
.logo { margin: 0; line-height: 0; animation: entra .6s var(--curva) backwards; }
.logo img {
  display: block;
  width: min(430px, 78vw);
  height: auto;
  filter: drop-shadow(0 12px 48px rgba(0, 229, 255, .35));
}

/* ── Tarjeta de vidrio ── */
.tarjeta {
  width: min(440px, 100%);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 36px);
  background: color-mix(in srgb, var(--superficie) 74%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 80px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 229, 255, .06);
  animation: entra .6s var(--curva) .1s backwards;
}

.vista { display: flex; flex-direction: column; gap: 20px; }

.encabezado { display: flex; flex-direction: column; gap: 6px; }
h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 28px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
  text-wrap: balance;
}
.bajada { margin: 0; color: var(--texto-2); font-size: 15px; text-wrap: pretty; }

/* ── BotonLuz: el único de la pantalla (guía §3). Pastilla oscura con un borde que gira. ── */
.boton-luz {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 8px 8px 18px;
  border-radius: 999px;
  color: #fff; text-decoration: none;
  font-size: 16px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 10px 40px rgba(0, 229, 255, .22);
  transition: transform .16s var(--curva), box-shadow .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.boton-luz::before {
  content: ''; position: absolute; inset: -150% -20%; z-index: -2;
  background: conic-gradient(from 0deg, var(--cian), var(--violeta), var(--destello), var(--cian) 40%, transparent 55%, var(--cian));
  animation: girar 4s linear infinite;
}
.boton-luz::after {
  content: ''; position: absolute; inset: 1.5px; z-index: -1; border-radius: inherit;
  background: linear-gradient(180deg, rgb(14, 28, 50), rgb(8, 17, 33));
}
.boton-luz:hover { box-shadow: 0 14px 56px rgba(0, 229, 255, .38); }
.boton-luz:active { transform: scale(.96); }
.boton-luz:focus-visible { outline: 2px solid var(--violeta); outline-offset: 4px; }
.boton-luz .g-icono {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 50%; background: #fff;
}
/* Centrado óptico: el texto compensa el círculo de la flecha (guía §3). */
.boton-luz .texto { flex: 1; text-align: center; margin-right: -8px; }
.boton-luz .flecha {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; background: var(--degrade); color: #041018;
  transition: transform .2s var(--curva);
}
.boton-luz:hover .flecha { transform: translateX(3px); }

/* ── Separador: líneas que se desvanecen hacia los costados (guía §3) ── */
.separador { display: flex; align-items: center; gap: 12px; color: var(--texto-3); font-size: 13px; }
.separador::before, .separador::after { content: ''; flex: 1; height: 1px; }
.separador::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16)); }
.separador::after { background: linear-gradient(270deg, transparent, rgba(255, 255, 255, .16)); }

/* ── Formulario ── */
.form { display: flex; flex-direction: column; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-2); }
.campo input {
  height: 48px; padding: 0 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--texto); font: inherit; font-size: 16px; /* 16 px: iOS no hace zoom al enfocar */
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo input::placeholder { color: var(--texto-3); }
.campo input:focus { outline: none; border-color: var(--violeta); box-shadow: 0 0 0 3px rgba(136, 102, 255, .22); }

/* ── BotonSolido: la acción del formulario (guía §3) ── */
.boton-solido {
  min-height: 48px; margin-top: 4px;
  border: 0; border-radius: 999px;
  background: var(--degrade); color: #041018;
  font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 28px rgba(0, 229, 255, .18);
  cursor: pointer;
  transition: transform .16s var(--curva), opacity .15s ease;
}
.boton-solido:active { transform: scale(.96); }
.boton-solido:disabled { opacity: .55; cursor: default; }
.boton-solido:focus-visible { outline: 2px solid var(--violeta); outline-offset: 4px; }

.error {
  margin: 0; padding: 10px 14px; border-radius: 12px;
  background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .3);
  color: #fecaca; font-size: 14px;
}
.status { margin: 0; color: var(--destello); font-size: 14px; text-align: center; }
.ayuda { margin: 0; color: var(--texto-3); font-size: 13px; text-align: center; text-wrap: pretty; }
/* Un aviso que no es un error: «tu solicitud está pendiente». Cian, no rojo. */
.aviso {
  margin: 0; padding: 10px 14px; border-radius: 12px;
  background: rgba(0, 229, 255, .07); border: 1px solid rgba(0, 229, 255, .28);
  color: var(--texto); font-size: 14px; text-wrap: pretty;
}

/* ── «¿No tenés cuenta? Solicitá una» (2026-09-29) ── */
.pedir {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px;
  color: var(--texto-2); font-size: 14px;
}
.pedir + .ayuda { margin-top: -12px; }
/* Secundario: sin relleno ni luz, para no competir con el BotonLuz. 44 px de alto: se toca. */
.boton-fantasma {
  min-height: 44px; padding: 0 18px;
  border: 1px solid rgba(0, 229, 255, .35); border-radius: 999px;
  background: transparent; color: var(--destello);
  font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .16s var(--curva);
}
.boton-fantasma:hover { border-color: var(--cian); background: rgba(0, 229, 255, .08); }
.boton-fantasma:active { transform: scale(.96); }
.boton-fantasma:focus-visible { outline: 2px solid var(--violeta); outline-offset: 4px; }
.boton-volver { align-self: center; }

/* Google en la solicitud: pastilla con borde, sin el borde de luz (el BotonLuz es uno solo). */
.boton-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 52px; padding: 8px 18px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .04);
  color: var(--texto); text-decoration: none; font-size: 16px; font-weight: 600;
  transition: border-color .15s ease, background-color .15s ease, transform .16s var(--curva);
}
.boton-google:hover { border-color: rgba(0, 229, 255, .5); background: rgba(255, 255, 255, .07); }
.boton-google:active { transform: scale(.96); }
.boton-google:focus-visible { outline: 2px solid var(--violeta); outline-offset: 4px; }
.boton-google .g-icono {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: #fff;
}

.campo span em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--texto-3); }
.campo textarea {
  min-height: 72px; padding: 12px 14px; resize: vertical;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--texto); font: inherit; font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo textarea::placeholder { color: var(--texto-3); }
.campo textarea:focus { outline: none; border-color: var(--violeta); box-shadow: 0 0 0 3px rgba(136, 102, 255, .22); }

.tilde {
  display: grid; place-items: center; width: 52px; height: 52px;
  border-radius: 50%; background: var(--degrade); color: #041018;
  box-shadow: 0 10px 36px rgba(0, 229, 255, .3);
}

/* ── Footer fino (guía §3): una línea, casi transparente ── */
.pie {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  padding: 12px 24px;
  font-size: 11px; color: var(--texto-3);
  background: color-mix(in srgb, var(--tinta) 70%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.pie a { color: inherit; text-decoration: none; }
.pie a:hover { color: var(--texto-2); }

/* El selector de idioma: texto chico como el resto del pie, con área de toque de 40 px. */
.idiomas { display: flex; gap: 2px; }
.idiomas button {
  min-height: 40px; padding: 0 10px; border: 0; border-radius: 999px; background: none;
  color: var(--texto-3); font: inherit; font-size: 12px; cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.idiomas button:hover { color: var(--texto-2); }
.idiomas button[aria-pressed="true"] { color: var(--destello); background: rgba(0, 229, 255, .08); }
.idiomas button:focus-visible { outline: 2px solid var(--violeta); outline-offset: 2px; }

/* Mientras login.js pone los textos de otro idioma (ver el <script> del <head>). Si el JS no
   llega, se muestra igual a los 1,5 s: una página en castellano es mejor que una en blanco. */
.i18n-pendiente .escena { visibility: hidden; animation: mostrar 0s 1.5s forwards; }
@keyframes mostrar { to { visibility: visible; } }

@keyframes girar { to { transform: rotate(1turn); } }
/* La entrada va en envoltorios (logo y tarjeta), nunca en los botones: con el `to` aplicado,
   el `scale(.96)` del :active dejaría de andar (gotcha §5). `backwards`, no `both`. */
@keyframes entra { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  .boton-luz::before { animation: none; }
  .logo, .tarjeta { animation: none; }
}
