/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Calibri', sans-serif;
}

/* BODY */
body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #535353, #CC3222);
}

/* Evita que SweetAlert mueva el layout */
body.swal2-shown {
    height: 100vh !important;
    overflow: hidden;
}

.login-container {
    position: fixed;       /* fijo en la pantalla */
    top: 50%;              /* centro vertical */
    left: 50%;             /* centro horizontal */
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #535353, #CC3222);
}
.login-box {
    width: 500px;
    background: #ffffff;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* HEADER */
.login-box h2 {
    font-weight: bold;
    color: #CC3222;
    margin-bottom: 10px;
    font-size: 32px;
}

.login-subtitle {
    color: #535353;
    margin-bottom: 40px;
    font-size: 18px;
}

/* INPUT CON ICONO */
.user-box {
    position: relative;
    margin-bottom: 35px;
}

/* ICONO */
.input-icon {
    position: absolute;
    top: 16px;
    left: 0;
    color: #2481BF;
    font-size: 18px;
}

/* INPUT */
.user-box input {
    width: 100%;
    padding: 15px 0 15px 30px;
    font-size: 18px;
    border: none;
    border-bottom: 3px solid #CC3222;
    background: transparent;
    outline: none;
    color: #535353;
    transition: 0.3s ease;
}

.user-box input:focus {
    border-bottom: 3px solid #EC8E3F;
}

/* LABEL */
.user-box label {
    position: absolute;
    top: 15px;
    left: 30px;
    color: #535353;
    font-size: 16px;
    pointer-events: none;
    transition: 0.3s ease;
}

/* ANIMACIÓN LABEL */
.user-box input:focus ~ label,
.user-box input:valid ~ label {
    top: -18px;
    font-size: 13px;
    color: #CC3222;
}

/* BOTÓN */
.login-box input[type="submit"] {
    border: none;
    padding: 16px 0;
    width: 100%;
    background: #CC3222;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s ease;
}

.login-box input[type="submit"]:hover {
    background: #EC8E3F;
    transform: scale(1.03);
}

/* RESPONSIVE */
@media screen and (max-width: 600px) {
    .login-box {
        width: 90%;
        padding: 30px;
    }

    .login-box h2 {
        font-size: 24px;
    }

    .login-subtitle {
        font-size: 14px;
    }
}
/* ============================= */
/* ====== LOGO INSTITUCIONAL ====== */
/* ============================= */
.login-logo {
    width: 90px;
    margin-bottom: 15px;
}

/* ============================= */
/* ====== PASSWORD TOGGLE ====== */
/* ============================= */
.password-box {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 0;
    top: 16px;
    cursor: pointer;
    color: #2481BF;
    font-size: 18px;
    transition: 0.3s ease;
}

.toggle-password:hover {
    color: #EC8E3F;
}

/* ============================= */
/* ====== BOTÓN CON LOADER ====== */
/* ============================= */
.login-btn {
    border: none;
    padding: 16px 0;
    width: 100%;
    background: #CC3222;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s ease;
    position: relative;
}

.login-btn:hover {
    background: #EC8E3F;
    transform: scale(1.03);
}

/* Loader */
.loader {
    display: none;
    border: 3px solid #fff;
    border-top: 3px solid transparent;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 0.6s linear infinite;
    margin: auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================= */
/* ====== SHAKE ANIMATION ====== */
/* ============================= */
.shake {
    animation: shake 0.4s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-8px); }
    100% { transform: translateX(0); }
}

/* ============================= */
/* ====== MODO OSCURO AUTOMÁTICO ====== */
/* ============================= */
@media (prefers-color-scheme: dark) {

    body {
        background: linear-gradient(135deg, #1a1a1a, #2c2c2c);
    }

    .login-container {
        background: linear-gradient(135deg, #1a1a1a, #2c2c2c);
    }

    .login-box {
        background: #3f3333;
        color: #ffffff;
    }

    .login-box h2 {
        color: #EC8E3F;
    }

    .login-subtitle {
        color: #cccccc;
    }

    .user-box input {
        color: #ffffff;
        border-bottom: 3px solid #EC8E3F;
    }

    .user-box label {
        color: #cccccc;
    }

    .toggle-password {
        color: #EC8E3F;
    }
}
/* Loader */
.loader {
    display: none; /* empieza oculto */
    border: 3px solid #f3f3f3; /* fondo del círculo */
    border-top: 3px solid #CC3222; /* color de la barra que gira */
    border-radius: 50%;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    vertical-align: middle;
    animation: spin 0.8s linear infinite;
}

/* Animación giro */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Opcional: botón con loader centrado */
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}
