/* ==========================================================================
   VARIABLES GLOBALES
   ========================================================================== */
:root {
    --primary: #008f47;
    --secondary: #000000;
 --accent: #ffc107;
    
    /* Variables Especiales Estadísticas */
    --main-green: #008f47;
    --bg-gradient: linear-gradient(135deg, #008f47 0%, #006b35 100%);
    --text-primary: #ffffff;
    --text-secondary: #cbeedd; 
    --accent-glow: #ffffff;    
}

/* ==========================================================================
   RESET CORRIMIENTO
   ========================================================================== */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    width: 100% !important;
    margin: 0; padding: 0;
    font-family: 'Poppins', sans-serif;
}

/* ==========================================================================
   1. GALERÍA PRINCIPAL (CARRUSEL)
   ========================================================================== */
.carrusel-item-contenedor {
    position: relative;
    width: 100%;
    height: 550px; /* Altura ideal en pantallas grandes */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #f8f9fa; 
    contain: paint; /* Optimización extra para rendimiento móvil */
}

.carrusel-item-contenedor::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(1.0) opacity(0.85); 
    transform: scale(1.15); /* Aumentado a 1.15 para asegurar que no queden bordes blancos en celulares */
    z-index: 1;
    will-change: transform, filter; /* Suaviza el rendimiento en Safari y Chrome móvil */
}

.img-carrusel {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); 
}

.tarjeta-informacion {
    position: relative;
    z-index: 10; 
    margin-top: -60px; 
    background: #ffffff;
    border-radius: 15px 15px 0 0; 
    padding: 30px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08); 
}

/* Controles personalizados de la Galería */
.custom-nav-icon {
    background-color: var(--primary);
    border-radius: 50%;
    padding: 20px;
    background-size: 60%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.carousel-control-prev:hover .custom-nav-icon,
.carousel-control-next:hover .custom-nav-icon {
    transform: scale(1.1);
    background-color: var(--secondary); 
}

.carousel-indicators [data-bs-target] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    margin: 0 5px;
}

/* ==========================================================================
   AJUSTES RESPONSIVE QUIRÚRGICOS (SIN TOCAR TU HTML)
   ========================================================================== */
@media (max-width: 768px) {
    .carrusel-item-contenedor {
        height: 350px; /* Reducimos la altura en celulares para que mantenga proporción estética */
    }
    
    .tarjeta-informacion {
        margin-top: -30px; /* Suavizamos el solapamiento en pantallas chicas */
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .carrusel-item-contenedor {
        height: 280px; /* Ajuste perfecto para pantallas de teléfonos delgados */
    }
}

/* ==========================================================================
   2. BIENVENIDOS & MÁQUINA DE ESCRIBIR PREMIUM
   ========================================================================== */
.welcome-hero-original {
    background: linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)), url('../images/f1.jpg') no-repeat center center/cover;
    padding: 80px 0;
}

