/* ============================================================
   Bloc "Question — Produit mis en avant" — v2 UX
   Tout est namespacé .qpb / .qpb__* pour éviter tout conflit.
   ============================================================ */

/* Variables locales : on s'aligne sur la charte, fallback explicite si vars absentes */
.qpb {
  --qpb-pink: var(--wp--preset--color--color-1, #e62ca1);
  --qpb-pink-dark: #c81f8a;
  --qpb-pink-soft: #fbeaf0;
  --qpb-pink-text: #993556;
  --qpb-text: #1a1a1a;
  --qpb-text-soft: #5e6470;
  --qpb-border: #e5e7eb;
  --qpb-bg-soft: #f7f5f3;
  --qpb-green: #16a34a;
  --qpb-green-soft: #e8f7ee;
  --qpb-red: #b00020;
  --qpb-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --qpb-shadow-md: 0 6px 16px rgba(0, 0, 0, 0.06);
  --qpb-shadow-lg: 0 14px 32px rgba(0, 0, 0, 0.08);

  max-width: 1080px;
  margin: 24px auto;
  color: var(--qpb-text);
  font-family: inherit;
  line-height: 1.5;

  /* Container queries : on adapte la mise en page à la largeur RÉELLE du bloc
     (pas du viewport), car la colonne d'article qui l'enveloppe peut être
     étroite même sur grand écran (Bootstrap col-lg-10/xl-8 → ~700px). */
  container-type: inline-size;
  container-name: qpb;
}

.qpb--placeholder {
  padding: 14px 18px;
  border: 1px dashed #ccc;
  border-radius: 10px;
  color: #888;
  background: #fafafa;
}

/* ============================================================
   1. Bandeau de comparaison "En pharmacie / chez nous"
   ============================================================ */
.qpb__banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(6px, 1.2cqw, 10px) clamp(8px, 1.5cqw, 14px);
  background: linear-gradient(135deg, #fbeaf0 0%, #fef4f8 100%);
  border: 1px solid #f6c8dd;
  border-radius: clamp(9px, 1.3cqw, 12px);
  padding: clamp(9px, 1.3cqw, 12px) clamp(11px, 1.9cqw, 18px);
  margin-bottom: clamp(12px, 1.9cqw, 18px);
  font-size: clamp(12px, 1.9cqw, 14px);
  color: var(--qpb-pink-text);
}
.qpb__banner-icon {
  font-size: clamp(14px, 2.4cqw, 18px);
  line-height: 1;
}
.qpb__banner-text {
  flex: 1 1 auto;
  min-width: 200px;
}
.qpb__banner-text strong {
  color: var(--qpb-pink-text);
  font-weight: 700;
}
.qpb__banner-text .woocommerce-Price-amount {
  color: inherit;
  font-weight: 700;
}
.qpb__banner-savings {
  background: var(--qpb-pink);
  color: #fff;
  font-weight: 700;
  font-size: clamp(11px, 1.8cqw, 13px);
  padding: 4px clamp(8px, 1.6cqw, 12px);
  border-radius: 999px;
  white-space: nowrap;
}
.qpb__banner-savings .woocommerce-Price-amount {
  color: inherit;
}

/* ============================================================
   2. Grille : principal large + alternative compact
   ============================================================ */
.qpb__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 28cqw, 300px);
  gap: clamp(12px, 1.9cqw, 18px);
  align-items: stretch;
}
/* Sous ~880px de largeur DU BLOC, l'alternative passe sous le principal */
@container qpb (max-width: 880px) {
  .qpb__grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   3. Carte produit principale
   ============================================================ */
.qpb__main {
  position: relative;
  background: #fff;
  border: 1px solid var(--qpb-border);
  border-radius: clamp(10px, 1.5cqw, 14px);
  padding: clamp(14px, 2.4cqw, 24px);
  display: grid;
  /* Colonne image fluide : plus le bloc est large, plus l'image est grande */
  grid-template-columns: clamp(150px, 24cqw, 240px) minmax(0, 1fr);
  gap: clamp(14px, 2.6cqw, 26px);
  box-shadow: var(--qpb-shadow-sm);
  transition:
    box-shadow 200ms ease,
    transform 200ms ease;
}
.qpb__main:hover {
  box-shadow: var(--qpb-shadow-md);
}
/* Sous ~560px de largeur du bloc, l'image passe au-dessus des infos */
@container qpb (max-width: 560px) {
  .qpb__main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Badge "-X%" en haut à DROITE (le coin haut gauche est pris par la pastille stock) */
.qpb__badge {
  position: absolute;
  top: clamp(8px, 1.2cqw, 12px);
  right: clamp(8px, 1.2cqw, 12px);
  z-index: 3;
  padding: 4px clamp(7px, 1cqw, 10px);
  border-radius: 999px;
  font-size: clamp(10px, 1.7cqw, 12px);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--qpb-pink);
  color: #fff;
  box-shadow: var(--qpb-shadow-sm);
}

/* Zone média : porte la pastille de stock en overlay */
.qpb__main-media {
  position: relative;
  align-self: start;
}

/* Image produit — même principe que les fiches produit :
   conteneur flex centré + image à son ratio NATUREL bornée par le conteneur.
   Les produits verticaux (spray, déo) s'affichent donc en entier, sans rognage. */
.qpb .qpb__main-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* Hauteur proportionnelle à la largeur du bloc (colonne image ≈ 24cqw) */
  height: clamp(165px, 26cqw, 265px);
  border-radius: clamp(7px, 1.2cqw, 10px);
  background: #fff;
  overflow: hidden;
  transition: transform 200ms ease;
}

