/* ============================  1. Header Layout ============================ */
.mah-header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.5rem 1.5rem;
  flex-wrap: wrap;
  width: 100%;
  position: relative;
  flex-direction: row;
  background-color: #4d004d;
}

.mah-site-logo {
    display: flex;
    align-items: center;
    max-width: 180px;
    height: 60px;
    border-radius: 4px;
    background-color: white;

}

.mah-site-logo img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.mah-site-logo a {
  font-size: 1.25rem;
  font-weight: bold;
  color: #ffffff;
  text-decoration: none;
}

@media (max-width: 768px) {
    .mah-site-logo {
        max-width: 140px;
        height: 50px;
    }
}

.mah-site-logo {
  margin-right: auto;
}

.mah-header-cta a {
  background-color: #fb5607;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
}

.mah-header-cta a:hover {
  background-color: #2c5282;
}

.mah-header-cta {
  margin-left: auto;
  padding-right: 2rem;
}

/* ============================  2. Navigation Core Styles ============================ */
.mah-site-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background-color: #4d004d;
}

.mah-nav-list {
  list-style: none;
  display: flex;
  gap: 1.2rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

/* Shared base link styles for nav/menu/nested links */
.mah-nav-list a,
.mah-menu-group-header > a,
.mah-nested-toggle ul li a {
  text-decoration: none;
  color: #fcb900;
  font-size: 15px;
  display: inline-block;
  transition: transform 0.2s ease;
}


/* Shared hover styles for nav/menu/nested links - desktop only */
@media (hover: hover) and (pointer: fine) {
  .mah-nav-list a:hover,
  .mah-menu-group-header > a:hover,
  .mah-nested-toggle ul li a:hover {
    color: #219ebc;
    text-decoration: none;
    transform: scale(1.05);
  }
}

/* Nav item: align label and arrow horizontally */
.mah-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

/* Dropdown toggle button for mobile and global styling */
.mah-nav-toggle {
  appearance: none;
  background-color: #fcb900;
  border: 1px solid #fcb900;
  border-radius: 50%;
  padding: 0.1rem 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #4d004d;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: background-color 0.2s ease, transform 0.3s ease;
  width: 1.1rem;
  height: 1.1rem;
}

.mah-nav-toggle:hover {
  background-color: #edf2f7;
}

/* ============================  3. Mega Menu Structure ============================ */
/* Mega Menu */
.mah-mega-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  width: 100%;
}

/* Menu Group */
.mah-menu-group {
  display: flex;
  flex-direction: row;
  position: relative;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid #a9b5c4;
}

.mah-menu-group > span,
.mah-menu-group > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
  color: #2d3748;
  text-decoration: none;
}

/* Consistent Menu Group Header Styling */
.mah-menu-group-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.mah-menu-group-header > a,
.mah-menu-group-header > span {
  flex-grow: 1;
  display: flex;
  align-items: center;
  padding-left: 10px;
  text-align: left;
  color: #fcb900;
}

.mah-menu-group-header > a {
  transition: transform 0.2s ease;
}

/* Nested Toggle (Desktop & Mobile) */
.mah-nested-toggle {
  display: none;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: absolute;
  top: 0;
  left: 100%;
  background: #4d004d;
  padding: 1rem;
  /*border: 1px solid #e2e8f0;*/
  min-width: 220px;
  width: auto;
  max-width: 300px;
  z-index: 1001;
  white-space: normal;
  overflow: visible;
}

.mah-nested-toggle ul {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
}

.mah-nested-toggle ul li a {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Submenu ul hidden by default */
.mah-menu-group ul {
  display: none;
  margin: 0;
  padding-left: 1rem;
  list-style: none;
}

.mah-menu-group ul li {
  margin-bottom: 0.35rem;
  border-bottom: 1px solid #a9b5c4;
}

.mah-menu-group ul li a {
  text-decoration: none;
  color: #fcb900;
  font-size: 0.95rem;
}

.mah-menu-group ul li a:hover {
  text-decoration: underline;
  color: #3182ce;
}

/* ============================  4. Dropdown Behavior (Desktop) ============================ */
.mah-nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #4d004d;
  padding: 1rem;
  opacity: 0;
  max-height: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, max-height 0.3s ease, transform 0.3s ease;
  transform-origin: top;
  transform: scaleY(0);
  flex-direction: column;
  gap: 2rem;
  margin-left: 0;
  padding-left: 0;
  z-index: 1050;
}

.mah-nav-dropdown a {
  color: #fcb900;
}

