/* Custom Menu Overrides - Responsive & Premium */

:root {
    --menu-height: 60px;
    /* Reduced from 70px */
    --menu-bg: linear-gradient(to right, #004d40, #00695c);
    --pro-gold: #d4af37;
    --menu-text-color: #ffffff;
    --dropdown-bg: #ffffff;
    --dropdown-text: #333333;
}

/* 1. Global Container Fixes */
.nav-container .auto-container {
    max-width: 1400px !important;
    /* Constrained width as requested */
    width: 95% !important;
    padding: 0 15px !important;
    margin: 0 auto !important;
    /* Center the container */
}

/* 2. Menu Layout & Structure - Global */
.nav-container {
    min-height: var(--menu-height);
    /* Allow expansion on mobile */
    height: auto;
    /* Flexible height */
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    border-bottom: 4px solid var(--pro-gold);
    width: 100%;
    background: var(--menu-bg) !important;
    /* Ensure bg is applied to container */
}

/* --- Desktop Layout (992px+) --- */
@media (min-width: 992px) {
    .nav-container {
        height: var(--menu-height);
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .main-menu {
        height: 100%;
        width: 100%;
        margin: 0 auto;
        display: flex;
        justify-content: center;
    }

    .main-menu>ul {
        height: 100%;
        display: flex !important;
        justify-content: center;
        align-items: center;
        width: auto;
        padding: 0 !important;
        margin: 0 auto !important;
        gap: 0 !important;
        /* Remove gap, use padding for spacing logic */
    }

    .main-menu>ul>li {
        height: 100%;
        flex: 0 1 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    .main-menu>ul>li>a {
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center;
        padding: 0 15px !important;
        /* Increased padding with no gap */
        font-size: 13.5px !important;
        /* Slightly smaller for safety */
        font-weight: 700 !important;
        white-space: nowrap !important;
        color: rgba(255, 255, 255, 0.9) !important;
        width: auto;
        text-transform: uppercase;
        letter-spacing: 0px;
        /* Normal spacing */
        transition: all 0.3s ease;
        position: relative;
    }

    /* Hover & Active Effects */
    .main-menu>ul>li>a:hover,
    .main-menu>ul>li.current>a {
        background: rgba(0, 0, 0, 0.1);
        /* Darken slightly */
        color: #ffffff !important;
    }

    /* Separators */
    .main-menu>ul>li::after {
        content: '';
        display: block;
        width: 1px;
        height: 14px;
        /* Shorter */
        background: rgba(255, 255, 255, 0.2);
        /* Subtle */
        margin: 0;
    }

    .main-menu>ul>li:last-child::after {
        display: none;
    }

    /* Icons */
    .main-menu>ul>li>a i {
        font-size: 13px;
        margin: 0 6px !important;
        color: var(--pro-gold) !important;
        opacity: 0.9;
    }
}

/* --- Responsive Adaptations --- */

/* Extra Large Screens */
@media (min-width: 1600px) {
    .main-menu>ul>li>a {
        padding: 0 20px !important;
        font-size: 15px !important;
    }
}

/* Standard Laptop (1200px - 1599px) */
@media (min-width: 1200px) and (max-width: 1599px) {
    .main-menu>ul>li>a {
        padding: 0 10px !important;
        font-size: 13px !important;
    }
}

/* Small Laptop / Tablet Landscape (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .main-menu>ul>li>a {
        padding: 0 5px !important;
        font-size: 12px !important;
    }

    .main-menu>ul>li>a i {
        display: none;
    }

    .main-menu>ul>li:first-child>a i {
        display: inline-block;
    }

    .main-menu>ul>li::after {
        display: none;
    }
}

/* --- Mobile Layout (Max 991px) --- */
@media (max-width: 991px) {
    .nav-container {
        display: block;
        /* Stack controls and menu */
        padding: 0;
    }

    .main-menu {
        display: none;
        /* Hidden by default */
        width: 100%;
        background: rgba(0, 0, 0, 0.95) !important;
        /* Darker bg for mobile menu */
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        position: absolute;
        top: 100%;
        /* Push below header */
        left: 0;
        z-index: 9999;
    }

    /* Active State from JS */
    .main-menu.show {
        display: block !important;
        animation: fadeIn 0.3s ease;
    }

    .main-menu>ul {
        display: block !important;
        width: 100%;
        padding: 0 !important;
        margin: 0 !important;
        height: auto !important;
    }

    .main-menu>ul>li {
        display: block !important;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        height: auto !important;
        background: transparent;
    }

    .main-menu>ul>li>a {
        display: flex !important;
        justify-content: space-between !important;
        /* Space between text and arrow */
        align-items: center !important;
        padding: 15px 20px !important;
        font-size: 15px !important;
        height: auto !important;
        color: #ffffff !important;
        /* Fixed White Color */
        font-weight: 600 !important;
        text-transform: none !important;
        /* More readable on mobile */
    }

    .main-menu>ul>li>a i {
        width: 25px;
        text-align: center;
        margin-right: 10px;
        color: var(--pro-gold) !important;
    }

    /* Submenu Toggle Icon */
    .main-menu>ul>li>a .fa-angle-down {
        margin-right: 0 !important;
        margin-left: auto !important;
        /* Push to end */
        transform: rotate(0deg);
        transition: transform 0.3s ease;
    }

    /* Mobile Dropdown Logic */
    .main-menu li ul {
        display: none !important;
        /* Hidden by default */
        background: rgba(0, 0, 0, 0.3) !important;
        /* Darker background for nested */
        padding: 0 !important;
        width: 100% !important;
        position: static !important;
        /* Flow naturally */
        box-shadow: none !important;
        border-radius: 0 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* Show submenu when active class is added by JS */
    .main-menu li.mobile-dropdown-active>ul {
        display: block !important;
        animation: slideInDown 0.3s ease;
    }

    /* Rotate arrow when open */
    .main-menu li.mobile-dropdown-active>a .fa-angle-down {
        transform: rotate(180deg);
    }

    .main-menu li ul li a {
        padding-left: 50px !important;
        /* Indent submenu items */
        padding-top: 12px !important;
        padding-bottom: 12px !important;
        font-size: 14px !important;
        color: rgba(255, 255, 255, 0.8) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    .main-menu li ul li a:hover {
        background: rgba(255, 255, 255, 0.05) !important;
        color: #fff !important;
    }
}

/* 4. Dropdown Menus */
@media (min-width: 992px) {
    .main-menu li ul {
        top: 100% !important;
        background: var(--dropdown-bg) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        border-radius: 0 0 8px 8px;
        width: 240px !important;
        padding: 8px 0 !important;
    }

    .main-menu li ul li a {
        color: var(--dropdown-text) !important;
        padding: 10px 20px !important;
        font-size: 13px !important;
        justify-content: flex-start !important;
        height: auto !important;
    }

    .main-menu li ul li a:hover {
        background: #f8f9fa !important;
        color: var(--primary-color) !important;
        padding-left: 25px !important;
    }

    [dir="rtl"] .main-menu li ul li a:hover {
        padding-left: 20px !important;
        padding-right: 25px !important;
    }
}

/* Header Top Tweak */
.header-top {
    padding: 5px 0 !important;
}

.logo-img {
    width: 50px !important;
    height: 50px !important;
}

.institute-text h1 {
    font-size: 16px !important;
}

.institute-text h2 {
    font-size: 16px !important;
}

.institute-text h3 {
    font-size: 11px !important;
}