/**
 * Fondo estático en rutas con visor pesado (WebGL/Three, canvas 2D, PDF, SVG).
 * body.rum-viewer-3d-route | body.rum-viewer-2d-route
 * Reduce animaciones y capas de decoración para dejar margen de GPU/CPU al visor.
 */

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) {
  background-color: #050a18 !important;
  background-image: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .stars-container {
  display: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .viewer-shell {
  background: #2a2a2a !important;
  background-image: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) #viewer {
  background: #2a2a2a !important;
}

/* Panel de mando: gradiente del host (el visor nativo .rum-cp-panel-native lo anula abajo con blanco BIM Office) */
body.project-panel-cc:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .pp-cc-bim-host .viewer-shell {
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #1e2d4a 0%, #0b1018 42%, #030508 100%) !important;
}

body.project-panel-cc:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .pp-cc-bim-host .main-layout.rum-cp-panel-native .viewer-shell,
body.project-panel-cc:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .pp-cc-bim-host .main-layout.rum-cp-panel-native .viewer-shell #viewer,
body.project-panel-cc:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .pp-cc-bim-host .main-layout.rum-cp-panel-native .viewer-shell #viewer canvas {
  background: #fff !important;
  background-image: none !important;
}

body.project-panel-cc:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .pp-cc-viewport:has(.rum-cp-panel-native) {
  background: #ffffff !important;
  background-image: none !important;
}

body.project-panel-cc:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .pp-cc-bim-host .viewer-shell #viewer {
  background: transparent !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) #visualizador-bim .main-layout {
  background: #0a1628 !important;
  background-image: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .viewer-loader {
  background: rgba(5, 8, 22, 0.94) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .viewer-loader__panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(15, 23, 42, 0.96) !important;
}

/* Solo aplanar el loader legacy; no tocar RumPortalOrb (.viewer-loader__portal-visual) */
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route)
  .viewer-loader__panel:not(:has(.viewer-loader__portal-visual))
  .viewer-loader__core {
  animation: none !important;
  background: rgba(56, 189, 248, 0.4) !important;
  box-shadow: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .star,
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .stars-container .star {
  animation: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .satellite,
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .satellite-1,
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .satellite-2 {
  animation: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .rum-takeoff-page .star {
  animation: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .rum-takeoff-page .satellite,
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .rum-takeoff-page .satellite-1,
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .rum-takeoff-page .satellite-2 {
  animation: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route)
  .viewer-loader__panel:not(:has(.viewer-loader__portal-visual))
  .viewer-loader__warp::before,
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route)
  .viewer-loader__panel:not(:has(.viewer-loader__portal-visual))
  .viewer-loader__warp::after {
  animation: none !important;
  opacity: 0.4 !important;
  transform: scale(1) !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .world .satDot {
  animation: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

body.rum-viewer-2d-route .top-controls,
body.rum-viewer-2d-route .viewer-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.rum-viewer-2d-route header {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.rum-viewer-2d-route .hint,
body.rum-viewer-2d-route .panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.rum-viewer-2d-route .project-modal::before {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Widget: desactivar blur mientras WebGL está activo para liberar GPU */
body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .rum-viewer-widget {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body:is(.rum-viewer-3d-route, .rum-viewer-2d-route) .rum-viewer-widget--floating {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Promueve el canvas del visor a su propia capa de composición (solo cuando renderiza activamente) */
body:is(.rum-viewer-3d-route) #viewer:not(.cp-panel-viewer-idle),
body:is(.rum-viewer-3d-route) #viewer:not(.cp-panel-viewer-idle) canvas {
  will-change: transform;
  transform: translateZ(0);
}

/* Panel proyecto: sin WebGL activo — ocultar canvas y evitar capas GPU que parpadean con backdrop-filter */
body.project-panel-cc.rum-viewer-3d-route #viewer.cp-panel-viewer-idle,
body.project-panel-cc.rum-viewer-3d-route #viewer.cp-panel-viewer-idle canvas {
  visibility: hidden !important;
  pointer-events: none !important;
  will-change: auto !important;
  transform: none !important;
}

/* Evita que el split resizer y el KPI column compitan con el canvas */
body.rum-viewer-3d-route .pp-cc-cockpit--kpi {
  contain: layout style;
}

body.rum-viewer-3d-route .pp-cc-split {
  contain: strict;
}

/* Model Coordination — tema estudio claro (menos decoración oscura) */
body.rum-mc-studio {
  background-color: #f3f4f6 !important;
  background-image: none !important;
}

body.rum-mc-studio .viewer-shell,
body.rum-mc-studio #viewer {
  background: #000 !important;
}

body.rum-mc-studio .viewer-loader {
  background: rgba(0, 0, 0, 0.88) !important;
}

body.rum-mc-studio .viewer-loader__panel {
  background: rgba(255, 255, 255, 0.98) !important;
}

/* BIM Office — shell operativo (gradiente + estrellas); el visor WebGL sigue optimizado */
body.rum-bim-office-operational.rum-viewer-3d-route,
body.rum-viewer-operational.rum-viewer-3d-route,
body.rum-mc-operational.rum-viewer-3d-route {
  background: radial-gradient(circle at top, #050522 0, #000115 50%, #000 100%) !important;
  background-color: #000115 !important;
}

body.rum-bim-office-operational.rum-viewer-3d-route .stars-container,
body.rum-viewer-operational.rum-viewer-3d-route .stars-container,
body.rum-mc-operational.rum-viewer-3d-route .stars-container {
  display: block !important;
}

body.rum-bim-office-operational.rum-viewer-3d-route .stars-container .star,
body.rum-viewer-operational.rum-viewer-3d-route .stars-container .star,
body.rum-mc-operational.rum-viewer-3d-route .stars-container .star {
  animation: bim-op-stars-move 300s linear infinite !important;
}

@keyframes bim-op-stars-move {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

body.rum-bim-office-operational.rum-viewer-3d-route .satellite-1,
body.rum-viewer-operational.rum-viewer-3d-route .satellite-1,
body.rum-mc-operational.rum-viewer-3d-route .satellite-1 {
  animation: bim-op-fly1 15s infinite !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body.rum-bim-office-operational.rum-viewer-3d-route .satellite-2,
body.rum-viewer-operational.rum-viewer-3d-route .satellite-2,
body.rum-mc-operational.rum-viewer-3d-route .satellite-2 {
  animation: bim-op-fly2 10s infinite 5s !important;
  opacity: 1 !important;
  visibility: visible !important;
}

@keyframes bim-op-fly1 {
  0% { transform: translateX(-100vw); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(100vw); opacity: 0; }
}

@keyframes bim-op-fly2 {
  0% { transform: translate(100vw, 0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(-100vw, 100vh); opacity: 0; }
}
