/* =============================================================================
 * login.css — Pantalla de ingreso de CELSUR ONLINE (Skill 8, rediseño G23+)
 * Dos paneles: marca (oscuro, con gradientes/animación CSS) + tarjeta de login.
 * Inspirado en la referencia de diseño, adaptado a la marca Celsur y al backend
 * real. Sin JS (CSP estricta): las animaciones son puro CSS. Fuente del sistema.
 * ========================================================================== */
:root {
    --c-primary:       #1f63ad;   /* azul Celsur */
    --c-primary-hover: #184f8c;
    --c-accent:        #f08c00;   /* naranja Celsur */
    --c-navy:          #0f2c4d;   /* base del panel de marca */

    --g-50:  #f6f8fb;

    --txt-strong: #14213a;
    --txt-body:   #3a4a5c;
    --txt-muted:  #6b7785;
    --border:     #dde3ea;

    --r-sm: 4px; --r-md: 8px; --r-full: 9999px;
    --sh-sm: 0 1px 2px rgba(0,0,0,.06);
    --sh-md: 0 6px 20px rgba(15,44,77,.12);
    --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body.login {
    margin: 0; min-height: 100vh;
    font-family: var(--font); font-size: 15px; line-height: 1.5;
    color: var(--txt-body); background: var(--g-50);
}

/* ===== Layout dos paneles ===== */
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }

/* ---- Panel izquierdo: marca ---- */
.login-brand {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 56px 48px;
    color: #fff;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(31,99,173,.45), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(240,140,0,.20), transparent 55%),
        var(--c-navy);
}
.grid-anim {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
            mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
    animation: drift 22s linear infinite;
}
@keyframes drift { from { background-position: 0 0, 0 0; } to { background-position: 44px 44px, 44px 44px; } }
.pulse {
    position: absolute; width: 10px; height: 10px; border-radius: var(--r-full);
    background: var(--c-primary); animation: ping 3.2s ease-out infinite;
}
.pulse.p1 { top: 24%; left: 30%; animation-delay: 0s; }
.pulse.p2 { top: 58%; left: 62%; animation-delay: .9s; background: var(--c-accent); }
.pulse.p3 { top: 72%; left: 22%; animation-delay: 1.7s; }
.pulse.p4 { top: 38%; left: 74%; animation-delay: 2.4s; }
@keyframes ping {
    0%   { transform: scale(.6); box-shadow: 0 0 0 0 rgba(31,99,173,.55); opacity: 1; }
    70%  { box-shadow: 0 0 0 26px rgba(31,99,173,0); opacity: .9; }
    100% { transform: scale(.6); box-shadow: 0 0 0 0 rgba(31,99,173,0); opacity: .6; }
}

.brand-top { position: relative; z-index: 2; }
.brand-chip { display: inline-block; background: #fff; padding: 10px 16px; border-radius: var(--r-md); box-shadow: var(--sh-md); }
.brand-logo { display: block; height: 34px; }

.brand-mid { position: relative; z-index: 2; max-width: 460px; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
    color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
    padding: 5px 12px; border-radius: var(--r-full);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--c-accent); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:.25;} }
