/**
 * Menu principal Fusion — aligné sur somef-foundation.css + home-fusion-variables-bridge.css
 * (plus de #004b9b / blocs blancs « carte » sur header-top : même fond que la bande logo + menu)
 */

/* --- Bande menu : fusion avec header-top (pas de carte blanche) --- */
#header .header-top #_desktop_top_menu.somef-fusion-menu,
#_desktop_top_menu.somef-fusion-menu {
  background: transparent !important;
  border-bottom: none !important;
  box-shadow: none !important;
  padding: 0;
  margin: 0;
  position: relative;
  width: 100%;
  font-family: var(--font-family-primary, inherit);
}

/* Rester visuellement dans le flux Fusion : largeur type pages modernized */
#header .header-top > .container {
  max-width: min(100%, var(--container-xxl, 1320px)) !important;
  padding-left: var(--spacing-md, 16px) !important;
  padding-right: var(--spacing-md, 16px) !important;
}

#header .header-top .header-top-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 3.25rem;
}

.somef-fusion-menu #top-menu {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.somef-fusion-menu #top-menu > li {
  position: static;
  margin: 0;
  padding: 0;
}

/* Liens : typographie & couleurs Fusion */
.somef-fusion-menu #top-menu > li > a.dropdown-item {
  color: var(--color-accent-blue, #2b3c45) !important;
  font-weight: 600 !important;
  padding: 0.65rem 0.85rem !important;
  display: block !important;
  font-size: var(--font-size-small, 0.875rem) !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.25;
  transition: color var(--somef-transition, 0.2s ease),
    background var(--somef-transition, 0.2s ease);
  background: transparent !important;
  border: none !important;
  border-radius: var(--border-radius-md, 8px) !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.somef-fusion-menu #top-menu > li:hover > a.dropdown-item {
  color: var(--color-primary, #d33343) !important;
  background: rgba(211, 51, 67, 0.07) !important;
}

.somef-fusion-menu #category-produits.somef-open > a.dropdown-item,
.somef-fusion-menu #category-solutions.somef-open > a.dropdown-item,
.somef-fusion-menu #category-produits:focus-within > a.dropdown-item,
.somef-fusion-menu #category-solutions:focus-within > a.dropdown-item {
  color: var(--color-primary, #d33343) !important;
  background: rgba(211, 51, 67, 0.07) !important;
}

/* --- Méga-menu PRODUITS --- */
.somef-fusion-menu .mega-menu-wrapper {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 100vw;
  max-width: none;
  box-sizing: border-box;
  background: var(--color-bg, #ffffff);
  border-top: 3px solid var(--color-primary, #d33343);
  box-shadow: var(--shadow-md, 0 4px 14px rgba(37, 33, 34, 0.12));
  padding: var(--spacing-xl, 32px) 0;
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  z-index: 999;
  pointer-events: none;
}

.somef-fusion-menu .mega-menu-wrapper::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 16px;
}

.somef-fusion-menu #category-produits:hover .mega-menu-wrapper,
.somef-fusion-menu #category-produits.somef-open .mega-menu-wrapper,
.somef-fusion-menu #category-produits:focus-within .mega-menu-wrapper {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.somef-fusion-menu .mega-menu-wrapper .menu-title {
  color: var(--color-accent-blue, #2b3c45);
  font-weight: 700;
  font-size: var(--font-size-h5, 0.9375rem);
  margin: 0 0 var(--spacing-md, 16px);
  padding-bottom: var(--spacing-sm, 8px);
  border-bottom: 1px solid var(--color-border, #e0e0e0);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.somef-fusion-menu .mega-menu-wrapper .somef-mega-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.somef-fusion-menu .mega-menu-wrapper .somef-mega-list li {
  margin-bottom: 0.45rem;
}

.somef-fusion-menu .mega-menu-wrapper .somef-mega-list li a {
  color: var(--color-text-light, #666666) !important;
  font-size: var(--font-size-small, 0.875rem);
  font-weight: 400 !important;
  text-transform: none !important;
  transition: color var(--transition-fast, 0.15s ease),
    padding-left var(--transition-fast, 0.15s ease);
  padding: 0.2rem 0 !important;
  display: block;
  line-height: var(--line-height-base, 1.5);
}

.somef-fusion-menu .mega-menu-wrapper .somef-mega-list li a:hover {
  color: var(--color-primary, #d33343) !important;
  padding-left: 0.5rem !important;
}

.somef-fusion-menu .mega-menu-wrapper .row {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin-left: calc(var(--spacing-md, 16px) * -0.25);
  margin-right: calc(var(--spacing-md, 16px) * -0.25);
}

.somef-fusion-menu .mega-menu-wrapper .col-md-4 {
  flex: 1 1 33.333%;
  max-width: 33.333%;
  min-width: 200px;
  padding: 0 var(--spacing-md, 16px);
}

/* --- Sous-menu SOLUTIONS --- */
.somef-fusion-menu .somef-solutions-wrapper {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 100vw;
  box-sizing: border-box;
  background: var(--color-bg, #ffffff);
  border-top: 3px solid var(--color-primary, #d33343);
  box-shadow: var(--shadow-md, 0 4px 14px rgba(37, 33, 34, 0.12));
  padding: var(--spacing-lg, 24px) 0;
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  z-index: 998;
  pointer-events: none;
}

.somef-fusion-menu .somef-solutions-wrapper::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 16px;
}

.somef-fusion-menu #category-solutions:hover .somef-solutions-wrapper,
.somef-fusion-menu #category-solutions.somef-open .somef-solutions-wrapper,
.somef-fusion-menu #category-solutions:focus-within .somef-solutions-wrapper {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.somef-fusion-menu .somef-solutions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  justify-content: center;
}

.somef-fusion-menu .somef-solutions-list a {
  color: var(--color-text-light, #666666) !important;
  font-size: var(--font-size-small, 0.875rem) !important;
  font-weight: 500 !important;
  padding: 0.5rem 0.85rem !important;
  display: inline-block;
  text-transform: none !important;
  transition: color var(--transition-fast, 0.15s ease),
    background var(--transition-fast, 0.15s ease);
  border-radius: var(--border-radius-sm, 4px);
}

.somef-fusion-menu .somef-solutions-list a:hover {
  color: var(--color-primary, #d33343) !important;
  background: var(--color-bg-light, #f8f9fa);
}

.somef-fusion-menu .collapse-icons {
  display: none !important;
}

/* =============================================================================
   Topbar — réseaux sociaux en SVG inline
   ============================================================================= */
#header .header-nav .somef-topbar-left .somef-social-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.4rem !important;
  margin: 0 !important;
  padding: 0 !important;
}

#header .header-nav .somef-topbar-left .somef-social-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  border: none !important;
  border-radius: var(--border-radius-sm, 4px) !important;
  background: var(--color-primary-light, #e85d6d) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease !important;
}

#header .header-nav .somef-topbar-left .somef-social-btn:hover,
#header .header-nav .somef-topbar-left .somef-social-btn:focus {
  background: var(--color-primary, #d33343) !important;
  color: #ffffff !important;
}

#header .header-nav .somef-topbar-left .somef-social-btn svg {
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
  pointer-events: none;
}

#header .header-nav .somef-topbar-left .somef-social-btn svg path {
  fill: currentColor !important;
}

/* =============================================================================
   Topbar — recherche : écrase ps_searchbar.css (overflow:auto, input width:100%, i en absolute)
   ============================================================================= */
#header .header-nav .somef-topbar-center #search_widget.search-widgets,
#header .header-nav .somef-topbar-center #search_widget {
  overflow: visible !important;
  margin-bottom: 0 !important;
  float: none !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

@media (min-width: 768px) {
  #header .header-nav .somef-topbar-center #search_widget {
    float: none !important;
  }
}

@media (min-width: 992px) {
  #header .header-nav .somef-topbar-center #search_widget {
    min-width: 0 !important;
  }
}

#header .header-nav .somef-topbar-center #search_widget form {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
  position: relative !important;
  width: 100% !important;
  min-height: 2.375rem !important;
  box-sizing: border-box !important;
}

#header .header-nav .somef-topbar-center #search_widget form > i.material-icons.search,
#header .header-nav .somef-topbar-center #search_widget form > i.search.material-icons {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 1.625rem !important;
  width: 1.625rem !important;
  height: 1.625rem !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  font-size: 1.125rem !important;
  align-self: center !important;
  -webkit-font-smoothing: antialiased;
}

#header .header-nav .somef-topbar-center #search_widget form > i.material-icons.clear,
#header .header-nav .somef-topbar-center #search_widget form > i.clear.material-icons {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  transform: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 1.5rem !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  font-size: 1rem !important;
  align-self: center !important;
}

