/* ==========================================================================
   IHNA Online – Courses mega menu (both headers)
   Markup: template-parts/header/courses-megamenu.php · JS: assets/js/megamenu.js
   Stacking: the panel sits at z-index 1045 – above the sticky course-page
   sub-navs (999), Bootstrap dropdowns (1000) and the fixed home navbar (1030),
   below Bootstrap modal backdrops (1050) so the "Enquire now" modal still covers it.
   ========================================================================== */

.ihm-mega-item { position: relative; }
.ihm-mega-item > .ihm-mega-toggle { cursor: pointer; }
.ihm-mega-item > .ihm-mega-toggle.dropdown-toggle::after { transition: transform .25s ease; }
.ihm-mega-item.is-open > .ihm-mega-toggle.dropdown-toggle::after { transform: rotate(180deg); }

.ihm-mega {
  --ihm-teal: #009690; --ihm-teal-700: #036d69; --ihm-teal-900: #024946;
  --ihm-mint: #cfeceb; --ihm-tint: #eef8f7; --ihm-orange: #f7941d; --ihm-ink: #2d2c2a; --ihm-muted: #4a4846;
  display: none;
  font-family: "Almarai", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ihm-ink); text-align: left; line-height: 1.45;
}
.ihm-mega *, .ihm-mega *::before, .ihm-mega *::after { box-sizing: border-box; }
.ihm-mega p, .ihm-mega ul { margin: 0; padding: 0; }
.ihm-mega ul { list-style: none; }
.ihm-mega span { color: inherit; } /* theme style.css sets span{color:black} */
.ihm-mega svg { display: block; flex: none; }

.ihm-mega__inner {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(0, 1fr); gap: 0;
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 28px 70px rgba(2, 40, 38, .22), 0 2px 6px rgba(2, 40, 38, .08);
  border: 1px solid rgba(2, 73, 70, .08);
}

