/* Contenedor principal que ocupa toda la pantalla debajo del header */
.mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-light-gray);
    z-index: 990; 
    padding-top: 100px; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-x: hidden; 
    overflow-y: hidden; 
}

.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contenedor interno: Le quitamos el movimiento para que no arrastre la columna izquierda */
.mega-menu-inner {
    display: flex;
    margin: 0 12px; 
    min-height: calc(100vh - 100px);
}

/* Columna Izquierda (Tarjetas) - Se queda fija en su lugar */
.mega-menu-left {
    flex: 0 0 calc(100% - 320px); 
    padding-top: 40px;
    padding-bottom: 60px;
    /* Resta los 12px del margin de mega-menu-inner para alinear con el logo del header */
    padding-left: calc(var(--site-px) - -31px);
    transition: opacity 0.4s ease; 
}

.mega-title {
    font-family: 'TiemposHeadline', serif;
    font-weight: 700;
    color: #070E46;
    font-size: 48px;
    margin-bottom: 1.5rem;
}

/* Tarjetas */
.mega-card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 30px 25px;
    text-align: left;
}

.card-img-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 0px;
    overflow: hidden;
}

.card-img-wrapper img,
.card-img-wrapper svg {
    height: 168px;
    width: 168px;
    transition: transform 0.4s ease;
}

.mega-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.mega-card-link:hover .card-img-wrapper img,
.mega-card-link:hover .card-img-wrapper svg {
    transform: translateY(-14px);
}

.mega-card .card-title {
    font-family: 'TiemposHeadline', serif;
    font-weight: 700;
    margin-bottom: 20px;
    color: #070E46;
    font-size: 24px;
}
.mega-card .card-title-bottom {
    font-family: 'TiemposHeadline', serif;
    font-weight: 700;
    margin-bottom: 50px;
    color: #070E46;
    font-size: 24px;
}

.mega-card .card-text {
    font-family: 'BentonSansBBVA-Book', sans-serif;
    color: #070E46;
    font-size: 15.01px;
    line-height: 1.6;
    margin: 0;
}

