:root {
    --accent-color: #d01341;
    --offwhite: #ffffff;
    --offblack: #2d4f95;
    --transition: all 0.3s ease;
}

/* ===== HEADER GENERAL ===== */
header {
    font-family: "PP Neue Montreal", sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: #ffffff;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(45, 79, 149, 0.08);
    transition: background-color 0.4s ease, padding 0.3s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

header.scrolled {
    background-color: #2d4f95;
    border-bottom: 1px solid transparent;
    box-shadow: 0 10px 30px rgba(10, 26, 53, 0.15);
}

/* ===== CONTAINER ===== */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header-right-block {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

/* CONTEXTO REFINADO DE IDIOMAS */
.csh-lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: 'Inter', -apple-system, sans-serif;
}

.csh-lang-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #0b1c33;
    cursor: pointer;
    opacity: 0.4;
    position: relative;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.csh-lang-divider {
    width: 1px;
    height: 12px;
    background-color: rgba(11, 28, 51, 0.15);
    display: inline-block;
}

.csh-lang-link:hover {
    opacity: 0.8;
}

.csh-lang-link.active {
    opacity: 1;
    color: #d1173c;
}



/* ===== LOGO ===== */
.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 42px;
    width: auto;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}

header.scrolled .logo img {
    filter: brightness(0) invert(1);
}

/* ===== NAV LINKS GENERAL ===== */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.8rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative;
    /* Base de anclaje para los submenús absolutos */
}

.nav-links a {
    font-size: 10px;
    color: #000000;
    line-height: 1.5;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    padding: 20px 0;
    /* Un padding vertical generoso mantiene el hover activo sin que se corte */
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.3s ease;
}

.nav-links>li>a::after {
    content: "";
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links>li:hover>a::after {
    width: 100%;
}

header.scrolled .nav-links>li>a {
    color: rgba(255, 255, 255, 0.85);
}

header.scrolled .nav-links>li:hover>a {
    color: var(--offwhite);
}

/* Indicadores de Flechas */
.submenu-arrow,
.subsubmenu-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

/* ===== NIVELES DE DESPLIEGUE (DESKTOP) ===== */
@media (min-width: 1025px) {

    /* SUBMENÚ NIVEL 2 */
    .submenu {
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #ffffff;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
        list-style: none;
        padding: 10px 0;
        margin: 0;
        min-width: 200px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        border-radius: 4px;
        border-top: 2px solid var(--accent-color);
        z-index: 120;
    }

    /* SUB-SUBMENÚ NIVEL 3 */
    .subsubmenu {
        position: absolute;
        top: 0;
        left: 100%;
        /* Se abre hacia el lado derecho */
        background-color: #ffffff;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
        list-style: none;
        padding: 10px 0;
        margin: 0;
        min-width: 180px;
        opacity: 0;
        visibility: hidden;
        transform: translateX(10px);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        border-radius: 4px;
        border-left: 2px solid #2d4f95;
    }

    /* Acciones Hover (Mostrar) */
    .has-submenu:hover>.submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .has-subsubmenu:hover>.subsubmenu {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    /* Estilos de enlaces dentro de los submenús */
    .submenu a,
    .subsubmenu a {
        color: #1e3e7a !important;
        padding: 10px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 10px;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        font-weight: 500;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .submenu a::after,
    .subsubmenu a::after {
        display: none !important;
    }

    /* Quitamos línea roja */

    .submenu li:hover>a,
    .subsubmenu li:hover>a {
        background-color: rgba(45, 79, 149, 0.05);
        color: var(--accent-color) !important;
    }

    /* Cambios visuales si el Header ya tiene Scroll en Desktop */
    header.scrolled .submenu,
    header.scrolled .subsubmenu {
        background-color: #1e3e7a;
    }

    header.scrolled .submenu a,
    header.scrolled .subsubmenu a {
        color: rgba(255, 255, 255, 0.9) !important;
    }

    header.scrolled .submenu li:hover>a,
    header.scrolled .subsubmenu li:hover>a {
        background-color: rgba(255, 255, 255, 0.08);
        color: #ffffff !important;
    }
}

/* --- Redes sociales --- */
.header-socials {
    display: flex;
    gap: 25px;
    align-items: center;
}

.header-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    color: #141e37;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.header-socials a:hover {
    background: rgba(45, 79, 149, 0.05);
    color: #d01341;
    transform: translateY(-3px);
}

header.scrolled .header-socials a {
    color: rgba(255, 255, 255, 0.9);
}

header.scrolled .header-socials a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

.mobile-only-li {
    display: none;
}

/* ===== HAMBURGER MENU ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 110;
    padding: 0;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #2d4f95;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

header.scrolled .menu-toggle span {
    background: #ffffff;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(6px) translateX(5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px) translateX(5px);
}

/* ===== RESPONSIVE (MÓVIL Y TABLET) ===== */
@media (max-width: 1024px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: flex;
    }

    .mobile-only-li {
        display: block;
        width: 100%;
        text-align: center;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 300px;
        background-color: #0b1a30;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0;
        padding: 80px 2rem 40px 2rem;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        /* Permite scroll si la lista multinivel supera la pantalla */
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links li {
        width: 100%;
        position: relative;
    }

    .nav-links a {
        color: rgba(255, 255, 255, 0.8) !important;
        font-size: 0.85rem;
        padding: 12px 0;
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .nav-links a:hover {
        color: #ffffff !important;
    }

    .nav-links a::after {
        display: none !important;
    }

    /* Estructuración limpia en bloque para Móviles (Acordeón por css o lista abierta) */
    .submenu,
    .subsubmenu {
        list-style: none;
        padding-left: 15px;
        margin: 0;
        display: block;
        /* En móviles se muestran alineados debajo de sus padres */
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }

    .submenu a {
        color: rgba(255, 255, 255, 0.65) !important;
        font-size: 0.8rem;
    }

    .subsubmenu a {
        color: rgba(255, 255, 255, 0.5) !important;
        font-size: 0.75rem;
    }

    .submenu-arrow,
    .subsubmenu-arrow {
        transform: rotate(90deg);
        /* Apunta abajo en móviles indicando apertura */
    }

    .nav-links .header-socials a {
        color: rgba(255, 255, 255, 0.8) !important;
        justify-content: center;
    }

    .nav-links .header-socials a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff !important;
    }
}

@media (max-width: 600px) {
    header {
        padding: 0.9rem 0;
    }

    .header-container {
        padding: 0 1.2rem;
    }

    .logo img {
        height: 35px;
    }

    .nav-links {
        width: 100%;
    }
}