/* ==========================================================================
   1. HEADER & TOP BAR
   ========================================================================== */

/* Top Bar (Barra azul oscuro superior) */
.ast-above-header-bar {
    background-color: #002855 !important;
    color: #ffffff !important;
    font-size: 11px;
    letter-spacing: 0.05em;
}

/* Menú Principal (Astra Header Menu) */
#ast-hf-menu-1 {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

#ast-hf-menu-1 .menu-item:not(:last-child) {
    border-right: 1px solid #00225B;
    height: 20px;
    margin-top: auto;
    margin-bottom: auto;
    display: flex;
    align-items: center;
}

#ast-hf-menu-1 .menu-item .menu-link {
    padding-right: 15px !important;
    padding-left: 15px;
    display: flex;
    align-items: center;
}

#ast-hf-menu-1 li:first-child {
    justify-content: flex-start;
}

#ast-hf-menu-1 li:first-child a {
    padding-left: 0 !important;
}

/* Header Transparente Background */
.ast-theme-transparent-header .main-header-bar,
.ast-theme-transparent-header.ast-header-break-point .main-header-bar {
    background: #eaf8fb;
}

/* ==========================================================================
   2. SEARCH BAR (Astra Overrides)
   ========================================================================== */
@media (min-width: 782px) {
    .ast-theme-transparent-header #masthead {
        position: relative !important;
    }

    .site-header-primary-section-center.site-header-section {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        height: 100% !important;
        min-height: 80px !important;
    }

    .ast-header-search.ast-builder-layout-element {
        display: flex !important;
        position: relative !important;
        width: 641px !important;
        height: 47px !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        margin: 0 auto !important;
    }

    .ast-header-search .ast-search-menu-icon.slide-search .search-form {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        width: 100% !important;
        height: 47px !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        border: none !important;
    }
    .ast-theme-transparent-header .main-header-bar,.ast-theme-transparent-header.ast-header-break-point .main-header-bar {
        background:#eaf8fb;
    }
    .ast-header-search .ast-search-menu-icon.slide-search .search-form label {
        display: flex !important;
        width: 100% !important;
        height: 47px !important;
        margin: 0 !important;
    }

    .ast-header-search .search-form .search-field {
        flex: 1 !important;
        height: 47px !important;
        width: 641px !important;
        border: 1px solid #002855 !important;
        border-radius: 8px 0 0 8px !important;
        padding: 0 20px !important;
        background-color: #ffffff !important;
        margin: 0 !important;
    }

    .ast-header-search .search-form .search-submit {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 47px !important;
        width: 65px !important;
        background-color: #002855 !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 0 8px 8px 0 !important;
        margin: 0 !important;
        padding: 0 !important;    
        border: none !important;
    }

    .ast-header-search .search-submit .ast-icon svg {
        fill: #ffffff !important;
        width: 20px !important;
        height: 20px !important;
    }

    .ast-search-icon, 
    .ast-header-search .ast-search-menu-icon > a {
        display: none !important;
    }
}
/* ==========================================================================
   3. MEGA MENU
   ========================================================================== */

.mega-menu-content {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 154px;
    width: 70%;
    background: #ffffff;
    z-index: 99999;
    padding: 25px;
}

.mega-menu-content.is-active {
    display: block;
    animation: fadeInDown 0.3s ease-out;
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.mega-menu-col h3 {
    color: #0072CE;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: normal;
}

.mega-menu-col h3.highlight-blue {
    color: #00225B;
}

/* Estilos para enlaces de categorías padre */
.mega-menu-col h3 a {
    color: inherit;
    text-decoration: none !important;
    display: block;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}


.mega-menu-col ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
}

.mega-menu-col ul li a {
    text-decoration: none !important;
    color: #666;
    font-size: 14px;
    display: block;
    padding: 4px 12px;
    transition: color 0.2s;
}


/* Botón "Ver más" que despliega categorías hijas */
.mega-menu-ver-mas-li {
    list-style: none !important;
    margin-top: 4px;
}

.mega-menu-ver-mas-btn {
    background: none;
    border: none;
    padding: 4px 12px;
    font-size: 14px;
    color: #0056b3;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: color 0.2s;
}


/* Bloque de categorías hijas adicionales (colapsado por defecto) */
.mega-menu-more-children.is-collapsed {
    display: none;
}

.mega-menu-more-children ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

.mega-menu-more-children ul li a {
    text-decoration: none !important;
    color: #666;
    font-size: 14px;
    display: block;
    padding: 4px 12px;
    transition: color 0.2s;
}

/* Estilos para el botón trigger */
.boton-catalogo-trigger {
    cursor: pointer;
    transition: filter 0.3s ease;
}

/* Animación de entrada */
@keyframes fadeInDown {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   4. MEGA MENU - RESPONSIVE
   ========================================================================== */

/* Tablets grandes (hasta 1200px) */
@media (max-width: 1200px) {
    .mega-menu-content {
        width: 85%;
        padding: 20px;
    }
    
    .mega-menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}

/* Tablets (hasta 992px) */
@media (max-width: 992px) {
    .mega-menu-content {
        width: 90%;
        top: 140px;
    }
    
    .mega-menu-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .mega-menu-col h3 {
        font-size: 15px;
        padding: 6px 10px;
    }
    
    .mega-menu-col ul li a {
        font-size: 13px;
        padding: 3px 10px;
    }
}

/* Móviles grandes (hasta 768px) */
@media (max-width: 768px) {
    .mega-menu-content {
        width: 95%;
        padding: 15px;
        top: 120px;
    }
    
    .mega-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .mega-menu-col h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
}

/* Móviles pequeños (hasta 576px) */
@media (max-width: 576px) {
    .mega-menu-content {
        width: 100%;
        left: 0;
        transform: none;
        border-radius: 0;
        padding: 12px;
        top: 110px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    
    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .mega-menu-col {
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 10px;
    }
    
    .mega-menu-col:last-child {
        border-bottom: none;
    }
    
    @keyframes fadeInDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }
}