/**
 * vehicle-3d-viewer.css — styles isolés sous .viewer-3d et .gallery [data-thumb="3d"].
 */

/* -------------------------------------------------------------------------
   Override .img-selected — passage de height fixe à min-height.
   La règle source est dans webroot/scss/theme.scss (déjà modifiée) mais
   theme.css n'est pas encore recompilé. Cet override tient la charge jusqu'au
   prochain build SCSS ; peut rester ensuite comme filet de sécurité.
   Spécificité alignée sur celle de theme.css (0,1,2,2) — l'ordre de chargement
   (vehicle-3d-viewer.css chargé après theme.css) tranche.
   ------------------------------------------------------------------------- */
body main #location-2 .gallery .img-selected {
  height: auto;
  min-height: 350px;
}
@media (max-width: 991.98px) {
  body main #location-2 .gallery .img-selected {
    height: auto;
    min-height: 350px;
  }
}

/* --- Miniature 3D dans la galerie --- */
.gallery ul li[data-thumb="3d"] {
  background: #f8f8f8;
}
.gallery ul li[data-thumb="3d"] .viewer-3d-thumb {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #4a7fc1;
}
.gallery ul li[data-thumb="3d"] .viewer-3d-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
  padding: 15%;
}
.gallery ul li[data-thumb="3d"].active .viewer-3d-thumb,
.gallery ul li[data-thumb="3d"]:hover .viewer-3d-thumb {
  color: #35608f;
}

/* --- Conteneur 3D dans .img-selected ---
   Le conteneur externe n'a PAS d'aspect-ratio ni d'overflow:hidden : il empile
   verticalement la scène, l'avis, et le bouton "Plus d'infos".
   L'aspect-ratio + clipping sont sur .scene-wrap uniquement. */
.viewer-3d {
  position: relative;
  width: 100%;
}
.viewer-3d .scene-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f8f8f8;
  overflow: hidden;
  touch-action: pan-y;
  border-radius: 4px;
}
.viewer-3d .scene-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Placeholder de chargement --- */
.viewer-3d .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
  color: #5b6570;
  font-size: 0.85rem;
}
.viewer-3d .placeholder .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e9eff8;
  border-top-color: #4a7fc1;
  border-radius: 50%;
  animation: viewer3d-sp 0.9s linear infinite;
}
@keyframes viewer3d-sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .viewer-3d .placeholder .spinner { animation: none; border-top-color: #e9eff8; }
}

