/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
html {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    overflow: hidden;
}

/* Layout principal */
.login-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
}

/* Lado izquierdo: fondo degradado con animación sutil */
.login-left {
    flex: 1.2;
    background: linear-gradient(135deg, 
        #64748b 0%, 
        #475569 35%, 
        #334155 70%, 
        #1e293b 100%);
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.02) 50%,
        transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.03) 0%, 
        transparent 50%);
    animation: float 6s ease-in-out infinite;
}

/* Lado derecho: formulario */
.login-container {
    flex: 1;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 60px;
    min-height: 100vh;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 
        -1px 0 0 rgba(226, 232, 240, 0.5),
        -20px 0 40px rgba(0, 0, 0, 0.05);
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #e2e8f0 50%, 
        transparent 100%);
}

/* Logo con animación de entrada */
.logo {
    margin-bottom: 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.logo img {
    width: 180px;
    height: auto;
    filter: grayscale(1) brightness(0.3);
    transition: all 0.4s ease;
}

.logo img:hover {
    filter: grayscale(0.8) brightness(0.4);
    transform: scale(1.02);
}

/* Título */
.login-container h2 {
    margin-bottom: 40px;
    color: #1e293b;
    font-size: 26px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
}

/* Formulario con animación */
form {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
}

.form-group {
    position: relative;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.6s ease-out calc(0.8s + var(--delay, 0s)) forwards;
}

.form-group:nth-child(1) { --delay: 0s; }
.form-group:nth-child(2) { --delay: 0.1s; }

/* Inputs mejorados */
form input {
    width: 100%;
    padding: 16px 20px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #334155;
    font-weight: 400;
    backdrop-filter: blur(10px);
}

form input:focus {
    border-color: #64748b;
    outline: none;
    background: #ffffff;
    box-shadow: 
        0 0 0 3px rgba(100, 116, 139, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

form input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    transition: color 0.3s ease;
}

form input:focus::placeholder {
    color: #cbd5e1;
}

/* Botón principal */
form button {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, 
        #475569 0%, 
        #334155 50%, 
        #1e293b 100%);
    color: white;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 1.2s forwards;
    box-shadow: 
        0 4px 12px rgba(30, 41, 59, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

form button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent);
    transition: left 0.5s ease;
}

form button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(30, 41, 59, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

form button:hover::before {
    left: 100%;
}

form button:active {
    transform: translateY(-1px);
}

/* Mensajes de error y éxito */
.error {
    color: #7f1d1d;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    border: 1px solid #fca5a5;
    backdrop-filter: blur(10px);
    animation: shake 0.5s ease-in-out;
}

.success {
    color: #14532d;
    background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    border: 1px solid #86efac;
    backdrop-filter: blur(10px);
    animation: slideInDown 0.5s ease-out;
}

/* Enlaces */
a {
    margin-top: 24px;
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.6s ease-out 1.4s forwards;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1px;
    background: #334155;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

a:hover {
    color: #334155;
}

a:hover::after {
    width: 100%;
}

/* Footer */
.login-footer {
    margin-top: 40px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.6s forwards;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%) translateY(-100%); }
    50% { transform: translateX(100%) translateY(100%); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .login-container {
        padding: 60px 40px;
    }
}

@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
    }
    
    .login-left {
        display: none;
    }
    
    .login-container {
        padding: 40px 20px;
        min-height: 100vh;
    }
    
    .logo img {
        width: 140px;
    }
    
    .login-container h2 {
        font-size: 24px;
    }
    
    form {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 16px;
    }
    
    .logo {
        margin-bottom: 30px;
    }
    
    .login-container h2 {
        font-size: 22px;
        margin-bottom: 30px;
    }
    
    form input,
    form button {
        padding: 14px 16px;
        font-size: 15px;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Estados de focus mejorados para accesibilidad */
form button:focus-visible {
    outline: 2px solid #334155;
    outline-offset: 2px;
}

form input:focus-visible {
    outline: 2px solid #64748b;
    outline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid #64748b;
    outline-offset: 2px;
    border-radius: 4px;
}