/*
 * Méga-menu des formations.
 *
 * Le menu empilait trois niveaux de survol — type, puis cycle, puis filière —
 * pour atteindre l'une des quarante filières. Il fallait garder le pointeur
 * sur une ligne de vingt pixels pendant toute la traversée, et au doigt
 * c'était impraticable. Tout tient maintenant dans un seul panneau.
 */

:root {
  --mm-encre: #14243a;
  --mm-bleu: #1f5793;
  --mm-or: #c8a04a;
}

/* Le panneau occupe la largeur utile plutôt qu'une colonne étroite. */
.mega-formations .dropdown-menu {
  width: min(1080px, calc(100vw - 40px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 22px 48px rgba(20, 36, 58, .18);
  overflow: hidden;
}

.mega-panneau {
  padding: 26px 28px 0;
  background: #fff;
  /* Quarante filières ne tiennent pas toujours à l'écran : le panneau défile
     plutôt que de déborder sous le pli. */
  max-height: min(72vh, 620px);
  overflow-y: auto;
}

.mega-colonnes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px 30px;
  padding-bottom: 22px;
}

.mega-colonne { min-width: 0; }

.mega-type {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mm-bleu);
  text-decoration: none;
  padding-bottom: 9px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--mm-or);
}

.mega-type:hover { color: var(--mm-encre); }

.mega-cycle { margin-bottom: 16px; }
.mega-cycle:last-child { margin-bottom: 4px; }

.mega-cycle-nom {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--mm-encre);
  margin-bottom: 6px;
}

.mega-filieres { list-style: none; margin: 0; padding: 0; }

.mega-filieres a {
  display: block;
  padding: 5px 9px 5px 13px;
  font-size: .85rem;
  line-height: 1.4;
  color: #475467;
  text-decoration: none;
  border-radius: 7px;
  position: relative;
  transition: background .15s ease, color .15s ease;
}

/* Une puce discrète tient lieu de tiret : le libellé n'a plus à en porter. */
.mega-filieres a::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #cbd2da;
  transition: background .15s ease;
}

.mega-filieres a:hover {
  background: #eef3f9;
  color: var(--mm-bleu);
}

.mega-filieres a:hover::before { background: var(--mm-or); }

.mega-aucune {
  display: block;
  font-size: .82rem;
  color: #98a2b3;
  font-style: italic;
  padding-left: 13px;
}

/* --------------------------------------------------------------- Le pied */

.mega-pied {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin: 0 -28px;
  padding: 14px 28px;
  background: #f7f9fc;
  border-top: 1px solid #e4e7ec;
}

.mega-pied a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .87rem;
  font-weight: 600;
  color: var(--mm-bleu);
  text-decoration: none;
}

.mega-pied a:hover { color: var(--mm-encre); }

.mega-appel {
  margin-left: auto;
  background: var(--mm-or);
  color: var(--mm-encre) !important;
  border-radius: 30px;
  padding: 8px 18px;
}

.mega-appel:hover { filter: brightness(1.07); }

/* Sur petit écran le thème replie le menu dans un tiroir : le panneau
   redevient une simple liste, sans hauteur imposée ni pied collant. */
@media (max-width: 991px) {
  .mega-formations .dropdown-menu {
    width: 100%;
    box-shadow: none;
    border-radius: 0;
  }

  .mega-panneau { padding: 14px 16px 0; max-height: none; overflow: visible; }
  .mega-colonnes { grid-template-columns: 1fr; gap: 18px; }
  .mega-pied { position: static; margin: 0 -16px; padding: 12px 16px; }
  .mega-appel { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mega-filieres a, .mega-filieres a::before { transition: none; }
}
