/* ==========================================================================
   1. CONTROL DE VISIBILIDAD (Ocultar elementos antiguos de la derecha)
   ========================================================================== */
.offcanvas-toggler,
.burger-icon,
#sp-menu .burger-icon,
#sp-menu .sp-modules,
#sp-menu i.fa-bars,
#sp-menu .search-trigger {
    display: none !important; 
}

/* ==========================================================================
   2. LA BARRA TURQUESA (Contenedor Base)
   ========================================================================== */
#sp-main-menu {
    background: #00a2c5 !important;
    border-radius: 30px !important;  
    margin: -2px auto 10px auto !important; 
    padding: 0 25px !important;      
    max-width: 1200px !important;    
    width: 95% !important;
    height: 50px !important;         
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    
    display: flex !important;
    align-items: center !important;  
}

/* ¡AQUÍ ESTÁ EL TRUCO! Rompemos todos los límites de ancho que impone Helix */
#sp-menu, 
.sp-menu-inner,
#sp-menu .container,
#sp-menu .row,
#sp-menu .col-md-9, 
#sp-menu .col-lg-9, /* Añadido por seguridad para pantallas grandes */
#sp-menu .sp-column,
#sp-menu .sp-megamenu-wrapper {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;        /* Forzamos ancho completo */
    max-width: 100% !important;    /* Evitamos que Bootstrap lo achique */
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;     /* Obliga a expandirse */
    padding: 0 !important;
    margin: 0 !important;
}

/* La lista UL ahora sí va a dominar todo el ancho disponible */
ul.sp-megamenu-parent {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;        /* Ocupa el 100% de la barra turquesa */
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* ==========================================================================
   3. TEXTOS DEL MENÚ, DIVISORES Y EFECTO HOVER
   ========================================================================== */
ul.sp-megamenu-parent > li {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    border-right: 1px solid rgba(255, 255, 255, 0.3) !important; 
    padding: 0 !important;
    margin: 0 !important;
    position: relative; 
}

ul.sp-megamenu-parent > li > a {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    text-transform: uppercase;
    padding: 0 18px !important;    
    line-height: 50px !important;   
    display: block !important;
    height: 100% !important;
    transition: color 0.2s ease !important; /* Cambio de color rápido y limpio */
}

/* EFECTO HOVER: Texto cambia a verde limón */
ul.sp-megamenu-parent > li:not(.boton-contacto):hover > a {
    color: #b2cc33 !important; 
}

/* ==========================================================================
   4. SEPARACIÓN IMPERATIVA A LA DERECHA (Ahora sí tiene espacio)
   ========================================================================== */

/* Buscamos el ítem "Validación de Certificados" y lo mandamos a la derecha */
ul.sp-megamenu-parent > li:nth-last-child(2) {
    margin-left: auto !important;  /* Ahora que el UL mide 100%, esto lo mandará al fondo */
    border-right: none !important; 
}

ul.sp-megamenu-parent > li:last-child {
    border-right: none !important; 
}

/* ==========================================================================
   5. EL BOTÓN "CONTÁCTANOS" (Verde Limón Ovalado)
   ========================================================================== */
ul.sp-megamenu-parent > li.boton-contacto,
ul.sp-megamenu-parent > li:last-child { /* Por si acaso no se guardó la clase en Joomla */
    border-right: none !important;
    display: flex !important;
    align-items: center !important;
}

ul.sp-megamenu-parent > li:last-child > a {
    background: #b2cc33 !important; 
    color: #222222 !important;       
    border-radius: 25px !important;  
    padding: 0 20px !important;    
    height: 34px !important;         
    line-height: 34px !important;    
    margin-left: 15px !important;    
    font-weight: 700 !important;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1) !important;
    display: inline-block !important;
    transition: all 0.3s ease !important;
}

ul.sp-megamenu-parent > li:last-child > a:hover {
    background: #9fb82b !important; 
    color: #000000 !important;
    transform: translateY(-1px); 
    box-shadow: 0 5px 8px rgba(0,0,0,0.15) !important;
}

/* ==========================================================================
   6. EFECTO DE DESPLAZAMIENTO SUAVE PARA LOS DESPLEGABLES (Flechas)
   ========================================================================== */
ul.sp-megamenu-parent .sp-dropdown {
    opacity: 0 !important;
    visibility: hidden !important;
    display: block !important; 
    transform: translateY(12px) !important; /* Desfase inicial hacia abajo */
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease !important;
    pointer-events: none;
}

ul.sp-megamenu-parent > li:hover .sp-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important; /* Desplazamiento hacia arriba suave */
    pointer-events: auto;
}

/* ==========================================================================
   7. OPTIMIZACIÓN RESPONSIVE
   ========================================================================== */
@media (max-width: 1199px) {
    ul.sp-megamenu-parent > li > a {
        font-size: 11px !important; 
        padding: 0 10px !important;  
    }
    ul.sp-megamenu-parent > li:last-child > a {
        padding: 0 14px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 991px) {
    .offcanvas-toggler,
    #sp-menu .burger-icon,
    #sp-menu i.fa-bars {
        display: block !important;
        color: #ffffff !important;
        font-size: 22px !important;
        cursor: pointer;
    }
    
    ul.sp-megamenu-parent {
        display: none !important;
    }
    
    #sp-main-menu {
        justify-content: flex-end !important; 
        padding: 0 20px !important;
    }
}