/**
 * BIENHABILLÉ — product-single.css
 * Structure : single product → content single product → product layout | product thumbnails | product image.
 *
 * Galerie : ≥1025px — desktop : rail miniatures + pile verticale scroll interne ;
 *           ≤1024px — même présentation que mobile : une colonne, carrousel horizontal, barre « 1 / N », miniatures masquées.
 */

/* ─── Fond page produit (évite tout héritage sombre) ─── */
.bh-content-single-product {
  background-color: var(--bh-bg-primary, #fff);
  color: var(--bh-text-primary, #1a1a1a);
}

/*
 * WooCommerce (feuille « Layout » du plugin) : float + ~48 % sur div.summary.
 * Avec notre grille .bh-product-layout, ça envoie le résumé au bord droit et crée un vide énorme.
 */
.single-product.woocommerce .bh-content-single-product .summary.entry-summary,
.woocommerce-page.single-product .bh-content-single-product .summary.entry-summary {
  float: none !important;
  width: 100% !important;
  max-width: 100% !important;
  clear: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.single-product.woocommerce .bh-product-layout__summary,
.woocommerce-page.single-product .bh-product-layout__summary {
  float: none !important;
  width: auto !important;
  max-width: none !important;
}

.single-product.woocommerce .bh-product-layout__gallery,
.woocommerce-page.single-product .bh-product-layout__gallery {
  float: none !important;
  width: auto !important;
  max-width: none !important;
}

/* Annule un éventuel flex + colonnes implicites du gabarit WC sur .product */
.single-product.woocommerce div.product.bh-content-single-product,
.woocommerce-page.single-product div.product.bh-content-single-product {
  display: block;
}

.single-product.woocommerce div.product.bh-content-single-product::before,
.single-product.woocommerce div.product.bh-content-single-product::after,
.woocommerce-page.single-product div.product.bh-content-single-product::before,
.woocommerce-page.single-product div.product.bh-content-single-product::after {
  content: none !important;
  display: none !important;
}

/* ─── Breadcrumb page produit ─── */
.bh-product-breadcrumb {
  padding: var(--bh-space-sm, 0.5rem) 0 var(--bh-space-md, 1rem);
}

.bh-product-breadcrumb .bh-breadcrumbs {
  margin: 0;
}

/* ─── Product layout (grille galerie | summary) ─── */
.bh-single-product .bh-product-layout {
  display: grid;
  grid-template-columns: var(--bh-product-gallery-width) var(--bh-product-summary-width);
  gap: var(--bh-product-gap);
  align-items: start;
}

.bh-single-product .bh-product-layout__gallery {
  min-width: 0;
}

.bh-single-product .bh-product-layout__summary {
  min-width: 0;
}

.bh-single-product .bh-product-layout__summary-sticky {
  position: sticky;
  top: calc(var(--bh-mega-header-total, var(--bh-header-height, 80px)) + var(--bh-space-md));
}

body.bh-mega-menu-active.bh-has-announcement .bh-single-product .bh-product-layout__summary-sticky {
  top: calc(
    env(safe-area-inset-top, 0px) + var(--bh-topbar-height, 36px) +
      var(--bh-mega-header-total, var(--bh-header-height, 80px)) + var(--bh-space-md)
  );
}

@media (max-width: 1024px) {
  .bh-single-product .bh-product-layout {
    grid-template-columns: 1fr;
  }

  .bh-single-product .bh-product-layout__summary-sticky {
    position: static;
  }

  .bh-product-gallery__color-panel.is-active,
  .bh-product-gallery--fallback {
    flex-direction: column;
  }

  .bh-product-gallery .bh-product-thumbnails {
    display: none;
  }

  .bh-product-gallery__mnav {
    display: flex;
  }

  .bh-product-gallery__cta {
    position: static;
    margin-top: var(--bh-space-sm);
    align-self: flex-start;
  }

  .bh-product-thumbnails__list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .bh-product-thumbnails__item,
  .bh-product-gallery__thumb {
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

@media (min-width: 1025px) {
  /* Même hauteur de ligne : le bas de la galerie s’aligne sur le bas du bloc résumé (sticky + onglets) */
  .bh-single-product .bh-product-layout {
    align-items: stretch;
  }

  .bh-single-product .bh-product-layout__gallery {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 0;
    min-width: 0;
  }

  .bh-single-product .bh-product-layout__gallery > .bh-product-gallery {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
  }

  .bh-single-product .bh-product-layout__summary-sticky {
    max-height: none;
  }
}

/* ─── Product gallery (contient thumbnails + image) ─── */
.bh-product-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--bh-product-thumb-gap);
  width: 100%;
}

.bh-product-gallery__color-panels {
  position: relative;
  width: 100%;
}

.bh-product-gallery__color-panel {
  display: none;
}

.bh-product-gallery__color-panel.is-active {
  display: flex;
  flex-direction: row;
  gap: var(--bh-product-thumb-gap);
  align-items: flex-start;
  width: 100%;
}

/* ─── Product thumbnails ─── */
.bh-product-thumbnails {
  flex-shrink: 0;
}

.bh-product-thumbnails__list {
  display: flex;
  flex-direction: column;
  gap: var(--bh-product-thumb-gap);
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bh-scrollbar-thumb) var(--bh-scrollbar-track);
}

.bh-product-thumbnails__list::-webkit-scrollbar {
  width: var(--bh-scrollbar-size);
  height: var(--bh-scrollbar-size);
}

.bh-product-thumbnails__list::-webkit-scrollbar-track {
  background: var(--bh-scrollbar-track);
  border-radius: 999px;
}

.bh-product-thumbnails__list::-webkit-scrollbar-thumb {
  background-color: var(--bh-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--bh-scrollbar-track);
}

.bh-product-thumbnails__list::-webkit-scrollbar-thumb:hover {
  background-color: var(--bh-scrollbar-thumb-hover);
}

.bh-product-thumbnails__item,
.bh-product-gallery__thumb {
  width: var(--bh-product-thumb-size);
  aspect-ratio: var(--bh-product-image-ratio);
  padding: 0;
  box-sizing: border-box;
  /* Bordure visible au repos : le curseur actif ressort */
  border: 1px solid var(--bh-product-thumb-idle-border, rgba(0, 0, 0, 0.12));
  border-radius: var(--bh-radius-xs, 4px);
  cursor: pointer;
  overflow: hidden;
  background: var(--bh-bg-secondary, #f5f5f5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bh-product-thumbnails__item img,
.bh-product-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bh-product-thumbnails__item:hover,
.bh-product-gallery__thumb:hover {
  border-color: var(--bh-color-primary, #1a1a1a);
}

/* Curseur : image courante dans le rail gauche */
.bh-product-thumbnails__item.is-active,
.bh-product-gallery__thumb.is-active {
  border: 3px solid var(--bh-color-primary, #000000);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.95);
}

/* ─── Product image ─── */
.bh-product-image {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--bh-space-md);
}

.bh-product-image__scroll {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  aspect-ratio: var(--bh-product-image-ratio);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.bh-product-image__scroll::-webkit-scrollbar {
  display: none;
}

.bh-product-image__slide,
.bh-product-gallery__slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.bh-product-image__slide img,
.bh-product-gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Pagination dots ─── */
.bh-product-gallery__dots {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.bh-product-gallery__dot {
  width: 24px;
  height: 3px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  transition: background 0.2s ease;
}

.bh-product-gallery__dot.is-active {
  background: var(--bh-color-primary);
}

/* ─── CTA Complétez le look (fond blanc, bordure noire) ─── */
.bh-product-gallery__cta {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 2;
  display: inline-block;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--bh-color-primary);
  background: #fff;
  border: 1px solid var(--bh-color-primary);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.bh-product-gallery__cta:hover {
  background: var(--bh-color-primary);
  color: #fff;
  text-decoration: none;
}

/* ─── Navigation mobile galerie (1 / N + flèches) ─── */
.bh-product-gallery__mnav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  align-self: center;
  margin-top: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: #fff;
  border: 1px solid var(--bh-border-color, #e5e5e5);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.bh-product-gallery__mnav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: var(--bh-color-primary, #000);
  cursor: pointer;
  line-height: 0;
}

.bh-product-gallery__mnav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.bh-product-gallery__mnav-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bh-text-primary);
  min-width: 3.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Fallback : sans panels ─── */
.bh-product-gallery--fallback {
  display: flex;
  flex-direction: row;
  gap: var(--bh-product-thumb-gap);
  align-items: flex-start;
}

.bh-product-gallery--fallback .bh-product-thumbnails {
  flex-shrink: 0;
}

.bh-product-gallery--fallback .bh-product-image {
  flex: 1;
  min-width: 0;
}

/* ─── Swatches (summary) : grille + overflow +N ─── */
.bh-product-swatches {
  display: flex;
  align-items: flex-start;
  gap: var(--bh-swatch-gap);
  flex-wrap: wrap;
  margin: var(--bh-space-md) 0;
}

.bh-product-swatches__label {
  font-weight: 600;
  flex-shrink: 0;
  width: 100%;
}

.bh-product-swatches__list {
  display: grid;
  grid-template-columns: repeat(6, var(--bh-swatch-size, 36px));
  gap: var(--bh-swatch-gap);
}

.bh-product-swatches__more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--bh-swatch-size, 36px);
  height: var(--bh-swatch-size, 36px);
  font-size: var(--bh-fs-xs);
  font-weight: 600;
  color: var(--bh-text-secondary);
  background: var(--bh-bg-secondary);
  border: 1px solid var(--bh-border-color);
  border-radius: var(--bh-swatch-radius);
}

.bh-product-swatch {
  width: var(--bh-swatch-size);
  height: var(--bh-swatch-size);
  padding: 0;
  border: var(--bh-swatch-border);
  border-radius: var(--bh-swatch-radius);
  cursor: pointer;
  overflow: hidden;
  background: transparent;
  transition: border-color 0.2s ease;
}

.bh-product-swatch:hover,
.bh-product-swatch.is-active {
  border: var(--bh-swatch-border-active);
}

.bh-product-swatch img,
.bh-product-swatch__hex {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.bh-product-swatch__hex {
  border-radius: inherit;
}

/* ─── Tabs accordéon ─── */
.bh-product-tabs {
  border-top: 1px solid var(--bh-border-color);
  margin-top: var(--bh-space-lg);
}

.bh-product-tabs__item {
  border-bottom: 1px solid var(--bh-border-color);
}

.bh-product-tabs__trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--bh-space-md) 0;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.bh-product-tabs__trigger:hover {
  color: var(--bh-color-primary);
}

.bh-product-tabs__icon {
  font-size: 1.25em;
  flex-shrink: 0;
}

.bh-product-tabs__panel {
  padding-bottom: var(--bh-space-md);
}

.bh-product-tabs__panel[hidden] {
  display: none;
}

/* ─── Reference bar ─── */
.bh-product-reference {
  padding: var(--bh-space-sm) 0;
  border: 1px solid var(--bh-border-color);
  border-radius: 4px;
  margin-bottom: var(--bh-space-sm);
}

.bh-product-reference__text {
  font-size: var(--bh-fs-sm);
  color: var(--bh-text-secondary);
}

/* ─── Badges (noir, texte blanc) ─── */
.bh-product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bh-space-xs);
  margin: var(--bh-space-sm) 0;
}

.bh-product-badges__item {
  display: inline-block;
  padding: 4px 10px;
  font-size: var(--bh-fs-xs);
  font-weight: 600;
  color: #fff;
  background: var(--bh-color-primary);
  border-radius: 2px;
}

/* ─── Store availability button ─── */
.bh-product-store-availability {
  display: block;
  width: 100%;
  margin-top: var(--bh-space-sm);
  padding: 14px 1rem;
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: center;
  color: var(--bh-color-primary);
  background: var(--bh-bg-secondary);
  border: 1px solid var(--bh-border-color);
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.bh-product-store-availability:hover {
  background: var(--bh-color-secondary-hover);
  border-color: var(--bh-border-color-dark);
  color: var(--bh-color-primary);
}

/* ─── Trust block (fond gris, checkmarks) ─── */
.bh-product-trust {
  margin: var(--bh-space-lg) 0;
  padding: var(--bh-space-md) 1rem;
  background: var(--bh-bg-secondary);
  border-radius: 4px;
}

.bh-product-trust__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--bh-space-sm);
}

.bh-product-trust__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--bh-fs-sm);
  color: var(--bh-text-primary);
}

