/* Main menu container */
.custom-menu {
    display: flex; 
    justify-content: space-between;
    align-items: center;
    font-family: 'Figtree', sans-serif;
    font-size: 1em;
    font-weight: 400;
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: transparent;
    box-sizing: border-box;
    padding: 0px 20px;
    transition: background-color 0.3s ease;
}

/* Logo */
.menu-logo {
    position: absolute;
    left: 50px;
    width: 119px;
    z-index: 1010;
}

.menu-logo img {
    height: auto;
    max-height: 50px;
}

/* -------------------------------------------
   DESKTOP FIXES (Default Styles)
   ------------------------------------------- */

/* Hide mobile controls */
.menu-mobile-toggle,
.mobile-dropdown-toggle {
    display: none !important; 
}

/* FIX: Set wrapper to display: contents on desktop. */
.mobile-menu-wrapper {
    display: contents; 
}

/* Ensure the main menu list is explicitly set to flex and pushes to the right. */
.menu-items {
    list-style: none;
    display: flex; 
    margin-left: auto; 
    padding: 10px 0;
}

.menu-items li {
    position: relative;
    padding-right: 30px;
}

.menu-items li a.menu-link {
    color: white;
    text-decoration: none;
    font-size: 1em;
}

/* CORRECTED DESKTOP DROPDOWN ICON */
.menu-items li.menu-item-has-children a.menu-link::after {
    content: '\276F';
    display: inline-block;
    transform: rotate(90deg);
    margin-left: 5px;
    font-size: 1em;
    opacity: 1;
}