.mah-nav-dropdown a:hover {
  color: #219ebc;
}

/* Show dropdown on hover for desktop */
.mah-nav-item:hover .mah-nav-dropdown {
  display: flex;
  opacity: 1;
  max-height: 1000px;
  pointer-events: auto;
  transform: scaleY(1);
}

/* Desktop nested toggle show */
.mah-menu-group:hover > .mah-nested-toggle {
  display: block;
  opacity: 1;
  transform: scaleY(1);
  z-index: 1001;
}

/* Show nested <ul> inside .mah-nested-toggle on hover of parent .mah-menu-group */
.mah-menu-group:hover .mah-nested-toggle ul {
  display: block;
}

/* ============================  5. Responsive Styles (Mobile) ============================ */
.mah-menu-toggle {
  display: none;
}

@media (max-width: 768px) {
  .mah-header-wrapper {
    flex-wrap: nowrap;
    padding: 1rem;
    gap: 1rem;
  }

  .mah-menu-toggle {
    display: block !important;
    order: 1;
    align-self: flex-start;
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #ffffff;
    padding: 0rem 0.75rem;
    cursor: pointer;
    z-index: 1001;
  }

  .mah-site-logo {
    order: 2;
  }

  .mah-header-cta {
    order: 3;
    text-align: center;
  }

  .mah-header-wrapper > .mah-site-logo {
    text-align: left;
  }

  .mah-header-wrapper > .mah-menu-toggle {
    text-align: right;
  }

  .mah-site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    background-color: #4d004d;
    z-index: 1050;
  }

  .mah-header-wrapper.mah-menu-open .mah-site-nav {
    display: flex;
  }

  .mah-nav-list {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    align-items: flex-start;
  }

  /* Mobile dropdown styles - smooth transition only for mobile main nav dropdown */
  .mah-nav-dropdown {
    display: none !important;
    opacity: 0;
    max-height: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, max-height 0.3s ease;
    position: static;
    flex-direction: column;
    background-color: #4d004d;
    padding: 1.5rem;
    width: 100%;
    height: auto;
    z-index: 999;
    overflow: hidden;
  }

  .mah-nav-dropdown.open {
    display: flex !important;
    opacity: 1;
    max-height: 1000px;
    pointer-events: auto;
  }

  .mah-mega-menu {
    gap: 1rem;
    display: flex;
    flex-direction: column;
  }

  .mah-menu-group {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    border-bottom: none;
    padding-bottom: 0;
  }

  /* ============================  Mobile Menu Group Header Layout ============================ */
  /* Ensure top-level nav items show label left, arrow right, but only for direct .mah-nav-item children */
  .mah-nav-item > .mah-menu-group-header {
    width:350px;
   
  }

  .mah-nav-toggle {
    margin-left: auto;
  }

  /* Nested toggle submenu display for mobile */
  .mah-nested-toggle {
    position: static;
    padding-left: 1rem;
    margin-top: 0.5rem;
    transition: opacity 0.3s ease, max-height 0.3s ease, transform 0.3s ease;
    transform-origin: top;
    transform: scaleY(0);
    display: none;
    opacity: 0;
    background-color: #4d004d;
  }

  .mah-menu-group.show-nested .mah-nested-toggle {
    display: block;
    transform: scaleY(1);
  }

  .mah-menu-group:not(.show-nested) .mah-nested-toggle {
    display: none;
  }

  .mah-nested-toggle ul {
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  /* Mobile overrides for nested toggle links */
  .mah-nested-toggle ul li a {
    font-size: 15px;
  }

  /* Apply bottom border and spacing to top-level and nested menu items in mobile */
  .mah-menu-group-header > a {
    border-bottom: 1px solid #a9b5c4;
    padding-bottom: 0.5rem;
    padding-top: 0.5rem;
    font-size: 18px;
    transition: transform 0.2s ease;
  }
}

@media (min-width: 769px) {
  .mah-menu-toggle {
    display: none !important;
  }

  .mah-nav-list > li > .mah-menu-group-header > a {
    font-size: 18px;
  }
}
.mah-menu-group.show-nested > .mah-menu-group-header > .mah-nav-toggle,
.mah-nav-dropdown.open ~ .mah-menu-group-header > .mah-nav-toggle {
  transform: rotate(180deg);
}
.mah-nav-dropdown.open > .mah-nav-toggle,
.mah-menu-group:hover > .mah-menu-group-header > .mah-nav-toggle {
  transform: rotate(90deg);
}

html, body {
  overflow-x: hidden;
}