/* Désactive le pseudo-élément (barre rose animée du thème parent sur tous les <a>)
   sur TOUS les liens du bloc : sur les liens-image elle passait derrière l'image
   et n'apparaissait qu'au début/à la fin (clippée par overflow:hidden). On la
   neutralise partout — le bloc a ses propres effets de survol (couleur, ombre). */
.qpb a::before,
.qpb a::after,
.qpb__main-img::before,
.qpb__main-img::after,
.qpb__alt-img::before,
.qpb__alt-img::after,
.qpb__alt-card::before,
.qpb__alt-card::after {
  display: none !important;
  content: none !important;
}

/* Neutralisation RENFORCÉE : la barre rose persiste sur la carte principale →
   elle est portée par un autre élément (carte, lien-titre) et/ou en fond animé.
   1) Pseudo-éléments (barre en ::before/::after) sur la carte et ses liens. */
.qpb .qpb__main::before,
.qpb .qpb__main::after,
.qpb .qpb__main a::before,
.qpb .qpb__main a::after {
  display: none !important;
  content: none !important;
  background: none !important;
  background-image: none !important;
  animation: none !important;
}
/* 2) Barre en FOND animé : on retire seulement l'image de fond (background-image)
   sur les liens de la carte ET sur la carte elle-même → la barre disparaît mais
   le fond blanc (background-color) de la carte est conservé. */
.qpb .qpb__main,
.qpb .qpb__main:hover,
.qpb .qpb__main a,
.qpb .qpb__main a:hover {
  background-image: none !important;
}

/* Même traitement pour l'ALTERNATIVE (la barre rose y persistait).
   On retire l'image de fond sur la card/lien de l'alternative + leurs pseudos.
   On ne cible PAS .qpb__banner (dégradé de fond légitime). */
.qpb .qpb__alt::before,
.qpb .qpb__alt::after,
.qpb .qpb__alt a::before,
.qpb .qpb__alt a::after {
  display: none !important;
  content: none !important;
  background: none !important;
  background-image: none !important;
  animation: none !important;
}
.qpb .qpb__alt,
.qpb .qpb__alt:hover,
.qpb .qpb__alt a,
.qpb .qpb__alt a:hover {
  background-image: none !important;
}
.qpb__main:hover .qpb__main-img {
  transform: translateY(-2px);
}
/* !important nécessaire : articles.css impose `height:auto` + `margin:2rem auto`
   + border-radius/ombre à TOUTES les images de .single .entry-content, ce qui
   étirait puis rognait l'image du bloc. */
.qpb .qpb__main-img img {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  margin: 0 !important;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: block;
}
/* Sous ~560px (mobile) : l'image occupe toute la largeur du bloc, sa hauteur
   suit donc la largeur du bloc et non celle d'une colonne. */
@container qpb (max-width: 560px) {
  .qpb .qpb__main-img {
    width: 100%;
    height: clamp(200px, 62cqw, 320px);
  }
}

/* Infos à droite */
.qpb__main-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Titre — on impose la couleur sombre (sinon les liens héritent du rose global) */
.qpb .qpb__main-title {
  color: var(--qpb-text);
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(14px, 2.4cqw, 17px);
  line-height: 1.35;
  margin: 0 0 clamp(5px, 1cqw, 8px);
  display: block;
}
.qpb .qpb__main-title:hover {
  color: var(--qpb-pink);
}

/* Description courte — on rend le HTML du produit (gras, listes…) et on
   FORCE une police réduite (!important) car la typographie d'article
   l'agrandissait sinon. */