/* intro panel */
.ihm-mega__intro {
  position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 10px; padding: 28px 26px; color: #fff;
  background: radial-gradient(260px 200px at 100% 0%, rgba(247, 148, 29, .30), transparent 70%), linear-gradient(160deg, #013a38 0%, #024946 50%, #036d69 100%);
}
.ihm-mega__intro::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .12; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .9) 1px, transparent 1.4px); background-size: 18px 18px;
}
.ihm-mega__eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #9fdcd9; }
.ihm-mega__eyebrow::before { content: ""; width: 22px; height: 3px; border-radius: 3px; background: var(--ihm-orange); }
.ihm-mega__title { font-size: 1.5rem; font-weight: 800; line-height: 1.15; color: #fff; }
.ihm-mega__text { font-size: .92rem; color: #d9f0ee; }
.ihm-mega__actions { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ihm-mega__btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ihm-orange); color: var(--ihm-ink); font: inherit; font-weight: 800; font-size: .92rem;
  box-shadow: 0 8px 18px rgba(247, 148, 29, .3); transition: transform .2s ease, background-color .2s ease;
}
.ihm-mega__btn:hover { background: #ffa431; transform: translateY(-1px); }
.ihm-mega__call { display: inline-flex; align-items: center; gap: 8px; color: #fff !important; font-weight: 700; font-size: .95rem; text-decoration: none; }
.ihm-mega__call:hover { text-decoration: underline; text-underline-offset: 3px; }
.ihm-mega__call svg { color: var(--ihm-orange); }

/* course columns */
.ihm-mega__col { padding: 24px 22px 22px; min-width: 0; }
.ihm-mega__col + .ihm-mega__col { border-left: 1px solid #e6eeed; }
.ihm-mega__head { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; margin-bottom: 8px !important; border-bottom: 1px solid #e6eeed; font-size: .98rem; font-weight: 800; color: var(--ihm-teal-900); }
.ihm-mega__icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--ihm-mint); color: var(--ihm-teal-700); flex: none; }
.ihm-mega__col:nth-of-type(3) .ihm-mega__icon { background: #fde3c2; color: #8a4b00; }
.ihm-mega__count { margin-left: auto; min-width: 26px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--ihm-tint); color: var(--ihm-teal-700); font-size: .78rem; display: inline-grid; place-items: center; }
.ihm-mega__list { display: grid; gap: 4px; }
.ihm-mega__link {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "code go" "name go"; align-items: center; gap: 2px 10px;
  padding: 10px 10px 10px 12px; border-radius: 12px; text-decoration: none !important; color: var(--ihm-ink) !important;
  transition: background-color .2s ease, transform .2s ease;
}
.ihm-mega__link::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--ihm-orange); transform: scaleY(0); transition: transform .2s ease; }
.ihm-mega__code { grid-area: code; justify-self: start; font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: var(--ihm-teal-700); background: var(--ihm-tint); border-radius: 5px; padding: 2px 7px; }
.ihm-mega__name { grid-area: name; font-size: .95rem; font-weight: 700; line-height: 1.35; }
.ihm-mega__go { grid-area: go; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--ihm-teal-700); opacity: 0; transform: translateX(-6px); transition: opacity .2s ease, transform .2s ease, background-color .2s ease; }
.ihm-mega__link:hover, .ihm-mega__link:focus-visible { background: var(--ihm-tint); }
.ihm-mega__link:hover::before, .ihm-mega__link:focus-visible::before, .ihm-mega__link.is-current::before { transform: scaleY(1); }
.ihm-mega__link:hover .ihm-mega__go, .ihm-mega__link:focus-visible .ihm-mega__go { opacity: 1; transform: none; background: #fff; }
.ihm-mega__link:hover .ihm-mega__name { color: var(--ihm-teal-900); }
.ihm-mega__link.is-current { background: var(--ihm-tint); }
.ihm-mega a:focus-visible, .ihm-mega button:focus-visible { outline: 3px solid var(--ihm-orange); outline-offset: 2px; }

/* ---------- desktop: floating panel ---------- */
@media (min-width: 992px) {
  .ihm-mega {
    display: block; position: absolute; top: 100%; left: 0; z-index: 1045;
    width: min(900px, calc(100vw - 32px)); padding-top: 14px; /* padding = hover bridge between link and panel */
    opacity: 0; visibility: hidden; transform: translateY(10px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }
  .ihm-mega-item.is-open > .ihm-mega { opacity: 1; visibility: visible; transform: none; transition: opacity .22s ease, transform .22s ease, visibility 0s; }
  .ihm-mega__arrow { position: absolute; top: 7px; width: 16px; height: 16px; background: #fff; transform: rotate(45deg); border-radius: 3px 0 0 0; border: 1px solid rgba(2, 73, 70, .08); border-right: 0; border-bottom: 0; }
  .ihm-mega-item.is-open .ihm-mega__list li { animation: ihm-in .35s ease both; }
  .ihm-mega-item.is-open .ihm-mega__list li:nth-child(2) { animation-delay: .04s; }
  .ihm-mega-item.is-open .ihm-mega__list li:nth-child(3) { animation-delay: .08s; }
  .ihm-mega-item.is-open .ihm-mega__list li:nth-child(4) { animation-delay: .12s; }
  .ihm-mega-item.is-open .ihm-mega__list li:nth-child(5) { animation-delay: .16s; }
}
@media (min-width: 992px) and (max-width: 1100px) {
  .ihm-mega__inner { grid-template-columns: 210px minmax(0, 1fr) minmax(0, 1fr); }
  .ihm-mega__intro { padding: 24px 20px; }
}

/* ---------- tablet / phone: inline accordion inside the collapsed navbar ---------- */
@media (max-width: 991.98px) {
  .ihm-mega { position: static; width: 100%; margin: 6px 0 12px; }
  .ihm-mega-item.is-open > .ihm-mega { display: block; animation: ihm-in .25s ease both; }
  .ihm-mega__arrow { display: none; }
  .ihm-mega__inner { grid-template-columns: 1fr; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
  .ihm-mega__intro { order: 3; padding: 18px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
  .ihm-mega__eyebrow, .ihm-mega__text { display: none; }
  .ihm-mega__title { font-size: 1.05rem; flex: 1 1 100%; }
  .ihm-mega__actions { margin-top: 0; padding-top: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ihm-mega__col { padding: 16px 14px 12px; }
  .ihm-mega__col + .ihm-mega__col { border-left: 0; border-top: 1px solid #e6eeed; }
  .ihm-mega__go { opacity: 1; transform: none; }
  .ihm-mega__link { padding: 10px; }
}
/* home page: its navbar is fixed, so let the opened mobile menu scroll instead of running off the screen */
@media (max-width: 991.98px) {
  #front-page-header .navbar-collapse.show, #front-page-header .navbar-collapse.collapsing {
    max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
}

/* home page phones: its menu has extra side padding – let the course panel use that width */
@media (max-width: 575.98px) {
  #front-page-header .ihm-mega { margin-left: -1rem; margin-right: -1rem; width: calc(100% + 2rem); }
}
/* phones/tablets: hide the floating quick-action buttons while the courses list is open so they never sit over it */
@media (max-width: 991.98px) {
  body.ihm-mega-open .floating-btn-container { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }
}
/* desktop: on short or zoomed-in screens the panel scrolls inside itself instead of running off the bottom */
@media (min-width: 992px) {
  .ihm-mega__inner.is-scroll { overflow-y: auto; overscroll-behavior: contain; }
  .ihm-mega__inner.is-scroll .ihm-mega__intro { position: sticky; top: 0; align-self: start; min-height: 100%; }
}

@keyframes ihm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ihm-mega, .ihm-mega *, .ihm-mega-item > .ihm-mega-toggle::after { transition: none !important; animation: none !important; }
}
