/* ========================================================================== 1. VARIABLES & OPTIMIZED KEYFRAMES ========================================================================== */
 :root {
     --transition-fast: 0.2s;
     --transition-medium: 0.3s;
     --shadow-light: 0 2px 4px rgba(0,0,0,.3);
     --shadow-medium: 0 2px 10px rgba(0, 0, 0, 0.15);
     --shadow-heavy: 0 10px 30px rgba(0, 0, 0, 0.15);
     --border-radius: 6px;
     --nav-height: 93px;
     --mega-menu-width: 275px;
}
/* Optimized animation with transform3d for hardware acceleration */
 @keyframes fadeInUp {
     from {
         opacity: 0;
         transform: translate3d(0, 20px, 0);
    }
     to {
         opacity: 1;
         transform: translate3d(0, 0, 0);
    }
}
/* ========================================================================== 2. MAIN NAVIGATION STRUCTURE ========================================================================== */
 .header-section {
     width: 100%;
}
 .main-nav {
     box-shadow: var(--shadow-medium);
     position: relative;
     z-index: 1001;
    /* Enable hardware acceleration */
     transform: translate3d(0, 0, 0);
     backface-visibility: hidden;
}
 .nav-container {
     width: 100%;
     margin: 0 auto;
     padding: 2rem 20px;
     display: flex;
     align-items: center;
     max-height: var(--nav-height);
     border-bottom: 1px solid #ddd;
}
/* ========================================================================== 3. LOGO STYLES ========================================================================== */
 .navbar-brand {
     padding: 0 15px;
}
 .logo {
     display: flex;
     align-items: center;
     padding: 15px 0;
}
 .logo img {
     height: 50px;
     margin-right: 15px;
    /* Optimize image rendering */
     image-rendering: -webkit-optimize-contrast;
     image-rendering: optimize-contrast;
}
 .logo-text {
     font-size: 24px;
     font-weight: bold;
     color: #2D2A26;
}
/* ========================================================================== 4. NAVIGATION MENU ========================================================================== */
 .nav-menu {
     display: flex;
     list-style: none !important;
     align-items: center;
     flex: 1;

}
 .nav-item {
     position: static;
     list-style: none !important;
    /* Static positioning for proper mega menu alignment */
}
/* Add class for keyboard-activated items */
 .nav-item .keyboard-active .mega-menu {
     max-height: 1000px;
     opacity: 1;
     visibility: visible;
}
/* Navigation Links - Optimized transitions */
 .nav-link {
     display: block;
     padding: 20px 15px;
     color: var(--body-text-template);
     text-decoration: none;
     font-weight: 700;
     transition: color var(--transition-medium) ease;
     cursor: pointer;
     font-size: 21px;
     position: relative;
    /* Enable hardware acceleration */
     transform: translate3d(0, 0, 0);
     will-change: color;
}
 .nav-link:hover, .nav-item:hover .nav-link {
     color: var(--primary-template);
}
/* Optimized underline effect using transform instead of width */
 .nav-link::after {
     content: '';
     position: absolute;
     bottom: 0;
     left: 50%;
     width: 80%;
     height: 2px;
     background: var(--primary-template);
     transition: transform var(--transition-medium) ease;
     transform: translate3d(-50%, 0, 0) scaleX(0);
     transform-origin: center;
}
 .nav-link:hover::after {
     transform: translate3d(-50%, 0, 0) scaleX(1);
}
 .nav-link i {
     margin-left: 5px;
     font-size: 12px;
}
 /* Regular Dropdown  */
        .nav-item.dropdown .mega-menu {
            position: absolute;
            width: auto;
            left: auto;
            right: auto;
        }

        .nav-item.dropdown .mega-content {
            padding: 20px;
            display: block;
            max-width: 100%;
        }

        .nav-item.dropdown .mega-column {
            margin-bottom: 10px;
        }

        .nav-item.dropdown .mega-column h3 {
            margin-bottom: 5px;
            font-size: 14px;
        }
        .nav-item.dropdown .mega-columns-wrapper {
            flex: 1;
            display: block;
            flex-wrap: wrap;
            gap: 20px;
            min-width: 0; /* Important for flex shrinking */
        }
        
        .nav-item.dropdown .mega-columns-wrapper {
            column-count: 1;
        }
