/**
 * Thème wiloo — page produit.
 * - Panneau « Fiche technique » repliable sous l'image (colonne gauche).
 * - Section onglets pleine largeur sous les 2 colonnes
 *   (Description / Fiche technique / En savoir plus / Gabarit et fiche produit).
 * Vanilla, raccord charte wiloo (violet #925da2 / orange #f28a1b).
 * Variables préfixées --wiloo-pp- pour éviter toute collision avec le thème.
 */

:root {
  --wiloo-pp-accent: #925da2;
  --wiloo-pp-border: #e7e2ea;
  --wiloo-pp-border-soft: #efeaf2;
  --wiloo-pp-hover: #f6f2f8;
  --wiloo-pp-ink: #2b2b2b;
  --wiloo-pp-muted: #666;
}

/* ------------------------------------------------------------------ *
 * 1. Colonne image : retrait du sticky + du scroll interne.
 *    Le panneau vit sous l'image → la colonne doit suivre le flux,
 *    sinon une barre de scroll apparaît (hauteur bornée + overflow).
 * ------------------------------------------------------------------ */
.wiloo-product-image-col,
.wiloo-product-image-col .page-content,
.wiloo-product-image-col #content {
  position: static !important;
  top: auto !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

/* ------------------------------------------------------------------ *
 * 2. Panneau repliable sous l'image (Fiche technique)
 * ------------------------------------------------------------------ */