.welcome-hero-original .welcome-text {
    font-size: clamp(2.5rem, 6vw, 4rem);
    background: linear-gradient(135deg, #15253D 0%, #2c3e50 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.floating-logo { 
    animation: float 4s ease-in-out infinite; 
}

/* Efecto de Escritura Dinámico */
.maquina-escribir {
    font-size: clamp(1.4rem, 3.8vw, 2.2rem); 
    font-weight: 800;
    color: var(--primary); 
    text-transform: uppercase;
    letter-spacing: -0.5px;
    margin-top: 15px;
    display: inline-block;
    position: relative;
    text-shadow: 0 4px 12px rgba(0, 143, 71, 0.12); 
    min-height: 3.5rem; 
}

.maquina-escribir::after {
    content: "|";
    margin-left: 5px;
    color: var(--accent); 
    font-weight: 300;
    animation: parpadeoCursor 0.8s infinite;
}

/* ==========================================================================
   3. ESTADÍSTICAS DELGADAS ULTRA COMPACTAS
   ========================================================================== */
.stats-ultra-compact {
    background: var(--bg-gradient);
    padding: 1rem 0; 
    width: 100%;     
    box-shadow: 0 6px 20px rgba(0, 143, 71, 0.25);
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.stats-ultra-compact::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: rotateBg 14s linear infinite;
    pointer-events: none;
}

.stat-mini {
    padding: 0.5rem 1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
}

.stat-mini h2 {
    font-size: 2.8rem; 
    font-weight: 900;  
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 0px;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.stat-mini p {
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
}

.stat-mini:hover {
    transform: translateY(-4px) scale(1.05);
}

.stat-mini:hover h2 {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 3px 5px rgba(0,0,0,0.4);
}

.divider-stats {
    border: none !important;
}

/* ==========================================================================
   4. SECCIÓN NIVELES ACADÉMICOS (CORREGIDO Y OPTIMIZADO)
   ========================================================================== */
.seccion-niveles-modern {
    position: relative;
    padding: 100px 0;
    background: url('../images/f1.jpg') no-repeat center center fixed;
    background-size: cover;
    overflow: hidden;
}

/* CORRECCIÓN: Fondo verde oscuro translúcido para que las letras blancas resalten de verdad */
.overlay-glass {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(194, 235, 212, 0.353); /* Un verde bosque profundo que da un contraste espectacular */
    z-index: 1;
}

/* Forzar que el contenido se ponga delante del overlay oscuro */
.seccion-niveles-modern .container,
.seccion-niveles-modern .contenido-bloque {
    position: relative;
    z-index: 2;
}

/* Tarjetas */
.card-modern { 
    border-radius: 25px; 
    overflow: hidden; 
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); 
    height: 100%; 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}
.card-modern:hover { 
    transform: translateY(-10px); 
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.3);
}
.img-wrapper { height: 350px; overflow: hidden; }
.img-wrapper img { width: 100%; height: 100%; object-fit: cover; }

/* TÍTULO DE NIVELES AVANZADO */
.header-niveles-premium {
    position: relative;
    z-index: 10;
    text-align: center;
    margin-bottom: 50px;
}

/* Pre-título en Amarillo Dorado Fijo (#ffc107) */

.header-niveles-premium .pre-titulo {
    color: #000000; 
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.35em;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    margin-bottom: 12px;
    display: block;
    opacity: 0;
    
    /* CORREGIDO: Dejamos solo la animación de entrada suave (fadeInSlideIn) */
    animation: fadeInSlideIn 0.8s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards;
}