/* ========================================================================== 5. ACCESSIBILITY & FOCUS STATES ========================================================================== */
 .nav-link:focus {
     outline: 2px solid var(--primary-template);
     outline-offset: 2px;
}
/* Remove the automatic focus-within behavior */
/* .nav-item:focus-within .mega-menu {
     opacity: 1;
     visibility: visible;
     transform: translate3d(0, 0, 0);
}
 */
/* ========================================================================== 6. MEGA MENU STRUCTURE - Accordion slide effect for desktop ========================================================================== */
 .mega-menu {
     position: absolute;
     left: 0;
     right: 0;
     width: 100vw;
     background: white;
     box-shadow: var(--shadow-heavy);
    /* Accordion effect - start collapsed */
     max-height: 0;
     overflow: hidden;
     opacity: 1;
    /* Always fully visible during animation */
     visibility: visible;
    /* Always visible during animation */
    /* Smooth accordion transition */
     transition: max-height 0.4s ease-out;
     z-index: 1000;
    /* Performance optimizations */
     contain: layout style paint;
     will-change: max-height;
     backface-visibility: hidden;
}
/* Accordion open state on hover */
 .nav-item:hover .mega-menu {
     max-height: 1000px;
    /* Large enough value to accommodate content */
}
/* ========================================================================== 7. MEGA MENU CONTENT ========================================================================== */
/* FLEXIBLE LAYOUT - Key Solution */
        .mega-content {
            max-width: 1400px;
            margin: 0 auto;
            padding: 40px 0px;
            display: flex;
            gap: 30px;
            align-items: flex-start;
        }
 .mega-column {
     /*
     flex: 1;
     padding-left: 10px;
     padding-right: 10px;
     animation: fadeInUp var(--transition-medium) ease-out;
     transform: translate3d(0, 0, 0);
     white-space: nowrap;
    */
     break-inside: avoid;
            margin-bottom: 10px;
            display: inline-block;
            width: 100%;
}
 .mega-column a {
     color: #374151;
     text-decoration: none;
     display: block;
     padding: 0px 0;
     transition: color var(--transition-medium) ease, padding-left var(--transition-medium) ease;
     border-left: 3px solid transparent;
     padding-left: 10px;
    /* Optimize for hover effects */
     will-change: color, padding-left;
}
 .mega-column h3 {
     color: var(--primary-template);
     font-size: 18px;
     margin-bottom: 15px;
     padding-bottom: 7px;
     border-bottom: 1px solid rgba(97, 109, 126, 0.12);
}
 .mega-column h3 a {
     color: var(--primary-template);
     font-size: 18px;
}
 .mega-column ul {
     list-style: none;
}
 .mega-column li {
     margin: 0px 0px 10px 0px;
     list-style: none;
}
 .mega-column a:hover {
     color: var(--accent-template);
     border-left-color: var(--primary-template);
     padding-left: 15px;
}
/* Left section - wraps columns as needed */
        .mega-columns-wrapper {
            /*flex: 1;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
            flex-wrap: wrap;
            gap: 20px;
            min-width: 0;*/
            column-count: 3;
            column-gap: 10px;
            display: block;
        }