.bh-product-trust__item .bh-icon,
.bh-product-trust__item svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--bh-color-success);
}

/* ─── Add to cart button (pleine largeur, noir) ─── */
.bh-single-product .bh-btn-add-to-cart,
.bh-single-product .single_add_to_cart_button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 16px 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: var(--bh-color-primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.bh-single-product .bh-btn-add-to-cart:hover,
.bh-single-product .single_add_to_cart_button:hover:not(.disabled) {
  background: var(--bh-color-primary-hover);
  color: #fff;
}

.bh-single-product .bh-btn-add-to-cart.disabled,
.bh-single-product .single_add_to_cart_button.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Avis clients (progress bars, cartes) ─── */
.bh-product-reviews {
  margin-top: var(--bh-space-2xl);
  padding-top: var(--bh-space-xl);
  border-top: 1px solid var(--bh-border-color);
}

.bh-product-reviews__title {
  font-size: var(--bh-fs-xl);
  font-weight: 700;
  margin: 0 0 var(--bh-space-md);
}

.bh-product-reviews__summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--bh-space-lg);
}

.bh-product-reviews__stars .star-rating {
  margin-right: 0.25rem;
}

.bh-product-reviews__score {
  font-weight: 600;
}

.bh-product-reviews__count {
  color: var(--bh-text-secondary);
  text-decoration: underline;
  font-size: var(--bh-fs-sm);
}

