﻿.MenuBar {
    background-color: #1a365d; /* Elegant deep blue to match institute branding */
    border-bottom: 2px solid #000000;
    position: relative;
    z-index: 999;
}

/* --- Menu Toggle Button (Desktop State) --- */
.menu-toggle {
    display: none; /* Completely hidden on desktop */
}

/* Main Top-Level Menu (UL) */
.MenuBar > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* Wraps items nicely on smaller desktop screens */
}

/* Base List Item Styling */
.MenuBar li {
    position: relative; /* Crucial for positioning the dropdown */
}

/* Top-Level Links (ASP LinkButtons render as anchor tags) */
.MenuBar > ul > li > a {
    display: block;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    font-family: Arial, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hover Effect for Main Menu Items */
.MenuBar > ul > li:hover > a {
    background-color: #2b6cb0; /* Lighter slate blue on hover */
    color: #ffffff;
}

/* --- Dropdown Menu Logic (Gallery Sub-menu) --- */

/* Hide Sub-menu by default */
.MenuBar ul li ul {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background-color: #ffffff;
    list-style: none;
    margin: 0;
    padding: 0;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    
    /* Smooth visibility toggle */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* Show Sub-menu on Hovering the Parent LI */
.MenuBar ul li:hover ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Menu Link Items Styling */
.MenuBar ul li ul li a {
    display: block;
    padding: 12px 15px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Dropdown Links Hover State */
.MenuBar ul li ul li a:hover {
    background-color: #f7fafc;
    color: #1a365d;
    font-weight: bold;
}

/* Remove bottom border from last dropdown link */
.MenuBar ul li ul li:last-child a {
    border-bottom: none;
}

/* --- Responsive Layout Adjustments --- */
@media (max-width: 900px) {
    
    /* 1. Show and Draw the Three-Line Hamburger Icon */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 21px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        margin: 15px 20px; /* Aligns neatly in your bar */
    }

    /* Styles the lines of the hamburger button */
    .menu-toggle span {
        width: 100%;
        height: 3px;
        background-color: #ffffff; /* White lines to pop against deep blue background */
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* 2. Hide Mobile Menu Row by Default until Toggled */
    .MenuBar > ul {
        display: none; /* Keeps menu hidden by default on mobile */
        flex-direction: column; /* Vertical stack on mobile devices */
        width: 100%;
    }

    /* 3. Display Menu When Button is Clicked (.active class added) */
    .MenuBar.active > ul {
        display: flex !important;
    }
    
    /* FIX: Force left alignment and full width for mobile LI containers */
    .MenuBar > ul > li {
        width: 100%;
        text-align: left !important;
        float: none !important;
    }
    
    /* FIX: Ensure mobile parent links stretch fully and align text left */
    .MenuBar > ul > li > a {
        display: block;
        width: 100%;
        text-align: left !important;
        box-sizing: border-box;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Standardize dropdown configuration for touch devices */
    .MenuBar ul li ul {
        position: static;
        width: 100%;
        opacity: 1;
        visibility: visible;
        display: none; 
        transform: none;
        box-shadow: none;
        background-color: #2d3748;
    }
    
    .MenuBar ul li:hover ul {
        display: block;
    }
    
    /* FIX: Ensure sub-menu links also stretch and align correctly */
    .MenuBar ul li ul li a {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: left !important;
        color: #e2e8f0;
        padding-left: 35px; /* Indent sub items on mobile stack */
        border-bottom: 1px solid #4a5568;
    }
}