/**
 * Fix for dropdown remaining visible on active/current page
 * Prevents dropdowns from staying open when on a page in the dropdown
 */

/* Hide dropdowns even when parent has active/current class */
.sp-megamenu-parent > li.active > .sp-dropdown,
.sp-megamenu-parent > li.current > .sp-dropdown,
.sp-megamenu-parent > li.current-menu-item > .sp-dropdown,
.sp-megamenu-parent > li.current_page_item > .sp-dropdown,
.sp-megamenu-parent > li.selected > .sp-dropdown {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Only show dropdown on actual hover, not just active state */
.sp-megamenu-parent > li.active:hover > .sp-dropdown,
.sp-megamenu-parent > li.current:hover > .sp-dropdown,
.sp-megamenu-parent > li.current-menu-item:hover > .sp-dropdown,
.sp-megamenu-parent > li.current_page_item:hover > .sp-dropdown,
.sp-megamenu-parent > li.selected:hover > .sp-dropdown {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Remove any active styling that forces dropdown to show */
.sp-megamenu-parent > li.active .sp-dropdown,
.sp-megamenu-parent > li.current .sp-dropdown {
    position: absolute !important;
    display: none !important;
}

/* Style the active parent menu item without showing dropdown */
.sp-megamenu-parent > li.active > a,
.sp-megamenu-parent > li.current > a {
    color: #337ab7 !important; /* Or your active color */
    background-color: transparent !important;
}

/* Style active item within dropdown (when visible on hover) */
.sp-dropdown li.active > a,
.sp-dropdown li.current > a,
.sp-dropdown li.current-menu-item > a {
    background-color: #f5f5f5 !important;
    color: #337ab7 !important;
    font-weight: 600 !important;
}

/* Override any theme rules that show dropdown on active */
.sp-has-child.active > .sp-dropdown,
.sp-has-child.current > .sp-dropdown {
    display: none !important;
}

/* Ensure hover still works properly */
.sp-megamenu-parent > li:hover > .sp-dropdown {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Remove blue background from active dropdown items */
.sp-dropdown .active > a,
.sp-dropdown .current > a {
    background-color: #f8f8f8 !important; /* Subtle highlight instead of blue */
    color: #333 !important;
}

/* Hover state should override active state */
.sp-dropdown .active > a:hover,
.sp-dropdown .current > a:hover {
    background-color: #f5f5f5 !important;
    color: #000 !important;
}