/* ============================================================
   Vue 3D dynamique — overlay plein écran
   Tous les styles sont scopés sous .threed-overlay pour ne pas
   interférer avec le reste de la page (planner ou calculator).
   ============================================================ */

.threed-overlay {
  position: fixed;
  inset: 0;
  background: #07090f;
  z-index: 9000;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.threed-overlay .scene-root { position: absolute; inset: 0; }
.threed-overlay .labels { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

.threed-overlay .label {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}
.threed-overlay .label.cat-hidden { visibility: hidden; }

.threed-overlay .label-floor {
  background: rgba(7, 9, 15, .92);
  border: 1px solid rgba(255, 255, 255, .10);
  border-top: 3px solid currentColor;
  border-radius: 4px;
  padding: 6px 12px;
  text-align: center;
}
.threed-overlay .label-floor b { display: block; font-size: 13px; font-weight: 700; color: #e8eaf0; }
.threed-overlay .label-floor sm { display: block; font-size: 9px; opacity: .5;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

.threed-overlay .label-flow {
  background: rgba(7, 9, 15, .92);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
}
.threed-overlay .label-flow b { font-size: 13px; }
.threed-overlay .label-flow sm { display: block; font-size: 8px; opacity: .55;
  text-transform: uppercase; letter-spacing: .05em; }

.threed-overlay .label-final {
  background: rgba(250, 149, 73, 0.15);
  border: 2px solid currentColor;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 700;
  text-align: center;
}
.threed-overlay .label-final b { display: block; font-size: 16px; }
.threed-overlay .label-final sm { display: block; font-size: 9px; opacity: .6;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }

.threed-overlay .label-factory {
  background: rgba(7, 9, 15, .95);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 8px 14px;
  text-align: center;
  font-weight: 700;
}
.threed-overlay .label-factory b { display: block; font-size: 14px; color: #e8eaf0; }
.threed-overlay .label-factory sm { display: block; font-size: 9px; opacity: .55;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }

.threed-overlay .hud {
  position: absolute; top: 14px; left: 14px;
  pointer-events: none; z-index: 20; max-width: 340px;
}
.threed-overlay .hud h1 { color: #FA9549; font-size: 14px; font-weight: 700; }
.threed-overlay .hud p  { color: rgba(255, 255, 255, .40); font-size: 10px;
  margin-top: 3px; line-height: 1.5; }

.threed-overlay .hints {
  position: absolute; bottom: 14px; right: 14px;
  color: rgba(255, 255, 255, .25);
  font-size: 10px; text-align: right;
  pointer-events: none; line-height: 1.7; z-index: 20;
}

.threed-overlay .legend {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  background: rgba(7, 9, 15, .94);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 8px;
  padding: 10px 0;
  font-size: 11px;
  user-select: none;
  min-width: 190px;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.threed-overlay .legend-section {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.threed-overlay .legend-section:last-child { border-bottom: none; }

.threed-overlay .legend-section-title {
  color: #FA9549; font-size: 9px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  margin-bottom: 6px;
}
.threed-overlay .legend-quick {
  display: flex; gap: 5px; margin-bottom: 7px;
}
.threed-overlay .legend-quick button {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.65);
  border-radius: 4px;
  font-size: 10px;
  padding: 3px 6px;
  cursor: pointer;
  font-family: inherit;
}
.threed-overlay .legend-quick button:hover {
  background: rgba(250, 149, 73, .15);
  border-color: #FA9549;
  color: #FA9549;
}
.threed-overlay .legend label {
  display: flex; align-items: center; gap: 6px;
  color: rgba(255, 255, 255, .70); cursor: pointer;
  padding: 2px 0;
}
.threed-overlay .legend label:hover { color: #fff; }
.threed-overlay .legend input[type=checkbox] {
  cursor: pointer; accent-color: #FA9549; flex-shrink: 0;
}

/* Bâtiments — par factory / étage */
.threed-overlay .legend-factory { margin-bottom: 5px; }
.threed-overlay .legend-factory:last-child { margin-bottom: 0; }
.threed-overlay .legend-factory-label {
  font-weight: 700;
  color: rgba(255,255,255,.90) !important;
}
.threed-overlay .legend-floors {
  padding-left: 16px;
  margin-top: 2px;
}
.threed-overlay .legend-floors label {
  font-size: 10px;
  color: rgba(255,255,255,.55) !important;
  padding: 1px 0;
}
.threed-overlay .legend-floors label:hover {
  color: rgba(255,255,255,.85) !important;
}
.threed-overlay .label.scope-hidden { display: none !important; }

.threed-overlay .td-close {
  position: absolute; top: 14px; right: 14px; z-index: 30;
  width: 36px; height: 36px;
  background: rgba(7, 9, 15, .92);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 6px;
  color: #e8eaf0; font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.threed-overlay .td-close:hover {
  background: rgba(250, 149, 73, .15);
  border-color: #FA9549;
  color: #FA9549;
}

.threed-overlay .error-box {
  position: absolute; inset: 30% 10%;
  background: #1a0a0a; color: #fca5a5;
  border: 1px solid #dc2626; border-radius: 8px;
  padding: 20px;
  font-family: monospace; font-size: 12px;
  display: none; z-index: 100;
  white-space: pre-wrap; overflow: auto;
}

/* Bouton "Vue 3D" dans le header du planner */
.threed-launch-btn {
  flex-shrink: 0;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(135deg, #FA9549, #f78c6b);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(250, 149, 73, .35);
  transition: all .15s;
  white-space: nowrap;
  align-self: flex-start;
}
.threed-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(250, 149, 73, .50);
}
.threed-launch-btn::before { content: '🏭 '; }