/* ========================================================================== 8. MEGA MENU SIDEBAR ========================================================================== */
 .mega-column-side-right {
      flex: 0 0 auto;
            padding: 25px;
            border-radius: var(--border-radius);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
 .mega-column-side-right h2 {
     color: var(--body-bg-template);
}
/* ========================================================================== 9. MEGA MENU FOOTER ========================================================================== */
 .mega-footer {
     height: 45px;
     border-top: 1px solid #e5e7eb;
     display: flex;
     align-items: center;
     justify-content: flex-start;
     margin-top: 30px;
     color: var(--body-text-template);
     font-size: 14px;
     padding-left: 20px;
}
/* ========================================================================== 10. SPECIALIZED MEGA MENU LAYOUTS ========================================================================== */
 .academics-mega {
     grid-template-columns: repeat(4, 1fr);
}
/* .mega-search {
     background: none !important;
     box-shadow: none !important;
}
 .mega-search .mega-content {
     margin: 0 auto;
}
 */
 .highlight-box {
     background: linear-gradient(135deg, #3b82f6, #1e40af);
     color: white;
     padding: 20px;
     border-radius: 8px;
     text-align: center;
    /* Performance optimization */
     contain: layout style paint;
}
 .highlight-box h4 {
     margin-bottom: 10px;
     font-size: 16px;
}
 .highlight-box p {
     font-size: 14px;
     opacity: 0.9;
}
/* ========================================================================== 11. SEARCH BAR STYLES ========================================================================== */
 .header-section #search-bar {
     height: 100%;
     -webkit-transform: rotate(360deg);
     -moz-transform: rotate(360deg);
     -ms-transform: rotate(360deg);
     -o-transform: rotate(360deg);
     transform: rotate(360deg);
     position: fixed;
     width: 100%;
     top: 0;
     left: 0;
     right: 0;
     visibility: hidden;
     opacity: 0;
     z-index: 9999;
     -moz-transition: 0.5s;
     -ms-transition: 0.5s;
     -o-transition: 0.5s;
     transition: 0.5s;
     align-content: center;
}
 .header-section #search-bar.active {
     visibility: visible;
     opacity: 1;
}
 #search-bar .form-group {
     margin-bottom: 0;
     position: relative;
     width: 75%;
     margin: 0 auto;
}
 .close-bar {
     float: right !important;
     margin-right: 20px;
     background-color: white;
     border-radius: 6px;
     width: 50px;
     text-align: center;
     padding: 10px;
}
 #search-bar input {
     border: none;
     font-size: 23px;
     height: 42px;
     box-shadow: var(--shadow-light);
     backdrop-filter: blur(10px);
     contain: layout style;
     will-change: backdrop-filter;
     border-radius: var(--border-radius);
}
 #search-bar .form-control::placeholder {
     color: var(--primary-template);
     opacity: 1;
}
 .form-group label {
     display: block;
     margin-bottom: 0.5em;
    /* Adds space between label and input */
     font-family: var(--primary-font-template), var(--primary-font-style);
     font-size: xx-large;
     color: var(--body-bg-template);
}
/* #search-bar {
     min-width: 267px;
     width: 75%;
     background: rgba(255, 255, 255, 0.95);
     backdrop-filter: blur(10px);
     border: 1px solid rgba(0, 0, 0, 0.1);
     border-radius: var(--border-radius);
     box-shadow: var(--shadow-light);
     padding: 5px;
     margin-top: 15px;
     padding-left: 30px;
     outline: none;
     contain: layout style;
     will-change: backdrop-filter;
}
 #search-bar .form-group {
     margin-bottom: 0;
     position: relative;
}
 #search-bar input {
     border: none;
     width: 100%;
     background: none;
     font-size: 23px;
     height: 42px;
}
 .form-bar {
     margin-block-end: 0;
}
 #search-bar .submit {
     background-color: var(--primary-template);
     color: #fff;
     font-family: var(--primary-font-template), var(--primary-font-style);
     border-radius: var(--border-radius);
     font-size: 23px;
     cursor: pointer;
     transition: background-color var(--transition-fast) ease;
}
 #search-bar .form-control::placeholder {
     color: var(--primary-template);
     opacity: 1;
}
 .mega-search {
     margin: auto;
}
 */
