﻿/* ===== Mega Submenu Base ===== */
.navbar .site-menu > ul > li {
    position: relative;
}

/* Panel container (hidden by default) */
.mega-submenu {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-start: 0; /* RTL/LTR aware */
    width: 100vw; /* full width under navbar */
    max-width: 100%;
    padding: 16px 0;
    z-index: 1000;
    /* Ensure it overlays page content under the header */
}

/* Inner card area */
.mega-submenu-inner {
    margin-inline: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
    padding: 24px 28px;
    /* grid for columns */
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 28px;
    /* Constrain to your container width if you use .container */
    width: min(1200px, 92vw);
}

/* Column */
.mega-col {
    min-width: 180px;
}

/* Column title */
.mega-col-title {
    font-weight: 700;
    color: #198754; /* green similar to screenshot */
    margin-bottom: 10px;
    font-size: 1.05rem;
}

/* List in column */
.mega-col-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .mega-col-list li + li {
        margin-top: 10px;
    }

    .mega-col-list a {
        display: inline-flex;
        gap: 8px;
        align-items: center;
        text-decoration: none;
        color: #222;
        font-weight: 500;
    }

        .mega-col-list a:hover {
            color: #0d6efd; /* bootstrap primary-like hover */
        }

    /* External link small icon */
    .mega-col-list .link-ext {
        width: 16px;
        height: 16px;
        opacity: .85;
    }

/* ===== Open on hover (desktop) ===== */
@media (min-width: 992px) {
    .navbar .site-menu > ul > li:hover > .mega-submenu {
        display: block;
    }

    /* Remove old flyout sub-side-menu style if any is still there */
    .navbar .site-menu > ul > li .sub-side-menu {
        display: none !important;
    }
}

/* ===== Mobile/Tablet behavior =====
   We let your existing collapse do the work.
   The panel becomes stacked columns.
*/
@media (max-width: 991.98px) {
    .mega-submenu {
        position: static;
        width: 100%;
        display: block; /* show when parent is expanded in the collapse */
        padding: 0;
    }

    .mega-submenu-inner {
        box-shadow: none;
        border-radius: 0;
        padding: 8px 0 16px;
        width: 100%;
        grid-template-columns: 1fr; /* stack */
        gap: 12px;
    }

    .mega-col-title {
        margin-top: 8px;
    }
}

/* ===== RTL tweaks (Bootstrap sets dir=rtl in your layout) ===== */
html[dir="rtl"] .mega-submenu {
    inset-inline-start: auto;
    inset-inline-end: 0; /* align to the right edge under the navbar */
}


