/* ==========================================================================
   Cube Graph View — CSS Styles
   ===========================================================================
   Styles for the force-directed graph ("Cube") visualization in the Lattice
   dashboard. All classes use the `cube-` prefix to avoid collisions with
   existing dashboard styles. Theme-aware via the same CSS custom properties
   used by the rest of the dashboard.
   ========================================================================== */


/* ---------------------------------------------------------------------------
   Container
   --------------------------------------------------------------------------- */

.cube-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 120px);
  background: var(--bg-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
}


/* ---------------------------------------------------------------------------
   Legend (bottom-left overlay)
   --------------------------------------------------------------------------- */

.cube-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: var(--surface);
  opacity: 0.95;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 11px;
  max-width: 200px;
  z-index: 10;
  box-shadow: var(--shadow-card-hover);
}

.cube-legend-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cube-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--text-secondary);
}

.cube-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.cube-legend-line {
  width: 16px;
  height: 2px;
  flex-shrink: 0;
  display: inline-block;
  border-radius: 1px;
}


/* ---------------------------------------------------------------------------
   Tooltip (hover state on nodes)
   --------------------------------------------------------------------------- */

.cube-tooltip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12px;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  line-height: 1.4;
}

.cube-tooltip-id {
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 2px;
}

.cube-tooltip-title {
  font-weight: 500;
  margin-bottom: 6px;
}

.cube-tooltip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}

.cube-tooltip-label {
  color: var(--text-muted);
  font-size: 11px;
  min-width: 60px;
}

.cube-tooltip-hint {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}


/* ---------------------------------------------------------------------------
   Side Panel (selection detail, top-right overlay)
   --------------------------------------------------------------------------- */

.cube-side-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card-hover);
  z-index: 10;
  max-height: calc(100% - 32px);
  overflow-y: auto;
}

.cube-side-panel-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
}

.cube-side-panel-close:hover {
  color: var(--text-primary);
}

.cube-side-panel-id {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 12px;
}

.cube-side-panel-title {
  font-weight: 600;
  font-size: 16px;
  margin: 4px 0 12px;
}

.cube-side-panel-field {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.cube-side-panel-open {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: var(--accent-primary);
  color: var(--text-on-accent, #fff);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
}

.cube-side-panel-open:hover {
  background: var(--accent-hover);
}


/* ---------------------------------------------------------------------------
   Empty State (0-2 tasks)
   --------------------------------------------------------------------------- */

.cube-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}


/* ---------------------------------------------------------------------------
   Fallback (CDN failure / error state)
   --------------------------------------------------------------------------- */

.cube-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.cube-fallback-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.cube-fallback-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.cube-fallback-msg {
  max-width: 400px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.cube-fallback-retry {
  padding: 8px 24px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.cube-fallback-retry:hover {
  background: var(--accent-hover);
}


/* ---------------------------------------------------------------------------
   Mobile Notice (small viewport banner)
   --------------------------------------------------------------------------- */

.cube-mobile-notice {
  background: var(--color-warning-bg);
  color: var(--text-on-warning, var(--text-primary));
  padding: 8px 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}


/* ---------------------------------------------------------------------------
   Loading State
   --------------------------------------------------------------------------- */

.cube-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

/* Reuse the existing dashboard spinner animation (@keyframes spin) */
.cube-loading .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}


/* ---------------------------------------------------------------------------
   Accessibility: screen-reader only
   --------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
