/* =============================================================================
   LanePal Debug Panel — Live Architecture Visualization
   Shared across inbound dashboard and outbound dialer
   ============================================================================= */

/* Toggle button */
.debug-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  background: #1a1d27;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-family: monospace;
  cursor: pointer;
  transition: all 0.2s;
}
.debug-toggle:hover {
  color: #58a6ff;
  border-color: #58a6ff;
}
.debug-toggle.active {
  background: #0d1117;
  color: #3fb950;
  border-color: #3fb950;
}

/* Panel container */
.debug-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  background: #0d1117;
  border-top: 2px solid #30363d;
  z-index: 9998;
  overflow: hidden;
  transition: height 0.35s ease;
  display: flex;
  flex-direction: column;
}
.debug-panel.open {
  height: 420px;
}

/* Panel header */
.debug-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}
.debug-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #58a6ff;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: monospace;
}
.debug-panel-stats {
  font-size: 11px;
  color: #8b949e;
  font-family: monospace;
}
.debug-panel-stats span {
  margin-left: 16px;
}
.debug-panel-stats .count {
  color: #3fb950;
  font-weight: 600;
}

/* Main content area */
.debug-panel-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SVG diagram area */
.debug-diagram {
  flex: 1;
  padding: 8px;
  min-width: 0;
}
.debug-diagram svg {
  width: 100%;
  height: 100%;
}

/* Event ticker */
.debug-ticker {
  width: 300px;
  border-left: 1px solid #30363d;
  overflow-y: auto;
  flex-shrink: 0;
  font-family: monospace;
  font-size: 11px;
}
.debug-ticker-header {
  padding: 6px 12px;
  background: #161b22;
  color: #8b949e;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  border-bottom: 1px solid #30363d;
}
.debug-ticker-entry {
  padding: 4px 12px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
  animation: tickerFadeIn 0.3s ease;
}
.debug-ticker-entry .tick-time {
  color: #484f58;
  margin-right: 6px;
}
.debug-ticker-entry .tick-type {
  color: #58a6ff;
  font-weight: 600;
  margin-right: 6px;
}
.debug-ticker-entry .tick-data {
  color: #8b949e;
  word-break: break-all;
}
.debug-ticker-entry .tick-data .highlight {
  color: #3fb950;
}

@keyframes tickerFadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =========================================================================
   SVG Node styles
   ========================================================================= */

/* Default node */
.debug-node rect {
  fill: #1a1d27;
  stroke: #30363d;
  stroke-width: 1.5;
  rx: 6;
  transition: all 0.3s ease;
}
.debug-node text.node-label {
  fill: #c9d1d9;
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
}
.debug-node text.node-sub {
  fill: #484f58;
  font-size: 8px;
  text-anchor: middle;
  pointer-events: none;
}

/* Active node — glows */
.debug-node.active rect {
  stroke: #3fb950;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(63, 185, 80, 0.5));
}
.debug-node.active text.node-label {
  fill: #3fb950;
}

/* Category colors when active */
.debug-node.active.cat-telephony rect { stroke: #58a6ff; filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.5)); }
.debug-node.active.cat-telephony text.node-label { fill: #58a6ff; }

.debug-node.active.cat-media rect { stroke: #bc8cff; filter: drop-shadow(0 0 8px rgba(188, 140, 255, 0.5)); }
.debug-node.active.cat-media text.node-label { fill: #bc8cff; }

.debug-node.active.cat-ai rect { stroke: #d29922; filter: drop-shadow(0 0 8px rgba(210, 153, 34, 0.5)); }
.debug-node.active.cat-ai text.node-label { fill: #d29922; }

.debug-node.active.cat-user rect { stroke: #f0883e; filter: drop-shadow(0 0 8px rgba(240, 136, 62, 0.5)); }
.debug-node.active.cat-user text.node-label { fill: #f0883e; }

/* =========================================================================
   SVG Edge styles
   ========================================================================= */

.debug-edge line,
.debug-edge path {
  stroke: #21262d;
  stroke-width: 1.5;
  fill: none;
  transition: all 0.3s ease;
}

.debug-edge.active line,
.debug-edge.active path {
  stroke: #3fb950;
  stroke-width: 2;
}

/* Animated data particle traveling along edge */
.debug-particle {
  fill: #3fb950;
  r: 3;
  opacity: 0;
}
.debug-particle.active {
  opacity: 1;
  animation: particleTravel 0.8s ease forwards;
}
.debug-particle.cat-telephony { fill: #58a6ff; }
.debug-particle.cat-media { fill: #bc8cff; }
.debug-particle.cat-ai { fill: #d29922; }

@keyframes particleTravel {
  0% { opacity: 1; offset-distance: 0%; }
  100% { opacity: 0.3; offset-distance: 100%; }
}

/* Floating data label on edge */
.debug-data-label {
  position: absolute;
  background: #161b22;
  border: 1px solid #3fb950;
  color: #3fb950;
  font-family: monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: labelFade 2.5s ease forwards;
  z-index: 10;
}
.debug-data-label.cat-telephony { border-color: #58a6ff; color: #58a6ff; }
.debug-data-label.cat-media { border-color: #bc8cff; color: #bc8cff; }
.debug-data-label.cat-ai { border-color: #d29922; color: #d29922; }

@keyframes labelFade {
  0% { opacity: 0; transform: translateY(4px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* =========================================================================
   Scaling Simulator Controls
   ========================================================================= */

.debug-sim-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-btn {
  background: #1a1d27;
  color: #3fb950;
  border: 1px solid #3fb950;
  border-radius: 6px;
  padding: 4px 14px;
  font-size: 11px;
  font-family: monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.sim-btn:hover {
  background: rgba(63, 185, 80, 0.15);
}
.sim-btn.active {
  background: #3fb950;
  color: #0d1117;
}

.sim-speed-controls {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.sim-speed-btn {
  background: #161b22;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-family: monospace;
  cursor: pointer;
  transition: all 0.2s;
}
.sim-speed-btn:hover {
  color: #c9d1d9;
  border-color: #484f58;
}
.sim-speed-btn.active {
  background: #58a6ff;
  color: #0d1117;
  border-color: #58a6ff;
  font-weight: 600;
}

.sim-stats {
  display: inline-flex;
  gap: 14px;
  font-family: monospace;
  font-size: 11px;
  color: #8b949e;
}
.sim-stats .count {
  color: #3fb950;
  font-weight: 600;
}

/* Custom scrollbar for ticker */
.debug-ticker::-webkit-scrollbar { width: 4px; }
.debug-ticker::-webkit-scrollbar-track { background: transparent; }
.debug-ticker::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }
