* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-regular);
    min-height: 100vh;
    /* Permitimos scroll vertical (antes estaba oculto) y evitamos scroll horizontal accidental */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* inercia en iOS */
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1a2142 50%, var(--brand-secondary) 100%);
    position: relative;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.login-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    /* Fondo exclusivo para la pantalla de login */
    background-image: url('../../assets/images/login/FONDO.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* Layout dividido: imagen izquierda, formulario derecha */
.login-split {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr; /* imagen un poco más ancha */
    gap: 24px;
    align-items: stretch;
    position: relative;
    z-index: 10;
}

.login-visual {
    /* background: rgba(255, 255, 255, 0.06); */
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    position: relative;
    overflow: hidden;
    /* box-shadow: 0 25px 50px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.08); */
    /* border: 1px solid rgba(255, 255, 255, 0.18); */
}

.login-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    /* background: radial-gradient(60% 60% at 20% 20%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 60%),
                linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); */
    pointer-events: none;
}

.login-hero {
    max-width: 100%;
    max-height: 420px;
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.25));
}

/* Overlay sutil para mejorar contraste de la tarjeta de login sobre la imagen */
.login-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.30);
    pointer-events: none;
}

.background-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
    background: rgba(217, 4, 142, 0.1);
}

.shape-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 15%;
    animation-delay: -5s;
    background: rgba(4, 157, 217, 0.1);
}

.shape-3 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 20%;
    animation-delay: -10s;
    background: rgba(255, 255, 255, 0.08);
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(120deg); }
    66% { transform: translateY(20px) rotate(240deg); }
}

.auth-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 12px 24px rgba(37, 50, 89, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    padding: 48px 40px;
    width: 100%;
    max-width: 480px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 10;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 24px;
    z-index: -1;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-container {
    margin-bottom: 24px;
    position: relative;
}

.login-logo {
    height: 64px;
    width: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.login-logo:hover {
    transform: scale(1.05);
}

.auth-header h1 {
    color: var(--brand-primary);
    font-size: 2.5em;
    font-weight: var(--font-weight-bold);
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: -0.5px;
}

.auth-header p {
    color: #64748b;
    font-size: 1.1em;
    font-weight: var(--font-weight-regular);
    line-height: 1.5;
}

.login-form {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 32px;
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--brand-primary);
    font-weight: var(--font-weight-semibold);
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    color: var(--brand-accent);
    font-size: 1em;
}

.input-wrapper {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-bottom: 2px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    font-size: 1.05em;
    font-weight: var(--font-weight-regular);
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--brand-primary);
}

.form-control::placeholder {
    color: #94a3b8;
    font-weight: var(--font-weight-regular);
}

.form-control:focus {
    outline: none;
    background: #ffffff;
    border-bottom-color: var(--brand-accent);
    box-shadow: 0 4px 12px rgba(217, 4, 142, 0.15);
    transform: translateY(-2px);
}

.form-control:hover:not(:focus) {
    border-bottom-color: var(--brand-secondary);
    background: #ffffff;
}

.input-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-accent) 0%, var(--brand-secondary) 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus + .input-underline {
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--brand-accent);
}

.btn {
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: 16px;
    font-size: 1.1em;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-accent) 0%, #b8037a 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(217, 4, 142, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(217, 4, 142, 0.4);
    background: linear-gradient(135deg, #f205a0 0%, var(--brand-accent) 100%);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(-1px);
    transition: transform 0.1s ease;
}

.btn i {
    transition: transform 0.3s ease;
}

.btn:hover i {
    transform: translateX(4px);
}

.btn-secondary {
    background: var(--brand-primary);
    color: white;
    margin-top: 15px;
}

.btn-secondary:hover {
    background: #1b243d;
    transform: translateY(-1px);
}

.auth-links {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e1e5e9;
}

.auth-links a {
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: var(--brand-accent);
    text-decoration: underline;
}

.alert {
    padding: 16px 20px;
    margin-bottom: 32px;
    border-radius: 12px;
    font-weight: var(--font-weight-medium);
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    animation: slideInDown 0.4s ease-out;
}

