/* admin-login.css - VERSIÓN PERFECTAMENTE ORDENADA */
:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #4CAF50;
    --secondary: #00695C;
    --accent: #388E3C;
    --success: #43A047;
    --warning: #F57C00;
    --danger: #D32F2F;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --border-radius: 20px;
    --box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: rgba(255, 255, 255, 0.3);
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estados del body */
body.login-active {
    overflow: hidden;
    height: 100vh;
    background: linear-gradient(135deg, #E8F5E8 0%, #C8E6C9 50%, #A5D6A7 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body.admin-active #loginSection {
    display: none !important;
}

body.login-active .admin-header,
body.login-active #adminPanel {
    display: none !important;
}

/* Contenedor principal del login */
#loginSection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #E8F5E8 0%, #C8E6C9 50%, #A5D6A7 100%);
    z-index: 10000;
}

/* Elementos decorativos */
.decoration {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(46, 125, 50, 0.1), transparent);
    pointer-events: none;
}

.decoration-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation: float 12s ease-in-out infinite;
}

.decoration-2 {
    width: 300px;
    height: 300px;
    bottom: -80px;
    left: -80px;
    animation: float 10s ease-in-out infinite reverse;
}

/* ================================================ */
/* TARJETA DE LOGIN - CONTENEDOR PRINCIPAL */
/* ================================================ */
.login-card {
    display: grid;
    grid-template-columns: 50% 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 1000px;
    height: 600px;
    overflow: hidden;
    position: relative;
    z-index: 2;
    transition: var(--transition);
    border: 1px solid var(--glass-border);
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.15);
}

/* ================================================ */
/* PANEL IZQUIERDO - BRANDING */
/* ================================================ */
.login-brand {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 35%, #00695C 70%, #004D40 100%);
    color: white;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center; /* CAMBIAR: centrar en lugar de space-between */
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.brand-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* REDUCIR el gap para subir todo */
    height: 100%;
    justify-content: center; /* CENTRAR TODO VERTICALMENTE */
}

/* LOGO CIRCULAR */
.login-logo {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    backdrop-filter: blur(15px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.25),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.login-logo:hover {
    transform: scale(1.08) rotate(5deg);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.35),
        inset 0 0 30px rgba(255, 255, 255, 0.15);
}

.login-logo img {
    height: 110px;
    width: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
    transition: all 0.3s ease;
}

/* INFORMACIÓN INSTITUCIONAL */
.institucion-info {
    text-align: center;
}

.institucion-info h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    line-height: 1.0; /* CORREGIR: 2.0 era demasiado */
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    color: white;
}

.institucion-info .lema {
    font-size: 0.98rem;
    opacity: 0.95;
    font-weight: 400;
    line-height: 1.5;
    font-style: italic;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 0.8rem 0;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

/* CARACTERÍSTICAS - SUBIDAS MÁS ARRIBA */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.8rem; /* REDUCIR gap */
    width: 100%;
    margin-top: 0.3rem; /* CAMBIAR: quitar auto y poner pequeño margen */
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.9rem;
    opacity: 0.95;
    justify-content: flex-start;
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.13);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: var(--transition);
    font-weight: 500;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.feature-item i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: #FDD835;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    filter: drop-shadow(0 0 6px rgba(253, 216, 53, 0.4));
}

/* ================================================ */
/* PANEL DERECHO - FORMULARIO */
/* ================================================ */
.login-form-container {
    padding: 2.5rem 2.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: white;
}

/* HEADER DEL FORMULARIO */
.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.form-header h2 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
}

.form-header h2 i {
    color: var(--primary);
    font-size: 1.7rem;
}

.form-header p {
    color: var(--gray);
    font-size: 0.92rem;
    font-weight: 400;
}

/* ADVERTENCIA DE SEGURIDAD */
.security-warning {
    background: linear-gradient(135deg, #FFF8E1, #FFECB3);
    border: 2px solid #FFD54F;
    border-radius: 10px;
    padding: 0.95rem 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    box-shadow: 0 3px 12px rgba(255, 213, 79, 0.25);
}

.security-warning::before {
    content: "🔒";
    font-size: 1.2rem;
    flex-shrink: 0;
}

.warning-content h4 {
    color: #7D6608;
    margin: 0 0 0.3rem 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.warning-content p {
    color: #7D6608;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* FORMULARIO */
.login-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-group {
    margin-bottom: 1.3rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.88rem;
}

.form-group label i {
    color: var(--primary);
    width: 14px;
    text-align: center;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.95rem 1.1rem;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 0.92rem;
    transition: var(--transition);
    background: var(--light);
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: #a0a0a0;
    font-weight: 400;
}

/* BOTÓN DE LOGIN */
.login-btn {
    width: 100%;
    padding: 1rem 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.8rem;
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.35);
    position: relative;
    overflow: hidden;
}

.login-btn::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: left 0.5s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(46, 125, 50, 0.45);
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:active {
    transform: translateY(0);
}

/* MENSAJES DEL SISTEMA */
.login-message {
    margin-top: 1rem;
    padding: 0.85rem;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    font-size: 0.82rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.login-message.success {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    color: #2e7d32;
    border: 1px solid #A5D6A7;
}

.login-message.error {
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #d32f2f;
    border: 1px solid #EF9A9A;
}

/* FOOTER DEL LOGIN */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
}

.login-footer p {
    margin: 0;
    color: var(--gray);
    font-size: 0.78rem;
    font-weight: 500;
}

/* ================================================ */
/* ANIMACIONES */
/* ================================================ */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg) scale(1); 
    }
    50% { 
        transform: translateY(-12px) rotate(2deg) scale(1.01); 
    }
}

