/* ============================================================
   HY Mega Menu — theme_almondb
   ============================================================ */

/* ── Hide Moodle's entire primary moremenu nav (we rebuild manually) ── */
.primary-navigation .moremenu-container,
.primary-navigation [data-region="moremenu"] {
    display: none !important;
}

/* ── Primary nav container — centered between logo and search ── */
.primary-navigation {
    flex: 1 1 auto !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
}

/* ── Manual nav links — same style for all items, no border ── */
.hy-nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: inherit !important;
    text-decoration: none !important;
    padding: 6px 12px;
    border-radius: 4px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    white-space: nowrap;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
    background: none !important;
    cursor: pointer;
}

.hy-nav-link:hover,
.hy-nav-link:focus {
    background: rgba(255,255,255,0.12) !important;
    text-decoration: none !important;
    color: inherit !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ── Home dropdown wrapper ── */
.hy-nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Show dropdown on hover ── */
.hy-nav-dropdown:hover .hy-nav-dropdown-panel {
    display: block;
}

.hy-nav-dropdown-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.13);
    border: 1px solid #e2e8f0;
    padding: 6px 0;
    z-index: 1060;
    /* Small invisible bridge to prevent gap between button and panel */
    margin-top: 0;
}

/* Invisible hover bridge so mouse can travel to panel */
.hy-nav-dropdown-panel::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.hy-nav-dropdown-panel.is-open {
    display: block;
}

.hy-nav-dropdown-panel a {
    display: block;
    padding: 8px 18px;
    font-size: 0.85rem;
    color: #333 !important;
    text-decoration: none !important;
    transition: background 0.12s, color 0.12s;
    border: none !important;
}

.hy-nav-dropdown-panel a:hover {
    background: #f0f7ff;
    color: #4a7fa5 !important;
}

/* ── Chevron ── */
.hy-nav-chevron {
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    transition: transform 0.22s;
    flex-shrink: 0;
}

.hy-nav-dropdown:hover .hy-nav-chevron {
    transform: rotate(180deg);
}

.hy-nav-link[aria-expanded="true"] .hy-nav-chevron {
    transform: rotate(180deg);
}

/* ── Contact link — same as other nav links ── */
.hy-nav-contact-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: inherit !important;
    text-decoration: none !important;
    padding: 6px 12px;
    border-radius: 4px;
    border: none !important;
    white-space: nowrap;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
}

.hy-nav-contact-link:hover {
    background: rgba(255,255,255,0.12);
    text-decoration: none !important;
    color: inherit !important;
}

/* ── Mega Menu Wrapper ── */
.hy-megamenu-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Show mega menu on hover ── */
.hy-megamenu-wrapper:hover .hy-megamenu-panel {
    display: block;
    pointer-events: all;
}

.hy-megamenu-wrapper:hover .hy-nav-chevron {
    transform: rotate(180deg);
}

/* ── Mega Menu Trigger ── */
.hy-megamenu-trigger {
    font-size: 0.9rem;
    font-weight: 500;
    color: inherit !important;
    white-space: nowrap;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 24px 12px;
    text-decoration: none !important;
    line-height: 1.4;
    border-radius: 4px;
    transition: background 0.15s;
}

.hy-megamenu-trigger:hover,
.hy-megamenu-trigger:focus,
.hy-megamenu-trigger[aria-expanded="true"] {
    background: rgba(255,255,255,0.12) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ── Backdrop ── */
.hy-megamenu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1040;
}

.hy-megamenu-backdrop.is-open {
    display: block;
}

/* ── Panel ── */
.hy-megamenu-panel {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #ffffff;
    border-top: 3px solid #4a7fa5;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    pointer-events: none;
    overflow-y: auto;
    max-height: calc(100vh - 70px);
}

.hy-megamenu-panel.is-open {
    display: block;
    pointer-events: all;
}

/* Invisible hover bridge so mouse can travel down to panel */
.hy-megamenu-wrapper::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

/* ── Body ── */
.hy-megamenu-body {
    padding: 28px 0 24px;
}

/* ── Inner grid: strict 4 columns ── */
.hy-megamenu-inner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-flow: row dense;
    gap: 28px 36px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}