/* Título Principal Metálico (Ahora perfectamente legible sobre el fondo oscuro) */
.header-niveles-premium .titulo-principal {
    background: linear-gradient(120deg, #008f47 30%, #008f48ce 45%, #26d07b 50%, #087940 55%, #008f47 70%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: clamp(2.2rem, 7.5vw, 4rem); 
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.04em;
    margin: 0;
    line-height: 1.1;
    filter: drop-shadow(0 4px 15px rgba(43, 43, 43, 0.436));
    opacity: 0;
    animation: fadeInSlideIn 1s cubic-bezier(0.25, 1, 0.5, 1) 0.5s forwards, 
               shineTextEffect 4s linear 1.5s infinite;
}

/* Adornos Inferiores con Colores Fijos */
.adorno-inferior {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 1.5rem; 
    margin-top: 25px; 
    opacity: 0;
    animation: fadeInSimple 1s ease 1s forwards;
}

.adorno-inferior .linea {
    width: clamp(35px, 15vw, 90px); 
    height: 2px;
    background: linear-gradient(to right, transparent 0%, #ffc107 50%, transparent 100%);
    border-radius: 5px; 
    transform: scaleX(0);
    animation: expandLines 1s cubic-bezier(0.25, 1, 0.5, 1) 1.2s forwards;
}

.adorno-inferior i {
    color: #000000; 
    font-size: clamp(1.2rem, 3.5vw, 1.5rem);
    filter: drop-shadow(0 0 10px #ffc107); 
    animation: pulseStar 3s infinite ease-in-out;
}

/* ==========================================================================
   5. SECCIÓN ENLACES DE INTERÉS (FONDO BORROSO RESPONSIVE)
   ========================================================================== */
.enlaces-de-interes-fondo {
    position: relative;
    padding: 80px 0 !important; 
    overflow: hidden; 
    border-top: 1px solid rgba(0,0,0,0.03);
    background-color: #f8f9fa; 
    /* Asegura que nada del escalado interno rompa los márgenes de la página */
    contain: paint; 
}

/* Capa de la imagen de fondo con desenfoque */
.enlaces-de-interes-fondo::before {
    content: "";
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: linear-gradient(rgba(248, 249, 250, 0.6), rgba(186, 192, 4, 0.5)), 
                url('images/enlaces.jpg') no-repeat center center;
    background-size: cover;
    
    /* Efecto óptico */
    filter: blur(8px); 
    transform: scale(1.08); /* Evita las esquinas blancas/transparentes del blur */
    z-index: 1;

    /* OPTIMIZACIÓN MÓVIL CRÍTICA: Fuerza la aceleración por hardware (GPU) */
    will-change: transform, filter;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden; 
}

/* Contenedor del contenido al frente */
.enlaces-de-interes-fondo .container {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   6. MEDIA QUERIES (ADAPTABILIDAD RESPONSIVE)
   ========================================================================== */
@media (max-width: 768px) {
    /* Ajuste de espacios para la sección de enlaces */
    .enlaces-de-interes-fondo {
        padding: 50px 0 !important; 
    }
    
    /* Ajuste de seguridad para las estadísticas compactas si no usas clamp() */
    .stats-ultra-compact h2 {
        font-size: 1.8rem !important; 
    }
}

/* ==========================================================================
   TÍTULO CON LÍNEA ANIMADA INTERACTIVA
   ========================================================================== */
.section-title-main {
    font-size: clamp(2rem, 5vw, 2.8rem); /* Fluido para celulares y PC */
    font-weight: 800;
    color: var(--secondary); /* Tu azul oscuro institucional */
    letter-spacing: -0.5px;
    margin-bottom: 60px !important; /* Espacio para que la línea respire */
    display: inline-block;
}

.section-title-main span {
    position: relative;
    display: inline-block;
    padding-bottom: 15px; /* Separación entre el texto y la línea */
}

/* Diseño de la línea decorativa */
.section-title-main span::after {
    content: "";
    position: absolute;
    bottom: 0; 
    left: 50%; 
    width: 100%; 
    height: 3.5px; /* Grosor elegante */
    
    /* Degradado de la línea: Base verde con centro brillante en amarillo dorado */
    background: linear-gradient(90deg, 
                var(--primary) 0%, 
                var(--accent) 50%, 
                var(--primary) 100%);
    background-size: 200% auto;
    border-radius: 4px;
    
    /* Configuración inicial de la animación */
    transform: translateX(-50%) scaleX(0);
    
    /* Animaciones coordinadas: entrada elástica + destello brillante infinito */
    animation: expandirLinea 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.3s forwards, 
               brilloLinea 3s linear infinite;
}

/* ==========================================================================
   TARJETAS DE CRISTAL TRANSLÚCIDO (GLASSMORPHISM)
   ========================================================================== */
.enlace-card-animated {
    background: rgba(255, 255, 255, 0.45) !important; 
    backdrop-filter: blur(12px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(140%) !important;
    padding: clamp(1.8rem, 4vw, 2.6rem) 1.5rem; 
    border-radius: 24px; 
    display: block;
    text-decoration: none !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    height: 100%;
}

.enlace-card-animated:hover {
    background: rgba(0, 143, 71, 0.92) !important; 
    transform: translateY(-8px); 
    border-color: rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 20px 35px rgba(0, 143, 71, 0.25) !important; 
}

.icon-rotate { 
    width: 75px; height: 75px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    margin: 0 auto 20px; font-size: 30px; 
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.4s ease, color 0.4s ease;
}

.enlace-card-animated:hover .icon-rotate { 
    transform: scale(1.05) rotateY(360deg);
    background: #ffffff !important; 
    color: var(--primary) !important; 
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.trophy { background: #fff3cd; color: #856404; }
.grad { background: #cfe2ff; color: #084298; }
.mail { background: #f8d7da; color: #8f0005; }

.enlace-card-animated h3 { 
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    color: var(--secondary);
    font-weight: 700; margin: 0;
    transition: color 0.3s ease; 
}

.enlace-card-animated:hover h3 { 
    color: #ffffff !important; 
}

/* ==========================================================================
   ANIMACIONES ESPECÍFICAS DEL TÍTULO
   ========================================================================== */

/* 1. Despliega la línea sutilmente desde el centro */
@keyframes expandirLinea {
    to { transform: translateX(-50%) scaleX(1); }
}

/* 2. Desplaza el destello dorado continuamente */
@keyframes brilloLinea {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}


/* ==========================================================================
   6. TABLÓN DE ANUNCIOS Y COMPONENTES ADICIONALES
   ========================================================================== */
.header-tablon-modern { display: flex; align-items: center; gap: 20px; justify-content: center; }
.tablon-line { flex: 1; height: 2px; background: rgba(0, 143, 71, 1); }
.tablon-pill-red {
    background: var(--primary); color: white; padding: 12px 50px;
    border-radius: 50px; font-weight: 800; text-transform: uppercase;
    font-size: 1.5rem; border-bottom: 4px solid var(--accent); white-space: nowrap;
}

/* Redes Sociales Flotantes */
.social-modern-bar { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.social-modern-btn {
    width: 50px; height: 50px; border-radius: 15px; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 24px; text-decoration: none; transition: 0.3s;
}
.social-modern-btn:hover { transform: scale(1.1) translateX(-5px); color: white; }
.fb { background: #1877F2; } .ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); } .wa { background: #25D366; }

/* ==========================================================================
   KEYFRAMES / ANIMACIONES
   ========================================================================== */
@keyframes parpadeoCursor { 
    0%, 100% { opacity: 1; } 50% { opacity: 0; } 
}
@keyframes shineTextEffect {
    0% { background-position: 200% center; } 100% { background-position: -200% center; }
}
@keyframes fadeInSlideIn {
    from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseStar {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px var(--accent)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 20px var(--accent)); }
}
@keyframes textShimmerPre {
    0%, 100% { opacity: 1; text-shadow: 0 0 1px var(--accent); }
    50% { opacity: 0.85; text-shadow: 0 0 10px var(--accent); }
}
@keyframes expandLines { to { transform: scaleX(1); } }
@keyframes fadeInSimple { to { opacity: 1; } }
@keyframes rotateBg { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes expandirLinea { to { transform: translateX(-50%) scaleX(1); } }
@keyframes brilloLinea { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 768px) {
    .carrusel-item-contenedor { height: 350px; }
    .tarjeta-informacion { margin-top: -30px; padding: 20px; }
    .stat-mini h2 { font-size: 2.2rem; }
    .stat-mini p { font-size: 0.75rem; }
    .enlace-card-animated:hover { transform: translateY(-4px); }
    .enlace-card-animated { padding: 1.5rem 1rem; }
    .icon-rotate { width: 65px; height: 65px; font-size: 26px; margin-bottom: 12px; }
    .stats-ultra-compact { width: 95%; margin-top: -25px; }
    .tablon-pill-red { font-size: 1.1rem; padding: 10px 30px; }
    .tablon-line { display: none; }
    .social-modern-bar {
        top: auto; bottom: 0; left: 0; right: 0; width: 100%;
        flex-direction: row; transform: none; padding: 10px;
        background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
        justify-content: space-around; border-radius: 20px 20px 0 0;
    }
}

@media (max-width: 480px) {
    .adorno-inferior { gap: 1rem; margin-top: 15px; }
    .stats-ultra-compact { padding: 1.5rem 0; }
    .stats-ultra-compact .row { flex-direction: column; gap: 1.5rem; }
    .stats-ultra-compact .col-4 { width: 100% !important; }
    .maquina-escribir { min-height: 2.8rem; letter-spacing: 0px; }
}