/**
 * Mobile Menu Animations and Active States
 */

/* Mobile Menu Toggle Button States */
.mobile-menu-toggle {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
}

.mobile-menu-toggle.active {
    background-color: #0046be !important;
    color: white !important;
}

.mobile-menu-toggle.opening {
    animation: pulse 0.4s ease;
}

.mobile-menu-toggle.closing {
    animation: fadeOut 0.4s ease;
}

/* Mobile Menu Container */
#mobile-menu, #mobileMenu {
    overflow: hidden;
    transition: all 0.4s ease;
}

/* Navigation Active States */
.nav-menu a,
.menu a,
nav a {
    position: relative;
    transition: all 0.3s ease;
}

/* Active page highlighting - WordPress menu classes */
.nav-menu li.current-menu-item > a,
.nav-menu li.current_page_item > a,
.menu li.current-menu-item > a,
.menu li.current_page_item > a,
nav li.current-menu-item > a,
nav li.current_page_item > a {
    background-color: #0046be !important;
    color: white !important;
    font-weight: bold;
}

/* Active state for custom navigation links - only when explicitly set */
nav a.active:not(.menu-item a),
.nav-menu a.active:not(.menu-item a),
.menu a.active:not(.menu-item a),
li.current-menu-item > a.active,
li.current_page_item > a.active {
    background-color: #0046be !important;
    color: white !important;
    font-weight: bold;
}

/* Prevent ancestor highlighting (only highlight direct current page) */
.nav-menu li.current-page-ancestor > a,
.nav-menu li.current-menu-ancestor > a,
.menu li.current-page-ancestor > a,
.menu li.current-menu-ancestor > a,
nav li.current-page-ancestor > a,
nav li.current-menu-ancestor > a {
    background-color: transparent !important;
    color: inherit !important;
}

/* Hover effects for navigation */
.nav-menu a:hover,
.menu a:hover,
nav a:hover {
    background-color: #0046be;
    color: white;
    transform: translateX(5px);
}

/* Mobile menu specific active states */
#mobile-menu .current-menu-item > a,
#mobile-menu .current_page_item > a,
#mobile-menu .current-page-ancestor > a,
#mobile-menu .current-menu-ancestor > a,
#mobileMenu .current-menu-item > a,
#mobileMenu .current_page_item > a,
#mobileMenu .current-page-ancestor > a,
#mobileMenu .current-menu-ancestor > a {
    background-color: #0046be !important;
    color: white !important;
    border-left: 4px solid #fabc20;
    padding-left: 16px !important;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Smooth transitions for all navigation elements */
.nav-menu,
.menu,
nav {
    transition: all 0.3s ease;
}

.nav-menu li,
.menu li,
nav li {
    transition: all 0.3s ease;
}

/* Header specific active states for different header styles */

/* Header 1 & 3 active states */
header nav a.active,
header .nav-menu a.active {
    background-color: #0046be !important;
    color: white !important;
    box-shadow: 0 4px 8px rgba(0, 70, 190, 0.3);
}

/* Header 2 active states */
header .hidden.md\\:flex a.active {
    background-color: #0046be !important;
    color: white !important;
}

/* Ensure active states work with WordPress menu classes */
.menu-item.current-menu-item > a,
.menu-item.current_page_item > a,
.menu-item.current-page-ancestor > a,
.menu-item.current-menu-ancestor > a {
    background-color: #0046be !important;
    color: white !important;
}

/* Mobile menu animation improvements */
#mobile-menu,
#mobileMenu {
    transform-origin: top;
    will-change: height, opacity;
}

/* Dropdown Menu Styles */
.has-dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-top: 8px;
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.has-dropdown:hover > .dropdown-menu,
.has-dropdown.open > .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 2px 8px;
}

.dropdown-menu a:hover {
    background-color: #f3f4f6;
    color: #0046be;
    transform: translateX(5px);
}

.dropdown-menu li.current-menu-item > a,
.dropdown-menu li.current_page_item > a {
    background-color: #0046be;
    color: white;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-arrow,
.has-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Mobile dropdown styles */
@media (max-width: 1024px) {
    #mobile-menu .dropdown-menu,
    #mobileMenu .dropdown-menu {
        position: static;
        box-shadow: none;
        background: #f9fafb;
        margin-left: 20px;
        margin-top: 8px;
        border-left: 3px solid #0046be;
    }
    
    #mobile-menu .has-dropdown > a,
    #mobileMenu .has-dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    #mobile-menu .dropdown-menu a,
    #mobileMenu .dropdown-menu a {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #mobile-menu a,
    #mobileMenu a {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid #f0f0f0;
        transition: all 0.3s ease;
    }
    
    #mobile-menu a:hover,
    #mobileMenu a:hover {
        background-color: #f8f9fa;
        padding-left: 30px;
    }
}
