/* ==========================================================================
   1. ISOLATED COMPONENT SCOPE (Safe for #include files)
   ========================================================================== */
.navbar, .navbar * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   2. GLASSMORPHIC NAVBAR CONTAINER (Desktop Baseline)
   ========================================================================== */
/* │️ FIXED SECTION 2 */
.navbar {
    background: #111827; /* Solid dark fallback for unaccelerated browsers */
    background: rgba(15, 23, 42, 0.85); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999; 
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    font-family: 'Segoe UI', Roboto, Ubuntu, -apple-system, sans-serif;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 75px;
}

.logo {
    font-size: 1.5em;
    font-weight: 800;
    color: #ffffff !important;
    text-decoration: none;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Hide mobile checkbox control logic on desktop layouts */
.menu-btn, .menu-icon {
    display: none;
}

/* ==========================================================================
   3. DESKTOP MENU STRUCTURE & LINKS
   ========================================================================== */
.menu-list {
    list-style: none !important;
    display: flex;
}

.menu-list li {
    position: relative;
    list-style: none !important;
}

.menu-list a {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 26px 22px;
    font-size: 1em;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.menu-list a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
}

/* Dropdown Indicators */
.has-children > a::after {
    content: ' ▾';
    font-size: 0.75em;
    vertical-align: middle;
    display: inline-block;
    margin-left: 5px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   4. DESKTOP DROPDOWNS (LEVEL 2 & 3)
   ========================================================================== */
.navbar .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(15, 23, 42, 0.95); /* Deep backdrop background avoids page transparency clashing */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    list-style: none !important;
    min-width: 220px;
    border-radius: 8px;
    margin-top: 0px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    overflow: visible;
    z-index: 10000;
}

.navbar .submenu a {
    padding: 14px 20px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.85);
}

/* Level 3 flyouts shift LEFT on desktop to avoid cutting off screen edge */
.navbar .submenu .submenu {
    top: -6px;
    left: auto;
    right: 100%;
    margin-right: 2px;
    margin-left: 0px;
}

.navbar .submenu .has-children > a::after {
    content: ' ◂'; /* Standardizes left arrow direction indicator for desktop flyouts */
}

/* Desktop Hover Triggers */
@media screen and (min-width: 769px) {
    /* Level 2 Submenus (Dropdowns): Must allow side-spilling so Level 3 can pop out */
    .menu-list > li > .submenu {
        opacity: 0;
        visibility: hidden;
        max-height: none !important;
        overflow: visible !important; /* Permits Level 3 flyouts to project outwards safely */
    }

    /* Level 3 Submenus (Flyouts): Independently locked down so they don't break the bottom screen boundary */
    .navbar .submenu .submenu {
        opacity: 0;
        visibility: hidden;
        max-height: calc(100vh - 120px) !important; /* Clips the inner list safely before page bottom */
        overflow-y: auto !important;                 /* Restores clean vertical scrollbars just for the flyouts */
    }

    /* Level 2 drops straight down under main header categories */
    .menu-list > li:hover > .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .menu-list li:hover > a::after {
        transform: translateY(2px);
    }
    
    .submenu .has-children:hover > a::after {
        transform: translateX(-2px);
    }
    
    /* Level 3 opens smoothly to the left side when hovered */
    .navbar .submenu li:hover > .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}


/* ==========================================================================
   5. MOBILE RESPONSIVE LAYOUT (< 768px)
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* Force the navbar wrapper to match the container height */
    .navbar {
        height: 65px;
    }

    .nav-container {
        height: 65px;
        display: flex;          /* Ensures active flex alignment on mobile */
        align-items: center;    /* Keeps the logo and burger perfectly centered */
        justify-content: space-between;
        width: 100%;
    }
    
    .menu-icon {
        display: flex;          /* Switches to flex to neatly contain the lines */
        align-items: center;
        height: 100%;           /* Fills the 65px bar perfectly without bleeding */
        padding: 0 20px;        /* Replaces deep top/bottom padding with side padding */
        cursor: pointer;
        position: relative;
        z-index: 10002;
    }
    
    .navicon {
        background: #ffffff;
        display: block;
        height: 2px;
        position: relative;
        width: 22px;
        transition: background 0.2s ease-out;
    }
    
    .navicon:before, .navicon:after {
        background: #ffffff;
        content: '';
        display: block;
        height: 100%;
        position: absolute;
        transition: all 0.2s ease-out;
        width: 100%;
    }
    .navicon:before { top: 6px; }
    .navicon:after { top: -6px; }

    /* Mobile Slider Panel */
    .menu-list {
        position: fixed; /* Keeps it as a floating side-drawer overlay */
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh; /* Locks it to the exact height of the screen */
        background: rgba(15, 23, 42, 0.98);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        flex-direction: column;
        padding-top: 80px;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto; /* ENABLES vertical scrolling inside the drawer */
        z-index: 10001;
    }

    .menu-list a {
        padding: 15px 25px;
    }

    /* Checkbox Drawer Trigger Logic */
    .menu-btn:checked ~ .menu-list {
        right: 0;
    }

    /* Animation: Burger to X */
    .menu-btn:checked ~ .menu-icon .navicon {
        background: transparent;
    }
    .menu-btn:checked ~ .menu-icon .navicon:before {
        transform: rotate(-45deg);
        top: 0;
    }
    .menu-btn:checked ~ .menu-icon .navicon:after {
        transform: rotate(45deg);
        top: 0;
    }

    /* Mobile Accordion Stack Override - Completely closed by default */
    .navbar .submenu, .navbar .submenu .submenu {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.04) !important;
        margin: 0 !important;
        padding-left: 15px !important;
        opacity: 0 !important;              /* Hidden by default on mobile */
        visibility: hidden;                  /* Hidden by default on mobile */
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;          /* Keeps items from leaking space while shut */
        transition: max-height 0.3s ease-out, opacity 0.2s ease-out !important;
    }

    /* Expands cleanly ONLY when active tap/focus forces a hover toggle sequence */
    .menu-list li:hover > .submenu,
    .menu-list li:focus-within > .submenu {
        opacity: 1 !important;
        visibility: visible !important;
        max-height: 3000px !important;       /* High ceiling opens individual category blocks seamlessly */
    }
    
    .submenu .has-children > a::after {
        content: ' ▾' !important;
    }
}


