/* ============================================
   LOGIN ERI-CICESCT - ESTILOS PROFESIONALES
   Diseño moderno, responsive y accesible
   Modo claro/oscuro automático
   ============================================ */

/* ===== VARIABLES GLOBALES ===== */
:root {
    /* Modo claro - Azul institucional */
    --color-primary: #0f3c5f;
    --color-primary-dark: #0a2e4a;
    --color-primary-light: #1a5a8c;
    --color-primary-soft: #e6f0fa;
    --color-accent: #38bdf8;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-dorado: #FFD700;
    
    /* Texto */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    
    /* Fondos */
    --bg-body: linear-gradient(145deg, #0f3c5f 0%, #1e5a85 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-solid: #ffffff;
    --bg-input: #f8fafc;
    --bg-input-hover: #ffffff;
    
    /* Bordes */
    --border-color: #e2e8f0;
    --border-focus: #0f3c5f;
    
    /* Sombras */
    --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 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-focus: 0 0 0 4px rgba(15, 60, 95, 0.15);
    
    /* Otros */
    --border-radius: 24px;
    --border-radius-sm: 12px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== MODO OSCURO ===== */
@media (prefers-color-scheme: dark) {
    :root {
        /* Colores base - más profundos */
        --color-primary: #1e4a7a;
        --color-primary-dark: #123456;
        --color-primary-light: #2a5f94;
        --color-primary-soft: #1a2e42;
        --color-accent: #60a5fa;
        
        /* Texto */
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-tertiary: #94a3b8;
        
        /* Fondos */
        --bg-body: linear-gradient(145deg, #0a1a2b 0%, #1a3347 100%);
        --bg-card: rgba(17, 25, 35, 0.95);
        --bg-card-solid: #111f2b;
        --bg-input: #1a2a38;
        --bg-input-hover: #1f3342;
        
        /* Bordes */
        --border-color: #2d3a4a;
        --border-focus: #60a5fa;
        
        /* Sombras - más intensas en modo oscuro */
        --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        --shadow-focus: 0 0 0 4px rgba(96, 165, 250, 0.2);
    }
}

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

/* ===== FONDO ANIMADO ===== */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 25%),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 30%),
        radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.04) 0%, transparent 25%);
    pointer-events: none;
    animation: backgroundShift 20s ease-in-out infinite alternate;
}

@keyframes backgroundShift {
    0% { transform: scale(1) rotate(0deg); opacity: 0.5; }
    50% { transform: scale(1.05) rotate(1deg); opacity: 0.7; }
    100% { transform: scale(1) rotate(-1deg); opacity: 0.5; }
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.login-box {
    background: var(--bg-card-solid);
    padding: 45px 40px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10;
    animation: slideUp 0.6s ease-out;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
}

.login-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3);
}

/* ===== ANIMACIÓN DE ENTRADA ===== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== LOGO (OPTIMIZADO PARA FONDO AZUL) ===== */
.logo {
    height: 100px;
    width: auto;
    margin-bottom: 30px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding: 8px;
    border-radius: 20px;
    transition: var(--transition);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Efecto especial para logo con letras blancas */
.logo {
    /* Mejora el contraste sobre cualquier fondo */
    background: gold;
   /*background: transparent;+
   */
}

.logo:hover {
    transform: scale(1.05) translateY(-2px);
    filter: drop-shadow(0 10px 15px rgba(15, 60, 95, 0.3));
}

/* Placeholder para pruebas (reemplazar con tu logo real) */
.logo-placeholder {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    font-size: 2rem;
    font-weight: 700;
    padding: 1rem 2.5rem;
    border-radius: 60px;
    display: inline-block;
    margin: 0 auto 30px;
    letter-spacing: 1px;
    box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    text-align: center;
    width: fit-content;
}

/* ===== TÍTULO ===== */
.login-box h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.02em;
    line-height: 1.2;
    position: relative;
    padding-bottom: 16px;
}

.login-box h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.login-box:hover h2::after {
    width: 120px;
}

/* ===== CAMPOS DEL FORMULARIO ===== */
.input-group {
    margin-bottom: 24px;
    text-align: left;
    width: 100%;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

/* Contenedor de input con ícono */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-tertiary);
    font-size: 1.2rem;
    transition: var(--transition);
    pointer-events: none;
    z-index: 2;
}

input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
}

/* Input específico sin ícono */
input:not(.input-wrapper input) {
    padding: 16px 20px;
}

input:hover {
    border-color: var(--color-primary-light);
    background: var(--bg-input-hover);
    transform: translateY(-1px);
}

input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-hover);
    box-shadow: var(--shadow-focus);
}

.input-wrapper:focus-within .input-icon {
    color: var(--color-primary);
    transform: scale(1.1);
}

input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
    font-size: 0.95rem;
}

