/*
 * IMMGO — Écrans de la vente sur plan : jetons propres au module (couleurs des statuts sur la 3D et les plans), scène
 * 3D, étiquettes, légendes, commutateur, repli 2D, plan d'étage et ses zones (préfixe vsp-)
 * Auteur : Jacks Ngalangala
 */
:root {
  --vsp-vendu: #c98078;
  --vsp-vendu-trait: var(--danger);
  --vsp-reserve: #ddb062;
  --vsp-reserve-trait: var(--attention);
  --vsp-libre: #7db592;
  --vsp-libre-trait: var(--succes);
  --vsp-neutre: #ddd6ca;
  --vsp-neutre-trait: #a59c8b;
  --vsp-neutre-clair: #f6f3ec;
  --vsp-hachure: #e2c77d;
  --vsp-voile: rgba(255, 255, 255, 0.9);
  --vsp-ombre-texte: rgba(255, 255, 255, 0.9);
  --vsp-degrade-photo: rgba(22, 22, 22, 0.78);
}

/* ---------- Scène 3D (les couleurs de three.js sont lues ici) ---------- */
.vsp-3d {
  --vsp-3d-sol: #e6e0d4;
  --vsp-3d-parcelle: #d9d4cb;
  --vsp-3d-dalle: #fbfaf7;
  --vsp-3d-blanc: #f4f2ee;
  --vsp-3d-noyau: #e2ded7;
  --vsp-3d-vitre: #5e6a72;
  --vsp-3d-anthracite: #5a5d61;
  --vsp-3d-bois: #a9805c;
  --vsp-3d-or: #bba460;
  --vsp-3d-or-ombre: #5a3f08;
  --vsp-3d-vendu: var(--vsp-vendu);
  --vsp-3d-reserve: var(--vsp-reserve);
  --vsp-3d-libre: var(--vsp-libre);
  --vsp-3d-neutre-vendu: #dcd6cb;
  --vsp-3d-neutre-libre: #f7f5f0;
  --vsp-3d-neutre-fonce: #5f5a4f;
  --vsp-3d-arbre: #8e9c70;
  --vsp-3d-tronc: #8a7458;
  --vsp-3d-ciel: #fff9ee;
  --vsp-3d-sol-lumiere: #d9cfbe;
  --vsp-3d-soleil: #fff0d4;
  --vsp-3d-arete: #b5ab98;
  --vsp-3d-arete-claire: #ffffff;
  --vsp-3d-sans-lueur: #000000;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-grand);
  background: radial-gradient(120% 80% at 50% 0%, #fffdf8 0%, #f3eee4 60%, #ebe5d9 100%);
  border: 1px solid var(--trait);
  touch-action: none;
  min-height: 320px;
}
.vsp-3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.vsp-3d-canvas.vsp-3d-pointe {
  cursor: pointer;
}
.vsp-3d-etiquettes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.vsp-etiquette {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-weight: var(--graisse-forte);
  transform: translate(-50%, -100%) translate(var(--x, 0), var(--y, 0));
}
.vsp-etiquette-or {
  padding: 6px 12px;
  border-radius: var(--r-pilule);
  background: var(--nuit);
  color: var(--nuit-texte);
  font-size: var(--taille-petit);
  box-shadow: var(--ombre-3);
  margin-top: -10px;
}
.vsp-etiquette-or::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--nuit);
  transform: translateX(-50%) rotate(45deg);
}
.vsp-etiquette-niveau {
  font-size: 12px;
  color: var(--texte-faible);
  font-variant-numeric: tabular-nums;
}
.vsp-3d-calque {
  position: absolute;
  z-index: 2;
  display: flex;
  gap: var(--e-2);
  align-items: center;
}
.vsp-3d-haut-gauche {
  top: var(--e-4);
  left: var(--e-4);
}
.vsp-3d-haut-droite {
  top: var(--e-4);
  right: var(--e-4);
}
.vsp-3d-bas-gauche {
  bottom: var(--e-4);
  left: var(--e-4);
}
.vsp-3d-bas-droite {
  bottom: var(--e-4);
  right: var(--e-4);
}
.vsp-3d-bas {
  left: var(--e-3);
  right: var(--e-3);
  bottom: var(--e-3);
  justify-content: center;
}
.vsp-pastille-flottante {
  display: inline-flex;
  align-items: center;
  gap: var(--e-2);
  min-height: 36px;
  padding: var(--e-1) var(--e-3);
  border-radius: var(--r-pilule);
  background: var(--vsp-voile);
  border: 1px solid var(--trait);
  box-shadow: var(--ombre-2);
  font-size: var(--taille-petit);
  color: var(--texte-second);
  backdrop-filter: blur(6px);
}
.vsp-pastille-flottante svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.vsp-3d-chargement {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--e-3);
  background: var(--vsp-voile);
  color: var(--texte-second);
}
.vsp-3d-chargement .jauge {
  width: 220px;
}

