/* ============================================
   INTERACTIVE WIDGETS — Shared styles
   ============================================ */

/* Container for interactive visualizations */
.interactive {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.interactive__label {
  position: absolute;
  top: var(--sp-md);
  left: var(--sp-md);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 5;
  pointer-events: none;
}

/* Hide label when a toolbar is present — the toolbar itself signals interactivity */
.interactive:has(.widget-toolbar--top) .interactive__label {
  display: none;
}


/* ============================================
   STYLED SLIDERS
   ============================================ */
.widget-slider {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.widget-slider__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

.widget-slider__input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.widget-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(200,160,100,0.3);
  transition: transform 0.15s var(--ease-spring), box-shadow 0.15s;
}

html[data-theme="light"] .widget-slider__input::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(160,120,48,0.35);
}

.widget-slider__input::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 12px rgba(200,160,100,0.5);
}

html[data-theme="light"] .widget-slider__input::-webkit-slider-thumb:active {
  box-shadow: 0 0 0 1px var(--accent), 0 2px 12px rgba(160,120,48,0.5);
}

.widget-slider__input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(200,160,100,0.3);
}

html[data-theme="light"] .widget-slider__input::-moz-range-thumb {
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(160,120,48,0.35);
}

.widget-slider__value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  min-width: 40px;
}


/* ============================================
   TOGGLE GROUPS
   ============================================ */
.widget-toggles {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.widget-toggle {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.widget-toggle:hover {
  color: var(--text-secondary);
}

.widget-toggle.is-active {
  background: var(--surface);
  color: var(--accent);
}


/* ============================================
   ACTION BUTTONS
   ============================================ */
.widget-btn {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, color 0.2s, transform 0.15s var(--ease-spring);
}

.widget-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.widget-btn:active {
  transform: scale(0.97);
}

.widget-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.widget-btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 80%, white);
  border-color: color-mix(in srgb, var(--accent) 80%, white);
  color: var(--bg);
}


/* ============================================
   PLAYBACK CONTROLS
   ============================================ */
.widget-playback {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.widget-playback__btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.widget-playback__btn:hover {
  color: var(--accent);
  background: var(--surface);
}

.widget-playback__btn svg {
  width: 16px;
  height: 16px;
}

.widget-playback__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}


/* ============================================
   TOOLTIPS
   ============================================ */
.widget-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.widget-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}


/* ============================================
   SVG INTERACTIVE ELEMENTS
   ============================================ */
.draggable-handle {
  cursor: grab;
}

.draggable-handle:active {
  cursor: grabbing;
}

/* SVG node hover states */
.node-interactive {
  cursor: pointer;
  transition: filter 0.2s;
}

.node-interactive:hover {
  filter: brightness(1.2);
}


/* ============================================
   WIDGET TOOLBAR — Controls above/below viz
   ============================================ */
.widget-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  flex-wrap: wrap;
}

.widget-toolbar--top {
  border-bottom: 1px solid var(--border-subtle);
}

.widget-toolbar--bottom {
  border-top: 1px solid var(--border-subtle);
}

.widget-toolbar__spacer {
  flex: 1;
}


/* ============================================
   STATUS INDICATORS
   ============================================ */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot--active {
  background: var(--success);
  box-shadow: 0 0 6px rgba(126, 200, 150, 0.5);
}

.status-dot--error {
  background: var(--error);
  box-shadow: 0 0 6px rgba(212, 117, 106, 0.5);
}

.status-dot--idle {
  background: var(--text-muted);
}