.qpb .qpb__main-desc {
  color: var(--qpb-text-soft);
  margin: 0 0 12px;
}
.qpb .qpb__main-desc,
.qpb .qpb__main-desc p,
.qpb .qpb__main-desc li {
  font-size: clamp(11.5px, 1.85cqw, 13px) !important;
  line-height: 1.5 !important;
}
.qpb .qpb__main-desc p {
  margin: 0 0 6px;
}
.qpb .qpb__main-desc p:last-child {
  margin-bottom: 0;
}
.qpb .qpb__main-desc ul,
.qpb .qpb__main-desc ol {
  margin: 0 0 6px;
  padding-left: 18px;
}
.qpb .qpb__main-desc li {
  margin-bottom: 2px;
}
.qpb .qpb__main-desc strong {
  font-weight: 700;
  color: var(--qpb-text);
}

/* Pastille de stock — en overlay, coin haut gauche de l'image */
.qpb__stock {
  position: absolute;
  top: clamp(7px, 1.1cqw, 10px);
  left: clamp(7px, 1.1cqw, 10px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: clamp(3px, 0.7cqw, 5px);
  font-size: clamp(10px, 1.7cqw, 12px);
  font-weight: 600;
  padding: clamp(4px, 0.7cqw, 5px) clamp(7px, 1.3cqw, 10px);
  border-radius: 999px;
  line-height: 1;
  box-shadow: var(--qpb-shadow-sm);
}
.qpb__stock--ok {
  background: var(--qpb-green-soft);
  color: var(--qpb-green);
}
.qpb__stock--out {
  background: #fdecef;
  color: var(--qpb-red);
}
.qpb__stock svg {
  flex: 0 0 auto;
  width: clamp(10px, 1.8cqw, 14px);
  height: clamp(10px, 1.8cqw, 14px);
}

/* Rangée d'actions : prix + quantité + CTA TOUJOURS sur une seule ligne,
   à n'importe quelle largeur. Tout est dimensionné en cqw (% de la largeur du
   bloc) borné par clamp() → les éléments grandissent et rétrécissent ensemble. */
.qpb__actions {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: clamp(6px, 1.5cqw, 16px);
}

/* Bloc prix — promo + courant */
.qpb__price-block {
  display: flex;
  align-items: baseline;
  gap: clamp(4px, 1cqw, 10px);
  margin: 0;
  /* Le prix ne rétrécit jamais : c'est le CTA qui absorbe la contrainte. */
  flex: 0 0 auto;
}
.qpb__price-old {
  font-size: clamp(11px, 1.9cqw, 15px);
  color: #999;
  text-decoration: line-through;
}
.qpb__price-old .woocommerce-Price-amount {
  color: inherit;
  font-weight: 400;
}
.qpb__price-now {
  font-size: clamp(17px, 3.7cqw, 28px);
  font-weight: 800;
  color: var(--qpb-text);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.qpb__price-now .woocommerce-Price-amount {
  color: inherit;
  font-weight: 800;
}
.qpb__price-now .woocommerce-Price-amount,
.qpb__price-now .woocommerce-Price-amount bdi {
  display: inline;
  white-space: nowrap;
}
.qpb__price-now .woocommerce-Price-currencySymbol {
  font-size: clamp(12px, 2.4cqw, 18px);
  font-weight: 700;
  margin-left: 2px;
}

/* Formulaire d'ajout au panier — quantité + bouton sur la même ligne, joli */
.qpb__form {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: clamp(5px, 1.2cqw, 10px);
  align-items: stretch;
  flex-wrap: nowrap;
}
.qpb__qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--qpb-border);
  border-radius: clamp(7px, 1.2cqw, 10px);
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}
.qpb__qty-btn {
  border: 0;
  background: #fff;
  width: clamp(26px, 4.4cqw, 38px);
  height: clamp(36px, 5.6cqw, 44px);
  font-size: clamp(14px, 2.2cqw, 18px);
  padding: 0;
  cursor: pointer;
  color: var(--qpb-text);
  transition: background 120ms ease;
}
.qpb__qty-btn:hover {
  background: var(--qpb-bg-soft);
}
.qpb__qty-val {
  width: clamp(30px, 5.4cqw, 46px);
  height: clamp(36px, 5.6cqw, 44px);
  padding: 0;
  border: 0;
  border-left: 1px solid var(--qpb-border);
  border-right: 1px solid var(--qpb-border);
  text-align: center;
  font-size: clamp(12px, 2cqw, 15px);
  font-weight: 600;
  -moz-appearance: textfield;
  appearance: textfield;
  background: #fff;
}
.qpb__qty-val::-webkit-outer-spin-button,
.qpb__qty-val::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qpb__add {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1cqw, 8px);
  background: var(--qpb-pink);
  color: #fff;
  border: 0;
  border-radius: clamp(7px, 1.2cqw, 10px);
  height: clamp(36px, 5.6cqw, 44px);
  padding: 0 clamp(8px, 2cqw, 18px);
  font-size: clamp(11.5px, 1.95cqw, 14px);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
  transition:
    background-color 150ms ease,
    transform 80ms ease,
    box-shadow 150ms ease;
}
.qpb__add:hover {
  background: var(--qpb-pink-dark);
  box-shadow: 0 6px 14px rgba(230, 44, 161, 0.25);
}
.qpb__add:active {
  transform: translateY(1px);
}
.qpb__add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.qpb__add svg {
  flex: 0 0 auto;
  width: clamp(13px, 2.2cqw, 18px);
  height: clamp(13px, 2.2cqw, 18px);
}
.qpb__add-txt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Sous ~410px de largeur de bloc, le libellé se réduit à « Ajouter » pour que
   prix + quantité + CTA tiennent toujours sur une seule ligne. */