/* ===== Your Figma specs (as provided) ===== */
.DGA-Nav-Sub-Container {
    display: flex;
    /*width: 1440px;*/
    padding: 0 var(--spacing-4xl, 32px);
    flex-direction: column;
    /*align-items: center;*/
    align-items: flex-start;
    background: var(--Background-background-menu, #FFF);
    box-shadow: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
}

.DGA-Nav-Sub-Container-Content {
    display: flex;
    max-width: 1280px;
    padding: var(--spacing-4xl, 32px) 0;
    /*justify-content: flex-end;
    align-items: flex-start;
    align-content: flex-start;*/
    gap: 24px var(--spacing-3xl, 24px);
    /*align-self: stretch;*/
    flex-wrap: wrap;
}

.DGA-Nav-Sub-Container-Content-Sections {
    display: flex;
    min-width: 240px;
    flex-direction: column;
    /*align-items: flex-end;*/
    gap: var(--spacing-lg, 12px);
    flex: 1 0 0;
}

.DGA-Nav-Sub-Container-Content-Sections-GroupLevel {
    display: flex;
    padding: 0 var(--spacing-xl, 16px);
    /*justify-content: flex-end;*/
    align-items: center;
    gap: 8px;
    /*align-self: stretch;*/
    cursor: default;
}

    .DGA-Nav-Sub-Container-Content-Sections-GroupLevel span {
        flex: 1 0 0;
        color: var(--Text-text-primary, #1B8354);
        font-family: var(--Font-Family-font-family-text, "IBM Plex Sans Arabic");
        font-size: var(--Size-Text-typo-size-text-Ig, 18px);
        font-style: normal;
        font-weight: 700;
        line-height: var(--Line-Height-Text-line-heights-text-Ig, 28px);
    }

.DGA-Nav-Sub-Container-Content-Sections-Navigation {
    display: flex;
    flex-direction: column;
    /*align-items: flex-end;*/
    gap: var(--spacing-xs, 4px);
    /*align-self: stretch;*/
}

.DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu {
    display: flex;
    min-width: 240px;
    padding: var(--spacing-md, 8px) var(--spacing-xl, 16px);
    /*justify-content: flex-end;
    align-items: flex-start;*/
    gap: var(--spacing-xl, 16px);
    /*align-self: stretch;*/
}

.DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu-Content {
    display: flex;
    flex-direction: column;
    /*align-items: flex-end;*/
    gap: var(--spacing-lg, 12px);
    flex: 1 0 0;
}

.DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu-Content-Text {
    display: flex;
    flex-direction: row;
    /*align-items: flex-start;*/
    gap: var(--spacing-xs, 4px);
    /*align-self: stretch;*/
    gap: var(--spacing-xl, 16px);
}

    .DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu-Content-Text span {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        overflow: hidden;
        color: var(--Text-text-display, #1F2A37);
        text-align: right;
        text-overflow: ellipsis;
        /* Text md/Medium */
        font-family: var(--Font-Family-font-family-text, "IBM Plex Sans Arabic");
        font-size: var(--Size-Text-typo-size-text-md, 16px);
        font-style: normal;
        font-weight: 500;
        line-height: var(--Line-Height-Text-line-heights-text-md, 24px); /* 150% */
    }

.DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu:hover {
    border-radius: var(--radius-md, 8px);
    background: var(--Button-button-background-neutral-hovered, #F3F4F6);
}

    .DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu:hover span {
        overflow: hidden;
        color: var(--Text-text-display, #1F2A37);
        text-align: right;
        text-overflow: ellipsis;
        /* Text md/Medium underlined */
        font-family: var(--Font-Family-font-family-text, "IBM Plex Sans Arabic");
        font-size: var(--Size-Text-typo-size-text-md, 16px);
        font-style: normal;
        font-weight: 500;
        line-height: var(--Line-Height-Text-line-heights-text-md, 24px); /* 150% */
        text-decoration-line: underline;
        text-decoration-style: solid;
        text-decoration-skip-ink: none;
        text-decoration-thickness: auto;
        text-underline-offset: auto;
        text-underline-position: from-font;
    }

.DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu:focus {
    border-radius: var(--radius-md, 8px);
    border: 2px solid var(--Border-border-black, #161616);
}

    .DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu:focus span {
        overflow: hidden;
        color: var(--Text-text-display, #1F2A37);
        text-align: right;
        text-overflow: ellipsis;
        /* Text md/Medium underlined */
        font-family: var(--Font-Family-font-family-text, "IBM Plex Sans Arabic");
        font-size: var(--Size-Text-typo-size-text-md, 16px);
        font-style: normal;
        font-weight: 500;
        line-height: var(--Line-Height-Text-line-heights-text-md, 24px); /* 150% */
        text-decoration-line: underline;
        text-decoration-style: solid;
        text-decoration-skip-ink: none;
        text-decoration-thickness: auto;
        text-underline-offset: auto;
        text-underline-position: from-font;
    }

.DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu:active {
    border-radius: var(--radius-md, 8px);
    background: var(--Button-button-background-neutral-pressed, #E5E7EB);
}

    .DGA-Nav-Sub-Container-Content-Sections-Navigation-Header-Sub-Menu:active span {
        overflow: hidden;
        color: var(--Text-text-display, #1F2A37);
        text-align: right;
        text-overflow: ellipsis;
        /* Text md/Medium underlined */
        font-family: var(--Font-Family-font-family-text, "IBM Plex Sans Arabic");
        font-size: var(--Size-Text-typo-size-text-md, 16px);
        font-style: normal;
        font-weight: 500;
        line-height: var(--Line-Height-Text-line-heights-text-md, 24px); /* 150% */
        text-decoration-line: underline;
        text-decoration-style: solid;
        text-decoration-skip-ink: none;
        text-decoration-thickness: auto;
        text-underline-offset: auto;
        text-underline-position: from-font;
    }

/* ===== Minimal dropdown mechanics (no design changes) ===== */

/* The top-level li that owns submenu should be relative */
.navbar .site-menu > ul > li {
    position: static;
}
/* allow full-width panel spanning the viewport */

/* Wrapper that appears under header when parent is hovered (desktop) */

.DGA-Nav-Sub-Wrapper {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    /* ❗ This is the important line */
    top: var(--header-height, 105px);
    /* Set this equal to your real header height */

    z-index: 1000;
}


    /* Center the 1440 container */
    .DGA-Nav-Sub-Wrapper .DGA-Nav-Sub-Container {
        margin: 0 auto;
    }


.navbar .site-menu ul li.DGA-Selected-NavBar {
    border-radius: var(--radius-sm, 4px);
    background: var(--Button-button-background-primary-default, #1B8354);
    cursor: pointer;
    text-decoration-line: underline;
    text-decoration-skip-ink: none;
}

    .navbar .site-menu ul li.DGA-Selected-NavBar > a {
        color: var(--Text-text-oncolor-primary, #FFF);
    }

        .navbar .site-menu ul li.DGA-Selected-NavBar > a .Trail-Icon-DGA {
            filter: brightness(0) invert(1);
        }

.navbar .site-menu > ul > li.one-col-menu.DGA-Selected-NavBar::before {
    content: '';
    position: absolute;
    left: 8%;
    bottom: 1px;
    height: 6px;
    width: 84%; /* يظهر دائمًا */
    background: var(--Background-background-primary-400, #54C08A);
    border-radius: var(--radius-sm, 4px);
}






/* Show on hover (lg+) */
@media (min-width: 992px) {
    .navbar .site-menu > ul > li:hover > .DGA-Nav-Sub-Wrapper {
        display: block;
    }
}

/* MOBILE ONLY */
@media (max-width: 991.98px) {

    .navbar .site-menu > ul {
        display: block;
    }

    .navbar .site-menu ul li:not(:has(> a.sub-menu)) {
        display: block;
        padding: 0;
        margin: 0;
        height: 40px;
    }

    /* Hide by default */
    .DGA-Nav-Sub-Wrapper {
        display: none;
        position: sticky;
        width: fit-content;
    }

    /* When li has .open-sub → show submenu */
    .site-menu.show ul li.open-sub > .DGA-Nav-Sub-Wrapper {
        display: block;
    }

    .DGA-Nav-Sub-Container-Content-Sections-Navigation {
        max-height: 250px; /* adjust as needed */
        overflow-y: auto;
        --webkit-overflow-scrolling: touch;
    }
}
