/* ----- Base ----- */
.custom-menu-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0;
}

.custom-menu-wrapper .mod-menu {
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

.custom-menu-wrapper .mod-menu li {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
}

/* ----- Liens principaux ----- */
.custom-menu-wrapper .mod-menu li.metismenu-item > a,
.custom-menu-wrapper .mod-menu li.metismenu-item > button {
  color: #84948D !important;
  font-weight: normal;
  padding: 0.6rem 1.2rem;
  border-radius: 3rem;
  transition: background-color 0.3s ease;
}

/* Lien actif direct */
.custom-menu-wrapper .mod-menu li.metismenu-item.active > a,
.custom-menu-wrapper .mod-menu li.metismenu-item.current > a {
  color: black !important;
  font-weight: bold !important;
}

/* Parent d’un actif */
.custom-menu-wrapper .mod-menu li.metismenu-item.active > a:has(+ ul),
.custom-menu-wrapper .mod-menu li.metismenu-item.current > a:has(+ ul) {
  color: black !important;
  font-weight: bold !important;
}

/* Ancêtres contenant un actif */
.custom-menu-wrapper .mod-menu li.metismenu-item:has(li.active) > a,
.custom-menu-wrapper .mod-menu li.metismenu-item:has(li.current) > a {
  color: black !important;
  font-weight: bold !important;
}

/* Hover */
.custom-menu-wrapper .mod-menu li.metismenu-item > a:hover,
.custom-menu-wrapper .mod-menu li.metismenu-item > button:hover {
  background-color: #FFD147 !important;
  color: black !important;
}

/* ----- Dropdown principal ----- */
.custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent > ul {
  position: absolute;
  left: 0;
  top: 100%;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  min-width: 200px;
  z-index: 1000;
}

/* Affichage au hover sur desktop */
.custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent:hover > ul {
  display: block;
}

/* Dropdown secondaire (sous-sous-menus) */
.custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent > ul li.metismenu-item > ul {
  position: absolute;
  left: 93%;
  top: 0;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  min-width: 200px;
  z-index: 1000;
}

.custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent > ul li.metismenu-item:hover > ul {
  display: block;
}

/* Liens dans les dropdowns */
.custom-menu-wrapper .mod-menu li.metismenu-item > ul li a {
  display: block;
  width: 100%;
  padding: 0.6rem 1.2rem;
  background-color: transparent !important;
  color: black !important;
  border-radius: 0 !important;
  transition: background-color 0.3s ease;
}

.custom-menu-wrapper .mod-menu li.metismenu-item > ul li a:hover {
  background-color: #B9EFDC !important;
  color: black !important;
  border-radius: 0 !important;
}

/* ----- Comportement JS sur les titres de menu actifs ----- */
.custom-menu-wrapper .mod-menu__heading.heading-active {
  font-weight: bold !important;
  color: black !important;
}

/* ----- Mobile ----- */
@media (max-width: 768px) {
  .custom-menu-wrapper .mod-menu {
    flex-direction: column;
    align-items: center;
  }

  .custom-menu-wrapper .mod-menu li {
    margin: 0.5rem 0;
    text-align: center;
  }

  /* Dropdowns masqués par défaut */
  .custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent > ul,
  .custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent > ul li.metismenu-item > ul {
    position: static !important;
    display: none;
    background: none;
    padding: 0;
    margin: 0;
  }

  /* Dropdowns ouverts via JS (.open) */
  .custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent.open > ul,
  .custom-menu-wrapper .mod-menu li.metismenu-item.deeper.parent > ul li.metismenu-item.open > ul {
    display: block !important;
  }
}

/* ----- Tablette ----- */
@media (min-width: 768px) and (max-width: 1024px) {
  .custom-menu-wrapper .mod-menu {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }

  .custom-menu-wrapper .mod-menu li {
    padding: 0.6rem 1.2rem;
    box-sizing: border-box;
  }
}