/* ========================================================================== 12. MOBILE NAVIGATION ========================================================================== */
 .mobile-menu-btn {
     display: none;
     background: none;
     border: none;
     color: black;
     font-size: 24px;
     cursor: pointer;
     margin-left: auto;
    /* Touch optimization */
     touch-action: manipulation;
}
 .mobile-menu-toggle {
     display: none;
}
/* ========================================================================== 13. MOBILE RESPONSIVE STYLES - Keep original mobile behavior ========================================================================== */
 @media (max-width: 768px) {
     .main-nav {
         display:none;
    }
     .mega-footer {
         display: none;
    }
     .mega-column-side-right {
         display: none;
    }
     .nav-container {
         flex-wrap: wrap;
    }
     .mobile-menu-btn {
         display: block;
         order: 3;
    }
     .logo {
         order: 1;
         padding: 0;
    }
     .nav-menu {
         order: 4;
         position: absolute;
         top: 100%;
         left: 0;
         right: 0;
         background-color: #ffffff;
         flex-direction: column;
         width: 100%;
         margin-left: 0;
         display: none;
         box-shadow: var(--shadow-medium);
        /* Mobile optimization */
         transform: translate3d(0, 0, 0);
         contain: layout style;
    }
     .mobile-menu-toggle:checked + .nav-container .nav-menu {
         display: flex;
         height: calc(100vh - var(--nav-height));
    }
     .nav-item {
         width: 100%;
         border-bottom: 1px solid rgba(255, 255, 255, 0.1);
         position: relative;
    }
     .nav-item:last-child {
         border-bottom: none;
    }
     .nav-item:hover .mega-menu, .nav-item:focus-within .mega-menu {
         display: block;
    }
     .nav-link {
         padding: 15px 20px;
         display: block;
         width: 100%;
         text-align: left;
    }
    /* Mobile mega menu - revert to original behavior */
     .mega-menu {
         position: static;
         width: 100%;
         margin-left: 0;
         transform: none;
         display: none;
        /* Reset accordion properties for mobile */
         max-height: none;
         overflow: visible;
         opacity: 0;
         visibility: hidden;
         transition: opacity var(--transition-fast) ease-in, visibility var(--transition-fast) ease-in;
        /* Mobile mega menu optimization */
         contain: layout style paint;
    }
     .mega-content {
         grid-template-columns: 1fr;
         gap: 20px;
         padding: 20px;
         max-width: 100%;
    }
     .academics-mega {
         grid-template-columns: 1fr;
    }
     .nav-item:hover .mega-menu, .nav-item:focus-within .mega-menu {
         display: none !important;
    }
    /* Ensure mega menu shows properly on mobile when activated */
     .nav-item.keyboard-active .mega-menu {
         display: block !important;
         opacity: 1 !important;
         visibility: visible !important;
         transform: none !important;
         position: static !important;
         transition: none !important;
         max-height: none !important;
         overflow: visible !important;
    }
     .nav-item.keyboard-active .nav-link {
         border-bottom: none;
    }
    /* Make sure the nav link is properly clickable */
     .nav-link {
         cursor: pointer;
         touch-action: manipulation;
         border-bottom: 1px solid rgba(0, 0, 0, 0.1);
         transition: transform var(--transition-medium) ease;
    }
    /* Ensure mega menu content is visible */
     .mega-menu .mega-content {
         display: flex !important;
         flex-direction: column;
    }
    /* Fix mega column display on mobile */
     .mega-column {
         width: 100% !important;
         flex: none !important;
         min-width: auto !important;
    }
     .nav-link:focus {
         outline: none !important;
         outline-offset: none !important;
    }
     .nav-link i {
         position: absolute;
         font-size: 23px;
         right: 30px;
    }
}
/* ========================================================================== 14. PERFORMANCE UTILITIES ========================================================================== */
/* Reduce motion for users who prefer it */
 @media (prefers-reduced-motion: reduce) {
     *, *::before, *::after {
         animation-duration: 0.01ms !important;
         animation-iteration-count: 1 !important;
         transition-duration: 0.01ms !important;
    }
}
/* GPU acceleration for key interactive elements */
 .nav-link, .mega-menu, .mega-column, .mega-column a {
     backface-visibility: hidden;
     perspective: 1000px;
}
/* Optimize font rendering */
 .nav-link, .mega-column a, .logo-text {
     font-display: swap;
     text-rendering: optimizeLegibility;
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
}
 @media (min-width: 769px) {
    /* Core accordion styles */
     .mega-menu {
         max-height: none !important;
        /* allow natural height */
         overflow: visible;
        /* let content flow */
        /* slide animation via clip-path (auto‑height) */
         clip-path: inset(0 0 100% 0);
         visibility: hidden;
        /* hidden when clipped */
         transition: clip-path 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.45s;
        /* delay visibility toggle */
         will-change: clip-path;
         z-index: 999;
    }
    /* OPEN – via hover, focus, or JS‑added .keyboard-active */
     .nav-item:hover > .mega-menu, .nav-item:focus-within > .mega-menu, .nav-item.keyboard-active > .mega-menu {
         clip-path: inset(0 0 0 0);
         visibility: visible;
         transition: clip-path 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
    }
    /* Ensure no overlap – close siblings instantly when one opens */
     .nav-item:hover ~ .nav-item > .mega-menu, .nav-item.keyboard-active ~ .nav-item > .mega-menu {
         clip-path: inset(0 0 100% 0);
         visibility: hidden;
         transition: clip-path 0.2s ease-out, visibility 0s linear 0.2s;
    }
}
 @media (max-width: 768px) {
     .nav-menu {
         max-height: 100vh;
         overflow-y: auto;
         -webkit-overflow-scrolling: touch;
    }
     .nav-item.keyboard-active .mega-menu {
         max-height: none !important;
         overflow: visible !important;
    }
}
 