/* =========================================
   Start Menu — Agent Plaque Hover Animation
   Green gradient "thrust" with arrow motif.
   JS adds/removes .sm-active on the button
   to persist the highlight while its flyout
   is visible.
   ========================================= */

[data-control-id^="agent-plaque-"] {
  position: relative !important;
}

/* Gradient thrust layer — slides in from the left */
[data-control-id^="agent-plaque-"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(72, 200, 110, 0.07) 35%,
    rgba(72, 200, 110, 0.16) 68%,
    rgba(72, 200, 110, 0.22) 100%
  );
  opacity: 0;
  transform: translateX(-20px);
  transition:
    opacity  0.22s ease-out,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

/* Arrow motif — ❯ ❯ ❯ at right edge, thrust in with gradient */
[data-control-id^="agent-plaque-"]::after {
  content: '❯  ❯  ❯';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(72, 200, 110, 0.40);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity  0.22s ease-out,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}

/* Activate: CSS :hover on the row div OR JS .sm-active class on the button */
[data-layout-id^="agent-row-"]:hover [data-control-id^="agent-plaque-"]::before,
[data-control-id^="agent-plaque-"].sm-active::before {
  opacity: 1;
  transform: translateX(0);
}

[data-layout-id^="agent-row-"]:hover [data-control-id^="agent-plaque-"]::after,
[data-control-id^="agent-plaque-"].sm-active::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Persistent tint while flyout is open */
[data-control-id^="agent-plaque-"].sm-active {
  background-color: rgba(72, 200, 110, 0.07) !important;
}

/* =========================================
   Depth field layers (D2) */
.depth-layer-0 { opacity: 1.0; filter: none; transition: opacity 300ms, filter 300ms; }
.depth-layer-1 { opacity: 0.7; filter: blur(1px); transition: opacity 300ms, filter 300ms; }
.depth-layer-2 { opacity: 0.4; filter: blur(2px); transition: opacity 300ms, filter 300ms; }
.depth-layer-3 { opacity: 0.15; filter: blur(3px) grayscale(80%); transition: opacity 300ms, filter 300ms; }

/* Frozen placeholders for layer-2 windows (D3) */
.window-frozen-placeholder {
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
}
.window-frozen-title {
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-family: sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.window-frozen-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100% - 25px);
    opacity: 0.3;
}
.window-frozen-indicator {
    font-size: 24px;
    color: rgba(255,255,255,0.6);
}

/* Shadow silhouettes for layer-3 windows (D4) */
.window-silhouette {
    background: rgba(100, 100, 100, 0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    user-select: none;
    width: 100%;
    height: 100%;
}
.window-silhouette-title {
    color: rgba(255,255,255,0.25);
    font-size: 11px;
    font-family: sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
    max-width: 100%;
}

/* =========================================
   B5: Window spawn / close / move / focus
   CSS transition infrastructure (Epic B)
   ========================================= */

/* Spawning: scale from 0 with spring overshoot */
.window-spawning {
  transform: scale(0) !important;
  opacity: 0 !important;
  transition:
    transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   200ms ease-out !important;
}

/* Closing: scale to 0, fade out */
.window-closing {
  transform: scale(0) !important;
  opacity: 0 !important;
  transition:
    transform 200ms cubic-bezier(0.36, 0, 0.66, 0),
    opacity   150ms ease-in !important;
  pointer-events: none;
}

/* Moving: smooth position glide */
.window-moving {
  transition:
    left   200ms ease-out,
    top    200ms ease-out !important;
}

/* Focusing: subtle scale pulse — applied momentarily by JS, then removed */
.window-focusing {
  transform: scale(1.02) !important;
  transition: transform 120ms ease-out !important;
}

/* CSS custom properties for JS physics to read */
:root {
  --spring-tension: 0.005;
  --spring-damping: 0.8;
  --spring-rest-length: 300;
  --focus-attraction-factor: 0.6;
}

/* Smooth transition for programmatic zoom (button clicks, keyboard shortcuts, fitAll) */
/* NOT applied during wheel zoom — that uses applyTransform() which skips this class */
#floating-viewport.zoom-transitioning {
  transition: transform 200ms ease-out;
}

/* LOD: Micro tier — title-only collapsed view */
.lod-micro {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  overflow: hidden;
}

.lod-micro-title {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  font-family: sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 4px;
}

/* =========================================
   Data Point Mode — Epic E5
   Windows collapse to tiny colored dots
   when camera is far from the scene.
   ========================================= */

/* Collapse each floating window to a 6x6 dot when body is in data-point mode */
body.scene-data-point-mode #floating-viewport .floating-window-wrapper {
  width: 6px !important;
  height: 6px !important;
  overflow: visible !important;
  background: transparent !important;
}

/* Data point dot visual */
body.scene-data-point-mode #floating-viewport .floating-window-wrapper::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: rgba(100, 160, 255, 0.85);
  box-shadow: 0 0 4px rgba(100, 160, 255, 0.5);
}

/* Title tooltip on hover */
body.scene-data-point-mode #floating-viewport .floating-window-wrapper::after {
  content: attr(data-window-id);
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 25, 40, 0.9);
  color: rgba(200, 215, 240, 0.95);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
}

body.scene-data-point-mode #floating-viewport .floating-window-wrapper:hover::after {
  opacity: 1;
}

/* Hide the window content (all children) in data-point mode */
body.scene-data-point-mode #floating-viewport .floating-window-wrapper > * {
  display: none !important;
}

/* =========================================
   Analysis Transition — Epic G4
   Windows fly to scatter-plot positions
   with 800ms transition + LOD shrink.
   ========================================= */

/* Smooth position fly-to for scatter plot (overrides window-moving's 80ms) */
.analysis-transitioning {
  transition:
    left   800ms cubic-bezier(0.34, 1.56, 0.64, 1),
    top    800ms cubic-bezier(0.34, 1.56, 0.64, 1),
    width  400ms ease-out,
    height 400ms ease-out,
    transform 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shrink windows to micro during scatter transition (restored on exit) */
body.scene-analysis-active #floating-viewport .floating-window-wrapper:not(.analysis-transitioning) {
  opacity: 0.8;
}

/* =========================================
   Outlier Highlighting — Epic G5
   Pulsing border glow for outlier windows
   in DataAnalysis mode.
   ========================================= */

@keyframes outlier-pulse-high {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(220, 60, 60, 0.6); }
  50%       { box-shadow: 0 0 16px 4px rgba(220, 60, 60, 0.9); }
}

@keyframes outlier-pulse-moderate {
  0%, 100% { box-shadow: 0 0 6px 2px rgba(220, 180, 40, 0.5); }
  50%       { box-shadow: 0 0 12px 3px rgba(220, 180, 40, 0.8); }
}

.floating-window-wrapper.outlier-high {
  border: 1px solid rgba(220, 60, 60, 0.7);
  animation: outlier-pulse-high 1.5s ease-in-out infinite;
}

.floating-window-wrapper.outlier-moderate {
  border: 1px solid rgba(220, 180, 40, 0.6);
  animation: outlier-pulse-moderate 2s ease-in-out infinite;
}

/* =========================================
   Drill-Down — Epic G6
   ========================================= */

/* Highlighted window when drilled into */
.floating-window-wrapper.drill-down-active {
  box-shadow: 0 0 0 3px rgba(100, 180, 255, 0.8), 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 2000 !important;
}

/* Dim all other windows during drill-down */
body.scene-analysis-active .floating-window-wrapper:not(.drill-down-active):not(.outlier-high):not(.outlier-moderate) {
  opacity: 0.4;
  transition: opacity 300ms ease;
}