.alert i {
    font-size: 1.2em;
    flex-shrink: 0;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.alert-success i {
    color: #10b981;
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.alert-error i {
    color: #ef4444;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1em;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--brand-accent);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(217, 4, 142, 0.15);
}

/* Animación de entrada */
.auth-container {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.login-footer p {
    color: #64748b;
    font-size: 0.9em;
    font-weight: var(--font-weight-regular);
    line-height: 1.5;
}

/* Animaciones de entrada mejoradas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-wrapper { padding: 16px; }
    .login-split {
        display: flex;
        flex-direction: column;
        gap: 16px;
        max-width: 640px;
        margin: 0 auto;
    }
    .login-visual {
        order: -1; /* mostrar imagen arriba en móviles */
        padding: 24px;
        border-radius: 20px;
    }
    .login-hero { max-height: 260px; }
    
    .auth-container {
        padding: 32px 24px;
        max-width: 100%;
        margin: 0;
    }
    
    .auth-header h1 {
        font-size: 2.2em;
    }
    
    .shape-1 {
        width: 120px;
        height: 120px;
    }
    
    .shape-2 {
        width: 100px;
        height: 100px;
    }
    
    .shape-3 {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .auth-header h1 {
        font-size: 1.9em;
    }
    
    .auth-header p {
        font-size: 1em;
    }
    
    .login-logo {
        height: 56px;
    }
    
    .form-control {
        padding: 14px 16px;
        font-size: 1em;
    }
    
    .btn {
        padding: 16px 20px;
        font-size: 1em;
    }
    
    .background-shapes {
        display: none; /* Ocultar formas en móviles para mejor rendimiento */
    }
}

@media (max-width: 360px) {
    .auth-container {
        padding: 28px 20px;
    }
    
    .auth-header h1 {
        font-size: 1.7em;
    }
    
    .form-group {
        margin-bottom: 28px;
    }
}

/* Mejoras adicionales y optimizaciones */

/* Soporte para navegadores Safari */
@supports (-webkit-backdrop-filter: blur(20px)) or (backdrop-filter: blur(20px)) {
    .auth-container {
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }
}

/* Estados de validación para campos */
.form-control:valid {
    border-bottom-color: #10b981;
}

.form-control:invalid:not(:placeholder-shown) {
    border-bottom-color: #ef4444;
}

/* Mejoras de accesibilidad */
.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

/* Estados de loading para el botón */
.btn-primary.loading {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary.loading:hover {
    transform: none !important;
    box-shadow: 0 8px 24px rgba(148, 163, 184, 0.3);
}

/* Smooth scroll para mejor UX */
html {
    scroll-behavior: smooth;
}

/* Optimización para reducir reflows */
* {
    will-change: auto;
}

.auth-container,
.form-control,
.btn {
    will-change: transform, opacity;
}

/* Mejora para usuarios que prefieren reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .background-shapes {
        display: none;
    }
}

/* ========== Estilos para páginas de recuperación de contraseña ========== */

/* Indicador de fortaleza de contraseña */
.password-strength {
    margin-top: 12px;
    margin-bottom: 20px;
}

.strength-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-bar-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
}

.strength-text {
    display: block;
    font-size: 0.85em;
    font-weight: 500;
    margin-top: 6px;
}

.form-text {
    display: block;
    font-size: 0.85em;
    color: #64748b;
    margin-top: 8px;
    font-style: italic;
}

/* Enlaces de texto con animación */
.text-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 12px;
    border-radius: 8px;
}

.text-link:hover {
    color: var(--brand-secondary);
    background: rgba(217, 4, 142, 0.05);
    transform: translateX(-4px);
}

.text-link i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-link:hover i {
    transform: translateX(-4px);
}

/* Contenedor de texto centrado */
.text-center {
    text-align: center;
}

/* Enlace "¿Olvidaste tu contraseña?" */
.form-footer {
    margin-top: -12px;
    margin-bottom: 24px;
    text-align: right;
}

.forgot-password-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
}

.forgot-password-link:hover {
    color: var(--brand-secondary);
    background: rgba(217, 4, 142, 0.05);
    transform: translateX(2px);
}

/* Mejoras para alertas en páginas de recuperación */
.alert {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
