/* --- VARIABLES --- */
:root {
    --azul-oscuro: #1a2a5f;
    --azul: #334c95;
    --naranja: #d67e29;
    --naranja-claro: #ff9d42;
    --blanco: #ffffff;
    --gris-input: #f8fafc;
    --gris-borde: #e2e8f0;
    --texto: #334155;
    --icono-color: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--texto);
    margin: 0;
    padding: 20px;
    position: relative;
    overflow: hidden;
    background-color: #ffffff; /* Fondo negro mientras carga el video */
}

/* --- VIDEO BACKGROUND --- */
#video-bg {
    position: fixed;
    inset: 0;
    width: auto;
    left: 40%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    /* Inicialmente oculto para GSAP */
    opacity: 0;
    visibility: hidden;
}

@media (max-width: 768px) {
    #video-bg {
        left: 0 !important;
        width: 100% !important;
        object-position: center center !important;
    }
}

/* --- PRELOADER (NUEVO) --- */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--blanco);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-logo {
    width: 80px;
    height: 80px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--azul-oscuro);
    border-radius: 50%;
    animation: spinLoader 13s linear infinite;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

/* --- WRAPPER DEL LOGIN --- */
.login-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Inicialmente oculto para GSAP */
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px);
}

/* --- LOGO --- */
.logo-container {
    margin-bottom: 25px;
    transition: transform 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.02);
}

.logo-img {
    max-width: 190px;
    height: auto;
    display: block;
    margin: 0 auto;
}

h2 {
    color: var(--azul-oscuro);
    font-weight: 700;
    font-size: 24px;
    margin-bottom: 8px;
}

p.subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 35px;
    font-weight: 500;
}

/* --- INPUTS --- */
.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--azul);
    margin-bottom: 8px;
    display: block;
    margin-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-wrapper {
    position: relative;
}

.custom-input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    background-color: var(--gris-input);
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    font-size: 14px;
    color: var(--texto);
    outline: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.custom-input::placeholder {
    color: #cbd5e1;
}

.custom-input:focus {
    background-color: var(--blanco);
    border-color: var(--naranja);
    box-shadow: 0 0 0 4px rgba(214, 126, 41, 0.15);
}

.custom-input.has-content {
    background-color: var(--blanco);
}

/* --- ÍCONOS --- */
.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--icono-color);
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 5;
}

.custom-input:focus+.input-icon,
.custom-input.has-content+.input-icon,
input:-webkit-autofill+.input-icon {
    color: var(--naranja) !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important;
    -webkit-text-fill-color: #000 !important;
    transition: background-color 5000s ease-in-out 0s;
}

.toggle-pass {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--icono-color);
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
}

.toggle-pass:hover {
    color: var(--naranja);
}

.custom-input:focus~.toggle-pass {
    color: var(--naranja);
}

/* --- BOTÓN --- */
.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
    color: var(--blanco);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(51, 76, 149, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(51, 76, 149, 0.35);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-login.loading span {
    display: none;
}

.btn-login.loading .spinner {
    display: block;
}

.forgot-container {
    margin-top: 25px;
}

.forgot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--naranja-claro);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
    padding: 5px 10px;
}

.forgot-link:hover {
    color: var(--naranja);
}

/* --- COPYRIGHT FOOTER --- */
.footer-copyright {
    margin-top: 40px;
    font-size: 12px;
    color: #000000f3;
    font-weight: 700;
    border-top: 1px solid #000000;
    padding-top: 20px;
}

/* --- SWEETALERT --- */
div:where(.swal2-container) div:where(.swal2-popup) {
    border-radius: 15px !important;
}

div:where(.swal2-title) {
    color: var(--azul-oscuro) !important;
    font-family: 'Montserrat', sans-serif !important;
}

.swal2-confirm {
    background: var(--azul) !important;
    box-shadow: none !important;
}

.swal2-cancel {
    background: #cbd5e1 !important;
    color: #333 !important;
}

.otp-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.otp-inp {
    width: 40px;
    height: 50px;
    text-align: center;
    font-size: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: var(--azul-oscuro);
    background: #f8fafc;
}
