/* ====== VARIABLES ====== */
:root {
    --primary: #0084CA;
    --primary-dark: #00669b;
    --primary-light: #4aabe2;
    --accent: #e83e8c;
    --secondary: #1d5a83;
    --secondary-light: #3390c4;
    --secondary-dark: #164264;
    --text-light: #ffffff;
    --text-dark: #333333;
    --text-muted: #6c757d;
    --bg-light: #f8f9fa;
    --border-color: rgba(0, 132, 202, 0.25);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
}

/*=========================================================
=            Estilo general a toda las paginas            =
=========================================================*/
* {
    font-family: 'Inter', sans-serif;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-light));
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* ====== PARTICLES BACKGROUND ====== */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ====== MAIN CONTAINER ====== */
.login-container {
    width: 100%;
    max-width: 450px;
    margin: 32px;
    position: relative;
    z-index: 10;
    perspective: 1000px;
}

/* ====== CARD STYLING ====== */
.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 
                0 5px 15px rgba(0, 0, 0, 0.1),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    animation: cardEntrance 1s ease-out forwards;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(40px) rotateX(10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.login-card:hover {
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3), 
                0 10px 20px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-5px) scale(1.01);
}

/* ====== HEADER ====== */
.login-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-light);
    padding: 25px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: rotate(30deg);
    z-index: 1;
}

.logo-container {
    position: relative;
    margin: 0 auto 16px;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.serapun-logo {
    width: 80px;
    height: auto;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.logo-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 3s infinite;
    z-index: 1;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.login-title {
    font-size: 35px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.divider {
    color: var(--accent);
    font-weight: 300;
    margin: 0 5px;
}

.login-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 0;
    font-weight: 300;
    position: relative;
    z-index: 2;
}

/* ====== BODY ====== */
.login-body {
    padding: 32px 32px 24px;
    background: var(--bg-light);
}

/* Form styling */
.form-floating {
    position: relative;
    margin-bottom: 24px;
}

.form-floating .form-control {
    height: 60px;
    padding: 18px 16px 18px 50px; /* Espacio para el icono */
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05), 
                0 0 0 1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.form-floating .form-control:focus {
    box-shadow: 0 0 0 3px rgba(0, 132, 202, 0.3), 
                0 6px 15px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    outline: none;
    transform: translateY(-2px);
}
/* Etiquetas */
.form-floating label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 18px 16px 18px 50px; /* Alinear con el campo */
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* Posicionamiento y estilo de los iconos */
.form-floating label i {
    position: absolute;
    left: 16px;
    font-size: 16px;
    color: var(--primary);
    transition: all 0.3s ease;
    opacity: 0.8;
}

/* Animación al enfocar */
.form-floating .form-control:focus ~ label i,
.form-floating .form-control:not(:placeholder-shown) ~ label i,
.focused label i {
    color: var(--primary-dark);
    opacity: 1;
    transform: scale(1.1);
}

/* Efecto de label flotante */
.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label,
.focused label {
    opacity: 0.9;
    transform: scale(0.8) translateY(-20px) translateX(10px);
    background: linear-gradient(to right, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: var(--primary);
    background-clip: text;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Efecto de borde de foco mejorado */
.form-floating .focus-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary-light));
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 0 0 0 12px;
}

.form-floating .form-control:focus ~ .focus-border {
    width: 100%;
    border-radius: 0 0 12px 12px;
}

/* Mejora del toggle de contraseña */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
    z-index: 10;
    transition: all 0.3s ease;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary);
    background-color: rgba(0, 132, 202, 0.1);
    transform: translateY(-50%) scale(1.1);
}
/* Checkbox */
.form-check {
    padding-left: 30px;
    margin-bottom: 24px;
    position: relative;
}

/* Oculatar la casilla checkbox */
.form-check-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Crear un checkbox */
.form-check-label {
    position: relative;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    color: var(--text-dark);
    display: inline-block;
    transition: all 0.2s ease;
}

.form-check-label:before {
    content: '';
    position: absolute;
    left: -30px;
    top: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

/* Create the checkmark (hidden when not checked) */
.form-check-label:after {
    content: '';
    position: absolute;
    left: -24px;
    top: 2px;
    width: 8px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* Show the checkmark when checked */
.form-check-input:checked ~ .form-check-label:before {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:checked ~ .form-check-label:after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

/* Animation for hover */
.form-check-label:hover:before {
    box-shadow: 0 0 0 3px rgba(0, 132, 202, 0.2);
    border-color: var(--primary-light);
}

/* Focus state */
.form-check-input:focus ~ .form-check-label:before {
    box-shadow: 0 0 0 3px rgba(0, 132, 202, 0.3);
}

/* Ripple effect */
.form-check-input:active ~ .form-check-label:before {
    animation: ripple 0.4s ease;
}

@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 132, 202, 0.5);
    }
    100% {
        box-shadow: 0 0 0 10px rgba(0, 132, 202, 0);
    }
}

/* Disabled state */
.form-check-input:disabled ~ .form-check-label {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-check-input:disabled ~ .form-check-label:before {
    border-color: var(--text-muted);
    background-color: rgba(240, 240, 240, 0.9);
}

/* Button */
.btn-login {
    width: 100%;
    padding: 13px 24px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.6s;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, var(--primary-dark), var(--secondary-dark));
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Efecto de pulso para el botón */
@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 132, 202, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 132, 202, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 132, 202, 0);
    }
}

.pulse-animation {
    animation: pulse-animation 2s infinite;
}

/* Options */
.login-options {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    font-size: 14px;
}

.login-link {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    display: inline-block;
}

.login-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-dark);
    transition: width 0.3s ease;
}

.login-link:hover {
    color: var(--primary-dark);
}

.login-link:hover::after {
    width: 100%;
}

.login-link i {
    font-size: 14px;
}

/* ====== FOOTER ====== */
.login-footer {
    padding: 20px;
    text-align: center;
    background: var(--bg-light);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.essalud-logo {
    width: 120px;
    height: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.essalud-logo:hover {
    transform: scale(1.05);
}

.copyright {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ====== TOAST NOTIFICATIONS ====== */
.toast {
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 10px;
    overflow: hidden;
}

.toast-header {
    background-color: rgba(248, 249, 250, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.toast-body {
    padding: 16px;
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate__fadeIn {
    animation: fadeIn 0.6s ease-out forwards;
}

/* ====== MEDIA QUERIES ====== */
@media (max-width: 576px) {
    .login-container {
        margin: 16px;
    }
    
    .login-title {
        font-size: 29px;
    }
    
    .login-subtitle {
        font-size: 14px;
    }
    
    .login-options {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .form-floating .form-control {
        height: 53px;
    }
}

@media (max-width: 380px) {
    .login-header {
        padding: 24px 16px;
    }
    
    .login-body {
        padding: 24px 24px 16px;
    }
    
    .logo-container {
        width: 80px;
        height: 80px;
    }
    
    .serapun-logo {
        width: 60px;
    }
}

@media (min-width: 992px) {
    .login-card {
        transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .login-card:hover {
        transform: translateY(-10px) rotateY(2deg) rotateX(2deg);
    }
}