/* Reseteo básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* MODIFICACIÓN AQUÍ: Barra de navegación Sticky */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgb(30 58 138 / var(--tw-bg-opacity, 1));
    color: white;
    padding: 15px 20px;
    
    /* Cambiamos 'relative' por 'sticky' */
    position: sticky; 
    top: 0;           /* Se pega al borde superior */
    
    height: 70px;
    z-index: 1000;    /* Aumentamos el z-index para asegurar que nada pase por encima */
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Estilos de los enlaces en versión escritorio */
.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    position: relative;
}

.nav-links li a {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    transition: background 0.3s;
}

.nav-links li a:hover {
    background-color: #0083cb;
    border-radius: 5px;
}

/* --- ESTILOS DEL SUBMENÚ BASE --- */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #0083cb;
    list-style: none;
    min-width: 200px;
    border-radius: 0 0 5px 5px;
    border: 1px solid #0083cb; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 101;
    
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.dropdown-menu li a {
    padding: 12px 15px;
    border-radius: 0;
}

.dropdown-menu li a:hover {
    background-color: rgb(30 58 138 / var(--tw-bg-opacity, 1));
    border: 1px solid #0083cb;
}

/* --- ESTADO ACTIVO PARA PC --- */
@media (min-width: 769px) {
    .nav-links li.dropdown:hover .dropdown-menu {
        max-height: 500px;
        opacity: 1;
        visibility: visible;
    }
}

/* Botón hamburguesa */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 25px;
    height: 20px;
    position: relative;
}

.menu-toggle .bar {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

/* --- ESTILOS PARA CELULARES --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        font-weight: 300;
        display: flex;
        flex-direction: column;
        width: 100%;
        background-color: rgb(30 58 138 / var(--tw-bg-opacity, 1));
        position: absolute;
        top: 70px;
        left: 0;
        z-index: 99;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease-in-out;
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Ajuste para que el menú móvil también sea fijo si la navbar lo es */
    .nav-links {
        position: fixed; 
    }

    .nav-links > li {
        text-align: center;
        width: 100%;
    }

    .nav-links > li > a {
        font-weight: 600;
        padding: 20px;
        width: 100%;
    }

    .dropdown-menu {
        position: static;
        background-color: rgb(30 58 138 / var(--tw-bg-opacity, 1));
        box-shadow: none;
        width: 100%;
    }

    .nav-links li.dropdown.active .dropdown-menu {
        max-height: 500px;
        opacity: 1;
        visibility: visible;
    }

    /* Animación X de la hamburguesa */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8.5px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8.5px) rotate(-45deg);
    }
}