/**
 * Disposition des éléments - Menu principal
 * Pilotage par classe body :
 *  - .mytheme-menu-item-layout--layout_1
 *  - .mytheme-menu-item-layout--layout_2
 *  - .mytheme-menu-item-layout--layout_3
 *
 * Cette feuille ne gère QUE la disposition desktop/mobile
 * sans modifier le comportement du menu mobile.
 */

/* Base */
.mytheme-menu-item-layout .nova-menu__inner {
  position: relative;
}

.mytheme-menu-item-layout .nova-menu__row {
  align-items: center;
}

/* ============================================================
   MOBILE (< 992px)
   On garde le comportement existant inchangé
   [burger] [logo] [icônes]
   puis [menu] en dessous
   ============================================================ */
@media (max-width: 991.98px) {
  .mytheme-menu-item-layout .nova-menu-col-burger  { order: 1 !important; }
  .mytheme-menu-item-layout .nova-menu-col-logo    { order: 2 !important; }
  .mytheme-menu-item-layout .nova-menu-col-actions { order: 3 !important; }
  .mytheme-menu-item-layout .nova-menu-col-nav     { order: 4 !important; }
}

/* ============================================================
   DESKTOP (>= 992px)
   LAYOUT 1 : Logo gauche · Menu centré · Icônes droite
   ============================================================ */
@media (min-width: 992px) {
  .mytheme-menu-item-layout--layout_1 .nova-menu__row {
    flex-wrap: nowrap;
  }

  .mytheme-menu-item-layout--layout_1 .nova-menu-col-logo {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center;
  }

  .mytheme-menu-item-layout--layout_1 .nova-menu-col-nav {
    order: 2 !important;
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
  }

  .mytheme-menu-item-layout--layout_1 .nova-menu-col-actions {
    order: 3 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    margin-left: auto !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center;
  }

  .mytheme-menu-item-layout--layout_1 .nova-menu-col-nav .navbar-collapse {
    width: 100% !important;
    justify-content: center !important;
  }

  .mytheme-menu-item-layout--layout_1 .nova-menu-col-nav .navbar-nav {
    text-align: center !important;
    width: auto !important;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============================================================
   DESKTOP (>= 992px)
   LAYOUT 2 + LAYOUT 3 :
   Menu gauche · Logo centré sur toute la navbar · Icônes droite
   IMPORTANT :
   - Le logo est centré ABSOLUMENT sur .nova-menu__inner
   - left: 50% se calcule sur la largeur intérieure du conteneur,
     donc respecte automatiquement les paddings desktop du Customizer
   ============================================================ */
@media (min-width: 992px) {
  .mytheme-menu-item-layout--layout_2 .nova-menu-col-nav,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-nav {
    order: 1 !important;
  }

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-logo,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-logo {
    order: 2 !important;
    position: absolute !important;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    display: flex !important;
    justify-content: center !important;
    align-items: center;
    width: auto;
    max-width: 40%;
    padding-left: 0;
    padding-right: 0;
    pointer-events: auto;
  }

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-actions,
.mytheme-menu-item-layout--layout_3 .nova-menu-col-actions {
  order: 3 !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center;

  /* Très important :
     on ne laisse plus Bootstrap garder la colonne icônes "au milieu"
     après la sortie du logo du flux.
     On pousse explicitement ce bloc jusqu'au bord droit du conteneur interne. */
  margin-left: auto !important;

  /* On évite que la largeur col-lg-3 continue à imposer une zone trop large
     qui décale visuellement les icônes. */
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
}

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-nav .navbar-collapse,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-nav .navbar-collapse {
    justify-content: flex-start !important;
  }

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-nav .navbar-nav,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-nav .navbar-nav {
    text-align: left !important;
    width: 100% !important;
  }

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-logo .navbar-brand,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-logo .navbar-brand {
    margin: 0 auto;
    max-width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-logo .custom-logo-link,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-logo .custom-logo-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
  }

  .mytheme-menu-item-layout--layout_2 .nova-menu-col-logo img,
  .mytheme-menu-item-layout--layout_3 .nova-menu-col-logo img {
    display: block;
    max-width: 100%;
    height: auto;
  }
}

/* ============================================================
   DESKTOP COMPACT
   Même rendu qu'aujourd'hui tant qu'il y a de la place.
   Quand le contenu déborde, seuls les items du menu passent sur une 2e ligne.
   ============================================================ */
@media (min-width: 992px) {
  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop {
    min-height: auto;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu__inner {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu__row {
    align-items: flex-start;
    min-height: 0;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-logo,
  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-actions {
    align-self: flex-start;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-nav {
    min-width: 0;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-nav .navbar-collapse {
    width: 100%;
    justify-content: center !important;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-nav .navbar-nav {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    flex-wrap: wrap;
    row-gap: 0.35rem;
    gap: 1.2rem !important;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-nav .navbar-nav > .nav-item {
    flex: 0 0 auto;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-nav .nav-link {
    white-space: nowrap;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-actions {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .mytheme-menu-item-layout .nova-menu.nova-menu--compact-desktop .nova-menu-col-actions > * {
    flex: 0 0 auto;
  }
}
