/* ----------------------------- */
/* Header                        */
/* ----------------------------- */

/* Desplazamiento suave */
html {scroll-behavior: smooth;}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10%;
    background-color: #252d5c;
    color: white;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

header .logo img {height: 24px;}

/* Header con menú activo */
header nav ul li a.active {color: #00b4ff;}

/* Botón de menú hamburguesa */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #00b4ff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

/* Contenedor del menú y redes sociales */
.menu-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Menú centrado en desktop */
header nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 0;
}

header nav ul li {
    margin-bottom: 0px;
    font-family: 'Ubuntu', sans-serif;
}

header nav ul li a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    padding: 13px 20px;
    display: block;
    height: 100%;
}

header nav ul li a:hover {
    color: #ffffff;
    background-color: #3c5082;
}

/* Íconos sociales a la derecha */
header .social-icons {
    margin-left: auto;
}

header .social-icons a {
    color: #00b4ff;
    margin: 0 0 0 10px;
    font-size: 18px;
    transition: color 0.3s ease;
}

header .social-icons a:hover {
    color: #ffffff;
}

/* Submenús */
.has-submenu {
    position: relative;
}

.has-submenu > a::after {
    content: " ▼";
    font-size: 0.6em;
}

.submenu {
    display: none;
    position: absolute;
    background-color: #252d5c;
    padding: 0;
    border-radius: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 1000;
    top: 100%;
    left: 0;
    min-width: 220px;
    flex-direction: column;
}

.submenu li {
    margin: 0 0;
}

.submenu a {
    padding: 8px 15px;
    display: block;
    border-radius: 3px;
    color: #00b4ff !important;
}

.submenu a:hover {
    background-color: rgba(61, 80, 131, 0.2);
    color: #ffffff !important;
}

.has-submenu:hover .submenu {
    display: flex;
}

/* Mobile: Menú vertical */
@media (max-width: 767px) {
    header {
        padding: 10px 5%;
    }

    .menu-toggle {
        display: block !important;
        z-index: 1001;
    }

    .menu-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background-color: #252d5c;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        transform: translateX(-100%) translateZ(0);
        transition: transform 0.3s ease;
        z-index: 1000;
        padding: 80px 20px 40px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        will-change: transform;
        backface-visibility: hidden;
        perspective: 1000px;
    }

    .menu-container.active {
        transform: translateX(0) translateZ(0);
    }

    header nav {
        position: static;
        transform: none;
        width: 100%;
        padding: 0 20px;
    }

    .main-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
        text-align: left;
    }

    .main-menu > li {
        width: 100%;
        padding: 0;
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .main-menu > li a {
        padding: 15px 20px;
        font-size: 16px;
        text-align: left;
        width: 100%;
        display: block;
        position: relative;
        cursor: pointer;
    }

    /* Ítems padre */
    .has-submenu > a {
        font-weight: 700;
        color: #ffffff !important;
        background-color: #252d5c;
        user-select: none;
    }

    /* Submenús */
    .submenu {
        display: none;
        width: 100%;
        background-color: rgba(60, 80, 130, 0.8);
        padding: 0 10px;
        position: static;
        box-shadow: none;
        border-radius: 0;
        margin: 0 0;
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.3s ease;
    }

    .submenu.active {
        display: block;
        max-height: 1000px;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Ítems hijos */
    .submenu li a {
        font-weight: 500;
        font-size: 15px;
        color: #ffffff !important;
        padding: 12px 20px 12px 30px !important;
        background-color: transparent;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .submenu li:last-child a {
        border-bottom: none;
    }

    .submenu li a:hover {
        background-color: rgba(0, 180, 255, 0.2) !important;
    }

    /* Indicador de submenú */
    .has-submenu > a::after {
        content: "▶";
        position: absolute;
        right: 20px;
        font-size: 18px;
        transition: transform 0.3s ease;
    }

    .has-submenu > a.active::after {
        content: "▼";
    }

    .social-icons {
        padding: 20px;
        margin-top: 30px;
        width: 100%;
        text-align: left;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .social-icons a {
        font-size: 20px;
        margin: 0 15px 0 0;
        color: #00b4ff !important;
    }

    body.no-scroll {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
    }
}