/**
 * BIENHABILLÉ — mega-menu.css (Bloc C)
 * Mega menu dropdown : colonnes, bannières, liens. Uniquement var(--bh-*).
 * Z-index : --bh-z-dropdown. Ouverture au survol + animation slide/fade.
 */

.bh-nav-item.menu-item-has-mega-menu,
.bh-nav-list > li.menu-item-has-mega-menu {
  position: relative;
}

/* Desktop : mega menu full width, position fixed pour éviter le clipping */
@media (min-width: 1024px) {
  .bh-header .bh-mega-menu {
    position: fixed;
    left: 0;
    right: 0;
    overflow: visible;
    top: calc(var(--bh-topbar-height, 36px) + var(--bh-header-height-sticky, 70px));
    width: 100%;
    min-width: 100%;
    max-width: none;
    margin-left: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    transform: translateY(-8px);
  }

  .bh-header .bh-mega-menu--full {
    width: 100%;
    min-width: 100%;
    max-width: none;
  }

  .bh-nav-item.menu-item-has-mega-menu:hover .bh-mega-menu,
  .bh-nav-item.menu-item-has-mega-menu.mega-menu-open .bh-mega-menu {
    transform: translateY(0);
  }
}

.bh-mega-menu {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%) translateY(-8px);
  min-width: min(600px, 95vw);
  max-width: 1200px;
  margin-top: 0;
  padding: var(--bh-space-lg);
  background: var(--bh-mega-bg);
  box-shadow: var(--bh-mega-shadow);
  border-radius: var(--bh-radius-md);
  border: 1px solid var(--bh-border-color-light);
  z-index: var(--bh-z-dropdown);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.bh-mega-menu--full {
  left: 50%;
  right: auto;
  width: 100vw;
  margin-left: -50vw;
  transform: translateY(-8px);
  min-width: 100%;
  max-width: none;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* Mega menu pleine largeur, fond blanc */
.bh-mega-menu--sidebar.bh-mega-menu--full {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem 0;
}

.bh-nav-item.menu-item-has-mega-menu.mega-menu-open .bh-mega-menu,
.bh-nav-item.menu-item-has-mega-menu:hover .bh-mega-menu,
.bh-nav-list > li.menu-item-has-mega-menu.mega-menu-open .bh-mega-menu,
.bh-nav-list > li.menu-item-has-mega-menu:hover .bh-mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.bh-nav-item.menu-item-has-mega-menu.mega-menu-open .bh-mega-menu--full,
.bh-nav-item.menu-item-has-mega-menu:hover .bh-mega-menu--full,
.bh-nav-list > li.menu-item-has-mega-menu.mega-menu-open .bh-mega-menu--full,
.bh-nav-list > li.menu-item-has-mega-menu:hover .bh-mega-menu--full {
  transform: translateY(0);
}

.bh-nav-item.menu-item-has-mega-menu.mega-menu-open .bh-nav-link,
.bh-nav-item.menu-item-has-mega-menu:hover .bh-nav-link,
.bh-nav-list > li.menu-item-has-mega-menu.mega-menu-open > a,
.bh-nav-list > li.menu-item-has-mega-menu:hover > a {
  color: var(--bh-nav-active-color);
  border-bottom-color: var(--bh-nav-active-color);
}

/* Grille multi-colonnes ─── */
.bh-mega-menu__inner {
  display: flex;
  flex-direction: column;
  gap: var(--bh-space-lg);
}

.bh-mega-menu__row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--bh-space-lg);
}

.bh-mega-menu__block {
  min-width: 0;
}

/* Sidebar gauche ─── */
/* Layout grid : chevrons uniquement hors sidebar */
.bh-mega-menu:not(.bh-mega-menu--sidebar) .bh-mega-menu__row .bh-mega-menu__block:first-child.bh-mega-menu__block--links {
  padding-right: var(--bh-space-lg);
  border-right: 1px solid var(--bh-border-color-light);
  margin-right: var(--bh-space-xs);
}