.wiloo-product-panels {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.wiloo-panel {
  border: 1px solid var(--wiloo-pp-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

/* Le bouton est encapsulé dans un <h3> : on neutralise tout style de titre du thème */
.wiloo-panel__heading {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  line-height: inherit;
}

.wiloo-panel__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .6rem .75rem;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  color: var(--wiloo-pp-ink);
  line-height: 1.3;
}

.wiloo-panel__head:hover {
  background: var(--wiloo-pp-hover);
}

.wiloo-panel__head:focus-visible {
  outline: 2px solid var(--wiloo-pp-accent);
  outline-offset: -2px;
}

.wiloo-panel__title {
  flex: 1 1 auto;
}

/* Chevron triangle plein, pivote à l'ouverture */
.wiloo-panel__chevron {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--wiloo-pp-accent);
  transition: transform .2s ease;
}

.wiloo-panel__head[aria-expanded="true"] .wiloo-panel__chevron {
  transform: rotate(180deg);
}

.wiloo-panel__body {
  padding: .35rem .75rem .85rem;
  border-top: 1px solid var(--wiloo-pp-border-soft);
  font-size: .78rem;
  color: var(--wiloo-pp-ink);
}

.wiloo-panel__body[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ *
 * 3. Onglets pleine largeur (section basse)
 * ------------------------------------------------------------------ */
.wiloo-product-tabs {
  margin: 2.25rem 0 1rem;
}

.wiloo-tabs__nav {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem;
  border-bottom: 2px solid var(--wiloo-pp-border);
}

.wiloo-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: .55rem 1rem;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
  color: var(--wiloo-pp-muted);
  cursor: pointer;
  white-space: nowrap;
}

.wiloo-tab:hover {
  color: var(--wiloo-pp-ink);
}

.wiloo-tab[aria-selected="true"] {
  color: var(--wiloo-pp-accent);
  border-bottom-color: var(--wiloo-pp-accent);
}

.wiloo-tab:focus-visible {
  outline: 2px solid var(--wiloo-pp-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wiloo-tabs__panels {
  padding-top: 1.1rem;
}

.wiloo-tab-panel {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--wiloo-pp-ink);
}

.wiloo-tab-panel[hidden] {
  display: none;
}

.wiloo-tab-panel .product-description {
  max-width: 80ch;
}

.wiloo-tab-panel .product-description :where(p, ul, ol):last-child,
.wiloo-tab-panel .product-description--short :where(p, ul, ol):last-child {
  margin-bottom: 0;
}

/* Tablette : on autorise le défilement horizontal des onglets si trop nombreux */
@media (max-width: 575px) {
  .wiloo-tabs__nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .wiloo-tab {
    font-size: .82rem;
    padding: .5rem .7rem;
  }
}

/* ------------------------------------------------------------------ *
 * 4. Fiche technique (product-details.tpl) — partagée panneau + onglet.
 *    On NEUTRALISE le rendu "boîtes 2 colonnes" hérité du thème,
 *    puis on reconstruit une vraie table label / valeur.
 *    Anchor = .wiloo-product-details (présent dans les 2 contextes).
 * ------------------------------------------------------------------ */
.wiloo-product-details > div,
.wiloo-product-details > section {
  margin-bottom: .55rem;
}
.wiloo-product-details > :last-child {
  margin-bottom: 0;
}

.wiloo-product-details .product-features .h6 {
  margin: 0 0 .3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: .68rem;
  color: var(--wiloo-pp-accent);
}

/* Reset des cellules habillées par le thème (fond gris, bordure, padding, float, largeur) */
.wiloo-product-details .data-sheet {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  margin: 0;
  column-count: 1 !important; /* annule un éventuel multi-colonnes du thème */
  font-size: .74rem;
}

.wiloo-product-details .data-sheet .name,
.wiloo-product-details .data-sheet .value {
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  float: none !important;
  width: auto !important;
  box-shadow: none !important;
  display: block !important;
  margin: 0 !important;
  border-bottom: 1px solid var(--wiloo-pp-border-soft) !important;
  padding: .35rem 0 !important;
  line-height: 1.3;
}

.wiloo-product-details .data-sheet .name {
  font-weight: 600;
  color: var(--wiloo-pp-ink);
  padding-right: .5rem !important;
}

.wiloo-product-details .data-sheet .value {
  color: var(--wiloo-pp-muted);
}

/* Lignes simples (référence, marque, condition…) */
.wiloo-product-details .label {
  font-weight: 600;
  margin-right: .25rem;
}
.wiloo-product-details .product-reference,
.wiloo-product-details .product-quantities,
.wiloo-product-details .product-condition,
.wiloo-product-details .product-manufacturer {
  font-size: .76rem;
  margin-bottom: .25rem;
}

/* L'onglet bas dispose de plus de place → on remonte un peu la taille de la fiche */
.wiloo-tab-panel .wiloo-product-details {
  font-size: .82rem;
}
.wiloo-tab-panel .wiloo-product-details .data-sheet {
  font-size: .82rem;
}

/* ------------------------------------------------------------------ *
 * 5. Pièces jointes / Gabarit (panneau + onglet)
 * ------------------------------------------------------------------ */
.wiloo-panel__body .attachment,
.wiloo-tab-panel .attachment {
  margin-bottom: .65rem;
}
.wiloo-tab-panel .attachment:last-child {
  margin-bottom: 0;
}
.wiloo-panel__body .attachment h4,
.wiloo-tab-panel .attachment h4 {
  font-size: .9rem;
  margin: 0 0 .2rem;
}
.wiloo-tab-panel .attachment p {
  font-size: .82rem;
  color: var(--wiloo-pp-muted);
  margin: 0 0 .35rem;
}

.wiloo-attachment-dl {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .8rem;
  background: var(--wiloo-pp-accent);
  color: #fff !important;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}
.wiloo-attachment-dl:hover {
  filter: brightness(.94);
}
.wiloo-attachment-dl .material-icons {
  font-size: 1.05rem;
}

/* Filet de sécurité : si une classe d'onglet Bootstrap subsiste sur un contenu inclus */
.wiloo-panel__body .tab-pane,
.wiloo-tab-panel .tab-pane {
  display: block;
  opacity: 1;
}

/* ------------------------------------------------------------------ *
 * 6. Divers
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .wiloo-panel__chevron {
    transition: none;
  }
}


/* ------------------------------------------------------------------ *
 * 7. Étiquette « Promo ! » sur l'image de couverture (fiche produit)
 *    Remplace le bandeau orange pleine largeur hérité du theme.css.
 *    product-flags.tpl reste STOCK : le <ul class="product-flags"> est
 *    inclus dans #content, au-dessus de la galerie (product.tpl l.69).
 *
 *    ⚠ .page-content / #content sont en `position: static !important`
 *    (section 1) → on NE peut PAS les utiliser comme contexte. On ancre
 *    donc la pastille sur la colonne image, repassée en `relative`
 *    (reste dans le flux → aucun sticky/scroll réintroduit).
 *
 *    Specificité 0-1-2-0 (avec #content) → bat une règle globale
 *    `#content .product-flags` du bandeau. Si le bandeau global est en
 *    !important, ajouter !important sur background/width/position.
 * ------------------------------------------------------------------ */
.wiloo-product-image-col {
  position: relative !important;
}

.wiloo-product-image-col #content .product-flags {
  position: absolute;
  top: 10px;
  right: 10px;
  left: auto;
  width: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.wiloo-product-image-col #content .product-flags .product-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 22px;
  margin: 0;
  background: #f28a1b;          /* orange marque (pas de var orange dans ce fichier) */
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 9px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .03em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  white-space: nowrap;
  pointer-events: none;
}
