/**
 * Network graph styles
 * @countermeasure/web-components/visualization/network-graph
 */

/* ============================================================================
   Container
   ============================================================================ */
.cmm-network-graph {
  position: relative;
  overflow: hidden;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none;
  cursor: grab;
}

.cmm-network-graph:active {
  cursor: grabbing;
}

.cmm-network-graph__svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================================================
   Nodes
   ============================================================================ */
.cmm-network-graph__node {
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.cmm-network-graph__node:hover {
  opacity: 0.85;
}

.cmm-network-graph__node-circle {
  fill: hsl(var(--primary));
  stroke: hsl(var(--background));
  stroke-width: 2;
  transition: stroke var(--transition-fast), r var(--transition-fast);
}

.cmm-network-graph__node:hover .cmm-network-graph__node-circle {
  stroke: hsl(var(--primary));
  stroke-width: 3;
}

.cmm-network-graph__node--selected .cmm-network-graph__node-circle {
  stroke: hsl(var(--primary));
  stroke-width: 3;
}

.cmm-network-graph__node--dimmed {
  opacity: 0.25;
  transition: opacity var(--transition-fast);
}

.cmm-network-graph__node--highlighted {
  opacity: 1;
}

.cmm-network-graph__node--dragging {
  cursor: grabbing;
}

.cmm-network-graph__node-icon {
  font-size: 0.75rem;
  text-anchor: middle;
  dominant-baseline: central;
  fill: hsl(var(--primary-foreground));
  pointer-events: none;
}

/* ============================================================================
   Labels
   ============================================================================ */
.cmm-network-graph__label {
  font-size: 0.6875rem;
  fill: hsl(var(--foreground));
  text-anchor: middle;
  pointer-events: none;
  font-weight: 500;
}

.cmm-network-graph__edge-label {
  font-size: 0.625rem;
  fill: hsl(var(--muted-foreground));
  text-anchor: middle;
  dominant-baseline: auto;
  pointer-events: none;
}

/* ============================================================================
   Edges
   ============================================================================ */
.cmm-network-graph__edge {
  cursor: pointer;
}

.cmm-network-graph__edge-line {
  fill: none;
  stroke: hsl(var(--border));
  stroke-width: 1.5;
  transition: stroke var(--transition-fast), stroke-width var(--transition-fast);
}

.cmm-network-graph__edge:hover .cmm-network-graph__edge-line {
  stroke: hsl(var(--primary));
  stroke-width: 2.5;
}

.cmm-network-graph__edge--dimmed {
  opacity: 0.15;
  transition: opacity var(--transition-fast);
}

.cmm-network-graph__edge--highlighted .cmm-network-graph__edge-line {
  stroke: hsl(var(--primary));
  stroke-width: 2;
}

.cmm-network-graph__arrowhead {
  fill: hsl(var(--border));
}

.cmm-network-graph__edge:hover .cmm-network-graph__arrowhead {
  fill: hsl(var(--primary));
}

.cmm-network-graph__edge--highlighted .cmm-network-graph__arrowhead {
  fill: hsl(var(--primary));
}

/* ============================================================================
   Zoom controls
   ============================================================================ */
.cmm-network-graph__controls {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cmm-network-graph__control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cmm-network-graph__control-btn:hover {
  background: hsl(var(--accent));
}