.bh-mega-menu:not(.bh-mega-menu--sidebar) .bh-mega-menu__row .bh-mega-menu__block:first-child.bh-mega-menu__block--links .bh-mega-menu__links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bh-mega-menu:not(.bh-mega-menu--sidebar) .bh-mega-menu__row .bh-mega-menu__block:first-child.bh-mega-menu__block--links .bh-mega-menu__links a::after {
  content: '›';
  opacity: 0.6;
}

.bh-mega-menu__products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--bh-space-md);
}

.bh-mega-menu__product {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--bh-text-primary);
  transition: color var(--bh-transition-fast);
}

.bh-mega-menu__product:hover {
  color: var(--bh-color-primary);
}

.bh-mega-menu__product-img {
  aspect-ratio: 4/5;
  overflow: hidden;
  background: var(--bh-bg-secondary);
}

.bh-mega-menu__product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bh-mega-menu__product-name {
  font-size: var(--bh-fs-sm);
  margin-top: var(--bh-space-xs);
}

.bh-mega-menu__product-price {
  font-size: var(--bh-fs-sm);
  color: var(--bh-price-sale-color);
}

.bh-mega-menu__cat-img {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  margin-bottom: var(--bh-space-2xs);
}

.bh-mega-menu__cat-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bh-nav-badge {
  font-size: var(--bh-fs-xs);
  background: var(--bh-color-accent);
  color: var(--bh-text-inverse);
  padding: 0 var(--bh-space-2xs);
  border-radius: var(--bh-radius-xs);
  margin-left: var(--bh-space-2xs);
}

.bh-mega-menu__column {
  display: flex;
  flex-direction: column;
  gap: var(--bh-space-xs);
}

.bh-mega-menu__column-title,
.bh-mega-menu__products-title {
  font-size: var(--bh-mega-title-fs);
  font-weight: var(--bh-mega-title-fw);
  color: var(--bh-text-primary);
  margin: 0 0 var(--bh-space-xs);
  padding-bottom: var(--bh-space-2xs);
  border-bottom: 1px solid var(--bh-border-color-light);
}

.bh-mega-menu__links-title {
  font-weight: var(--bh-mega-title-fw);
  color: var(--bh-text-primary);
}

.bh-mega-menu__links-title span {
  display: block;
  padding-bottom: var(--bh-space-2xs);
  border-bottom: 1px solid var(--bh-border-color-light);
}

.bh-mega-menu__title {
  font-size: var(--bh-mega-title-fs);
  font-weight: var(--bh-mega-title-fw);
  color: var(--bh-text-primary);
  margin: 0 0 var(--bh-space-xs);
  padding-bottom: var(--bh-space-2xs);
  border-bottom: 1px solid var(--bh-border-color-light);
}

.bh-mega-menu__links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bh-mega-menu__links a {
  display: block;
  padding: var(--bh-space-2xs) 0;
  font-size: var(--bh-mega-link-fs);
  color: var(--bh-mega-link-color);
  text-decoration: none;
  transition: color var(--bh-transition-fast);
}

.bh-mega-menu__links a:hover {
  color: var(--bh-color-primary);
}

.bh-mega-menu__link-item {
  display: flex;
  align-items: center;
  gap: var(--bh-space-xs);
}

.bh-mega-menu__link-img {
  flex-shrink: 0;
  display: block;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: var(--bh-radius-xs);
  background: var(--bh-bg-secondary);
}

.bh-mega-menu__link-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bh-mega-menu__link-label {
  flex: 1;
}

/* Bannière / image dans le mega ─── */
.bh-mega-menu__banner {
  display: block;
  border-radius: var(--bh-radius-sm);
  overflow: hidden;
}

.bh-mega-menu__banner img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.bh-mega-menu__banner:hover img {
  opacity: 0.95;
}

/* Lien parent avec indicateur (flèche) ─── */
.bh-nav-item.menu-item-has-mega-menu > .bh-nav-link,
.bh-nav-list > li.menu-item-has-mega-menu > a {
  padding-right: var(--bh-space-xs);
}