.bh-product-reviews__count:hover {
  color: var(--bh-color-primary);
}

.bh-product-reviews__breakdown {
  margin-bottom: var(--bh-space-xl);
}

.bh-product-reviews__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.bh-product-reviews__label {
  flex: 0 0 80px;
  font-size: var(--bh-fs-sm);
}

.bh-product-reviews__bar {
  flex: 1;
  height: 8px;
  background: var(--bh-bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.bh-product-reviews__bar-fill {
  height: 100%;
  background: var(--bh-color-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.bh-product-reviews__pct {
  flex: 0 0 50px;
  font-size: var(--bh-fs-sm);
  color: var(--bh-text-secondary);
  text-align: right;
}

.bh-product-reviews__items .comment {
  padding: var(--bh-space-md);
  margin-bottom: var(--bh-space-md);
  background: var(--bh-bg-secondary);
  border-radius: 4px;
  list-style: none;
}

.bh-product-reviews__empty {
  color: var(--bh-text-secondary);
  margin: 0;
}

/* Desktop large : masquer dots (miniatures suffisent) — tablette = comme mobile, dots visibles ─── */
@media (min-width: 1025px) {
  .bh-product-gallery__dots {
    display: none;
  }
}

/* ─── Desktop large : miniatures gauche + pile verticale dans la zone principale (scroll interne, sync JS) ─── */
@media (min-width: 1025px) {
  .bh-product-gallery {
    min-height: 0;
  }

  .bh-product-gallery__color-panels {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .bh-product-gallery__color-panel.is-active {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .bh-product-gallery--fallback {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .bh-product-thumbnails {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    flex-shrink: 0;
    min-height: 0;
    max-height: 100%;
  }

  .bh-product-image {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    align-self: stretch;
  }

  /* flex-basis 0 + min-height 0 : le bloc peut être plus petit que la pile d’images → scroll-y actif */
  .bh-product-image__scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    /* Laisse la page défiler quand le scroll interne est en haut / en bas (chaînage molette) */
    overscroll-behavior-y: auto;
    aspect-ratio: unset;
    scroll-snap-type: none;
    gap: var(--bh-space-sm, 0.5rem);
    /* Même style que la scrollbar fenêtre (variables.css / typography) */
    scrollbar-width: thin;
    scrollbar-color: var(--bh-scrollbar-thumb) var(--bh-scrollbar-track);
    padding-right: 6px;
    margin-right: -2px;
  }

  .bh-product-image__scroll::-webkit-scrollbar {
    display: block;
    width: var(--bh-scrollbar-size);
  }

  .bh-product-image__scroll::-webkit-scrollbar-track {
    background: var(--bh-scrollbar-track);
    border-radius: 999px;
  }

  .bh-product-image__scroll::-webkit-scrollbar-thumb {
    background-color: var(--bh-scrollbar-thumb);
    border-radius: 999px;
    border: 2px solid var(--bh-scrollbar-track);
  }

  .bh-product-image__scroll::-webkit-scrollbar-thumb:hover {
    background-color: var(--bh-scrollbar-thumb-hover);
  }

  .bh-product-image__slide,
  .bh-product-gallery__slide {
    flex: 0 0 auto;
    width: 100%;
    min-width: 100%;
    height: auto;
    aspect-ratio: var(--bh-product-image-ratio);
    scroll-snap-align: unset;
  }

  .bh-product-thumbnails__list {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    padding-right: 2px;
  }
}

/* Lien guide des tailles (résumé produit) */
.bh-product-guide-sizes {
  margin: var(--bh-space-sm) 0 0;
  font-size: var(--bh-fs-sm);
}

.bh-product-guide-sizes__link {
  text-decoration: underline;
  color: var(--bh-text-primary);
}

.bh-product-guide-sizes__link:hover {
  color: var(--bh-color-primary);
}