@container qpb (max-width: 410px) {
  .qpb__add-txt-long {
    display: none;
  }
}
/* Encore plus étroit : l'icône panier laisse la place au texte. */
@container qpb (max-width: 330px) {
  .qpb__add svg {
    display: none;
  }
}

/* ============================================================
   4. Alternative — card compacte, entièrement cliquable
   ============================================================ */
.qpb__alt {
  background: var(--qpb-bg-soft);
  border-radius: clamp(10px, 1.5cqw, 14px);
  padding: clamp(14px, 2cqw, 20px);
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  transition:
    border-color 200ms ease,
    background 200ms ease;
}
.qpb__alt:hover {
  border-color: var(--qpb-border);
  background: #fff;
}
.qpb__alt-label {
  font-size: clamp(10px, 1.6cqw, 11px);
  color: #8b8b8b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 0 0 clamp(10px, 1.5cqw, 14px);
}
/* Disposition verticale centrée : image en haut, infos dessous (plus "card") */
.qpb__alt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(8px, 1.3cqw, 12px);
  text-decoration: none;
  color: inherit;
  margin-bottom: clamp(12px, 1.9cqw, 18px);
}
.qpb__alt-img {
  flex: 0 0 auto;
  width: clamp(100px, 14cqw, 150px);
  height: clamp(100px, 14cqw, 150px);
  background: #fff;
  border-radius: clamp(7px, 1.2cqw, 10px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms ease;
}
.qpb__alt-card:hover .qpb__alt-img {
  transform: translateY(-2px);
}
/* Même immunisation que l'image principale contre les styles d'article
   (.single .entry-content img : height/margin/border-radius/ombre). */
.qpb .qpb__alt-img img {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  object-position: center;
  padding: clamp(6px, 1cqw, 10px);
  box-sizing: border-box;
  display: block;
  margin: 0 auto !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.qpb__alt-text {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.qpb .qpb__alt-title {
  font-weight: 700;
  font-size: clamp(13px, 2.1cqw, 15px);
  line-height: 1.3;
  color: var(--qpb-text);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qpb__alt-card:hover .qpb__alt-title {
  color: var(--qpb-pink);
}
.qpb__alt-price {
  font-size: clamp(16px, 2.7cqw, 20px);
  font-weight: 800;
  color: var(--qpb-text);
  letter-spacing: -0.01em;
}
.qpb__alt-price .woocommerce-Price-amount {
  color: inherit;
  font-weight: 800;
}

.qpb__alt-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--qpb-border);
  border-radius: clamp(7px, 1.2cqw, 10px);
  height: clamp(36px, 5.4cqw, 42px);
  font-size: clamp(11.5px, 1.85cqw, 13px);
  font-weight: 600;
  color: var(--qpb-text);
  text-decoration: none;
  transition:
    border-color 150ms ease,
    color 150ms ease,
    background 150ms ease;
}
.qpb__alt-link svg {
  transition: transform 150ms ease;
}
.qpb__alt-link:hover {
  border-color: var(--qpb-pink);
  color: var(--qpb-pink);
  background: #fff;
}
.qpb__alt-link:hover svg {
  transform: translateX(3px);
}

/* ============================================================
   5. Barre de réassurance
   ============================================================ */
.qpb__reass {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, 1.1cqw, 8px) clamp(12px, 2.4cqw, 22px);
  padding: clamp(10px, 1.5cqw, 14px) 4px 0;
  margin-top: clamp(12px, 1.7cqw, 16px);
  border-top: 1px dashed var(--qpb-border);
  font-size: clamp(11px, 1.8cqw, 13px);
  color: var(--qpb-text-soft);
}
.qpb__reass-item {
  display: inline-flex;
  align-items: center;
  gap: clamp(5px, 0.9cqw, 7px);
}
.qpb__reass-item svg {
  color: var(--qpb-pink);
  flex: 0 0 auto;
  width: clamp(13px, 2.1cqw, 16px);
  height: clamp(13px, 2.1cqw, 16px);
}
