/* ============================================================
   HEADER MAM — CSS (ACCESIBLE Y CONSISTENTE)
   ============================================================ */

.sitio-header {
    background-color: #051d2c;
    color: #fff;
}

.contenedor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1500px;
    margin: 0 auto;
    padding: 10px 20px;
    position: relative;
}

.header-logo { margin-right: 40px; }
.logo-imagen { width: 140px; height: auto; }

.menu-principal { flex-grow: 1; }
.menu-lista {
    list-style: none;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
}
.menu-enlace {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    position: relative;
}
.menu-item:hover > .megamenu-panel { display: block; }
.menu-item:hover > .menu-enlace { color: #9BB7D0; }

/* ============================================================
   MEGAMENÚ — FONDO BLANCO → usa #0038d1
   ============================================================ */
.megamenu-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1500px;
    background-color: #ffffff;
    padding: 40px 40px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    border-top: 1px solid #e5e7eb;
    z-index: 999;
}
.megamenu-contenido {
    display: flex;
    gap: 60px;
}
.megamenu-columna { flex: 1; }
.megamenu-titulo {
    font-size: 22px;
    font-weight: 600;
    color: #051d2c;
    margin-bottom: 25px;
}
.megamenu-lista {
    list-style: none;
    margin: 0;
    padding: 0;
}
.megamenu-item { margin-bottom: 20px; }
.megamenu-enlace {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #051d2c;
    position: relative;
    padding-right: 20px;
}
.mm-texto { font-size: 17px; font-weight: 500; }
.mm-descripcion {
    font-size: 14px;
    color: #6b7280;
    margin-top: 3px;
}
.mm-flecha {
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.2s ease, transform 0.2s ease;
    color: #0038d1; /* sobre blanco */
}
.megamenu-enlace:hover .mm-flecha {
    opacity: 1;
    transform: translateY(-50%) translateX(3px);
}
.megamenu-enlace:hover .mm-texto { color: #0038d1; }

/* BLOQUE INFERIOR (fondo #F2F4F7) → usa #0038d1 */
.megamenu-inferior {
    background: #F2F4F7;
    padding: 28px 32px;
    margin-top: 32px;
    width: calc(100% + 80px);
    margin-left: -40px;
    margin-right: -40px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    gap: 40px;
}
.inferior-columna { flex: 1; }
.inferior-enlace {
    text-decoration: none;
    color: #051d2c;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.inferior-linea {
    display: flex;
    align-items: center;
    gap: 10px;
}
.inferior-icono {
    width: 22px;
    height: 22px;
    stroke: #051d2c;
    stroke-width: 2;
    fill: none;
    transition: stroke 0.2s ease;
}
.inferior-titulo {
    font-size: 16px;
    font-weight: 600;
    transition: color 0.2s ease;
}
.inferior-descripcion {
    font-size: 14px;
    color: #4a5568;
    transition: color 0.2s ease;
}
.inferior-enlace:hover .inferior-titulo { color: #0038d1; }
.inferior-enlace:hover .inferior-descripcion { color: #1a2b3c; }
.inferior-enlace:hover .inferior-icono { stroke: #0038d1; }

.megamenu-panel { padding-bottom: 0 !important; }

/* --- RESPONSIVE TABLET --- */
@media (max-width: 992px) {
    .megamenu-contenido { flex-direction: column; gap: 40px; }
    .megamenu-panel { padding: 30px 30px; }
    .menu-lista { gap: 20px; }
}

/* ============================================================
   MENÚ HAMBURGUESA Y MÓVIL (fondo oscuro)
   ============================================================ */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}
.menu-toggle-line {
    width: 26px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.menu-toggle.activo .menu-toggle-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.menu-toggle.activo .menu-toggle-line:nth-child(2) { opacity: 0; }
.menu-toggle.activo .menu-toggle-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.menu-movil {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #051d2c;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    z-index: 9999;
}
.menu-movil-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.mm-item {
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 10px;
}
.mm-toggle {
    width: 100%;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    padding: 8px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mm-toggle::after {
    content: "+";
    font-size: 20px;
    transition: transform 0.3s ease;
}
.mm-item.activo .mm-toggle::after { transform: rotate(45deg); }
.mm-submenu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.mm-item.activo .mm-submenu { max-height: 800px; }
.mm-submenu li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    padding: 6px 0;
    display: block;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}
.mm-submenu li a:hover { opacity: 1; }
.menu-movil.activo { display: block; }

/* ============================================================
   HEADER ACCIONES + BOTÓN CONTACTAR (sobre fondo oscuro)
   ============================================================ */
.header-acciones {
    display: flex;
    align-items: center;
    gap: 22px;
}
.icono-header {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.icono-header:hover { opacity: 0.7; }
.icono-svg { width: 100%; height: 100%; }

/* Botón sobre fondo oscuro → #2a6fc9 */
.btn-contactar {
    padding: 8px 16px;
    background-color: #2a6fc9;
    color: #ffffff;
    border-radius: 0px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}
.btn-contactar:hover { background-color: #1a5cb5; }

/* BUSCADOR OVERLAY (fondo oscuro) */
.buscador-ipp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 29, 44, 0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.buscador-ipp-overlay.activo { display: flex; }
.buscador-ipp-overlay input {
    width: 80%;
    max-width: 600px;
    padding: 18px 24px;
    font-size: 20px;
    border-radius: 50px;
    border: 1px solid #2a6fc9;
    background: #051d2c;
    color: #fff;
}

/* ============================================================
   RESPONSIVE MÓVIL
   ============================================================ */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .menu-principal { display: none; }
    .contenedor-header {
        flex-direction: row;
        align-items: center;
        padding: 10px 16px;
    }
    .header-logo { margin-right: 10px; }
    .logo-imagen { width: 110px; }
    .btn-contactar { display: none; }
    .header-acciones { gap: 14px; }
    .icono-header { width: 22px; height: 22px; }
    .menu-movil {
        padding: 16px;
        max-height: 80vh;
        overflow-y: auto;
        box-sizing: border-box;
        width: 100%;
    }
    .menu-movil-lista { gap: 12px; }
    .mm-toggle { font-size: 16px; padding: 6px 0; }
    .mm-submenu { padding-left: 8px; }
    .mm-submenu li a { font-size: 15px; padding: 4px 0; }
    .buscador-ipp-overlay input {
        width: 90%;
        padding: 14px 20px;
        font-size: 18px;
    }
}

/* ============================================================
   TOP BAR - (MAM · Light)
   ============================================================ */

.top-bar-asociacion {
    background-color: #f9fafb;              /* Fondo gris muy claro */
    border-bottom: 1px solid #e9edf2;       /* Separación sutil con el header oscuro */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
    font-size: 13px;
    color: #475569;                         /* Gris profesional */
    padding: 6px 0;
    transition: all 0.2s ease;
    /* Sombra extremadamente sutil para darle "profundidad McKinsey" */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.contenedor-top-bar {
    max-width: 1500px;                      /* Misma anchura que el header */
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px 20px;
    min-height: 40px;
}

/* Etiqueta "asociación" */
.top-bar-etiqueta {
    font-weight: 600;
    color: #1e293b;                         /* Casi negro, para destacar */
    letter-spacing: 0.04em;
    font-size: 11px;
    text-transform: uppercase;
    background: #eef2f6;                    /* Fondo con tag suave */
    padding: 2px 10px;
    border-radius: 0px;
    white-space: nowrap;
}

/* Separadores ( |  ·  ) */
.top-bar-separador {
    color: #cbd5e1;
    font-weight: 300;
    font-size: 14px;
}

/* Navegación de enlaces centrales */
.top-bar-nav {
    display: flex;
    align-items: center;
    gap: 8px 18px;
    flex-wrap: wrap;
}

.top-bar-enlace {
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 450;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    position: relative;
    padding: 2px 0;
    white-space: nowrap;
}

/* Efecto elegante: subrayado al hacer hover */
.top-bar-enlace::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 0;
    height: 1.5px;
    background-color: #2563eb;              /* Azul corporativo */
    transition: width 0.25s ease;
}
.top-bar-enlace:hover {
    color: #1e293b;
}
.top-bar-enlace:hover::after {
    width: 100%;
}

/* Enlace "agenda una reunión →" (anclado a la derecha) */
.top-bar-ver-todos {
    margin-left: auto;                      /* Empuja este elemento hacia la derecha */
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;                         /* Azul institucional */
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    padding: 5px 14px;
    border-radius: 0px;
    background: transparent;
    border: 1px solid transparent;
    white-space: nowrap;
}
.top-bar-ver-todos:hover {
    background-color: #eef2ff;
    border-color: #dbeafe;
    color: #1d4ed8;
    transform: translateX(2px);             /* Efecto de desplazamiento sutil */
}

/* ============================================================
   RESPONSIVE · TABLET Y MÓVIL
   ============================================================ */

/* --- Tablet (max-width: 992px) --- */
@media (max-width: 992px) {
    .contenedor-top-bar {
        padding: 0 20px;
        gap: 6px 14px;
        min-height: 36px;
    }
    .top-bar-nav {
        gap: 6px 12px;
    }
    .top-bar-enlace {
        font-size: 12px;
    }
}

/* --- Móvil (max-width: 768px) --- */
@media (max-width: 768px) {
    .top-bar-servicios {
        padding: 4px 0;
        font-size: 12px;
        border-bottom: 1px solid #e2e8f0;
    }

    .contenedor-top-bar {
        padding: 0 16px;
        min-height: 34px;
        gap: 4px 8px;
        flex-wrap: nowrap;                 /* Evita saltos de línea bruscos */
    }

    /* Ocultamos los separadores y los enlaces centrales para ahorrar espacio */
    .top-bar-separador {
        display: none;
    }
    .top-bar-nav {
        display: none;
    }

    .top-bar-etiqueta {
        font-size: 10px;
        padding: 1px 8px;
        background: transparent;           /* En móvil se ve más limpio sin fondo */
        text-transform: uppercase;
        font-weight: 700;
        color: #1e293b;
        letter-spacing: 0.06em;
    }

    /* El botón "Todos los servicios" se mantiene visible y se alinea a la derecha */
    .top-bar-ver-todos {
        margin-left: auto;
        font-size: 11px;
        font-weight: 600;
        padding: 3px 8px;
        background: transparent;
        border: none;
        color: #2563eb;
    }
    .top-bar-ver-todos:hover {
        background: transparent;
        transform: none;
        color: #1d4ed8;
    }
}

/* --- Móviles muy pequeños (max-width: 420px) --- */
@media (max-width: 420px) {
    .top-bar-etiqueta {
        font-size: 9px;
        letter-spacing: 0.04em;
        padding: 1px 4px;
    }
    .top-bar-ver-todos {
        font-size: 10px;
        padding: 2px 4px;
        letter-spacing: 0.01em;
    }
    .contenedor-top-bar {
        padding: 0 12px;
        min-height: 30px;
    }
}

/* ============================================================
   MEGAMENÚ — RESPONSIVE FLUIDO (bloque final, no duplica nada)
   Corrige desbordes laterales y adapta el panel a cualquier ancho
   ============================================================ */

/* 1 · El panel debe medir lo que dice medir (incluye su padding) */
.megamenu-panel,
.megamenu-panel * {
    box-sizing: border-box;
}

/* 2 · Panel: ancho seguro, padding fluido y scroll si no cabe en alto */
.megamenu-panel {
    --mm-pad-x: clamp(16px, 2.2vw, 40px);
    --mm-pad-y: clamp(20px, 2.2vw, 40px);
    --mm-gap:   clamp(20px, 2.6vw, 60px);

    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1500px;
    padding: var(--mm-pad-y) var(--mm-pad-x) 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    overflow-wrap: break-word;
}

/* 3 · Columnas: se reparten y saltan de línea solas, sin breakpoints rígidos */
.megamenu-contenido {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--mm-gap);
}
.megamenu-columna {
    flex: 1 1 230px;
    min-width: 0;
    max-width: 100%;
}

/* 4 · Bloque inferior a sangre, alineado con el padding real del panel */
.megamenu-inferior {
    width: auto;
    margin: var(--mm-pad-y) calc(var(--mm-pad-x) * -1) 0;
    padding: clamp(18px, 1.8vw, 28px) var(--mm-pad-x);
    gap: clamp(18px, 2.4vw, 40px);
    flex-wrap: wrap;
}
.inferior-columna {
    flex: 1 1 230px;
    min-width: 0;
}

/* 5 · Tipografía fluida: nunca desborda ni se pega a los bordes */
.megamenu-titulo      { font-size: clamp(16px, 0.9rem + 0.35vw, 22px); margin-bottom: clamp(14px, 1.4vw, 25px); }
.megamenu-item        { margin-bottom: clamp(12px, 1.2vw, 20px); }
.mm-texto             { font-size: clamp(14px, 0.8rem + 0.25vw, 17px); }
.mm-descripcion       { font-size: clamp(12.5px, 0.72rem + 0.15vw, 14px); }
.inferior-titulo      { font-size: clamp(14px, 0.85rem + 0.2vw, 16px); }
.inferior-descripcion { font-size: clamp(12.5px, 0.72rem + 0.15vw, 14px); }
.megamenu-enlace      { padding-right: clamp(8px, 1vw, 20px); }

/* 6 · Barra principal: etiquetas en una línea y espacios que se adaptan */
.menu-lista  { gap: clamp(12px, 1.5vw, 30px); }
.menu-enlace { font-size: clamp(13.5px, 0.8rem + 0.2vw, 16px); white-space: nowrap; }

/* 7 · En pantallas estrechas el panel se apila (anula el column rígido anterior) */
@media (max-width: 992px) {
    .megamenu-contenido { flex-direction: row; flex-wrap: wrap; }
    .megamenu-columna   { flex: 1 1 100%; }
    .megamenu-inferior  { flex-direction: column; }
    .inferior-columna   { flex: 1 1 100%; }
}

/* 8 · Ajuste fino de cabecera para que el menú no apriete en 992–1400 px */
@media (max-width: 1400px) {
    .header-logo      { margin-right: 20px; }
    .logo-imagen      { width: 125px; }
    .header-acciones  { gap: 16px; }
    .icono-header     { width: 23px; height: 23px; }
}

@media (max-width: 768px) {
    .megamenu-panel { max-height: calc(100vh - 90px); }
}