/* ===== BOTÓN PRINCIPAL ===== */
button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 8px 16px -4px rgba(15, 60, 95, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Efecto de onda en hover */
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(135deg, var(--color-primary-dark), var(--color-primary));
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(15, 60, 95, 0.4);
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px -4px rgba(15, 60, 95, 0.3);
}

/* ===== MENSAJES DE ESTADO ===== */
#msg {
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.4s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1.5;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados del mensaje */
#msg[style*="color: red"],
#msg:has(strong:contains("Error")),
.message-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444 !important;
    backdrop-filter: blur(4px);
}

#msg[style*="color: blue"],
#msg[style*="color: #145a86"],
.message-info {
    background: rgba(15, 60, 95, 0.1);
    border: 1px solid rgba(15, 60, 95, 0.2);
    color: var(--color-primary) !important;
    backdrop-filter: blur(4px);
}

#msg[style*="color: green"],
.message-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981 !important;
    backdrop-filter: blur(4px);
}

/* ===== ENLACES ADICIONALES ===== */
.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.login-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    padding-bottom: 2px;
}

.login-footer a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.login-footer a:hover {
    color: var(--color-accent);
}

.login-footer a:hover::after {
    width: 100%;
}

/* ===== VERSIÓN INSTITUCIONAL ===== */
.institutional-badge {
    margin-top: 25px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    opacity: 0.8;
}

.institutional-badge img {
    height: 32px;
    margin-top: 12px;
    opacity: 0.7;
    transition: var(--transition);
    filter: brightness(0.9);
}

.institutional-badge img:hover {
    opacity: 1;
    transform: scale(1.05);
    filter: brightness(1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .login-box {
        padding: 40px 30px;
        max-width: 440px;
    }
    
    .logo {
        height: 85px;
    }
    
    .login-box h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 640px) {
    body {
        padding: 16px;
        background: linear-gradient(145deg, var(--color-primary-dark), var(--color-primary));
    }
    
    .login-box {
        padding: 35px 25px;
        max-width: 100%;
    }
    
    .logo {
        height: 75px;
        margin-bottom: 25px;
    }
    
    .login-box h2 {
        font-size: 1.6rem;
        margin-bottom: 25px;
    }
    
    .logo-placeholder {
        font-size: 1.6rem;
        padding: 0.8rem 2rem;
    }
    
    input {
        padding: 14px 18px 14px 48px;
        font-size: 0.95rem;
    }
    
    .input-icon {
        font-size: 1.1rem;
        left: 14px;
    }
    
    button {
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    #msg {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .logo {
        height: 65px;
        margin-bottom: 20px;
    }
    
    .login-box h2 {
        font-size: 1.4rem;
        padding-bottom: 12px;
    }
    
    .logo-placeholder {
        font-size: 1.4rem;
        padding: 0.7rem 1.8rem;
    }
    
    input {
        padding: 13px 16px 13px 44px;
    }
    
    .input-icon {
        font-size: 1rem;
        left: 12px;
    }
    
    .input-label {
        font-size: 0.85rem;
    }
    
    .login-footer {
        font-size: 0.85rem;
        padding-top: 20px;
    }
}

@media (max-width: 360px) {
    .login-box {
        padding: 25px 16px;
    }
    
    .logo {
        height: 55px;
    }
    
    .login-box h2 {
        font-size: 1.3rem;
    }
    
    .logo-placeholder {
        font-size: 1.2rem;
        padding: 0.6rem 1.5rem;
    }
    
    button {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    #msg {
        padding: 12px;
        font-size: 0.85rem;
        min-height: 50px;
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus visible para navegación por teclado */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 3px;
}

/* ===== ESTADO DE CARGA ===== */
button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
    cursor: wait;
}

button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-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;
        background: white;
    }
}

/* ===== MODAL DE CAMBIO DE CONTRASEÑA ===== */
#modalCambioPassword {
    animation: fadeIn 0.3s ease;
    background: var(--bg-card-solid);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

#modalCambioPassword input:focus {
    outline: none;
    border-color: var(--border-focus) !important;
    box-shadow: var(--shadow-focus) !important;
}

#modalCambioPassword button {
    margin-top: 20px;
}

#modalCambioPassword button:hover {
    transform: translateY(-2px);
}

/* ===== UTILIDADES ===== */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 20px;
}

/* ===== SOPORTE PARA LOGO TRANSPARENTE ===== */
/* Garantiza que el logo se vea bien en cualquier fondo */
img[src*="logo"] {
    background: transparent;
    mix-blend-mode: normal;
    isolation: isolate;
}

/* Para logos con texto blanco específicamente */
img[alt*="logo" i],
img[src*="logo" i] {
    filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Mejora adicional para modo oscuro */
@media (prefers-color-scheme: dark) {
    img[alt*="logo" i],
    img[src*="logo" i] {
        filter: brightness(1.2) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    }
}