/*
 * GestionIdtx — pantallas de acceso (login, recuperar y restablecer contraseña).
 * Panel azul con ilustración a la izquierda; formulario sobre fondo oscuro a la
 * derecha; avisos flotantes arriba a la derecha (3 s, ver auth.js).
 */

:root {
    --gx-hero-1: #3f7acb;
    --gx-hero-2: #2a5eab;
    --gx-hero-3: #1d4a8f;

    --gx-bg: #050f24;
    --gx-surface: #0b1a36;
    --gx-surface-2: #0e2042;
    --gx-border: #1c2e52;
    --gx-border-hover: #2a4170;

    --gx-text: #eaf1fb;
    --gx-label: #c8d4e8;
    --gx-muted: #8698b8;
    --gx-faint: #5d6f90;

    --gx-accent: #3b7ddd;
    --gx-accent-2: #4a8ae8;
    --gx-accent-soft: #6aa5f5;
    --gx-ring: rgba(75, 141, 240, .32);
    --gx-link: #ff6b7a;

    --gx-ok: #22c55e;
    --gx-err: #f43f5e;
    --gx-warn: #f59e0b;
    --gx-info: #38bdf8;

    --gx-radius: 10px;
    --gx-ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body.gx {
    margin: 0;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: var(--gx-bg);
    color: var(--gx-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.gx-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 41fr) minmax(0, 59fr);
}

/* ── Panel izquierdo: ilustración ───────────────────────────────── */
.gx-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 48px 56px;
    background: linear-gradient(160deg, var(--gx-hero-1) 0%, var(--gx-hero-2) 55%, var(--gx-hero-3) 100%);
}
/* Anillos concéntricos y luces suaves del fondo */
.gx-hero::before,
.gx-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, rgba(255, 255, 255, .11) 0 1px, transparent 1px 10px);
    -webkit-mask: radial-gradient(circle, #000 0 40%, transparent 70%);
    mask: radial-gradient(circle, #000 0 40%, transparent 70%);
    pointer-events: none;
}
.gx-hero::before { width: 560px; height: 560px; left: -300px; top: 6%; }
.gx-hero::after { width: 520px; height: 520px; right: -280px; bottom: -240px; }
.gx-hero-glow {
    position: absolute;
    z-index: -1;
    inset: -20% -10% auto auto;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .12), transparent 65%);
    pointer-events: none;
}

.gx-illus {
    display: block;
    width: min(100%, 520px);
    height: auto;
    filter: drop-shadow(0 26px 40px rgba(6, 22, 54, .32));
}
.gx-float-a, .gx-float-b {
    transform-box: fill-box;
    animation: gxFloat 6s ease-in-out infinite;
}
.gx-float-b { animation-duration: 7.5s; animation-delay: -2.5s; }

.gx-hero-copy { max-width: 450px; text-align: center; }
.gx-motto {
    margin: 0 0 10px;
    font-size: clamp(1.6rem, 2.2vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.15;
    color: #fff;
}
.gx-motto i { font-style: normal; color: #a5f3fc; }
.gx-hero-copy p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(234, 241, 251, .84);
}

/* ── Panel derecho: formulario ──────────────────────────────────── */
.gx-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 40px 24px 24px;
    background:
        radial-gradient(900px 520px at 88% -12%, rgba(59, 125, 221, .14), transparent 60%),
        radial-gradient(700px 420px at -10% 110%, rgba(59, 125, 221, .07), transparent 60%),
        var(--gx-bg);
}
.gx-panel-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gx-card {
    width: 100%;
    max-width: 440px;
    animation: gxRise .55s var(--gx-ease) both;
}

.gx-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
    color: var(--gx-text);
    text-decoration: none;
    border-radius: 12px;
}
.gx-brand:focus-visible { outline: 2px solid var(--gx-accent-soft); outline-offset: 6px; }
.gx-mark { flex: none; filter: drop-shadow(0 10px 18px rgba(37, 99, 235, .35)); }
.gx-brand-text { display: flex; flex-direction: column; gap: 6px; line-height: 1; }
.gx-brand-name { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.gx-brand-name span {
    font-weight: 800;
    color: var(--gx-accent-soft);
    background: linear-gradient(90deg, #38bdf8, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.gx-brand-tag {
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--gx-muted);
    white-space: nowrap;
}

.gx-title { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.gx-sub { margin: 8px 0 32px; font-size: .95rem; color: var(--gx-muted); }

.gx-field { margin-bottom: 20px; }
.gx-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.gx-label { display: block; font-size: .875rem; font-weight: 600; color: var(--gx-label); }
.gx-field > .gx-label { margin-bottom: 8px; }
.gx-link-danger {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gx-link);
    text-decoration: none;
    white-space: nowrap;
    border-radius: 4px;
}
.gx-link-danger:hover { text-decoration: underline; text-underline-offset: 3px; }
.gx-link-danger:focus-visible { outline: 2px solid var(--gx-link); outline-offset: 3px; }

.gx-input-wrap {
    display: flex;
    align-items: stretch;
    background: var(--gx-surface);
    border: 1px solid var(--gx-border);
    border-radius: var(--gx-radius);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.gx-input-wrap:hover { border-color: var(--gx-border-hover); }
.gx-input-wrap:focus-within {
    border-color: var(--gx-accent-2);
    background: var(--gx-surface-2);
    box-shadow: 0 0 0 4px var(--gx-ring);
}
.gx-input-wrap.is-invalid { border-color: var(--gx-err); box-shadow: 0 0 0 4px rgba(244, 63, 94, .18); animation: gxShake .35s ease; }
.gx-input-icon {
    display: flex;
    align-items: center;
    padding-left: 16px;
    font-size: .92rem;
    color: var(--gx-faint);
    transition: color .15s ease;
}
.gx-input-wrap:focus-within .gx-input-icon { color: var(--gx-accent-soft); }
.gx-input {
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 0 16px 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--gx-text);
    font: inherit;
    font-size: .95rem;
}
.gx-input::placeholder { color: var(--gx-faint); opacity: 1; }
.gx-input:-webkit-autofill,
.gx-input:-webkit-autofill:hover,
.gx-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--gx-text);
    caret-color: var(--gx-text);
    -webkit-box-shadow: 0 0 0 1000px var(--gx-surface) inset;
    transition: background-color 9999s ease-out;
}
.gx-eye {
    flex: none;
    width: 52px;
    border: 0;
    border-left: 1px solid var(--gx-border);
    border-radius: 0 var(--gx-radius) var(--gx-radius) 0;
    background: transparent;
    color: var(--gx-muted);
    font-size: .95rem;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}
