/* ===========================================
   Navigation Styles
   =========================================== */

/* Main Navigation */
.main-navigation {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

/* Primary Menu */
.primary-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-grow: 1;
}

.primary-menu > li {
    position: relative;
    margin: 0 15px;
}

.primary-menu > li > a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 0;
    position: relative;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.primary-menu > li > a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #ffffff;
    transition: width 0.3s ease;
}

.primary-menu > li > a:hover,
.primary-menu > li.current-menu-item > a {
    color: #ffffff;
    opacity: 0.9;
}

.primary-menu > li > a:hover:after,
.primary-menu > li.current-menu-item > a:after {
    width: 100%;
}

/* Desktop: Add chevron for menu items with submenus */
@media (min-width: 992px) {
    .primary-menu > li.menu-item-has-children > a {
        padding-right: 25px !important;
    }
    
    .primary-menu > li.menu-item-has-children > a::after {
        content: '';
        position: absolute;
        right: 8px;
        top: 50%;
        width: 6px;
        height: 6px;
        border-right: 2px solid #ffffff;
        border-bottom: 2px solid #ffffff;
        transform: translateY(-50%) rotate(45deg);
        transition: transform 0.3s ease;
        display: block !important;
        background: none !important;
        border-left: none !important;
        opacity: 1 !important;
    }
    
    .primary-menu > li.menu-item-has-children:hover > a::after {
        transform: translateY(-30%) rotate(-135deg);
    }
    
    /* Hide any other pseudo-elements that might interfere */
    .primary-menu > li.menu-item-has-children > a::before {
        display: none !important;
    }
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 1002;
    color: #ffffff;
    align-items: center;
    gap: 10px;
    margin-left: auto !important;
}

.menu-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
}

