:root {
    color-scheme: light;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
body {
    margin: 0;
    min-height: 100vh;
    /* Fondo con el degradado original */
    background: radial-gradient(circle at top left, #e6f3ff 0%, #f4ecff 40%, #e1f8ff 100%);
    display: flex;
    /* CAMBIO CLAVE: center en lugar de flex-start para centrar verticalmente */
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vh, 1.5rem) clamp(1.5rem, 4vw, 3rem);
}
.login-wrapper {
    position: relative;
    width: min(1100px, 100%);
    min-height: clamp(520px, 70vh, 640px);
    display: flex;
    flex-direction: row;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 24px 60px rgba(44, 72, 99, 0.18);
    backdrop-filter: blur(6px);
}
.login-panel {
    width: 100%;
    max-width: clamp(320px, 34vw, 360px);
    padding: clamp(1.7rem, 3vw, 2.7rem);
    background-color: rgba(255, 255, 255, 0.96);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.35rem;
    z-index: 2;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.login-brand img {
    width: 84px;
    height: auto;
    filter: drop-shadow(0 12px 20px rgba(12, 66, 107, 0.22));
}
.login-card {
    width: 100%;
}
.login-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0d3c61;
    margin-bottom: 1.4rem;
    text-align: left;
}
.form-label {
    font-weight: 600;
    color: #09395f;
}
.form-control {
    border-radius: 0.85rem;
    border: 1px solid rgba(9, 57, 95, 0.16);
    padding: 0.7rem 0.9rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-control:focus {
    border-color: #4aa9ff;
    box-shadow: 0 0 0 0.25rem rgba(74, 169, 255, 0.25);
}
.btn-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #2f89ff, #45c6ff);
    border: none;
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    /* Añadido para mejor UX */
}
.btn-brand:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(45, 146, 255, 0.35);
}
.btn-brand:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.3rem rgba(69, 198, 255, 0.35);
}
.forgot-link {
    color: #1768ff;
    font-weight: 600;
    text-decoration: none;
}
.forgot-link:hover,
.forgot-link:focus {
    text-decoration: underline;
    color: #0a3e91;
}
.github-link {
    margin-top: 2rem;
    text-align: center;
}
.github-link a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    color: #0d3c61;
    background: rgba(13, 60, 97, 0.08);
    font-size: 1.75rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
    text-decoration: none;
}
.github-link a:hover,
.github-link a:focus-visible {
    color: #fff;
    background: #24292f;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(36, 41, 47, 0.35);
    outline: none;
}
/* Estilos Visuales (Lado derecho/superior) */
.login-visual {
    position: relative;
    flex: 1;
    min-height: clamp(320px, 60vh, 520px);
    background: linear-gradient(135deg, rgba(137, 192, 255, 0.85), rgba(195, 172, 255, 0.85));
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-visual::before {
    content: "";
    position: absolute;
    inset: -40% -20%;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.4) 0%, transparent 55%),
        radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 50% 90%, rgba(255, 255, 255, 0.35) 0%, transparent 50%),
        linear-gradient(135deg, rgba(72, 144, 255, 0.8), rgba(169, 103, 255, 0.75), rgba(103, 219, 255, 0.8));
    filter: blur(0px);
    background-size: 120% 120%, 120% 120%, 150% 150%, 200% 200%;
    animation: gradientFlow 18s ease-in-out infinite;
}
.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('../img/logo.png');
    background-repeat: repeat;
    background-size: 220px auto;
    background-position: center;
    opacity: 0.08;
    mix-blend-mode: screen;
    animation: logoWave 24s linear infinite;
}
.visual-logo {
    position: relative;
    width: clamp(220px, 32vw, 320px);
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    border-radius: 13%;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 30px 60px rgba(15, 73, 118, 0.25);
    overflow: hidden;
    backdrop-filter: blur(6px);
    animation: floatUp 9s ease-in-out infinite;
}
.visual-logo img {
    width: 72%;
    height: auto;
    filter: drop-shadow(0 18px 28px rgba(12, 61, 102, 0.18));
    animation: logoPulse 6s ease-in-out infinite;
}
/* Animaciones */
@keyframes gradientFlow {
    0% {
        transform: translate3d(-6%, -4%, 0) scale(1.05);
    }
    50% {
        transform: translate3d(6%, 8%, 0) scale(1.1);
    }
    100% {
        transform: translate3d(-6%, -4%, 0) scale(1.05);
    }
}
@keyframes logoWave {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}
@keyframes floatUp {
    0%,
    100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-18px);
    }
}
@keyframes logoPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.04);
        opacity: 0.92;
    }
}
/* Media Queries */
@media (max-width: 1200px) {
    .login-wrapper {
        width: min(960px, 100%);
    }
}
@media (max-width: 992px) {
    .login-wrapper {
        flex-direction: column;
        width: min(560px, 100%);
        min-height: auto;
    }
    .login-visual {
        order: -1;
        min-height: clamp(220px, 35vh, 320px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    }
    .login-panel {
        max-width: 100%;
        padding: 2.5rem;
    }
    .visual-logo {
        width: clamp(160px, 28vw, 200px);
    }
}
@media (max-width: 768px) {
    body {
        /* En móviles permitimos que fluya si es necesario, pero centrado si sobra espacio */
        align-items: center;
        padding: 0;
    }
    .login-wrapper {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }
    .login-panel {
        padding: clamp(2rem, 5vw, 2.5rem);
    }
    .login-card h2 {
        font-size: clamp(1.5rem, 5vw, 1.75rem);
    }
}
@media (max-width: 576px) {
    .login-panel {
        padding: clamp(1.5rem, 6vw, 2rem);
    }
    .login-brand img {
        width: 60px;
    }
}
@media (max-height: 640px) and (min-width: 769px) {
    body {
        padding: 1rem;
    }
    .login-wrapper {
        min-height: auto;
        height: auto;
    }
    .login-panel {
        padding: 1.5rem;
    }
    .login-visual {
        min-height: 200px;
    }
}
/* =========================================
   NUEVAS ANIMACIONES DE ENTRADA Y OVERLAY
   ========================================= */
/* 1. Animaci��n de Entrada del Login (Slide-in) 
   Estas clases se usan en el HTML para que el panel y la imagen entren suavemente.
*/
.slide-in-left {
    opacity: 0;
    animation: slideInLeft 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.slide-in-right {
    opacity: 0;
    animation: slideInRight 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.2s;
    /* Peque�0�9o retraso para efecto cascada */
}
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
/* 2. Pantalla de Transici��n (Overlay Glassmorphism) 
   Se muestra al enviar el formulario.
*/
#loading-overlay {
    position: fixed;
    inset: 0;
    /* Top, right, bottom, left = 0 */
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.92);
    /* Blanco casi s��lido */
    backdrop-filter: blur(12px);
    /* Efecto vidrio potente */
    z-index: 9999;
    /* Por encima de todo */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#loading-overlay.active {
    opacity: 1;
    visibility: visible;
}
/* Logo pulsando en el centro del overlay */
.loader-logo {
    width: 90px;
    /* Un poco m��s grande que en el panel */
    height: auto;
    margin-bottom: 2rem;
    animation: pulse-blue 2s infinite ease-in-out;
}
/* Barra de progreso minimalista */
.loader-bar-bg {
    width: 260px;
    height: 4px;
    background-color: rgba(13, 60, 97, 0.1);
    /* Azul oscuro muy suave */
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.loader-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2f89ff, #45c6ff);
    /* Mismo gradiente que tu bot��n */
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s ease-out;
    /* Transici��n controlada por JS */
}
/* Texto de estado debajo de la barra */
.loader-text {
    margin-top: 1.2rem;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0d3c61;
    /* Azul corporativo */
    letter-spacing: 0.5px;
    opacity: 0.8;
}
/* Animaci��n de latido para el logo del loader */
@keyframes pulse-blue {
    0% {
        transform: scale(0.95);
        filter: drop-shadow(0 0 0 rgba(47, 137, 255, 0.4));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 15px rgba(47, 137, 255, 0.2));
    }
    100% {
        transform: scale(0.95);
        filter: drop-shadow(0 0 0 rgba(47, 137, 255, 0));
    }
}