.gx-eye:hover { color: var(--gx-text); background: rgba(255, 255, 255, .03); }
.gx-eye:focus-visible { outline: 2px solid var(--gx-accent-soft); outline-offset: -3px; }

.gx-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    font-size: .9rem;
    color: var(--gx-muted);
    cursor: pointer;
    user-select: none;
}
.gx-check input {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-content: center;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid var(--gx-border-hover);
    border-radius: 5px;
    background: var(--gx-surface);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.gx-check input::after {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border: 2px solid #fff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) scale(0);
    transition: transform .15s var(--gx-ease);
}
.gx-check input:checked { background: var(--gx-accent); border-color: var(--gx-accent); }
.gx-check input:checked::after { transform: rotate(-45deg) scale(1); }
.gx-check input:focus-visible { outline: 2px solid var(--gx-accent-soft); outline-offset: 2px; }
.gx-check:hover { color: var(--gx-label); }

.gx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    margin-top: 28px;
    border: 0;
    border-radius: var(--gx-radius);
    background: linear-gradient(180deg, var(--gx-accent-2), var(--gx-accent));
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 26px -12px rgba(59, 125, 221, .85), inset 0 1px 0 rgba(255, 255, 255, .15);
    transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.gx-btn:hover { filter: brightness(1.07); box-shadow: 0 16px 30px -12px rgba(59, 125, 221, .95), inset 0 1px 0 rgba(255, 255, 255, .15); }
.gx-btn:active { transform: translateY(1px); }
.gx-btn:focus-visible { outline: 3px solid var(--gx-ring); outline-offset: 3px; }
.gx-btn-arrow { font-size: .9rem; transition: transform .15s ease; }
.gx-btn:hover .gx-btn-arrow { transform: translateX(3px); }
.gx-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gxSpin .7s linear infinite;
}
.gx-btn.is-loading { pointer-events: none; filter: saturate(.85); }
.gx-btn.is-loading .gx-spinner { display: inline-block; }
.gx-btn.is-loading .gx-btn-arrow { display: none; }

.gx-alt { margin: 24px 0 0; text-align: center; font-size: .9rem; }
.gx-alt a { color: var(--gx-accent-soft); text-decoration: none; font-weight: 600; border-radius: 4px; }
.gx-alt a:hover { text-decoration: underline; text-underline-offset: 3px; }
.gx-alt a:focus-visible { outline: 2px solid var(--gx-accent-soft); outline-offset: 3px; }

.gx-foot { padding-top: 32px; text-align: center; font-size: .8rem; color: var(--gx-faint); }

/* ── Animaciones ────────────────────────────────────────────────── */
@keyframes gxRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gxFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes gxSpin { to { transform: rotate(360deg); } }
@keyframes gxShake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1180px) {
    .gx-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .gx-hero { padding: 40px 32px; }
}
@media (max-width: 880px) {
    .gx-shell { grid-template-columns: minmax(0, 1fr); }
    .gx-hero { display: none; }
    .gx-panel {
        padding: 32px 16px 20px;
        background:
            radial-gradient(640px 320px at 50% -8%, rgba(59, 125, 221, .26), transparent 70%),
            var(--gx-bg);
    }
    .gx-card { max-width: 420px; }
    .gx-brand { display: flex; justify-content: center; margin-bottom: 28px; }
    .gx-head { text-align: center; }
    .gx-sub { margin-bottom: 28px; }
}
@media (max-width: 380px) {
    .gx-label-row { flex-direction: column; gap: 4px; }
    .gx-title { font-size: 1.5rem; }
}
@media (max-height: 640px) and (min-width: 881px) {
    .gx-illus { width: min(100%, 360px); }
    .gx-hero { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .gx-card, .gx-float-a, .gx-float-b, .gx-input-wrap.is-invalid { animation: none; }
}

/* ── Tema claro (data-theme="light", partials/tema_inicial + js/tema.js) ─────
 * El panel azul de la ilustración es igual en los dos temas; el formulario
 * cambia de fondo y de texto. */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] {
    color-scheme: light;
    --gx-bg: #f3f6fb;
    --gx-surface: #ffffff;
    --gx-surface-2: #ffffff;
    --gx-border: #d8e0ec;
    --gx-border-hover: #b7c5da;
    --gx-text: #0f172a;
    --gx-label: #334155;
    --gx-muted: #5b6b85;
    --gx-faint: #8b99b1;
    --gx-accent-soft: #2f6fd0;
    --gx-ring: rgba(59, 125, 221, .22);
    --gx-link: #e11d48;
}
:root[data-theme="light"] .gx-eye:hover { background: rgba(15, 23, 42, .04); }
:root[data-theme="light"] .gx-input-wrap { box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }

/* (Sin botón de tema: el inicio de sesión va siempre en claro; pedido del usuario, 19-nov.) */
.gx-panel { position: relative; }
