/* Personnalisation 3D — chargé uniquement sur les fiches équipées de la visionneuse */
.p3d { --p3d-accent: #2d6a4f; --p3d-ligne: #ddd9d0; --p3d-doux: #5b6370; --p3d-vue: #e9e6df; --p3d-warn: #a85a07; --p3d-err: #b42318; }

/* Quand la visionneuse est prête, elle remplace les blocs natifs (qui restent dans la page, cachés :
   si le script ne se charge pas, la fiche reste utilisable telle quelle). */
body.p3d-actif .product-customization,
body.p3d-actif .product-variants,
body.p3d-actif .product-add-to-cart { display: none !important; }
/* Les photos réelles (.images-container) et le tableau des remises restent visibles sous l'aperçu. */

.p3d-vue-bloc, .p3d-panneau { --p3d-accent: #2d6a4f; --p3d-ligne: #ddd9d0; --p3d-doux: #5b6370; --p3d-vue: #e9e6df; --p3d-warn: #a85a07; --p3d-err: #b42318; }
.p3d-vue-bloc { margin-bottom: 1rem; }
.p3d-vue { position: relative; background: var(--p3d-vue); border-radius: 8px; aspect-ratio: 4 / 3; overflow: hidden; touch-action: none; max-width: 100%; }
.p3d-vue canvas { display: block; width: 100%; height: 100%; }
.p3d-charge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--p3d-doux); }
.p3d-sans3d { max-width: 30em; margin: 0; padding: 0 1.2em; text-align: center; line-height: 1.5; color: #3d4350; }
.p3d-badge { margin-top: 6px; color: var(--p3d-doux); font-size: 12px; line-height: 1.4; }
.p3d-nav { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 8px; font-size: 14px; }
.p3d-nav button { border: 1px solid var(--p3d-ligne); background: #fff; border-radius: 6px; padding: 4px 12px; cursor: pointer; }

.p3d-panneau { margin: 1rem 0; padding: 1rem; border: 1px solid var(--p3d-ligne); border-radius: 8px; background: #fff; }
.p3d-onglets { display: flex; gap: 6px; margin-bottom: 10px; }
.p3d-onglets button { flex: 1; padding: 8px; border: 1px solid var(--p3d-ligne); background: #faf9f7; border-radius: 6px; font: inherit; font-size: 14px; cursor: pointer; color: #232323; }
.p3d-onglets button[aria-pressed=true] { background: var(--p3d-accent); color: #fff; border-color: var(--p3d-accent); }
.p3d-t { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
.p3d-panneau input[type=text], .p3d-panneau select, .p3d-panneau textarea, .p3d-panneau input[type=number] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--p3d-ligne); border-radius: 6px; font: inherit; font-size: 16px; background: #fff; color: #232323; }
.p3d-panneau textarea { resize: vertical; line-height: 1.4; }
.p3d-panneau input[type=range] { width: 100%; accent-color: var(--p3d-accent); }
.p3d-compte { float: right; font-weight: 400; color: var(--p3d-doux); font-size: 13px; }
.p3d-aide { font-size: 13px; color: var(--p3d-doux); margin: 6px 0 0; }
.p3d-aide code { background: #f1efe9; padding: 1px 4px; border-radius: 3px; color: #232323; }
.p3d-apercu2d { margin-top: 8px; min-height: 34px; padding: 6px; border: 1px dashed var(--p3d-ligne); border-radius: 6px; overflow-x: auto; text-align: center; }
.p3d-ligne { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.p3d-ligne > div { flex: 1; min-width: 150px; }
.p3d-case { display: flex; gap: 8px; align-items: center; font-size: 15px; padding: 9px 0; font-weight: 400; }
.p3d-case input { width: 18px; height: 18px; }
.p3d-bornes { display: flex; justify-content: space-between; font-size: 12px; color: var(--p3d-doux); }
.p3d-lien { background: none; border: 0; padding: 6px 0; color: var(--p3d-accent); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.p3d-nuancier { display: flex; gap: 8px; flex-wrap: wrap; }
.p3d-nuancier button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--p3d-ligne); cursor: pointer; padding: 0; }
.p3d-nuancier button[aria-pressed=true] { outline: 3px solid var(--p3d-accent); outline-offset: 2px; }
#p3d-couleursLot { max-height: 220px; overflow-y: auto; margin-top: 8px; padding: 4px 8px; border: 1px solid var(--p3d-ligne); border-radius: 6px; }
.cl-ligne { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--p3d-ligne); font-size: 14px; }
.cl-ligne:first-child { border-top: 0; }
.cl-ligne span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-ligne button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--p3d-ligne); padding: 0; cursor: pointer; }
.cl-ligne button[aria-pressed=true] { outline: 2px solid var(--p3d-accent); outline-offset: 1px; }
.p3d-prix { margin-top: 14px; font-size: 18px; font-weight: 600; }
.p3d-prix small { font-weight: 400; color: var(--p3d-doux); font-size: 13px; }
.p3d-msg { font-size: 13px; margin-top: 10px; padding: 8px 10px; border-radius: 6px; display: none; }
.p3d-msg.warn { display: block; background: #fff4e5; color: var(--p3d-warn); }
.p3d-msg.err { display: block; background: #fdecea; color: var(--p3d-err); }
.p3d-ajouter { margin-top: 14px; width: 100%; }
/* Même vert que le bouton natif de la boutique (custom.css : .product-actions .btn-primary) */
.btn-primary.p3d-ajouter, .btn-primary.p3d-ajouter:disabled { background-color: #647d73; border-color: #647d73; }
.btn-primary.p3d-ajouter:hover:not(:disabled), .btn-primary.p3d-ajouter:focus:not(:disabled) { background-color: #55695f; border-color: #55695f; }
.p3d-atelier { margin-top: 14px; font-size: 13px; color: var(--p3d-doux); }
#p3d-carte { display: block; width: 100%; margin: 8px 0; border: 1px solid var(--p3d-ligne); background: #fff; }
.p3d [hidden], .p3d-panneau [hidden], .p3d-vue-bloc [hidden] { display: none !important; }
/* Le thème aligne certains intitulés à droite : on les remet à gauche dans le panneau */
.p3d-panneau label, .p3d-panneau .p3d-t { text-align: left; }
.p3d-atelier[open] { padding: 10px; border: 1px dashed var(--p3d-ligne); border-radius: 6px; }
.p3d-atelier button { margin-top: 6px; padding: 8px 12px; border: 1px solid var(--p3d-ligne); border-radius: 6px; background: #faf9f7; cursor: pointer; }

/* Fiche sans photo réelle (seulement des rendus « Aperçu 3D » ou rien) : on n'affiche pas le bloc image
   (ni le rendu en doublon, ni « Aucune image disponible ») ; l'aperçu 3D le remplace. */
body.p3d-actif.p3d-sans-photo .images-container { display: none !important; }
/* Fiche avec de vraies photos (sous l'aperçu manipulable) : le rendu « Aperçu 3D » ne sert qu'aux listes et au panier,
   on le retire de la galerie pour ne pas doubler l'aperçu (14/11/2026). */
body.p3d-actif .images-container .thumb-container:has(img[alt="Aperçu 3D"]),
body.p3d-actif #product-modal .thumb-container:has(img[alt="Aperçu 3D"]) { display: none !important; }
body.p3d-actif .images-container { margin-top: .5rem; }

/* Lot : une ligne par pièce, deux pastilles (plaque, relief) devant le texte */
.p3d-lot-ligne { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.p3d-lot-ligne input { flex: 1; min-width: 0; }
.p3d-pastille { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #ddd9d0; padding: 0; cursor: pointer; flex: none; }
.p3d-pastille.relief { width: 22px; height: 22px; }
.p3d-suppr { border: 0; background: none; color: #5b6370; cursor: pointer; font-size: 16px; padding: 4px 6px; }
.p3d-suppr:disabled { visibility: hidden; }
/* Lot : format et surcoût d'une pièce plus grande que les autres (13/11/2026) */
.p3d-format-ligne { flex: none; font-size: 12px; color: #5b6370; white-space: nowrap; }
.p3d-format-ligne.plus { color: #8a5a00; font-weight: 600; }
.p3d-palette { position: absolute; z-index: 1000; background: #fff; border: 1px solid #ddd9d0; border-radius: 8px; padding: 8px;
  display: grid; grid-template-columns: repeat(7, 28px); gap: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.p3d-palette-titre { grid-column: 1 / -1; font-size: 12px; color: #5b6370; font-weight: 600; }
.p3d-palette button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #ddd9d0; padding: 0; cursor: pointer; }
.p3d-palette button[aria-pressed=true] { outline: 3px solid #2d6a4f; outline-offset: 1px; }
