/* --- HEADER PRINCIPAL --- */
.main-header {
    height: 100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
}

.main-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 180px; 
    background: linear-gradient(180deg, 
        rgba(246, 0, 0, 1) 0%, 
        rgba(246, 0, 0, 0.7) 30%, 
        rgba(246, 0, 0, 0.3) 60%,   
        rgba(246, 0, 0, 0) 100%); 
    z-index: -1;
    pointer-events: none;
}

/* Logo */
.logo-container {
    flex: 0 0 auto;
    z-index: 10;
}

.logo-container img {
    height: 75px;
    width: auto;
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.2));
}

/* MENÚ CENTRADO */
.nav-principal {
    flex: 1;
    display: flex;
    justify-content: center; /* Centrado perfecto */
    z-index: 10;
}

.nav-principal ul {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.nav-principal a {
    color: #FFFFFF !important;
    text-decoration: none !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    text-transform: none !important; /* Mantiene "Inicio", "El Movimiento", etc. */
    padding-bottom: 8px;
    position: relative;
    transition: 0.3s ease;
}

/* LÍNEA AZUL RESTAURADA */
.nav-principal a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: #004C9E; /* Azul oficial */
    transition: width 0.3s ease;
}

.nav-principal a.active::after, 
.nav-principal a:hover::after {
    width: 100%; /* Expansión natural */
}

/* --- HEADER PRINCIPAL --- */
.main-header {
    height: 100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 9999; /* Máxima prioridad para que nada lo tape al bajar */
    background: transparent;
}

/* El degradado rojo de fondo */
.main-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 180px; 
    background: linear-gradient(180deg, 
        rgba(246, 0, 0, 1) 0%, 
        rgba(246, 0, 0, 0.7) 30%, 
        rgba(246, 0, 0, 0.3) 60%,   
        rgba(246, 0, 0, 0) 100%); 
    z-index: -1;
    pointer-events: none;
}

/* Logo */
.logo-container {
    flex: 0 0 auto;
    z-index: 10001; /* Por encima del degradado */
}

.logo-container img {
    height: 75px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Navegación Escritorio */
.nav-principal ul {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.nav-principal a {
    text-decoration: none;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 1.1rem;
    transition: 0.3s;
    text-transform: uppercase;
}

.nav-principal a:hover,
.nav-principal a.active {
    color: #FFD700; /* Dorado para resaltar */
}

/* --- RESPONSIVE HEADER LOGIC --- */

/* Escondemos el botón en computadoras */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 10002; /* Siempre por encima del header y la cortina */
    position: relative; /* Indispensable para que el z-index funcione */
}

.menu-toggle span {
    display: block;
    width: 30px;
    height: 3px;
    background-color: #FFFFFF !important; /* Forzado para el dominio */
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

/* MEDIA QUERY PARA TABLETS Y MÓVILES */
@media (max-width: 1024px) {
    .main-header {
        height: 80px;
        padding: 0 5%;
    }

    /* Mostramos el botón */
    .menu-toggle {
        display: flex !important;
    }

    /* Animación de Hamburguesa a X */
    .menu-toggle.is-active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .menu-toggle.is-active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.is-active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Convertimos el NAV en un menú lateral */
    .nav-principal {
        position: fixed;
        top: 0;
        right: -100%; /* Escondido a la derecha */
        width: 80%; 
        height: 100vh;
        background-color: #F60000; /* Rojo sólido oficial */
        z-index: 10001; /* Justo debajo del botón pero encima de la página */
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    }

    /* Clase que activa el JS */
    .nav-principal.active {
        right: 0;
    }

    .nav-principal ul {
        flex-direction: column;
        gap: 25px;
        align-items: center;
        width: 100%;
    }

    .nav-principal a {
        font-size: 1.4rem !important;
        padding: 10px 0;
        display: block;
        color: white !important;
    }

    /* Ajuste de logo en móvil */
    .logo-container img {
        height: 55px;
    }
}

/* Ajuste para teléfonos muy pequeños */
@media (max-width: 480px) {
    .nav-principal {
        width: 100%;
    }
}