/* ==========================================================================
   custom-menu.css - Correcciones y Adaptación para Bootstrap 5
   ========================================================================== */

/* ==========================================
   1. CORRECCIÓN ESTRUCTURAL DE CABECERA Y LOGO
   ========================================== */
header.fixed-top {
    width: 100%;
    z-index: 1030;
    background-color: #ffffff !important; /* Garantiza fondo sólido en el encabezado */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Permitir que la barra de Bootstrap administre la distribución del logo y menú */
header .navbar {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Mantiene las dimensiones correctas del logo sin distorsiones */
.navbar-brand img {
    display: inline-block;
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Anula floats residuales que puedan entrar en conflicto con Flexbox */
.desktop-menu, 
.mobile-menu, 
.lang-selector {
    float: none !important;
}


/* ==========================================
   2. CORRECCIÓN DE TEXTO Y COLORES EN HERO SECTION
   ========================================== */
.hero-section,
main section.text-white,
main section.text-white h1,
main section.text-white p,
main section.text-white .lead {
    color: #ffffff !important;
}


/* ==========================================
   3. CORRECCIÓN Y ESTILIZACIÓN DE BOTONES
   ========================================== */
.btn-light,
a.btn-light {
    background-color: #ffffff !important;
    color: #002F67 !important;
    border-radius: 0.5rem !important;
    font-weight: 600;
    border: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.btn-light:hover,
a.btn-light:hover {
    background-color: #e2e8f0 !important;
    color: #002F67 !important;
}


/* ==========================================
   4. MENÚ MÓVIL DESPLEGABLE (DRAWER)
   ========================================== */

/* Garantizar que el botón hamburguesa esté visible sobre el drawer */
#mobile-menu-toggle {
    position: relative;
    z-index: 1050;
}

/* Contenedor principal del Drawer móvil */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: #004981;
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 1040;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Estado activo cuando el JavaScript añade la clase .is-open */
.mobile-menu-drawer.is-open {
    transform: translateX(0);
}

/* Contenido interno del drawer */
.mobile-menu-drawer .nav-drawer-content {
    text-align: center;
    padding: 80px 20px 40px 20px;
    width: 100%;
    max-width: 500px;
    margin: auto 0;
}

.mobile-menu-drawer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-drawer ul li {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    padding: 10px 0;
}

/* Animación escalonada al abrir el menú */
.mobile-menu-drawer.is-open ul li {
    opacity: 1;
    transform: translateY(0);
}

.mobile-menu-drawer.is-open ul li:nth-child(1) { transition-delay: 0.1s; }
.mobile-menu-drawer.is-open ul li:nth-child(2) { transition-delay: 0.2s; }
.mobile-menu-drawer.is-open ul li:nth-child(3) { transition-delay: 0.3s; }
.mobile-menu-drawer.is-open ul li:nth-child(4) { transition-delay: 0.4s; }
.mobile-menu-drawer.is-open ul li:nth-child(5) { transition-delay: 0.5s; }
.mobile-menu-drawer.is-open ul li:nth-child(6) { transition-delay: 0.6s; }

.mobile-menu-drawer ul li a {
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 1.75rem;
    font-weight: 600;
    display: block;
    padding: 8px 0;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent; /* Evita el recuadro gris al presionar en móviles */
}

.mobile-menu-drawer ul li a:hover {
    color: #f4a261 !important;
}

/* Selector de Idioma dentro del Menú Móvil */
.mobile-menu-drawer .language-switcher {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.mobile-menu-drawer .language-switcher a {
    display: inline-block;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 5px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent; /* Quita el cuadro azul/gris nativo de iOS/Android */
}

/* Estado Hover (para cuando se navega con puntero en pantallas intermedias) */
.mobile-menu-drawer .language-switcher a:hover {
    background-color: rgba(244, 162, 97, 0.2);
    border-color: #f4a261;
    color: #ffffff !important;
}

/* Estado ACTIVO (El idioma seleccionado) */
.mobile-menu-drawer .language-switcher a.active,
.mobile-menu-drawer .language-switcher a.active:hover,
.mobile-menu-drawer .language-switcher a.active:focus {
    background-color: #f4a261 !important;
    border-color: #f4a261 !important;
    color: #004981 !important; /* Texto en azul oscuro sobre el naranja para mayor legibilidad y contraste */
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); /* Ligera sombra para darle realce visual */
}

/* Bloqueo del scroll en el cuerpo cuando el menú está abierto */
body.mobile-menu-open {
    overflow: hidden;
}


/* ==========================================
   5. MEDIA QUERIES Y ADAPTACIÓN DE PANTALLA
   ========================================== */

/* Pantallas grandes (Escritorio): Muestra menú normal y oculta el botón móvil */
@media (min-width: 992px) {
    .mobile-menu-drawer,
    #mobile-menu-toggle {
        display: none !important;
    }

    #main-nav-desktop {
        display: flex !important;
    }
}

/* Pantallas pequeñas (Móvil y Tablet): Muestra el botón móvil y oculta la barra de escritorio */
@media (max-width: 991.98px) {
    #main-nav-desktop {
        display: none !important;
    }

    #mobile-menu-toggle {
        display: block !important;
    }
}