/* ── Column ── */
.hy-megamenu-col {
    min-width: 0;
    width: 100%;
}

/* ── Category heading ── */
.hy-megamenu-cat-title {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #1a1a2e !important;
    margin-bottom: 10px;
    text-decoration: none !important;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
    z-index: 1051;
}

.hy-megamenu-cat-title:hover {
    color: #4a7fa5 !important;
}

/* ── Course list ── */
.hy-megamenu-course-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.hy-megamenu-course-list li {
    margin-bottom: 1px;
}

/* ── Course link ── */
.hy-megamenu-course-link {
    font-size: 0.82rem;
    color: #4a5568 !important;
    text-decoration: none !important;
    display: block;
    padding: 4px 6px;
    line-height: 1.45;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s, padding-left 0.15s;
    position: relative;
    z-index: 1051;
    cursor: pointer;
}

.hy-megamenu-course-link:hover {
    color: #4a7fa5 !important;
    background: #f0f7ff;
    padding-left: 10px;
    text-decoration: none !important;
}

/* ── View All ── */
.hy-megamenu-viewall-item {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #e2e8f0;
}

.hy-megamenu-viewall-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a7fa5 !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    position: relative;
    z-index: 1051;
}

.hy-megamenu-viewall-link:hover {
    text-decoration: underline !important;
    color: #2d6a8f !important;
}

/* ── Footer bar ── */
.hy-megamenu-footer {
    margin-top: 0;
    padding: 14px 40px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.hy-megamenu-footer-text {
    font-size: 0.83rem;
    color: #718096;
    margin: 0;
}

.hy-megamenu-footer-link {
    font-size: 0.83rem;
    font-weight: 600;
    color: #4a7fa5 !important;
    text-decoration: none !important;
    position: relative;
    z-index: 1051;
}

.hy-megamenu-footer-link:hover {
    text-decoration: underline !important;
}

/* ── Hide Moodle's default Courses nav item ── */
.primary-navigation .nav-item:has(a[href*="/course/index.php"]) {
    display: none !important;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 991.98px) {

 



    .primary-navigation {
        justify-content: flex-start !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .hy-megamenu-wrapper { width: 100%; }

    /* On mobile keep click behavior, disable hover */
    .hy-megamenu-wrapper:hover .hy-megamenu-panel {
        display: none;
    }
    .primary-navigation {

        display: none !important;
     
    }
    .hy-nav-dropdown:hover .hy-nav-dropdown-panel {
        display: none;
    }

    .hy-nav-link,
    .hy-megamenu-trigger,
    .hy-nav-contact-link {
        width: 100%;
        justify-content: space-between;
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.15) !important;
    }

    .hy-nav-dropdown {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .hy-nav-dropdown-panel {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: rgba(0,0,0,0.08);
        width: 100%;
        padding: 0;
        margin-top: 0;
    }

    .hy-nav-dropdown-panel a {
        color: rgba(255,255,255,0.85) !important;
        padding: 10px 24px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .hy-nav-dropdown-panel a:hover {
        background: rgba(255,255,255,0.1);
        color: #fff !important;
    }

    .hy-megamenu-panel {
        position: static !important;
        border-top: none;
        box-shadow: none;
        background: rgba(0,0,0,0.08);
        pointer-events: all;
        max-height: none;
        overflow-y: visible;
    }

    .hy-megamenu-body { padding: 0; }

    .hy-megamenu-inner {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
        max-width: 100%;
    }

    .hy-megamenu-col {
        padding: 14px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .hy-megamenu-cat-title {
        font-size: 0.78rem;
        color: rgba(255,255,255,0.6) !important;
        border-bottom-color: rgba(255,255,255,0.15);
    }

    .hy-megamenu-course-link {
        color: rgba(255,255,255,0.85) !important;
        padding: 5px 4px;
    }

    .hy-megamenu-course-link:hover {
        background: rgba(255,255,255,0.1);
        color: #fff !important;
    }

    .hy-megamenu-viewall-link { color: #7ec8e3 !important; }

    .hy-megamenu-footer { display: none; }

    .hy-megamenu-backdrop { display: none !important; }
}
@media(max-width: 500px){
    .navbar.fixed-top .navbar-brand .logo{
        max-height: 35px !important;
    }
}