/* Animación de portal/puerta para login exitoso */
#login-success-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #1a2a4f 0%, #0f1829 100%);
    z-index: 9999;
    transition: opacity 0.8s ease;
    overflow: hidden;
}
#login-success-loader::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 
        radial-gradient(circles at 20% 80%, #2957a420 0%, transparent 50%),
        radial-gradient(circles at 80% 20%, #d7313520 0%, transparent 50%),
        radial-gradient(circles at 40% 40%, #ffffff10 0%, transparent 50%);
    animation: floatParticles 4s ease-in-out infinite alternate;
}
@keyframes floatParticles {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-20px) scale(1.05); }
}
.loader-portal {
    position: relative;
    width: 480px;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.portal-door {
    position: absolute;
    top: 0; width: 50%; height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    box-shadow: 
        0 0 60px #2957a455,
        inset 0 2px 20px #ffffff80,
        0 8px 32px #00000020;
    border-radius: 40px 0 0 40px;
    z-index: 2;
    transition: all 1.4s cubic-bezier(0.68, 0, 0.32, 1);
    backdrop-filter: blur(10px);
}
.portal-door-left { 
    left: 0; 
    border-radius: 40px 0 0 40px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
}
.portal-door-right { 
    right: 0; 
    border-radius: 0 40px 40px 0;
    background: linear-gradient(225deg, #ffffff 0%, #f0f4ff 100%);
}
.portal-content {
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
}
.portal-content img {
    filter: drop-shadow(0 4px 20px #ffffff40);
    animation: logoGlow 2s ease-in-out infinite alternate;
}
@keyframes logoGlow {
    0% { transform: scale(1); filter: drop-shadow(0 4px 20px #ffffff40); }
    100% { transform: scale(1.05); filter: drop-shadow(0 8px 30px #ffffff60); }
}
#saludo-usuario {
    color: #fff;
    font-weight: 800;
    font-size: 2.4rem;
    margin: 15px 0;
    text-shadow: 0 2px 20px #00000050;
    animation: textGlow 2s ease-in-out infinite alternate;
    text-align: center;
    line-height: 1.1;
    letter-spacing: -1px;
}
@keyframes textGlow {
    0% { text-shadow: 0 2px 20px #00000050, 0 0 40px #ffffff30; }
    100% { text-shadow: 0 4px 30px #00000070, 0 0 60px #ffffff50; }
}
.loader-spinner {
    margin-top: 25px;
    position: relative;
    width: 60px;
    height: 60px;
}
.loader-spinner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 4px solid #ffffff30;
    border-top: 4px solid #d73135;
    border-right: 4px solid #2957a4;
    border-radius: 50%;
    animation: spinPortal 1.2s cubic-bezier(0.68, 0, 0.32, 1) infinite;
}
.loader-spinner::after {
    content: '';
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    border: 3px solid transparent;
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spinPortalInner 0.8s linear infinite reverse;
}
@keyframes spinPortal {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes spinPortalInner {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}
.portal-door.open-left { 
    transform: translateX(-120%) rotateY(25deg); 
    opacity: 0.3;
}
.portal-door.open-right { 
    transform: translateX(120%) rotateY(-25deg); 
    opacity: 0.3;
}
/* CSS para login premium con fondo oscuro, logo blanco destacado, imagen lateral y tarjeta blanca */
body {
    background: linear-gradient(120deg, #1a2a4f 0%, #2957a4 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-contrast {
    display: flex;
    flex-direction: row;
    width: 94vw;
    max-width: 1200px;
    min-height: 600px;
    background: #fff;
    border-radius: 32px;
    box-shadow: 0 8px 32px rgba(41,87,164,0.18), 0 1.5px 8px #d7313533;
    overflow: hidden;
    animation: fadeIn 1s;
}
.login-contrast-img {
    flex: 1 1 50%;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    background: #1a2a4f;
}
.login-contrast-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 340px;
    filter: brightness(0.85) saturate(1.1);
}
.login-contrast-img .img-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(120deg, #1a2a4f 0%, #2957a4cc 100%);
    opacity: 0.55;
    z-index: 2;
}
.login-contrast-form {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 64px 56px 64px 56px;
    background: #1a2a4f;
}
.login-logo-wrap {
    width: 100%; text-align: center; margin-bottom: 22px;
}
.login-logo {
    max-width: 250px;
    border-radius: 18px;
    box-shadow: 0 2px 24px #0005;
    background: transparent;
    margin-bottom: 10px;
}
.login-contrast-form form {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 16px #2957a422;
    padding: 38px 32px 32px 32px;
    margin: 0 auto;
}
.login-contrast-form h2 {
    font-weight: 800;
    color: #2957a4;
    margin-bottom: 28px;
    text-align: center;
    font-size: 2.1rem;
    letter-spacing: -1px;
}
.login-contrast-form .form-group {
    margin-bottom: 22px;
}
.login-contrast-form .form-control {
    border-radius: 10px;
    border: 1.5px solid #e0e0e0;
    font-size: 1.13rem;
    background: #f8faff;
    padding-left: 46px;
    height: 50px;
}
.login-contrast-form .form-control:focus {
    border-color: #2957a4;
    box-shadow: 0 0 0 2px #2957a433;
}
.login-contrast-form .input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #2957a4;
    font-size: 1.25em;
}
.login-contrast-form .btn-login {
    background: linear-gradient(90deg, #2957a4, #d73135);
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 15px 0;
    font-size: 1.15rem;
    box-shadow: 0 2px 8px #2957a433;
    transition: background 0.2s, box-shadow 0.2s;
    width: 100%;
}
.login-contrast-form .btn-login:hover {
    background: linear-gradient(90deg, #d73135, #2957a4);
    box-shadow: 0 4px 16px #d7313555;
}
.login-contrast-form .forgot-link {
    text-align: right;
    font-size: 1em;
    color: #2957a4;
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    margin-bottom: 22px;
}
.login-contrast-form .forgot-link:hover {
    color: #d73135;
    text-decoration: underline;
}
@media (max-width: 900px) {
    .login-contrast { flex-direction: column; min-height: 0; width: 98vw; }
    .login-contrast-img, .login-contrast-form { flex: 1 1 100%; min-height: 220px; }
    .login-contrast-img img { min-height: 180px; }
    .login-contrast-form { padding: 36px 12px 32px 12px; }
}
@media (max-width: 600px) {
    .login-contrast { border-radius: 0; box-shadow: none; flex-direction: column; }
    .login-contrast-img { display: none; }
    .login-contrast-form { padding: 24px 8px 18px 8px; }
}

/* ─── Botón ojo para ver/ocultar contraseña ─── */
.btn-eye-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #2957a4;
    font-size: 1.15em;
    padding: 0 4px;
    line-height: 1;
    z-index: 5;
    transition: color 0.2s;
}
.btn-eye-toggle:hover { color: #d73135; }
.btn-eye-toggle:focus { outline: none; }

/* ─── Botón de login deshabilitado ─── */
.btn-login:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    pointer-events: all !important;
}

/* ─── CAPTCHA checkbox estilo "No soy un robot" ─── */
.captcha-wrap {
    margin-bottom: 18px;
}
.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8faff;
    border: 1.5px solid #d0d8ea;
    border-radius: 10px;
    padding: 12px 16px 12px 14px;
    min-height: 64px;
    box-shadow: 0 1px 6px #2957a415;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    user-select: none;
}
.captcha-box:hover {
    border-color: #2957a4;
    box-shadow: 0 2px 12px #2957a425;
}
.captcha-check-area {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}
/* El cuadrado del checkbox */
.captcha-checkbox {
    width: 28px;
    height: 28px;
    border: 2.5px solid #b0b8cc;
    border-radius: 5px;
    background: #fff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
    cursor: pointer;
}
.captcha-checkbox:hover {
    border-color: #2957a4;
    box-shadow: 0 0 0 3px #2957a422;
}
.captcha-checkbox.checking {
    border-color: #2957a4;
}
.captcha-checkbox.verified {
    border-color: #1a7340;
    background: #e8f8ef;
    box-shadow: 0 0 0 3px #1a734020;
}
/* Spinner de verificación */
.captcha-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid #2957a430;
    border-top: 2.5px solid #2957a4;
    border-radius: 50%;
    animation: captchaSpin 0.7s linear infinite;
    position: absolute;
}
.captcha-checkbox.checking .captcha-spinner { display: block; }
@keyframes captchaSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Checkmark SVG */
.captcha-checkmark {
    display: none;
    width: 20px;
    height: 20px;
    position: absolute;
}
.captcha-checkmark svg {
    width: 20px;
    height: 20px;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    transition: stroke-dashoffset 0.38s cubic-bezier(.4,0,.2,1);
}
.captcha-checkbox.verified .captcha-checkmark { display: flex; }
.captcha-checkbox.verified .captcha-checkmark svg { stroke-dashoffset: 0; }

/* Label */
.captcha-label {
    font-size: 1.02rem;
    color: #2c3e6a;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Branding lateral */
.captcha-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 14px;
    border-left: 1.5px solid #e0e8f5;
    min-width: 64px;
    gap: 2px;
}
.captcha-brand-icon {
    font-size: 1.5rem;
    color: #2957a4;
    margin-bottom: 2px;
}
.captcha-brand-name {
    font-size: 0.72rem;
    font-weight: 800;
    color: #2957a4;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.captcha-brand-sub {
    font-size: 0.62rem;
    color: #8a9bbf;
    letter-spacing: 0.03em;
}

/* Sacudida cuando intenta enviar sin CAPTCHA */
@keyframes captchaShake {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(-7px); }
    40%  { transform: translateX(7px); }
    60%  { transform: translateX(-5px); }
    80%  { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

