/* Mobile Menu Styles */
.mobile-menu-toggle {
    display: none; /* Hidden by default, shown in media query */
    background: none;
    border: none;
    font-size: 24px; /* Hamburger icon size */
    color: var(--primary-dark-blue); /* Or your desired icon color */
    cursor: pointer;
    padding: 10px;
    margin-right: 15px; /* Adjust as needed */
    z-index: 1001; /* Ensure it's above other header elements */
}

/* Hide hamburger toggle when menu is open */
body.mobile-menu-open .mobile-menu-toggle {
    display: none;
}

.mobile-nav {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen */
    width: 246px; /* Reduced by 12% from 280px */
    height: 100vh;
    background-color: #ffffff; /* Or your desired background color */
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease-in-out;
    padding-top: 60px; /* Space for close button or header */
}

.mobile-nav.active {
    right: 0; /* Slide in */
    display: block;
}

.mobile-menu-close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px; /* X icon size */
    color: var(--primary-dark-blue); /* Or your desired icon color */
    cursor: pointer;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav ul li {
    border-bottom: 1px solid #eee; /* Separator for menu items */
}

.mobile-nav ul li:last-child {
    border-bottom: none;
}

.mobile-nav ul li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--primary-dark-blue); /* Menu item text color */
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.mobile-nav ul li a:hover,
.mobile-nav ul li a:focus {
    background-color: #f5f5f5; /* Hover/focus background color */
}

/* Submenu styles */
.mobile-nav .mobile-submenu {
    display: none;
    padding-left: 20px; /* Indent submenu items */
    background-color: #f9f9f9; /* Slightly different background for submenu */
}

.mobile-nav .mobile-submenu.active {
    display: block;
}

.mobile-nav .mobile-submenu li a {
    /* Indent submenu item text.
       Parent toggle has padding-left 20px. Parent 'a' has padding-left 5px.
       Approximate alignment: toggle width (font-size + L/R padding) + 'a' left padding.
       Let's aim for text alignment. Toggle: ~1.2rem font + 10px right pad. 'a' has 5px left pad.
       If toggle icon is ~20px wide, its left padding is 20px. Total space before 'a' text is ~45px.
    */
    padding: 10px 20px 10px 55px; /* Top/Bottom Right Left - Increased left padding for sub-items */
    font-size: 0.9rem; /* Slightly smaller font for sub-items */
    font-weight: normal;
    display: block; /* Ensure it takes full width of its li */
}

.mobile-nav li.has-submenu {
    display: flex; /* Use flex to align toggle and link on one line */
    flex-wrap: wrap; /* Allow submenu to wrap to the next line */
    align-items: center; /* Vertically align toggle and link */
    position: relative;
}

.mobile-nav .has-submenu > .submenu-toggle {
    /* display: inline-block; /* Not needed for flex item */
    /* vertical-align: middle; /* Not needed for flex item */
    padding: 15px 10px 15px 20px; /* Top, Right, Bottom, Left */
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1; /* Ensure consistent height */
    flex-shrink: 0; /* Prevent toggle from shrinking */
}

.mobile-nav .has-submenu > a {
    /* display: inline-block; /* Not needed for flex item */
    /* vertical-align: middle; /* Not needed for flex item */
    padding: 15px 20px 15px 5px; /* Adjust left padding to account for toggle */
    flex-grow: 1; /* Allow link to take remaining space on the line */
    text-decoration: none;
    color: var(--primary-dark-blue);
    font-weight: 600;
    line-height: 1.2rem; /* Match toggle line-height if needed */
}

/* Ensure submenu UL takes full width and is on a new line */
.mobile-nav .mobile-submenu {
    display: none; /* Hidden by default */
    width: 100%; /* Force it to take full width of parent li.has-submenu */
    padding-left: 0; /* Reset padding, li a inside will handle indentation */
    margin-top: 0; /* Remove any top margin that might create unwanted space */
    margin-bottom: 0;
    background-color: #f9f9f9;
    box-sizing: border-box;
    flex-basis: 100%; /* Ensure it takes the full basis in flex layout, forcing wrap */
}

.mobile-nav .submenu-toggle::after {
    content: '+';
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}

.mobile-nav .has-submenu.active > .submenu-toggle::after {
    content: '-';
    transform: none; /* Ensure no rotation */
}


/* Body class to prevent scrolling when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Media query to show hamburger and hide desktop nav */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    header nav { /* Assuming your desktop nav is <nav> inside <header> */
        display: none !important; /* Use !important if necessary to override other styles */
    }
}

/* Ensure mobile nav is hidden on desktop screens */
@media (min-width: 769px) {
    .mobile-nav {
        display: none !important;
    }
}