/* Columna Derecha (Blanca Lateral) - Preparamos para que se deslice encima de la izquierda */
.mega-menu-right {
    flex: 0 0 320px; 
    background-color: #ffffff;
    padding: 40px 30px;
    border-left: 1px solid #eaeaea; 
    position: relative; 
    z-index: 5; 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.explore-title {
    font-family: 'BentonSansBBVA-Medium', sans-serif;
    font-weight: 500;
    color: var(--bbva-blue);
    font-size: 24px;
    margin-bottom: 30px;
}

/* Fila contenedora de "Programas" y su flecha */
.programas-row {
    transition: background-color 0.2s ease;
    padding: 6px 10px;
    margin-left: -16px;
    margin-right: -5px;
    border-radius: 16px;
    display: flex;
    align-items: center;
}

.programas-row:hover {
    background-color: #F7F8F8;
}

/* Área de clic de la flecha ampliada */
.btn-arrow-sub {
    cursor: pointer;
    margin-right: 0px; 
    padding: 10px; 
}

.explore-link {
    font-family: 'BentonSansBBVA-Medium', sans-serif;
    font-weight: 500;
    color: var(--bbva-light-blue);
    font-size: 15.01px;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
    margin-bottom: 0px !important; 
    margin-top: 0.5rem !important;
}

.programas-row .explore-link {
    margin-bottom: 0;
}

.explore-link:hover {
    color: var(--bbva-blue);
}

@media (min-width: 992px) {
    .explore-links-wrapper > a.explore-link {
        padding: 16px 7px;
        margin-left: -14px;
        margin-right: -14px;
        border-radius: 16px;
        transition: background-color 0.2s ease;
    }

    .explore-links-wrapper > a.explore-link:hover {
        background-color: #F7F8F8;
    }
}

.mega-divider {
    border-color: #959595;
    margin: 30px 0;
}

.mega-icon-links li {
    margin-bottom: 20px;
}

.mega-icon-links a {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'BentonSansBBVA-Medium', sans-serif;
    font-weight: 500;
    color: #001391;
    font-size: 15.01px;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
}

.mega-icon-links a:hover {
    color: #070E46;
    background-color: #ffffff;
}

/* Tercera Columna (Subpanel de Programas) - Lista para deslizarse */
.mega-menu-subpanel {
    flex: 0 0 455px; 
    background-color: #ffffff;
    padding: 95px 0px; 
    border-left: 1px solid #eaeaea;
    position: relative;
    z-index: 4; 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.subpanel-link {
    display: flex;
    align-items: center;
    position: relative;
    font-family: 'BentonSansBBVA-Medium', sans-serif;
    font-weight: 500;
    color: var(--bbva-light-blue);
    font-size: 15.01px;
    text-decoration: none;
    padding: 12px 14px;
    margin-bottom: 4px;
    margin-right: 160px;
    border-radius: 16px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.subpanel-link:hover {
    background-color: #F7F8F8;
    color: var(--bbva-blue);
}

/* ESTADOS DE ANIMACIÓN (Al hacer clic en la flecha) */
.mega-menu-overlay.submenu-active .mega-menu-right,
.mega-menu-overlay.submenu-active .mega-menu-subpanel {
    transform: translateX(-456px); 
}

/* 2. Efecto ausente en la columna gris (Título y Tarjetas se quedan en su lugar pero atenuadas) */
.mega-menu-overlay.submenu-active .mega-menu-left {
    opacity: 0.25;
    pointer-events: none; 
}

/* 3. Estilo de la fila "Programas" cuando el panel está desplegado */
.programas-row.active-sub {
    background-color: var(--bg-light-gray);
}


/* ==========================================================================
   AJUSTES RESPONSIVE (MÓVIL Y TABLET)
   ========================================================================== */

/* Ocultar footer de tablet en móvil por defecto */
.mob-tablet-footer-section {
    display: none;
}

@media (max-width: 991px) {
    /* Overlay scrolleable */
    .mega-menu-overlay {
        padding-top: 80px;
        overflow-y: auto;
    }

    .mega-menu-inner {
        flex-direction: column;
        margin: 0;
        padding: 16px;
    }

    /* Animación del menú móvil entrando a la pantalla */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: #f8f8f8; 
        z-index: 9999;
        transform: translateX(100%); 
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        overflow-y: auto;
    }

    .mobile-overlay.active {
        transform: translateX(0); 
    }

    .mobile-overlay-header {
        padding: 12px 16px;
        background-color: #f8f8f8;
        min-height: 60px;
        margin-bottom: 0px;
    }

    .mobile-overlay-body {
        padding: 18px 4px 0 4px;
        margin-top: 0.5rem;
    }

    /* Móvil sin footer: restaurar espacio inferior */
    @media (max-width: 767px) {
        .mobile-overlay-body {
            padding-bottom: 3rem;
        }
    }

    .mob-close-text {
        color: #001391;
        font-size: 10px;
        font-weight: 500;
        font-family: 'BentonSansBBVA-Medium', sans-serif;
        display: block;
        margin-top: 4px;
    }

    /* Estructura de tarjetas superiores (Programas / Sustentabilidad) */
    .mob-card-link {
        border-radius: 12px;
        border: 1px solid #E9EDF5;
        box-shadow: 0px 2px 8px rgba(0,0,0,0.02);
        background-color: #ffffff;
        margin-bottom: 1rem;
    }

    .mob-link-text {
        font-family: 'BentonSansBBVA-Medium', sans-serif;
        color: #001391;
        font-size: 15.01px;
        font-weight: 500;
    }
    .mob-link-text:hover {
        color:#070E46;
    }

    .mob-sub-link {
        font-family: 'BentonSansBBVA-Medium', sans-serif;
        color: #001391;
        font-size: 15px;
        padding-bottom: 0.7rem;
    }

    /* Animación del submenú y flecha */
    .mob-arrow-btn .mob-arrow {
        transform: rotate(90deg); 
        transition: transform 0.3s ease;
    }
    .mob-has-sub[aria-expanded="true"] .mob-arrow {
        transform: rotate(-90deg) !important; 
    }


    .mob-search-form button img {
        width: 24px;
        height: 24px;
    }

    /* Elementos del Carrusel Móvil */
    .mob-programas-title {
        font-family: 'TiemposHeadline', serif;
        font-size: 32px;
        color: #070E46;
        font-weight: bold;
        white-space: nowrap;
    }

    .mob-carousel-track {
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        width: 300%;
    }

    .mob-slide {
        width: 33.333%;
        padding: 0px;
    }

    .mob-slide-img {
        height: 240px;
        width: 240px;
        object-fit: contain;
    }

    .mob-card-title {
        font-family: 'TiemposHeadline', serif;
        font-size: 32px;
        color: #070E46;
        font-weight: bold;
        margin-bottom: 12px;
        line-height: 1.1;
    }

    .mob-card-text {
        font-family: 'BentonSansBBVA-Book', sans-serif;
        font-size: 15px;
        color: #070E46;
        line-height: 1.5;
        margin: 0;
    }

    .mob-carousel-counter {
        font-family: 'BentonSansBBVA-BookItalic', sans-serif;
        font-size: 15px;
        color: #070E46;
        background-color: white;
        padding: 4px 8px;
        border-radius: 16px;
        box-shadow: 0px 2px 8px rgba(0,0,0,0.1);
    }

    .mob-carousel-btn {
        opacity: 0.5;
        transition: opacity 0.3s;
    }

    .mob-carousel-controls {
        margin-top: -1rem !important;
    }

    /* Enlaces Inferiores con Iconos */
    .mob-icon-link {
        transition: background 0.2s, color 0.2s;
        border-radius: 8px;
    }

    .mob-icon-link:hover {
        background-color: #ffffff;
    }

    .mob-icon-link:hover .mob-icon-text {
        color: #070E46;
    }

    .mob-icon-link:hover img {
        filter: brightness(0) saturate(100%) invert(8%) sepia(60%) saturate(2500%) hue-rotate(220deg) brightness(85%);
    }

    .mob-icon-link:active {
        background-color: #ffffff;
    }

    .mob-icon-link:active .mob-icon-text {
        color: #070E46;
    }

    .mob-icon-text {
        font-family: 'BentonSansBBVA-Medium', sans-serif;
        color: #001391;
        font-weight: 500;
        font-size: 15px;
        transition: color 0.2s;
    }

    /* =======================================================
       Reorganización del Menú Desktop para tablet (flex order)
       ======================================================= */
    .mega-menu-right {
        order: 1;
        width: 100%;
        flex: auto;
        background-color: transparent;
        border: none;
        padding: 0 0 8px 0;
        transform: none !important;
    }

    .mega-menu-subpanel {
        order: 2;
        display: none;
        padding: 0;
        border: none;
        background-color: transparent;
        transform: none !important;
    }

    .mega-menu-left {
        order: 3;
        padding: 24px 0 60px 0;
    }

    .programas-row {
        background-color: #ffffff;
        border-radius: 12px;
        padding: 16px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 8px;
    }

    .explore-links-wrapper .explore-link {
        background-color: #ffffff;
        border-radius: 12px;
        padding: 16px !important;
        margin-bottom: 8px !important;
        display: block;
    }

    .mega-divider {
        display: none;
    }

    .mega-icon-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mega-icon-links li {
        margin-bottom: 0;
    }

    .mega-icon-links a {
        background-color: #ffffff;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 0;
    }

    .subpanel-link {
        background-color: #ffffff;
        border-radius: 12px;
        margin-bottom: 8px;
        padding: 16px;
    }

    .subpanel-link:hover {
        background-color: #f0f0f0;
    }

    .mega-menu-overlay.submenu-active .mega-menu-subpanel {
        display: block;
    }

    .mega-menu-overlay.submenu-active .mega-menu-right,
    .mega-menu-overlay.submenu-active .mega-menu-subpanel {
        transform: none !important;
    }

    .mega-menu-overlay.submenu-active .mega-menu-left {
        opacity: 1;
        pointer-events: auto;
    }

    .mega-title {
        font-size: 32px;
    }
       .mob-arrow-btn .mob-arrow {
        width: 24px;
        height: 24px;
    }
}


/* Tablets: 768px - 991px — Footer visible y 3 cards estáticas en vez de carrusel */
@media (min-width: 768px) and (max-width: 991px) {
    .mob-tablet-footer-section {
        display: block;
    }

    .mob-carousel-wrapper {
        background-color: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .mob-carousel-overflow {
        overflow: visible !important;
    }
    .mob-carousel-track {
        width: 100% !important;
        transform: none !important;
        transition: none !important;
        gap: 16px;
    }
    .mob-slide {
        width: calc(33.333% - 11px) !important;
        flex-shrink: 0;
        background-color: #ffffff;
        border-radius: 16px;
        padding: 20px !important;
    }
    .mob-carousel-controls {
        display: none !important;
    }
    .mob-programas-title{
        text-align: center !important;
    }
    .mob-card-title{
        font-size: 21px !important;
    }
    .img-fluid{
        width: 168px !important;
        height: 168px !important;
    }
     
    
}