/*
 * Planta 3D view — the model owns the whole viewport (S19). Presets and model tools live behind
 * one menu button (top-right); title and view name stay as a visually hidden live region.
 */
.plant-layout {
  height: 100%;
}

/* ---------- 3D viewer ---------- */
.scene-wrap {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--gradient-viewer);
}
#viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  opacity: 0;
}

/* ---------- Menu button + collapsible controls ---------- */
.viewer-menu-btn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 42px;
  height: 42px;
  padding: 0;
  border-color: var(--border);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
  z-index: 6;
}
.viewer-controls {
  position: absolute;
  top: calc(var(--space-4) + 50px);
  right: var(--space-4);
  display: grid;
  gap: var(--space-2);
  justify-items: end;
  max-width: calc(100% - 2 * var(--space-4));
  z-index: 6;
}
.view-presets,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
}
.view-presets button {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
}
.view-presets button:hover {
  background: var(--state-hover-bg);
}
.view-presets button.active {
  background: var(--brand-700);
  color: var(--neutral-0);
}
.tool {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}
.separator {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  align-self: center;
  background: var(--border);
}
/* Layers popover opens beside the controls instead of the old bottom dock. */
.scene-wrap .popover {
  top: calc(var(--space-4) + 50px);
  bottom: auto;
  left: auto;
  right: calc(var(--space-4) + 290px);
  transform: none;
}

/* ---------- Equipment labels (off by default, enabled from the Layers menu) ---------- */
#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.tooltip-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgb(23 33 41 / 0.86);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
  pointer-events: auto; /* labels open their equipment on click */
  cursor: pointer;
  transition: background var(--transition-fast);
}
.tooltip-label:hover {
  background: var(--brand-600);
}
.tooltip-label.selected {
  background: var(--brand-700);
  box-shadow: 0 0 0 2px var(--neutral-0);
}

@media (max-width: 900px) {
  .scene-wrap .popover {
    right: var(--space-4);
    top: auto;
    bottom: var(--space-4);
  }
}