/* Légende : pastille de couleur + texte, jamais la couleur seule */
.vsp-legende {
  display: flex;
  flex-wrap: wrap;
  gap: var(--e-2) var(--e-4);
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.vsp-legende span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.vsp-legende i,
.vsp-repli-lot i {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 4px;
  background: var(--puce);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.vsp-c-or {
  --puce: var(--or);
}
.vsp-c-vendu {
  --puce: var(--vsp-vendu);
}
.vsp-c-reserve {
  --puce: var(--vsp-reserve);
}
.vsp-c-libre {
  --puce: var(--vsp-libre);
}
.vsp-c-neutre {
  --puce: var(--vsp-neutre);
}
.vsp-c-neutre-libre {
  --puce: var(--vsp-neutre-clair);
}
.vsp-c-fantome {
  --puce: transparent;
}
.vsp-c-fantome i {
  border: 1.5px dashed var(--vsp-neutre-trait);
}
.vsp-legende-3d {
  padding: var(--e-2) var(--e-4);
  border-radius: var(--r-pilule);
  background: var(--vsp-voile);
  border: 1px solid var(--trait);
}

/* Commutateur segmenté sur fond clair */
.vsp-segments {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--r-pilule);
  background: var(--vsp-voile);
  border: 1px solid var(--trait);
  box-shadow: var(--ombre-2);
}
.vsp-segments button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--e-4);
  border: 0;
  border-radius: var(--r-pilule);
  background: transparent;
  color: var(--texte-second);
  font: inherit;
  font-size: var(--taille-petit);
  font-weight: var(--graisse-forte);
  white-space: nowrap;
  cursor: pointer;
}
.vsp-segments button svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.vsp-segments button[aria-pressed='true'] {
  background: var(--nuit);
  color: var(--nuit-texte);
}
.vsp-segments button:focus-visible {
  box-shadow: var(--anneau);
  outline: none;
}

/* Repli 2D (sans WebGL) : façade à plat */
.vsp-3d-repli {
  display: flex;
  flex-direction: column;
  gap: var(--e-4);
  padding: var(--e-5);
  background: var(--surface);
}
.vsp-repli-note {
  display: flex;
  gap: var(--e-2);
  align-items: flex-start;
  color: var(--texte-second);
  font-size: var(--taille-petit);
}
.vsp-repli-grille {
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
  margin-top: auto;
}
.vsp-repli-rangee {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--e-2);
  align-items: stretch;
}
.vsp-repli-rangee[data-etat='a_venir'] .vsp-repli-lot {
  border-style: dashed;
}
.vsp-repli-niveau {
  align-self: center;
  color: var(--texte-faible);
  font-size: var(--taille-legende);
  font-variant-numeric: tabular-nums;
}
.vsp-repli-lot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--e-2);
  min-height: 52px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-moyen);
  background: var(--surface-douce);
  font: inherit;
  font-weight: var(--graisse-forte);
  cursor: pointer;
}
.vsp-repli-lot[aria-pressed='true'] {
  border: 2px solid var(--or);
  background: var(--or-pale);
}
/* Les actions d'en-tête d'une carte gardent la place de leur libellé (jamais coupé, jamais réduit à l'icône). */
.vsp-pile-ecran .carte-tete > :last-child:not(:first-child) {
  flex-shrink: 0;
}
.vsp-3d-repli .vsp-3d-calque {
  position: static;
}
.vsp-3d-repli .vsp-3d-haut-droite,
.vsp-3d-repli .vsp-3d-bas-droite {
  display: none;
}
.vsp-3d-repli .vsp-3d-bas {
  order: 9;
}
