/* ====== Custom CSS for Astroid Mega Menu ('เกี่ยวกับคณะ') ====== */

/* 1) ปรับความสูงให้พอดี ไม่ให้มีแถบเลื่อน */
.megamenu-container {
    max-height: none;
    overflow: visible;
}

/* 2) ปรับเฉพาะเมนู 'เกี่ยวกับคณะ' (nav-item-id-107) ให้เป็นแนวตั้ง */
/*    ไม่กระทบเมนู dropdown อื่น (หน่วยงานภายใน, เอกสารเผยแพร่, บริการ) */
.nav-item-id-107.has-megamenu > .megamenu-container {
    width: auto !important;
    min-width: 260px;
    max-width: 400px;
}
.nav-item-id-107.has-megamenu > .megamenu-container > .row {
    display: block !important;
    width: 100%;
}
.nav-item-id-107.has-megamenu > .megamenu-container > .row > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-right: 15px !important;
    padding-left: 15px !important;
}

/* 3) Level-1 items (ข้อมูลทั่วไป, การบริหาร) — แนวตั้ง และระยะห่างเหมือน dropdown ปกติ */
.nav-item-id-107 .megamenu-submenu-level-1 > li.megamenu-menu-item {
    position: relative;
    display: block;
}
.nav-item-id-107 .megamenu-submenu-level-1 > li.megamenu-menu-item > a {
    padding: 5px 15px !important;
    line-height: 2em !important;
}

/* 4) Level-2 (ประวัติความเป็นมา, ปรัชญา ฯลฯ) — ซ่อน, แสดงทางขวา */
.nav-item-id-107 .megamenu-submenu-level-1 > li.megamenu-menu-item > ul.nav-submenu {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 250px;
    z-index: 1004;
    background-color: var(--as-dropdown-bg-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 5) แสดง Level-2 เมื่อ hover */
.nav-item-id-107 .megamenu-submenu-level-1 > li.megamenu-menu-item:hover > ul.nav-submenu {
    display: block !important;
}

/* 6) ซ่อน Level-2 ตอนที่เมาส์ออกจากพื้นที่ */
.nav-item-id-107 .megamenu-submenu-level-1 > li.megamenu-menu-item > ul.nav-submenu:not(:hover) {
    display: none;
}