/* ================================================ */
/* RESPONSIVE DESIGN */
/* ================================================ */

/* Tablets grandes (1024px - 1200px) */
@media (max-width: 1200px) {
    .login-card {
        max-width: 950px;
        height: 580px;
    }
    
    .login-logo {
        width: 140px;
        height: 140px;
    }
    
    .login-logo img {
        height: 100px;
    }
}

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .login-card {
        max-width: 900px;
        height: 560px;
    }
    
    .login-brand,
    .login-form-container {
        padding: 2.2rem 1.8rem;
    }
    
    .login-logo {
        width: 130px;
        height: 130px;
    }
    
    .login-logo img {
        height: 95px;
    }
    
    .institucion-info h1 {
        font-size: 1.6rem;
    }
}

/* Tablets vertical y móviles grandes (480px - 768px) */
@media (max-width: 768px) {
    #loginSection {
        padding: 15px;
    }
    
    .login-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        max-width: 480px;
        height: auto;
        min-height: 700px;
    }
    
    .login-brand {
        order: 1;
        padding: 2rem 1.5rem;
        min-height: 320px;
    }
    
    .login-form-container {
        order: 2;
        padding: 2rem 1.5rem;
    }
    
    .brand-content {
        gap: 1.3rem;
    }
    
    .login-logo {
        width: 120px;
        height: 120px;
    }
    
    .login-logo img {
        height: 88px;
    }
    
    .institucion-info h1 {
        font-size: 1.5rem;
    }
    
    .institucion-info .lema {
        font-size: 0.92rem;
    }
    
    .feature-item {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

/* Móviles (380px - 480px) */
@media (max-width: 480px) {
    #loginSection {
        padding: 10px;
    }
    
    .login-card {
        border-radius: 16px;
        max-width: 100%;
    }
    
    .login-brand,
    .login-form-container {
        padding: 1.8rem 1.3rem;
    }
    
    .login-logo {
        width: 110px;
        height: 110px;
    }
    
    .login-logo img {
        height: 80px;
    }
    
    .institucion-info h1 {
        font-size: 1.35rem;
    }
    
    .institucion-info .lema {
        font-size: 0.88rem;
    }
    
    .form-header h2 {
        font-size: 1.45rem;
    }
    
    .feature-item {
        padding: 0.7rem 0.9rem;
        font-size: 0.82rem;
    }
    
    .security-warning {
        padding: 0.85rem 1rem;
    }
    
    .form-group input {
        padding: 0.88rem 1rem;
    }
    
    .login-btn {
        padding: 0.95rem 1.6rem;
        font-size: 0.92rem;
    }
}

/* Móviles muy pequeños (< 380px) */
@media (max-width: 380px) {
    .login-logo {
        width: 100px;
        height: 100px;
    }
    
    .login-logo img {
        height: 72px;
    }
    
    .institucion-info h1 {
        font-size: 1.2rem;
    }
    
    .institucion-info .lema {
        font-size: 0.82rem;
    }
}

/* ================================================ */
/* CLASES HELPER */
/* ================================================ */
.hidden {
    display: none !important;
}

/* ===================================================== */
/* MEJORAS DE SCROLL EN MÓVILES Y PANTALLAS PEQUEÑAS    */
/* Permite desplazamiento cuando el contenido del login  */
/* excede la altura de la pantalla (evita que quede justo)*/
/* ===================================================== */
@media (max-width: 768px) {
    body.login-active {
        overflow-y: auto;   /* Permite scroll en móvil */
        height: auto;
        min-height: 100vh;
    }
    #loginSection {
        position: relative; /* Quita fixed para permitir que el padre haga scroll */
        height: auto;
        min-height: 100vh;
        overflow-y: auto;   /* Scroll dentro del login si es necesario */
        -webkit-overflow-scrolling: touch;
        padding: 16px;
    }
    .login-card {
        height: auto;       /* Deja que crezca según contenido */
        max-height: none;
        margin: 8px 0;      /* Respiro vertical */
    }
}

/* También habilita scroll si la pantalla es baja (landscape móvil/tablet) */
@media (max-height: 700px) and (max-width: 1024px) {
    body.login-active {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
    #loginSection {
        position: relative;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}