/* Main Navigation Styles */
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem; /* Match content padding */
    width: 100%;
}

/* Base Navigation */
.main-nav {
    display: flex;
    align-items: center;
    padding: 0.5rem 0; /* Reduced vertical padding */
    background-color: #10131b;
    position: relative;
    z-index: 1000;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    margin-right: 1.5rem; /* Space between logo and menu */
    padding: 0.25rem 0; /* Slight vertical padding */
    margin-left: -1.25rem; /* Pull logo further to the left to align with content */
}

.nav-logo img {
    height: 40px;
    width: auto;
}

/* Menu Toggle Button (Mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid #ffb347;
    border-radius: 4px;
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    position: relative;
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 16px;
    position: relative;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: currentColor; /* Use the color from the parent */
    transition: all 0.3s ease;
}

.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Main Menu */
#iboost-main-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center; /* Vertically center menu items */
}

#iboost-main-nav > li {
    position: relative;
    margin: 0 0.15rem; /* Further reduced spacing */
}

#iboost-main-nav > li > a {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem; /* Further reduced padding */
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem; /* Slightly smaller font */
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    white-space: nowrap;
    border-radius: 3px; /* Subtle hover effect */
}

#iboost-main-nav > li > a:hover,
#iboost-main-nav > li > a:focus,
#iboost-main-nav > li > a.active {
    color: #ffb347;
    position: relative;
}

/* Add border bottom on hover and active states */
#iboost-main-nav > li > a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 8px;
    right: 8px;
    height: 2px;
    background-color: #ffb347;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease-in-out;
}

#iboost-main-nav > li > a:hover::after,
#iboost-main-nav > li > a:focus::after,
#iboost-main-nav > li > a.active::after {
    transform: scaleX(1);
}

/* Dropdown Menu */
#iboost-main-nav .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px; /* Slightly narrower for better readability */
    background-color: #1a1f2c;
    border: 1px solid #2a2f3c;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1000;
    display: block !important; /* Ensure it's always block/vertical */
}

#iboost-main-nav li:hover > .submenu,
#iboost-main-nav li:focus-within > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#iboost-main-nav .submenu li {
    display: block;
    margin: 0;
}

#iboost-main-nav .submenu a {
    display: block;
    padding: 0.6rem 1.5rem;
    color: #e0e6ed;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s, color 0.2s;
}

#iboost-main-nav .submenu a:hover,
#iboost-main-nav .submenu a:focus {
    background-color: rgba(255, 179, 71, 0.1);
    color: #ffb347;
}

/* Dropdown Indicators */
#iboost-main-nav > li.has-children > a::after {
    content: '\25BE';
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.8em;
    transition: transform 0.2s;
}

#iboost-main-nav > li.has-children:hover > a::after {
    transform: rotate(180deg);
}

/* Mobile Menu Styles */
@media (max-width: 992px) {
    .main-nav .nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background-color: #333; /* Add a dark gray background for contrast */
        border: none;
        cursor: pointer;
        z-index: 1002;
        position: relative;
        right: 20px;
        border-radius: 4px; /* Round the corners for better appearance */
    }
    
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        height: 18px;
    }
    
    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background-color: #ffffff !important; /* Force white color for visibility */
        transition: all 0.3s ease;
    }
    
    .nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    /* Menu overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Main menu */
    #iboost-main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background-color: #1a1f2c;
        padding: 5rem 0 2rem;
        margin: 0;
        list-style: none;
        transition: right 0.3s ease-in-out;
        z-index: 1001;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    /* Show menu when toggled */
    #iboost-main-nav.show {
        right: 0;
        opacity: 1;
        visibility: visible;
    }

    /* Ensure menu items are visible when the menu is shown */
    #iboost-main-nav.show > li {
        opacity: 1;
        visibility: visible;
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    /* Menu items */
    #iboost-main-nav > li {
        width: 100%;
        margin: 0;
        position: relative;
    }
    
    #iboost-main-nav > li > a {
        color: #fff;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-decoration: none;
        transition: background-color 0.2s ease;
    }
    
    #iboost-main-nav > li > a:hover,
    #iboost-main-nav > li > a:focus {
        background-color: rgba(255, 255, 255, 0.1);
        outline: none;
    }
    
    #iboost-main-nav > li.active > a {
        font-weight: 600;
        color: #4f9fef;
    }
    
    /* Submenu styles */
    #iboost-main-nav .submenu {
        display: none;
        padding-left: 1.5rem;
        background-color: rgba(0, 0, 0, 0.1);
    }
    
    #iboost-main-nav .submenu.show {
        display: block;
    }
    
    #iboost-main-nav .submenu li a {
        padding: 0.75rem 1.5rem;
        display: block;
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    #iboost-main-nav .submenu li:last-child a {
        border-bottom: none;
    }
    
    #iboost-main-nav .submenu li a:hover,
    #iboost-main-nav .submenu li a:focus {
        background-color: rgba(255, 255, 255, 0.05);
        color: #fff;
    }
    
    /* Submenu styles for mobile */
    #iboost-main-nav .submenu {
        display: none;
        position: static;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    
    #iboost-main-nav .submenu.show {
        display: block;
    }
    
    #iboost-main-nav .submenu a {
        padding-left: 2.5rem !important;
        padding-right: 1rem;
    }
    
    /* Dropdown arrow */
    #iboost-main-nav > li.has-children > a::after {
        content: '+';
        font-size: 1.2em;
        transition: transform 0.3s;
    }
    
    #iboost-main-nav > li.has-children.open > a::after {
        content: '-';
    }
    
    /* Mobile dropdown menu - consistent with desktop */
    #iboost-main-nav .submenu {
        position: static;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        border: none;
        box-shadow: none;
        padding: 0;
        max-height: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }
    
    #iboost-main-nav .submenu.show {
        max-height: 1000px; /* Adjust based on your needs */
    }
    
    #iboost-main-nav .submenu a {
        padding-left: 2.5rem;
    }
    
    #iboost-main-nav .submenu .submenu a {
        padding-left: 3.5rem;
    }
    
    /* Mobile dropdown indicator */
    #iboost-main-nav > li.has-children > a::after {
        content: '+';
        margin-left: auto;
        font-size: 1.2rem;
        transition: transform 0.3s;
    }
    
    #iboost-main-nav > li.has-children.open > a::after {
        content: '-';
        transform: none;
    }
    
    /* Overlay when menu is open */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Active menu item */
#iboost-main-nav li.active > a {
    color: #ffb347;
    font-weight: 600;
}

/* Focus styles for keyboard navigation */
#iboost-main-nav a:focus {
    outline: 2px solid #ffb347;
    outline-offset: 2px;
}

/* Disable body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}