#header .header-nav .somef-topbar-center #search_widget form input[type='text'],
#header .header-nav .somef-topbar-center #search_widget form input[type='search'] {
  width: auto !important;
  min-width: 0 !important;
  flex: 1 1 0% !important;
  max-width: 100% !important;
  padding: 0.35rem 0.35rem !important;
  margin: 0 !important;
  align-self: center !important;
}

/* =============================================================================
   Recherche mobile : même logique que topbar
   ============================================================================= */
@media (max-width: 767px) {
  .somef-mobile-search-wrapper #search_widget.search-widgets,
  .somef-mobile-search-wrapper #search_widget {
    overflow: visible !important;
    margin-bottom: 0 !important;
    float: none !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .somef-mobile-search-wrapper #search_widget form {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
    min-height: 2.375rem !important;
    box-sizing: border-box !important;
  }

  .somef-mobile-search-wrapper #search_widget form > i.material-icons.search,
  .somef-mobile-search-wrapper #search_widget form > i.search.material-icons {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 1.625rem !important;
    width: 1.625rem !important;
    height: 1.625rem !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    font-size: 1.125rem !important;
    align-self: center !important;
    -webkit-font-smoothing: antialiased;
  }

  .somef-mobile-search-wrapper #search_widget form > i.material-icons.clear,
  .somef-mobile-search-wrapper #search_widget form > i.clear.material-icons {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 1.5rem !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    font-size: 1rem !important;
    align-self: center !important;
  }

  .somef-mobile-search-wrapper #search_widget form input[type='text'],
  .somef-mobile-search-wrapper #search_widget form input[type='search'] {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 0% !important;
    max-width: 100% !important;
    padding: 0.35rem 0.35rem !important;
    margin: 0 !important;
    align-self: center !important;
  }
}
