/* =====================================================
   VARIABLES CSS Y CUSTOM PROPERTIES
   ===================================================== */
:root {
    /* Colores corporativos Keller */
    --keller-blue: #0A1B2A;
    --keller-orange: #FF6600;

    /* Variables de UI Glass Adaptativo */
    --bg-overlay: rgba(255, 255, 255, 0.1);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --border-color: rgba(255, 255, 255, 0.2);
    --input-bg: rgba(0, 0, 0, 0.2);

    /* Tipografía */
    --font-main: 'Inter', -apple-system, sans-serif;
}

/* =====================================================
   RESET Y BASE
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevenir scroll en el login */
    font-family: var(--font-main);
    background-color: #050505; /* Oscuro para que resalten los colores de Spline */
    color: var(--text-primary);
}

/* =====================================================
   SPLINE BACKGROUND
   ===================================================== */
spline-viewer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Interactividad natural habilitada por su comportamiento por defecto */
}

/* =====================================================
   LOGIN WRAPPER & GLASS CARD
   ===================================================== */
.login-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    /* PERMITE QUE LOS CLICKS ATRAVIESEN EL CONTENEDOR HACIA SPLINE */
    pointer-events: none;
}

.login-card {
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 35px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.4s ease-out forwards;
    /* RESTITUYEN LOS CLICKS SOLO EN LA TARJETA DEL FORMULARIO */
    pointer-events: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   HEADER DEL LOGIN
   ===================================================== */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    max-width: 130px;
    height: auto;
    margin-bottom: 12px;
    /* Asegura visibilidad sobre cristal oscuro/colores vivos */
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.5)) brightness(1.2) contrast(1.1);
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* =====================================================
   FORMULARIO E INPUTS
   ===================================================== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
    backdrop-filter: blur(4px);
}

.input-group input:focus {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* CHECKBOX PERSONALIZADO */
.options-group {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 16px;
    width: 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-right: 8px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-container:hover input~.checkmark {
    border-color: rgba(255, 255, 255, 0.6);
}

.checkbox-container input:checked~.checkmark {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 3px;
    height: 7px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

/* ERROR MESSAGE */
.error-message {
    background: rgba(255, 50, 50, 0.2);
    border: 1px solid rgba(255, 100, 100, 0.5);
    color: #FFB3B3;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    backdrop-filter: blur(4px);
}

.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {
    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }
    30%,
    50%,
    70% {
        transform: translate3d(-3px, 0, 0);
    }
    40%,
    60% {
        transform: translate3d(3px, 0, 0);
    }
}

/* =====================================================
   BOTÓN SUBMIT
   ===================================================== */
.login-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.login-btn:hover {
    background: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,255,255,0.2);
}

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

.login-btn.success {
    background: #10B981;
    color: white;
    pointer-events: none;
}

/* =====================================================
   FOOTER LOGIN
   ===================================================== */
.login-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* =====================================================
   RESPONSIVO / MULTIDISPOSITIVO
   ===================================================== */
@media (max-width: 768px) {
    .login-wrapper {
        padding: 20px;
    }
    .login-card {
        padding: 35px 25px;
    }
}

@media (max-width: 480px) {
    .login-wrapper {
        padding: 15px;
    }
    .login-card {
        padding: 30px 20px;
    }
    .login-logo {
        max-width: 100px;
    }
    .input-group input {
        font-size: 0.9rem;
        padding: 10px 12px;
    }
    .login-btn {
        padding: 12px 15px;
    }
}

/* Prevenir problemas en pantallas muy bajas (modo horizontal en móviles) */
@media (max-height: 600px) {
    .login-wrapper {
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
        overflow-y: auto;
    }
    .login-card {
        margin: auto;
    }
}