/**
 * Stylish Dropdown Menu Styles
 * Add this to your theme
 */

/* Desktop Full-Screen Popup Menu - Only for Courses */
@media (min-width: 992px) {
    /* Courses menu needs static positioning for full width */
    .navbar-nav .nav-item.dropdown.menu-open {
        position: static;
    }
    
    /* Other menus use relative positioning */
    .navbar-nav .nav-item.dropdown:not(.menu-open) {
        position: relative;
    }

    .navbar-nav .nav-item.dropdown .nav-link {
        position: relative;
        cursor: pointer;
    }

    .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle::after {
        transition: transform 0.3s ease;
    }

    /* Full-screen menu styles - only applied when menu-open class is present */
    .navbar-nav .nav-item.dropdown.menu-open .nav-link.dropdown-toggle::after {
        transform: rotate(180deg);
    }

    /* Full-screen overlay - only for Courses menu */
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        margin: 0;
        border: none;
        border-radius: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        padding: 120px 60px 60px;
        display: block;
        opacity: 1;
        pointer-events: auto;
        transition: opacity 0.4s ease;
        z-index: 9999;
        overflow-y: auto;
        animation: fadeIn 0.4s ease;
    }

    /* Prevent click-only menus (Courses) from opening on hover */
    .navbar-nav .nav-item.dropdown.click-only-menu:not(.menu-open):hover > .dropdown-menu {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Normal dropdown menu styles - for non-Courses menus */
    .navbar-nav .nav-item.dropdown:not(.menu-open):not(.click-only-menu) .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 0;
        border: none;
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        padding: 8px 0;
        background: #ffffff;
        min-width: 220px;
        display: none;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1000;
    }

    /* Show normal dropdown on hover - but NOT for click-only menus */
    .navbar-nav .nav-item.dropdown:not(.menu-open):not(.click-only-menu):hover > .dropdown-menu {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    /* Normal dropdown items */
    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu > li > .dropdown-item,
    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu > .dropdown-item {
        padding: 10px 20px;
        color: #333;
        font-size: 15px;
        transition: all 0.2s ease;
        display: block;
        white-space: nowrap;
    }

    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu > li > .dropdown-item:hover,
    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu > .dropdown-item:hover {
        background-color: rgba(102, 126, 234, 0.1);
        color: #667eea;
        padding-left: 24px;
    }

    /* Second level dropdown (submenu) */
    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu .dropdown-menu {
        position: absolute;
        top: 0;
        left: 100%;
        margin-left: 0;
        display: none;
        opacity: 0;
    }

    /* Show second level on hover */
    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu li:hover > .dropdown-menu {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    /* Items with submenu indicator */
    .navbar-nav .nav-item.dropdown:not(.menu-open) .dropdown-menu li.dropdown > .dropdown-item::after {
        content: '\203A';
        float: right;
        margin-left: 10px;
        font-size: 18px;
    }

    /* Close button - only for full-screen menu */
    .dropdown-menu .menu-close {
        position: fixed;
        top: 30px;
        right: 40px;
        background: rgba(0, 0, 0, 0.1);
        border: none;
        font-size: 36px;
        color: #333;
        cursor: pointer;
        padding: 10px 20px;
        line-height: 1;
        z-index: 10000;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.3s ease;
    }

    .dropdown-menu .menu-close:hover {
        background-color: rgba(0, 0, 0, 0.2);
        transform: rotate(90deg);
    }

    /* Menu title - only for full-screen menu */
    .dropdown-menu .menu-title {
        font-size: 32px;
        font-weight: 700;
        color: #333;
        margin-bottom: 40px;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 2px;
    }

    /* Container for menu items - only for full-screen menu */
    .dropdown-menu .menu-items-container {
        max-width: 1400px;
        margin: 0 auto;
        column-count: 4;
        column-gap: 40px;
    }

    /* Nested dropdown menus inside full-screen popup */
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-menu {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        background: transparent !important;
        backdrop-filter: none !important;
        padding: 0 0 0 20px !important;
        margin: 8px 0 !important;
        height: auto !important;
        width: auto !important;
        box-shadow: none !important;
        border-left: 3px solid rgba(102, 126, 234, 0.3);
    }

    /* Prevent column breaks inside items and nested menus */
    .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item,
    .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-menu {
        break-inside: avoid;
        page-break-inside: avoid;
        -webkit-column-break-inside: avoid;
    }

    /* Full-screen menu items */
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item {
        padding: 16px 24px;
        color: #333;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        border-radius: 8px;
        margin-bottom: 8px;
        display: block;
        width: 100%;
        background: rgba(255, 255, 255, 0.5);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Nested dropdown items styling in full-screen */
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-menu .dropdown-item {
        padding: 12px 20px;
        font-size: 15px;
        font-weight: 400;
        background: rgba(255, 255, 255, 0.3);
        margin-bottom: 6px;
    }

    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 4px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    /* Nested items - smaller accent bar */
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-menu .dropdown-item::before {
        width: 3px;
    }

    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item:hover,
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item:focus {
        background-color: rgba(102, 126, 234, 0.1);
        color: #667eea;
        padding-left: 28px;
        transform: translateX(4px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    /* Nested items hover in full-screen */
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-menu .dropdown-item:hover,
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-menu .dropdown-item:focus {
        padding-left: 24px;
        transform: translateX(2px);
    }

    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item:hover::before,
    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item:focus::before {
        transform: translateX(0);
    }

    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item:active {
        background-color: rgba(102, 126, 234, 0.15);
    }

    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-item.active {
        background-color: rgba(102, 126, 234, 0.12);
        color: #667eea;
        font-weight: 600;
    }

    .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-divider {
        margin: 8px 0;
        border-color: rgba(0, 0, 0, 0.1);
    }

    .navbar-nav .nav-item.dropdown.menu-open .dropdown-menu .dropdown-divider {
        margin: 16px 0;
        break-inside: avoid;
        page-break-inside: avoid;
        -webkit-column-break-inside: avoid;
    }

    /* Adjust column count based on screen size */
    @media (max-width: 1400px) {
        .dropdown-menu .menu-items-container {
            column-count: 3;
        }
    }

    @media (max-width: 1100px) {
        .dropdown-menu .menu-items-container {
            column-count: 2;
        }
    }

    /* Adjust for smaller number of items */
    .navbar-nav .nav-item.dropdown .dropdown-menu.mega-menu-small .menu-items-container {
        column-count: 2;
        max-width: 800px;
    }

    .navbar-nav .nav-item.dropdown .dropdown-menu.mega-menu-large .menu-items-container {
        column-count: 5;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Sidebar Menu Styles */
@media (max-width: 991px) {
    #navbar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
        transition: left 0.3s ease-in-out;
        z-index: 1050;
        overflow-y: auto;
        padding: 60px 0 20px 0;
    }

    #navbar.show {
        left: 0;
    }

    #navbar .navbar-nav {
        flex-direction: column;
        width: 100%;
        margin: 0 !important;
    }

    #navbar .navbar-nav .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    #navbar .navbar-nav .nav-item .nav-link {
        padding: 16px 20px;
        color: #ffffff !important;
        transition: all 0.2s;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 15px;
        font-weight: 500;
    }

    #navbar .navbar-nav .nav-item .nav-link:hover,
    #navbar .navbar-nav .nav-item .nav-link:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff !important;
    }

    #navbar .navbar-nav .nav-item .nav-link.dropdown-toggle::after {
        margin-left: auto;
        transition: transform 0.3s ease;
        border-top-color: #ffffff;
    }

    #navbar .navbar-nav .nav-item.dropdown.open .nav-link.dropdown-toggle::after {
        transform: rotate(180deg);
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin: 0;
        border: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 0;
        padding: 0;
        display: none;
        transform: none !important;
        animation: slideDown 0.3s ease;
        left: auto !important;
        top: auto !important;
        z-index: 1055;
        pointer-events: auto;
    }

    #navbar .navbar-nav .nav-item.dropdown.open .dropdown-menu {
        display: block !important;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu::before,
    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu::after {
        display: none;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item {
        padding: 14px 20px 14px 40px;
        color: #ffffff !important;
        font-size: 14px;
        border-left: 3px solid transparent;
        transition: all 0.2s ease;
        position: relative;
        white-space: normal;
        background: transparent;
        display: block;
        width: 100%;
        text-align: left;
        cursor: pointer;
        pointer-events: auto;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item a {
        color: #ffffff !important;
        text-decoration: none;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item::before {
        /* content: '›';
        position: absolute;
        left: 20px;
        color: rgba(255, 255, 255, 0.6);
        font-size: 20px;
        font-weight: bold;
        transition: all 0.2s ease; */
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item:hover,
    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.15);
        border-left-color: #ffffff;
        color: #ffffff !important;
        padding-left: 45px;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item:hover::before,
    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item:focus::before {
        left: 25px;
        color: #ffffff;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-item.active {
        background-color: rgba(255, 255, 255, 0.2);
        border-left-color: #ffffff;
        color: #ffffff !important;
        font-weight: 500;
    }

    #navbar .navbar-nav .nav-item.dropdown .dropdown-menu .dropdown-divider {
        margin: 0;
        border-color: rgba(255, 255, 255, 0.1);
    }

    #navbar .navbar-nav .nav-item.dropdown .nav-link[aria-expanded="true"] {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff !important;
    }

    #navbar .search-form {
        margin: 20px;
        min-width: auto;
    }

    #navbar .search-form .form-control {
        background-color: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.3);
        color: #ffffff;
    }

    #navbar .search-form .form-control::placeholder {
        color: rgba(255, 255, 255, 0.7);
    }

    #navbar .search-form .btn {
        background-color: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.3);
        color: #ffffff;
    }

    .navbar-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        font-size: 32px;
        color: #ffffff;
        cursor: pointer;
        padding: 5px 10px;
        line-height: 1;
        z-index: 1051;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        transition: all 0.2s;
    }

    .navbar-close:hover {
        background-color: rgba(255, 255, 255, 0.3);
        color: #ffffff;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            max-height: 0;
        }
        to {
            opacity: 1;
            max-height: 1000px;
        }
    }
}