.headline { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 700; line-height: 1.18; margin: 24px 0 14px; color: #fff; }
.epic { font-size: 1.2rem; font-weight: 600; }
.epic .grad {
    background: linear-gradient(90deg, #5aa0e6, var(--c-accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--c-accent);
}

.stats { position: relative; z-index: 2; display: flex; gap: 44px; margin-top: 28px; }
.stat .num { font-size: 1.5rem; font-weight: 700; color: #fff; }
.stat .lbl { font-size: 11px; color: #9fb3c8; text-transform: uppercase; letter-spacing: 1px; }
.copyright { position: relative; z-index: 2; margin: 18px 0 0; font-size: 12px; color: #8aa0b6; }

/* ---- Layout simple (recuperar / restablecer / reauth / avisos) ---- */
.auth-simple {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: radial-gradient(1000px 500px at 50% -10%, rgba(31,99,173,.40), transparent 60%),
                radial-gradient(800px 400px at 100% 110%, rgba(240,140,0,.16), transparent 55%),
                var(--c-navy);
}
.auth-simple .login-card { max-width: 380px; }
.card-logo { text-align: center; margin: 0 0 18px; }
.card-logo img { height: 30px; }
.card-foot { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--txt-muted); }
.card-foot a { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.card-foot a:hover { text-decoration: underline; }

/* ---- Panel derecho: tarjeta de login ---- */
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: var(--g-50); }
.login-card {
    width: 100%; max-width: 400px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
    box-shadow: var(--sh-sm); padding: 40px 32px;
    animation: rise .55s cubic-bezier(.21,.85,.3,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-card h1 { margin: 0 0 4px; font-size: 1.9rem; font-weight: 700; color: var(--txt-strong); line-height: 1.2; }
.login-card .sub { margin: 0 0 28px; color: var(--txt-muted); font-size: 14px; }

.campo { display: block; margin-bottom: 16px; }
.campo > span { display: block; font-size: 13px; font-weight: 600; color: var(--txt-body); margin-bottom: 7px; }
.input-wrap { position: relative; }
.input-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--txt-muted); pointer-events: none; }
.campo input {
    width: 100%; font-family: inherit; font-size: 15px; color: var(--txt-strong);
    background: var(--g-50); border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 11px 12px 11px 40px; transition: border-color .15s ease, box-shadow .15s ease;
}
.campo input::placeholder { color: var(--txt-muted); }
.campo input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(31,99,173,.18); }
.campo.plain input { padding-left: 12px; }

.row { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 22px; font-size: 13px; }
.link { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

.btn-login {
    width: 100%; background: var(--c-primary); color: #fff; border: 0;
    padding: 12px 16px; border-radius: var(--r-sm); font-family: inherit; font-size: 15px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background .15s ease, transform .05s ease;
}
.btn-login:hover { background: var(--c-primary-hover); }
.btn-login:active { transform: translateY(1px); }
.btn-login svg { transition: transform .2s ease; }
.btn-login:hover svg { transform: translateX(3px); }

.aviso { margin: 0 0 16px; padding: 9px 12px; border-radius: var(--r-sm); font-size: 13px; }
.aviso.error { background: #fdecec; color: #b42318; border: 1px solid #f4c9c9; }
.aviso.ok    { background: #e7f6ec; color: #1a7f37; border: 1px solid #bfe6cd; }
.aviso.info  { background: #eaf1fb; color: #184f8c; border: 1px solid #c9ddf4; }

/* ---- Verificación en dos pasos (MFA) ---- */
.login-card .sub { } /* hereda */
.mfa-enrol { margin: 0 0 18px; padding: 14px; background: var(--g-50); border: 1px solid var(--border); border-radius: var(--r-sm); }
.mfa-enrol h2 { margin: 0 0 6px; font-size: 1rem; font-weight: 600; color: var(--txt-strong); }
.mfa-enrol .sub { margin: 0 0 10px; }
.mfa-key {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 1.05rem; font-weight: 600; letter-spacing: 2px; color: var(--c-primary);
    background: #fff; border: 1px dashed var(--c-primary); border-radius: var(--r-sm);
    padding: 10px 12px; text-align: center; word-break: break-all;
}
.mfa-qr { margin: 0 0 12px; text-align: center; min-height: 4px; }
.mfa-qr img { display: inline-block; background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm); max-width: 200px; }
.mfa-uri { margin: 10px 0 0; font-size: 12px; color: var(--txt-muted); word-break: break-all; }
.mfa-uri code { font-size: 11px; }
.mfa-code { text-align: center; letter-spacing: 8px; font-size: 1.3rem; font-weight: 600; }
.btn-ghost {
    width: 100%; margin-top: 12px; background: transparent; color: var(--txt-body);
    border: 1px solid var(--border); padding: 10px 14px; border-radius: var(--r-sm);
    font-family: inherit; font-size: 13px; cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.btn-ghost:hover { background: var(--g-50); border-color: var(--txt-muted); }

/* Responsive: el panel de marca pasa arriba */
@media (max-width: 880px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-brand { padding: 36px 28px; }
    .stats { gap: 28px; }
}
@media (prefers-reduced-motion: reduce) {
    .grid-anim, .pulse, .eyebrow .dot, .login-card { animation: none; }
}
