/* Circuit Diagram Vector Styling and Signal Wire Glows */

.circuit-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #080d19;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: visible;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.4));
  transition: border-color 0.3s ease;
}

.circuit-svg:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

/* Wires */
.wire, .wire-bus, .wire-control {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.signal-low {
  stroke: var(--signal-low);
  stroke-width: 2px;
}

.signal-high {
  stroke: var(--signal-high);
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.6));
  stroke-dasharray: 6 3;
  animation: pulseFlow 0.8s linear infinite;
}

.wire-selected {
  stroke: var(--color-primary);
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.7));
}

.wire-dimmed {
  stroke: #1e293b;
  opacity: 0.45;
}

.wire-control {
  stroke: var(--color-success);
}

.wire-carry-ripple {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ripple-wave {
  stroke: var(--color-arithmetic) !important;
  stroke-width: 4.5px !important;
  filter: drop-shadow(0 0 10px rgba(255, 183, 3, 0.9)) !important;
  animation: ripplePulse 0.4s ease-in-out infinite alternate;
}

@keyframes pulseFlow {
  from {
    stroke-dashoffset: 18;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes ripplePulse {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.02); }
}

/* Junction Dots */
.dot-idle {
  fill: var(--signal-low);
}

.dot-active {
  fill: var(--signal-high);
  filter: drop-shadow(0 0 4px var(--color-primary));
}

/* Logic Gates */
.gate-group {
  transition: transform 0.2s ease;
}

.gate-stroke {
  stroke: #475569;
  transition: stroke 0.2s;
}

.gate-body {
  fill: #131b2e;
  stroke: #475569;
  stroke-width: 2px;
  transition: all 0.25s ease;
}

.gate-active-glow {
  fill: rgba(0, 240, 255, 0.12);
  stroke: var(--color-primary);
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.4));
}

.gate-label {
  fill: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
  letter-spacing: 0.5px;
}

/* Module Blocks (Adders, ALU Cores, MUX) */
.submodule-box {
  fill: rgba(15, 23, 42, 0.5);
  stroke: rgba(255, 255, 255, 0.1);
  stroke-dasharray: 4 4;
}

.submodule-title {
  fill: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.alu-block {
  fill: #111a2f;
  stroke: #334155;
  stroke-width: 2px;
  transition: all 0.3s ease;
}

.fa-block {
  fill: #141e34;
}

.block-active-glow {
  stroke: var(--color-primary);
  fill: rgba(0, 240, 255, 0.08);
  filter: drop-shadow(0 0 14px rgba(0, 240, 255, 0.35));
}

.block-dimmed {
  opacity: 0.5;
  stroke: #1e293b;
}

.fa-active-pulse {
  stroke: var(--color-arithmetic) !important;
  fill: rgba(255, 183, 3, 0.12) !important;
  filter: drop-shadow(0 0 12px rgba(255, 183, 3, 0.5));
}

.block-title {
  fill: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.block-subtitle {
  fill: var(--text-muted);
  font-size: 9px;
  font-family: var(--font-mono);
}

.block-pin-label {
  fill: #94a3b8;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.block-status-tag {
  fill: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.block-status-tag.tag-active {
  fill: var(--color-primary);
}

/* Multiplexer (MUX) Styles */
.mux-body {
  fill: #16203a;
  stroke: #475569;
  stroke-width: 2px;
  transition: all 0.25s ease;
}

.mux-text {
  fill: #e2e8f0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.mux-pin-label {
  fill: #64748b;
  font-family: var(--font-mono);
  font-size: 9.5px;
  transition: fill 0.2s;
}

.mux-pin-label.label-highlight {
  fill: var(--color-primary);
  font-weight: 700;
}

/* I/O Pins and Probes */
.pin-idle {
  fill: #1a243a;
  stroke: #334155;
  stroke-width: 1.5px;
}

.pin-active {
  fill: var(--color-primary);
  stroke: #fff;
  stroke-width: 2px;
  filter: drop-shadow(0 0 6px var(--color-primary));
}

.pin-control {
  fill: #064e3b;
  stroke: var(--color-success);
  stroke-width: 1.5px;
}

.pin-control-active {
  fill: var(--color-success);
  stroke: #fff;
  stroke-width: 2px;
  filter: drop-shadow(0 0 6px var(--color-success));
}

.pin-bus {
  fill: #1a2236;
  stroke: #475569;
  stroke-width: 2px;
}

.pin-out-idle {
  fill: #151d2f;
  stroke: #334155;
  stroke-width: 2px;
}

.pin-out-active {
  fill: #082f49;
  stroke: var(--color-primary);
  stroke-width: 2px;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
}

.pin-text {
  fill: #f8fafc;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.pin-active .pin-text,
.pin-control-active .pin-text {
  fill: #000;
}

.pin-label {
  fill: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
}

/* Probe Badges */
.probe-badge circle {
  transition: fill 0.2s, r 0.2s;
}

.probe-badge:hover circle {
  r: 11px;
  cursor: pointer;
}

/* Circuit container responsive wrapper */
.circuit-frame {
  position: relative;
  background: rgba(13, 19, 34, 0.6);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  margin-top: 1rem;
}

.circuit-badge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.circuit-caption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.circuit-live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--color-success);
  font-family: var(--font-mono);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
  animation: blink 1.6s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
