/* ============================================
   MENÚ PRINCIPAL - VEÏNS PER CUBELLES
   ============================================ */

.vxc-nav {
    --vxc-color: #557799;
    --vxc-hover: #405d78;
    --vxc-text: #ffffff;

    position: relative;
    z-index: 1000;
    background: var(--vxc-color);
    font-family: inherit;
}

/* Menú horizontal */

.vxc-menu,
.vxc-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.vxc-menu {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.vxc-menu > li,
.vxc-submenu > li {
    margin: 0;
    padding: 0;
}

.vxc-menu > li {
    position: relative;
    flex: 1;
}

/* Enlaces y botones principales */

.vxc-menu > li > a,
.vxc-dropdown-toggle,
.vxc-lang-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 14px;

    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--vxc-text);

    font: inherit;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;

    transition: background-color .2s;
}

.vxc-menu > li > a:hover,
.vxc-dropdown-toggle:hover,
.vxc-lang-toggle:hover,
.vxc-dropdown.vxc-open > .vxc-dropdown-toggle,
.vxc-language.vxc-open > .vxc-lang-toggle {
    background: var(--vxc-hover);
    color: #ffffff;
}

/* Indicador de desplegable */

.vxc-chevron {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -4px;
    transition: transform .2s;
}

.vxc-open > button .vxc-chevron {
    transform: rotate(225deg);
    margin-top: 4px;
}

/* Desplegables */

.vxc-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 205px;

    background: #ffffff;
    border: 1px solid #e0e5ea;
    border-radius: 0 0 7px 7px;
    box-shadow: 0 5px 14px rgba(0,0,0,.15);

    overflow: hidden;
    z-index: 1100;
}

.vxc-open > .vxc-submenu {
    display: block;
}

.vxc-submenu li a {
    display: block;
    padding: 11px 16px;

    color: #34495e;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;

    transition: background-color .15s;
}

.vxc-submenu li a:hover {
    background: #edf3f8;
    color: #203d56;
}

/* Selector de idiomas */

.vxc-current-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
}

.vxc-language > .vxc-submenu {
    left: auto;
    right: 0;
}

/* Accesibilidad */

.vxc-nav a:focus-visible,
.vxc-nav button:focus-visible {
    outline: 2px solid #ffdc70;
    outline-offset: -3px;
}

/* Ocultos en escritorio */

.vxc-burger,
.vxc-mobile-join {
    display: none;
}

/* ============================================
   MÓVILES Y TABLETS
   ============================================ */

@media (max-width: 950px) {

    .vxc-nav {
        --vxc-mobile-height: 44px;

        position: sticky;
        top: 0;
        z-index: 9999;
        display: grid;
        grid-template-columns: var(--vxc-mobile-height) minmax(0, 1fr) var(--vxc-mobile-height);
        align-items: center;
        min-height: var(--vxc-mobile-height);
    }

    /* Botón hamburguesa */

    .vxc-burger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;

        box-sizing: border-box;
        width: var(--vxc-mobile-height);
        height: var(--vxc-mobile-height);
        padding: 0;
        margin: 0;

        background: transparent;
        border: 0;
        cursor: pointer;
    }

    .vxc-burger span {
        display: block;
        width: 25px;
        height: 3px;
        background: #ffffff;
        border-radius: 2px;
        transition: transform .2s, opacity .2s;
    }

    .vxc-burger.vxc-active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .vxc-burger.vxc-active span:nth-child(2) {
        opacity: 0;
    }

    .vxc-burger.vxc-active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Enlace destacado */

    .vxc-mobile-join {
        display: block;
        padding: 6px 4px;
        line-height: 1.3;
        color: white;
        font-size: 14px;
        text-align: center;
        text-decoration: none;
        font-weight: 600;
    }

    /* Menú móvil */

    .vxc-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--vxc-color);
        box-shadow: 0 5px 14px rgba(0,0,0,.15);
        flex-direction: column;
        max-height: calc(100dvh - var(--vxc-mobile-height));
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .vxc-menu.vxc-visible {
        display: flex;
    }

    .vxc-menu > li {
        flex: none;
        border-top: 1px solid rgba(255,255,255,.15);
    }

    .vxc-menu > li > a,
    .vxc-dropdown-toggle,
    .vxc-lang-toggle {
        justify-content: space-between;
        min-height: 40px;
        height: auto;
        padding: 8px 12px;
        text-align: left;
    }

    /* Submenús en formato acordeón */

    .vxc-submenu {
        position: static;
        min-width: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .vxc-submenu li a {
        padding: 8px 20px;
        white-space: normal;
        border-bottom: 1px solid #edf0f3;
    }

}

@media (prefers-reduced-motion: reduce) {
    .vxc-nav *,
    .vxc-nav *::before,
    .vxc-nav *::after {
        transition: none !important;
    }
}