/* --- Légende cotes (coin haut-droit du canvas) --- */
.viewer-3d .legende-cotes {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d9dde3;
  border-radius: 5px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 20px auto 1fr;
  column-gap: 8px;
  row-gap: 4px;
  align-items: center;
  font-size: 0.8rem;
  color: #2e353c;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  max-width: 200px;
}
.viewer-3d .legende-titre {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  font-weight: 700;
  color: #35608f;
  padding-bottom: 5px;
  border-bottom: 1px solid #d9dde3;
  margin-bottom: 3px;
  letter-spacing: 0.01em;
}
.viewer-3d .cote-ico {
  width: 18px;
  height: 18px;
  stroke: #4a7fc1;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.viewer-3d .cote-lbl {
  color: #5b6570;
  font-size: 0.75rem;
}
.viewer-3d .cote-val {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.viewer-3d .cote-val.emphase {
  color: #35608f;
}
.viewer-3d .cote-sep {
  grid-column: 1 / -1;
  height: 1px;
  background: #d9dde3;
  margin: 3px 0;
  border: none;
}
@media (max-width: 500px) {
  .viewer-3d .legende-cotes {
    font-size: 0.72rem;
    padding: 6px 8px;
    column-gap: 6px;
    max-width: 150px;
    top: 6px;
    right: 6px;
  }
  .viewer-3d .legende-titre { font-size: 0.82rem; padding-bottom: 4px; margin-bottom: 2px; }
  .viewer-3d .cote-ico { width: 15px; height: 15px; }
  .viewer-3d .cote-lbl { font-size: 0.68rem; }
}

/* --- Bandeau d'avertissement sous la scène --- */
.viewer-3d-avis {
  background: #fff5e6;
  border-left: 3px solid #d18b2b;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin: 10px 0 0;
  color: #6b4a15;
}
.viewer-3d-avis[hidden] { display: none; }

/* --- Bouton "Plus d'infos" sous la scène ---
   Reprend la classe .btn-grey small du site (comme le simulateur kilométrique).
   Le seul ajout ici : override du margin-left:15px de .btn-grey.small,
   inapproprié pour un bouton isolé sous la scène.
   Sélecteur à 3 classes pour battre "body main .btn-grey.small" (2 types + 2 classes). */
.viewer-3d-more.btn-grey.small {
  margin: 10px 0 0 !important;
}
.viewer-3d-more[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Lightbox "Fiche technique" — reprise du style de la variante 6 des démos.
   Structure : panel (overflow: hidden) > close-button (absolute, hors scroll)
                                        + body (overflow-y: auto, scrollable)

   Z-index à 999999 = même niveau que "body header" mobile fixed (theme.css).
   Le portail JS place la lightbox en dernier enfant de <body> à l'ouverture ;
   à z-index égal, l'ordre DOM tranche et la lightbox passe au-dessus.
   Le seul élément de la page à z-index supérieur est #popup-overlay (9999999),
   qui n'est jamais simultané avec cette lightbox (popup de landing, dismiss
   avant que l'utilisateur n'atteigne l'étape 2 de réservation).
   ------------------------------------------------------------------------- */
.viewer-3d-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.viewer-3d-lightbox[hidden] { display: none; }
.viewer-3d-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 53, 60, 0.6);
  animation: v3d-lb-fade 0.15s ease-out;
}
@keyframes v3d-lb-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .viewer-3d-lightbox-backdrop { animation: none; }
}
.viewer-3d-lightbox-panel {
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid #d9dde3;
  border-radius: 8px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;              /* panel non scrollable */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #2e353c;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}
.v3d-lb-body {
  overflow-y: auto;              /* scroll dans le body seul */
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
}
/* Close : hors du scroll (dans le panel, absolute) et au-dessus du body scrollable.
   Fond bleu solide → visible aussi bien sur le header bleu que sur les
   sections blanches qui viennent derrière quand on scrolle.
   z-index local au panel (contexte d'empilement créé par position: relative
   sur .viewer-3d-lightbox-panel) : une valeur de 2 suffit. */
.v3d-lb-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: #4a7fc1;
  color: #fff;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s;
}
.v3d-lb-close:hover,
.v3d-lb-close:focus {
  background: #35608f;
  outline: none;
}
.v3d-lb-header {
  background: #4a7fc1;
  color: #fff;
  padding: 16px 56px 14px 18px;   /* padding-right laisse la place au bouton close (46px) */
}
.v3d-lb-header h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}
.v3d-lb-baseline {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.9;
}
.viewer-3d-lightbox .v3d-lb-section {
  padding: 14px 18px;
  border-bottom: 1px solid #eef1f5;
}
.viewer-3d-lightbox .v3d-lb-section:last-child {
  border-bottom: none;
}
.viewer-3d-lightbox .v3d-lb-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5b6570;
  margin: 0 0 10px;
  font-weight: 700;
}
.v3d-lb-hero {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.v3d-lb-volume {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.v3d-lb-volume-value {
  font-size: 2.6rem;
  font-weight: 800;
  color: #35608f;
  line-height: 1;
}
.v3d-lb-volume-unit {
  font-size: 1rem;
  color: #5b6570;
}
.v3d-lb-hero-label {
  font-size: 0.85rem;
  color: #5b6570;
  text-align: right;
}
.v3d-lb-dims {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.v3d-lb-dims li {
  background: #f4f6f9;
  border-radius: 5px;
  padding: 10px 8px;
  text-align: center;
}
.v3d-lb-dims li span {
  display: block;
  font-size: 0.7rem;
  color: #5b6570;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.v3d-lb-dims li strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: #35608f;
}
.v3d-lb-payload {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 10px;
}
.v3d-lb-payload-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #35608f;
  line-height: 1;
}
.v3d-lb-payload-unit {
  font-size: 0.95rem;
  color: #5b6570;
}
.v3d-lb-equiv {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: grid;
  gap: 4px;
}
.v3d-lb-equiv li {
  font-size: 0.85rem;
  color: #2e353c;
}
.v3d-lb-note {
  background: #e9eff8;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #35608f;
  margin: 8px 0 0;
}
.v3d-lb-cartons-value {
  font-size: 1rem;
  margin: 0 0 8px;
  color: #2e353c;
}
.v3d-lb-cartons-value strong {
  font-size: 1.4rem;
  color: #35608f;
  margin: 0 3px;
}
.v3d-lb-cartons-format {
  font-size: 0.8rem;
  color: #5b6570;
  display: block;
  margin-top: 2px;
}
.v3d-lb-disclaimer {
  font-size: 0.75rem;
  color: #5b6570;
  font-style: italic;
  margin: 8px 0 0;
  line-height: 1.4;
}
@media (max-width: 500px) {
  .viewer-3d-lightbox { padding: 8px; }
  .viewer-3d-lightbox-panel { max-height: 95vh; }
  .v3d-lb-header { padding: 14px 52px 12px 14px; }
  .v3d-lb-header h2 { font-size: 1.05rem; }
  .viewer-3d-lightbox .v3d-lb-section { padding: 12px 14px; }
  .v3d-lb-volume-value { font-size: 2.1rem; }
  .v3d-lb-dims { gap: 6px; }
  .v3d-lb-dims li strong { font-size: 0.95rem; }
}