.bar {
    width: 100%;
    height: 2px;
    background-color: #fff;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Animation when menu is active */
.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.menu-text {
    margin-left: 10px;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dropdown Menu Styles */
.primary-menu .sub-menu,
.primary-menu .children,
footer .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1001;
    border-radius: 4px;
    padding: 10px 0;
    margin: 0;
    list-style: none;
}

/* Show dropdown on hover */
.primary-menu > li:hover > .sub-menu,
.primary-menu > li:hover > .children,
.primary-menu > li.focus > .sub-menu,
.primary-menu > li.focus > .children,
.primary-menu > li > .sub-menu.show,
.primary-menu > li > .children.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

/* Dropdown items */
.primary-menu .sub-menu li,
.primary-menu .children li {
    position: relative;
    margin: 0;
}

.primary-menu .sub-menu a,
.primary-menu .children a {
    display: block;
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.primary-menu .sub-menu a:hover,
.primary-menu .children a:hover {
    background: #0f5bff;
    color: #fff;
    padding-left: 25px;
}

/* Nested dropdowns */
.primary-menu .sub-menu .sub-menu,
.primary-menu .children .children {
    left: 100%;
    top: 0;
    margin-left: 0;
    min-width: 240px;
}

/* Dropdown indicators - More specific selector to avoid conflicts */
.primary-menu > li.menu-item-has-children > a::after {
    display: inline-block !important;
    transition: transform 0.3s ease !important;
    /* Reset any conflicting styles from header.css */
    position: absolute !important;
    background: none !important;
    opacity: 1 !important;
    left: auto !important;
    bottom: auto !important;
    border-left: 1px solid #cdcdcd;
    width: 6px;
}

/* Nested dropdown indicators - More specific selector */
.primary-menu .sub-menu .menu-item-has-children > a::after {
    content: '\f054' !important; /* Chevron right icon */
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900 !important;
    position: absolute !important;
    right: 15px !important;

    transform: translateY(-50%) !important;
    font-size: 0.7em !important;
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    /* Reset any conflicting styles from header.css */
    width: auto !important;
    height: auto !important;
    background: none !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* Hover state for dropdown arrows */
.primary-menu > li.menu-item-has-children:hover > a::after,
.primary-menu > li.menu-item-has-children > a:hover::after {
    transform: translateY(-50%) rotate(223deg);
    opacity: 0.9;
}
.menu-close-btn{display: none;}

/* Mobile menu styles */
@media (max-width: 991px) {
    .menu-toggle {
        display: flex !important;
    }

    .primary-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 120vh;
        background: #ffffff;
        flex-direction: column;
        padding: 50px 50px 20px 30px;
        transition: all 0.3s ease-in-out;
        z-index: 1001;
        margin: 0;
        list-style: none;
        overflow-y: auto;
        transform: translateX(-100%);
    }
    
    .primary-menu.active {
        transform: translateX(0);
        box-shadow: none;
    }
    
    /* Close button */
    .menu-close-btn {
        position: fixed;
        top: 20px;
        right: 30px;
        width: 40px;
        height: 40px;
        background: var(--primary-color);
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1002;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .primary-menu.active + .menu-close-btn {
        opacity: 1;
        visibility: visible;
    }
    
    .menu-close-btn:before,
    .menu-close-btn:after {
        content: '';
        position: absolute;
        width: 20px;
        height: 2px;
        background: #ffffff;
        transition: all 0.3s ease;
    }
    
    .menu-close-btn:before {
        transform: rotate(45deg);
    }
    
    .menu-close-btn:after {
        transform: rotate(-45deg);
    }
    
    .menu-close-btn:hover:before,
    .menu-close-btn:hover:after {
        background: #ffffff;
    }


    /* Mobile menu items */
    .primary-menu > li {
        border-bottom: 1px solid #f0f0f0;
        margin: 0;
        width: 100%;
    }

    .primary-menu > li > a {
        display: block;
        padding: 12px 20px;
        color: #333333 !important;
        font-weight: 500;
    }

    .primary-menu > li > a:hover,
    .primary-menu > li.current-menu-item > a {
        color: var(--primary-color) !important;
        background-color: rgba(0, 0, 0, 0.02);
    }

    /* Mobile submenu styles */
    .primary-menu .sub-menu,
    .primary-menu .children {
        display: none;
        padding-left: 15px;
        margin: 0;
        list-style: none;
        position: static;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.02);
        width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .primary-menu .sub-menu.active,
    .primary-menu .children.active {
        display: block;
    }

    .primary-menu .sub-menu a,
    .primary-menu .children a {
        color: #555555;
        padding: 10px 20px 10px 30px;
    }

    .primary-menu .sub-menu a:hover,
    .primary-menu .children a:hover {
        color: var(--primary-color);
        background: rgba(0, 0, 0, 0.05);
    }

    /* Mobile menu toggle button */
    .menu-item-has-children > a {
        position: relative;
        padding-right: 40px !important;
    }

    .menu-item-has-children > a::after {
        content: '+';
        position: absolute;
        right: 15px;
        transform: translateY(-50%);
        font-size: 18px;
        font-weight: 700;
        transition: all 0.3s ease;
    }
    footer .menu-item-has-children > a::after {
        display: none;
    }
    .footer-address p{
        font-size: 0.8rem;
    }

    .primary-menu .menu-item-has-children.active > a::after {
        content: '-' !important;
    }
    .primary-menu > li.menu-item-has-children:hover > a::after, .primary-menu > li.menu-item-has-children > a:hover::after{
        transform: none;
    }

    /* Menu overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .primary-menu .menu-item-has-children > a.toggled::after {
        transform: translateY(-50%) rotate(180deg) !important;
    }
}

/* Dropdown Indicator for Mobile */
.dropdown-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2;
    display: none;
}

.dropdown-toggle::before {
    content: '+';
    font-size: 20px;
    color: var(--text-primary);
}

.dropdown-toggle.toggled::before {
    content: '-';
}

@media (max-width: 991px) {
    .dropdown-toggle {
        display: block;
    }
    
    .primary-menu .menu-item-has-children > a::after {
        content:'+';

    }
}

/* Animation for dropdowns */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.primary-menu .sub-menu,
.primary-menu .children {
    animation: fadeIn 0.3s ease forwards;
}