* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    overflow-y: auto;
}

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
}

/* Lado izquierdo - Welcome Back */
.welcome-section {
    flex: 1;
    background: linear-gradient(135deg, rgba(0,0,0,0.5), rgba(0,0,0,0.3)), 
                url('../images/inicio.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 80px;
    color: white;
    position: relative;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

.welcome-content h1 {
    font-size: 3.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.welcome-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 400px;
    line-height: 1.6;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.social-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Lado derecho - Formulario de login */
.login-section {
    flex: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 100vh;
}

.login-form-container {
    width: 100%;
    max-width: 400px;
    padding-bottom: 20px; /* Espacio adicional en la parte inferior */
}

.login-header {
    text-align: right;
    margin-bottom: 3rem;
}

.login-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header .subtitle {
    color: #666;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #364f6b;
    background: white;
    box-shadow: 0 0 0 3px rgba(54, 79, 107, 0.1);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remember-me input[type="checkbox"] {
    width: auto;
}

.forgot-password {
    color: #364f6b;
    text-decoration: none;
}

.forgot-password:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #364f6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.login-btn:hover {
    background: #213447;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(54, 79, 107, 0.3);
}

.login-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.login-footer a {
    color: #364f6b;
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
    }
    
    .login-container {
        flex-direction: column;
        min-height: 100vh;
        height: auto;
        overflow-y: auto;
    }
    
    .welcome-section {
        flex: none;
        min-height: 35vh;
        height: auto;
        padding: 30px 20px;
        text-align: center;
        align-items: center;
        overflow: visible;
    }
    
    .welcome-content h1 {
        font-size: 2.5rem;
    }
    
    .login-section {
        flex: 1;
        min-height: auto;
        height: auto;
        padding: 30px 20px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding-top: 40px;
        padding-bottom: 40px;
        overflow: visible;
    }
    
    .login-header {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .login-form-container {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .welcome-section {
        padding: 20px 15px;
        min-height: 30vh;
        overflow: visible;
    }
    
    .welcome-content h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .welcome-content p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .login-section {
        padding: 20px 15px;
        min-height: auto;
        padding-top: 30px;
        padding-bottom: 40px;
        overflow: visible;
    }
    
    .login-form-container {
        max-width: 100%;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
    
    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .login-btn {
        padding: 16px;
        font-size: 1rem;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 360px) {
    .welcome-section {
        min-height: 25vh;
        padding: 15px 10px;
        overflow: visible;
    }
    
    .welcome-content h1 {
        font-size: 1.8rem;
    }
    
    .login-section {
        padding: 15px 10px;
        min-height: auto;
        padding-bottom: 30px;
        overflow: visible;
    }
}

/* Estilos para alertas del sistema de login */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #a00;
}

.alert-success {
    background-color: #efe;
    border: 1px solid #cfc;
    color: #060;
}

.test-credentials {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.test-credentials h4 {
    margin: 0 0 10px 0;
    color: #007bff;
    font-size: 14px;
}

.test-credentials p {
    margin: 5px 0;
    font-size: 12px;
    color: #666;
}

/* Mejoras adicionales para móviles */
@media (max-width: 768px) {
    /* Asegurar que el viewport sea manejado correctamente */
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        overflow-y: auto;
        height: auto;
    }
    
    /* Evitar problemas con el teclado virtual */
    .login-section {
        position: relative;
        overflow: visible;
    }
    
    /* Mejorar la accesibilidad del botón en pantallas táctiles */
    .login-btn {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    /* Asegurar que los campos de entrada sean accesibles */
    .form-group input {
        min-height: 48px;
        touch-action: manipulation;
    }
}

/* Solución para dispositivos con teclado virtual */
@media (max-height: 600px) and (max-width: 768px) {
    .welcome-section {
        min-height: 20vh;
        overflow: visible;
    }
    
    .login-section {
        min-height: auto;
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 40px;
        overflow: visible;
    }
    
    .login-header {
        margin-bottom: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
}

/* Para dispositivos en landscape con altura muy pequeña */
@media (max-height: 480px) and (orientation: landscape) {
    .welcome-section {
        display: none;
    }
    
    .login-section {
        min-height: 100vh;
        padding: 20px 15px;
        overflow-y: auto;
    }
    
    .login-header {
        margin-bottom: 1rem;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
}

/* Asegurar scroll en dispositivos móviles */
@media screen and (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: auto;
        min-height: 100vh;
    }
    
    .login-container {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: auto;
        min-height: 100vh;
    }
    
    .welcome-section, .login-section {
        overflow: visible;
        height: auto;
    }
    
    /* Fix para iOS Safari */
    body {
        position: relative;
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix específico para iOS */
@supports (-webkit-overflow-scrolling: touch) {
    body {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
    
    .login-container {
        -webkit-overflow-scrolling: touch;
    }
}
