/* ============================================
   LOGIN ERI-CICESCT - ESTILOS PROFESIONALES
   Diseño moderno, responsive y accesible
   ============================================ */

/* ===== VARIABLES GLOBALES ===== */
:root {
    --color-primary: #0f3c5f;
    --color-primary-dark: #0a2e4a;
    --color-primary-light: #145a86;
    --color-accent: #38bdf8;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-background: #f8fafc;
    --color-white: #ffffff;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* ===== FONDO ANIMADO (OPCIONAL) ===== */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="10" cy="10" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="30" r="3" fill="rgba(255,255,255,0.1)"/><circle cx="30" cy="80" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="70" cy="70" r="4" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="20" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: 50px 50px;
    opacity: 0.5;
    pointer-events: none;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.login-box {
    background: var(--color-white);
    padding: 45px 40px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10;
    animation: slideUp 0.5s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* ===== ANIMACIÓN DE ENTRADA ===== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== LOGO ===== */
.logo {
    height: 90px;
    width: auto;
    margin-bottom: 25px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    background: var(--color-white);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* ===== TÍTULO ===== */
.login-box h2 {
    color: var(--color-primary);
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.5px;
    line-height: 1.2;
    position: relative;
    padding-bottom: 15px;
}

.login-box h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, var(--color-primary), var(--color-accent));
    border-radius: 2px;
}

/* ===== CAMPOS DEL FORMULARIO ===== */
.input-group {
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 14px 18px;
    margin: 0;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-sans);
}

input:hover {
    border-color: var(--color-primary-light);
    background: var(--color-white);
}

input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-white);
    box-shadow: 0 0 0 4px rgba(15, 60, 95, 0.1);
}

input::placeholder {
    color: var(--color-text-light);
    opacity: 0.7;
}

/* ===== BOTÓN PRINCIPAL ===== */
button {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(to right, var(--color-primary), var(--color-primary-light));
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover {
    background: linear-gradient(to right, var(--color-primary-dark), var(--color-primary));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* ===== MENSAJES DE ESTADO ===== */
#msg {
    margin-top: 20px;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados del mensaje */
#msg[style*="color: red"] {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: var(--color-error) !important;
}

#msg[style*="color: blue"],
#msg[style*="color: #145a86"] {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: var(--color-primary) !important;
}

#msg[style*="color: green"] {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    color: var(--color-success) !important;
}

/* ===== ENLACES ADICIONALES ===== */
.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-light);
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

.login-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* ===== VERSIÓN INSTITUCIONAL ===== */
.institutional-badge {
    margin-top: 25px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-light);
    opacity: 0.8;
}

.institutional-badge img {
    height: 30px;
    margin-top: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.institutional-badge img:hover {
    opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    body {
        padding: 15px;
        background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    }
    
    .login-box {
        padding: 30px 25px;
        max-width: 100%;
    }
    
    .logo {
        height: 70px;
    }
    
    .login-box h2 {
        font-size: 1.5rem;
    }
    
    input {
        padding: 12px 16px;
    }
    
    button {
        padding: 12px 16px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 25px 20px;
    }
    
    .logo {
        height: 60px;
    }
    
    .login-box h2 {
        font-size: 1.3rem;
        margin-bottom: 25px;
    }
    
    input {
        padding: 11px 14px;
    }
    
    #msg {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* ===== SOPORTE PARA PANTALLAS MUY PEQUEÑAS ===== */
@media (max-width: 360px) {
    .login-box {
        padding: 20px 15px;
    }
    
    .logo {
        height: 50px;
    }
    
    .login-box h2 {
        font-size: 1.2rem;
    }
}

/* ===== MODO OSCURO (OPCIONAL) ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #1e293b;
        --color-text: #f1f5f9;
        --color-text-light: #cbd5e1;
        --color-white: #0f172a;
    }
    
    .login-box {
        background: #1e293b;
        border-color: rgba(255,255,255,0.1);
    }
    
    input {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }
    
    input:focus {
        border-color: var(--color-accent);
        background: #1e293b;
    }
    
    .logo {
        background: #1e293b;
    }
    
    .login-footer {
        border-top-color: #334155;
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus visible para accesibilidad por teclado */
button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===== ESTADO DE CARGA ===== */
button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== VERSIÓN IMPRESIÓN ===== */
@media print {
    body {
        background: white;
    }
    
    .login-box {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Estilos para el modal de cambio de contraseña */
#modalCambioPassword {
    animation: fadeIn 0.3s ease;
}

#modalCambioPassword input:focus {
    outline: none;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(15, 60, 95, 0.1);
}

#modalCambioPassword button {
    transition: all 0.3s ease;
}

#modalCambioPassword button:hover {
    background: var(--color-primary-dark) !important;
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}