.bh-nav-item.menu-item-has-mega-menu > .bh-nav-link::after,
.bh-nav-list > li.menu-item-has-mega-menu > a::after {
  content: '';
  display: inline-block;
  margin-left: var(--bh-space-2xs);
  width: 0.4em;
  height: 0.4em;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  vertical-align: middle;
}

/* Accessibilité : focus visible ─── */
.bh-nav-item.menu-item-has-mega-menu > .bh-nav-link:focus-visible,
.bh-nav-list > li.menu-item-has-mega-menu > a:focus-visible {
  outline: 2px solid var(--bh-border-color-focus);
  outline-offset: 2px;
}

.bh-mega-menu a:focus-visible {
  outline: 2px solid var(--bh-border-color-focus);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   MEGA MENU SIDEBAR
   Sidebar gauche + panneaux de contenu au survol
   ═══════════════════════════════════════════════════════════════════ */
.bh-mega-menu--sidebar .bh-mega-menu__inner--sidebar {
  display: flex;
  flex-direction: row;
  min-height: 320px;
  gap: 0;
  max-width: var(--bh-container-max, 1320px);
  margin: 0 auto;
  padding: 0 var(--bh-container-padding, 1.25rem);
  overflow: visible;
}

.bh-mega-menu__sidebar {
  flex: 0 0 220px;
  padding-right: 2rem;
  margin-right: 2rem;
  border-right: 1px solid #e5e5e5;
}

.bh-mega-menu__sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bh-mega-menu__sidebar-item {
  margin: 0;
}

.bh-mega-menu__sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.5rem 0.75rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #666;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.bh-mega-menu__sidebar-link:hover,
.bh-mega-menu__sidebar-item--active .bh-mega-menu__sidebar-link {
  color: #1a1a1a;
  border-bottom-color: #1a1a1a;
}

/* Élément texte uniquement (ex. « Collection ») — pas de lien */
.bh-mega-menu__sidebar-link--label {
  cursor: pointer;
  text-decoration: none;
}

.bh-mega-menu__sidebar-chevron {
  font-size: 0.75em;
  opacity: 0.6;
  margin-left: 0.25rem;
}

.bh-mega-menu__panels {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  min-width: 0;
}

.bh-mega-menu__panel {
  display: none;
  width: 100%;
}

.bh-mega-menu__panel--active {
  display: block;
}

.bh-mega-menu__panel-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bh-mega-menu__panel-inner .bh-mega-menu__row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem 1.5rem;
}

/* Pas de chevron sur les liens des colonnes */
.bh-mega-menu--sidebar .bh-mega-menu__links a::after {
  content: none !important;
}

/* Colonnes de liens */
.bh-mega-menu--sidebar .bh-mega-menu__column-title,
.bh-mega-menu--sidebar .bh-mega-menu__products-title,
.bh-mega-menu--sidebar .bh-mega-menu__links-title span {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #e5e5e5;
}

.bh-mega-menu--sidebar .bh-mega-menu__links a {
  padding: 0.25rem 0;
  font-size: 0.875rem;
  color: #666;
  font-weight: 400;
}

.bh-mega-menu--sidebar .bh-mega-menu__links a:hover {
  color: #1a1a1a;
}

/* Bannière produit trend : bloc vertical à droite */
.bh-mega-menu--sidebar .bh-mega-menu__banner {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  max-height: 280px;
  background: #1a1a1a;
  color: #fff;
  padding: 1.5rem;
  justify-content: flex-end;
  border-radius: 0;
}

.bh-mega-menu--sidebar .bh-mega-menu__banner--no-image {
  min-height: 120px;
  max-height: 180px;
}

.bh-mega-menu--sidebar .bh-mega-menu__banner-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

/* Produits en grille (Nouveautés) */
.bh-mega-menu--sidebar .bh-mega-menu__products {
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.bh-mega-menu--sidebar .bh-mega-menu__product-img {
  aspect-ratio: 3/4;
}