/* CRITICAL FIX: Limit dropdown hover behavior to DESKTOP only */
@media screen and (min-width: 992px) {
    .menu-items li.menu-item-has-children:hover .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* Sub-menu styling (Desktop) */
.sub-menu {
    display: block;
    opacity: 0; 
    visibility: hidden; 
    position: absolute; 
    top: calc(100% + 10px); 
    left: 0;
    transform: translateY(-9px);
    background: white;
    color: black;
    width: 150px;
    list-style: none;
    padding: 0;
    z-index: 999;
    border-radius: 10px;
    overflow: visible;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Triangle pointer */
.sub-menu::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 20%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}

/* Sub-menu links */
.sub-menu li {
    padding: 0;
}

.sub-menu li a {
    display: block;
    width: 100%;
    padding: 10px 15px;
    box-sizing: border-box;
    color: black;
    text-decoration: none;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

/* Hover & Active effect */
.sub-menu li a:hover,
.sub-menu li.current-menu-item a {
    background-color: #F2F1FC;
}

/* Rounded corners on first and last items */
.sub-menu li:first-child a {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.sub-menu li:last-child a {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* Call-to-action button (Desktop Positioning) */
.menu-button {
    background-color: rgba(148, 38, 143, 1);
    color: white;
    border-radius: 25px;
    padding: 8px 20px;
    text-decoration: none;
    margin-left: 0;
    margin-right: 50px; 
    transition: background-color 0.8s ease;
    display: inline-block; 
}

.menu-button:hover {
    background-color: rgba(148, 38, 143, 0.8);
}
/* ------------------------------------------- */


/* --- SCROLLED STATE --- */
.custom-menu.scrolled {
    background-color: #36194C;
}

/* --- ACTIVE STATE BORDER (Desktop) --- */
.menu-items > li {
    border-left: 4px solid transparent;
    transition: border-left-color 0.3s ease;
}

.menu-items > li.current-menu-item,
.menu-items > li.current-menu-ancestor {
    border-left-color: #94268F;
    padding-left: 10px;
}

/* ==============================================
   MOBILE STYLES (Max 991px)
   ============================================== */
@media screen and (max-width: 991px) {
    
    /* Global Menu Adjustments */
    .custom-menu {
        padding: 0;
        min-height: 70px; 
        background-color: #36194C;
        /* FIX: Reverse order to put burger on right, logo on left */
        flex-direction: row-reverse; 
    }

    /* Logo adjustment */
    .menu-logo {
        position: static;
        margin-left: 0; 
        margin-right: auto; /* Pushes logo to the now-left side */
        padding-left: 20px; /* Spacing */
    }

    /* -------------------------------------------
       MOBILE ONLY: Show Mobile Elements
       ------------------------------------------- */
    .menu-mobile-toggle {
        display: block !important; 
        cursor: pointer;
        padding: 10px 20px;
        z-index: 1010;
        margin-left: 0; /* No longer need auto margin */
        font-size: 2em;
        line-height: 1;
        color: white;
    }
    
    .mobile-icon {
        display: none;
    }
    
    .menu-mobile-toggle .open-icon {
        display: block;
    }
    
    .custom-menu.menu-open .menu-mobile-toggle .open-icon {
        display: none;
    }
    .custom-menu.menu-open .menu-mobile-toggle .close-icon {
        display: block;
        font-size: 1.5em;
    }


    /* --- MOBILE MENU WRAPPER (THE FULL DROPDOWN) --- */
    .mobile-menu-wrapper {
        display: none; /* Hidden by default, shown by JS */
        visibility: visible; 
        position: fixed;
        top: 70px; 
        left: 0;
        width: 100%;
        background-color: #36194C; 
        overflow-y: auto; 
        padding: 0 0 40px 0; 
        box-sizing: border-box;
    }

    .custom-menu.menu-open .mobile-menu-wrapper {
        display: block; 
    }
    
    /* Hide the desktop chevron on mobile */
    .menu-items li.menu-item-has-children a.menu-link::after {
        content: none; 
    }

    /* --- MENU ITEMS (List) --- */
    .menu-items {
        display: block; /* Stack vertically */
        padding: 0;
        margin: 0;
    }

    /* PARENT ITEM STYLING (Mobile) */
    .menu-items > li {
        position: relative; 
        height: auto; 
        display: block; 
        padding-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-left: 0 !important;
        background-color: transparent; 
        border-left: none !important;
    }
    
    .menu-items > li:last-of-type {
        border-bottom: none;
    }

    /* Menu Link Styling (Parent) */
    .menu-items li a.menu-link {
        display: flex; 
        align-items: center;
        height: 60px; /* Fixed height for stability */
        padding: 0 20px; 
        font-weight: 400; 
        font-size: 1em; 
        color: white; 
        transition: padding-left 0.3s ease, border-left-color 0.3s ease;
    }
    
    /* Left border for ACTIVE PAGE/ANCESTOR on mobile */
    .menu-items > li.current-menu-item > a.menu-link,
    .menu-items > li.current-menu-ancestor > a.menu-link {
        border-left: 5px solid #94268F; 
        padding-left: 17px; 
    }

    /* Active Parent Item Styling (Mobile) */
    .menu-items > li.current-menu-item a,
    .menu-items > li.current-menu-ancestor a {
        color: white; 
    }


    /* --- MOBILE DROPDOWN TOGGLE BUTTON (+/-) --- */
    .mobile-dropdown-toggle {
        display: flex !important; 
        justify-content: center;
        align-items: center;
        position: absolute; 
        top: 0; 
        right: 0;
        width: 60px;
        height: 60px; /* Fixed height to match the link's height */
        background: none;
        border: none;
        color: white;
        font-size: 2em;
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }
    
    /* Icon swapping for dropdown toggle */
    .mobile-dropdown-toggle .minus-icon { display: none; }
    .mobile-dropdown-toggle .plus-icon { display: block; }
    
    /* CRITICAL FIX 1: Ensure JS display works by overriding desktop visibility rules */
    .menu-items li.open .sub-menu {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important; 
    }

    .menu-items li.open .mobile-dropdown-toggle .plus-icon { display: none; }
    .menu-items li.open .mobile-dropdown-toggle .minus-icon { display: block; }


    /* --- SUB-MENU (Child List) --- */
    .sub-menu {
        position: static; 
        display: none; /* Sub-menu is hidden and controlled by JS slideToggle */
        background-color: transparent; 
        box-shadow: none;
        padding-bottom: 10px;
        height: auto; 
        margin-top: 0px; 
        transition: all 0.3s ease-in-out; 
        overflow: hidden;
    }

    .sub-menu::before {
        content: none; 
    }

    /* Sub-menu list items (Child links) */
    .sub-menu li {
        position: static;
        height: auto;
        display: block; 
        margin-left: 0; 
        border-bottom: none;
        background-color: transparent;
        /* Ensure the link text is indented, but the background is on the LI */
        border-left: none; 
        transition: background-color 0.3s ease; /* Smooth hover transition */
    }

    .sub-menu li a {
        height: auto;
        /* CRITICAL FIX: Keep indentation only on the link */
        padding: 10px 20px 10px 40px; 
        color: rgba(255, 255, 255, 1);
        font-size: 0.9em;
        background-color: transparent !important; 
    }
    
    /* ACTIVE CHILD ITEM STYLING (Full Width Highlight and Border) */
    
    /* Hover state: Background on LI, text color on A */
    .sub-menu li:hover { 
     
    }
    .sub-menu li:hover a {
        color: white !important;
    }
    
    /* Active state: Background and Border on LI */
    .sub-menu li.current-menu-item { 
    
        /* The link must adjust its padding to maintain alignment when the border is present */
    }
    .sub-menu li.current-menu-item a {
        color: white !important;
        /* Adjust padding to account for the border on the LI */
        padding-left: 40px; /* (40px desired indent) - (5px border width) = 35px */
        text-decoration:underline;
      
     
    }


    /* --- CALL-TO-ACTION BUTTON (Mobile) --- */
    .menu-button {
        display: block; 
        width: calc(100% - 40px);
        margin: 20px auto 0 auto;
        text-align: center;
        padding: 15px 20px;
        font-size: 1em;
        border-radius: 10px; 
    }

    /* Target the link when it is being pressed/tapped */
    .sub-menu li a:active {
        /* CRITICAL FIX: Ensure the background stays transparent when tapped */
        background-color: transparent !important; 
        
        /* Optional: Also explicitly ensure the text color doesn't change */
        color: rgba(255, 255, 255, 0.8) !important;
    }
    
    /* To remove the "tap highlight" on some Android browsers */
    .sub-menu li a {
        -webkit-tap-highlight-color: transparent; 
    }

  
}

