/**
 * ESPP Full Microservice Architecture Visualizer (Diagram 3) Stylesheet
 * Hand-Drawn Topology Layout & Adaptive Context Node Styling
 */

.full-arch-viewport {
  position: relative;
  width: 100%;
  min-height: 860px;
  background: radial-gradient(circle at 50% 20%, #0d1527 0%, #060a12 100%);
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid #1e293b;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  padding: 18px 20px 24px 20px;
  box-sizing: border-box;
  transition: min-width 0.3s ease;
}

/* 100% Expanded View with Clear Paths */
.full-arch-viewport.view-100 {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  border-radius: 0 !important;
  border: none !important;
  max-width: none !important;
  min-height: 100vh !important;
  overflow: auto !important;
  padding: 24px 36px !important;
  background: radial-gradient(circle at 50% 20%, #0d1527 0%, #060a12 100%) !important;
  box-shadow: none !important;
}

.full-arch-viewport.view-100 .full-arch-grid {
  min-width: 1440px;
  max-width: 1680px;
  margin: 0 auto;
}

/* Header & Scenario Toolbar */
.full-arch-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
  z-index: 20;
}

.full-arch-title-group h2 {
  margin: 0 0 4px 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 10px;
}

.full-arch-title-group h2 .live-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.full-arch-title-group p {
  margin: 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

/* Toolbar & Scenario Selector */
.full-arch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.use-case-select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 290px;
}

.use-case-select:hover,
.use-case-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ctrl {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ctrl:hover {
  background: #334155;
  border-color: #475569;
  color: #ffffff;
}

.btn-ctrl:active {
  transform: translateY(1px);
}

.btn-play-scenario {
  background: #1d4ed8;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
}

.btn-play-scenario:hover {
  background: #2563eb;
  border-color: #60a5fa;
}

.btn-play-scenario.playing {
  background: #b91c1c;
  border-color: #ef4444;
}

/* Zoom Button */
.btn-zoom {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
}

.btn-zoom:hover {
  background: #334155;
  border-color: #64748b;
  color: #ffffff;
}

.btn-zoom.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Send Request Split Button & Batch Dropdown */
.send-request-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-send-request {
  background: #0284c7;
  border: 1px solid #0ea5e9;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-send-request:hover {
  background: #0369a1;
  border-color: #38bdf8;
}

.btn-send-request.sending {
  background: #075985;
  opacity: 0.85;
}

.btn-batch-toggle {
  background: #0284c7;
  border: 1px solid #0ea5e9;
  color: #ffffff;
  padding: 6px 8px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-batch-toggle:hover {
  background: #0369a1;
}

.dropdown-arch-batch {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 4px;
  z-index: 50;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-arch-batch.hidden {
  display: none;
}

.dropdown-batch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.dropdown-batch-item:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.dropdown-batch-item.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-weight: 600;
}

.batch-badge {
  font-size: 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 1px 5px;
  border-radius: 4px;
}

.dropdown-batch-item:hover .batch-badge,
.dropdown-batch-item.active .batch-badge {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

/* ==========================================================================
   Topology Canvas & Spatial Zone Layout (Matching Hand-Drawn Architecture)
   ========================================================================== */

.full-arch-grid {
  position: relative;
  width: 100%;
  flex: 1;
  z-index: 10;
  padding: 8px 4px;
}

/* Fullscreen SVG Overlay for Connection Rails & Signal Packets */
.full-arch-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.arch-topology-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
  z-index: 10;
}

/* Upper Zone: Ingress (left) | Gateway Hub (mid) | Microservices & DBs (right) */
.arch-upper-zone {
  display: grid;
  grid-template-columns: 190px 220px 1fr;
  gap: 24px;
  align-items: center;
  width: 100%;
}

.ingress-subzone {
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: center;
}

.gateway-hub-subzone {
  display: flex;
  flex-direction: column;
  gap: 36px;
  justify-content: center;
  align-items: center;
}

.services-db-stack-subzone {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.service-db-pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

/* Mid Zone: Harness Voice Orchestrator & Storage Pair */
.arch-mid-zone {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 2px;
}

.harness-storage-pair-row {
  display: grid;
  grid-template-columns: 280px 280px;
  gap: 28px;
  justify-content: center;
  align-items: center;
}

/* AI Zone: STT (left) | Decision -> LLM (center) | TTS (right) */
.arch-ai-zone {
  display: grid;
  grid-template-columns: 240px 280px 240px;
  gap: 32px;
  justify-content: center;
  align-items: start;
  width: 100%;
  margin-top: 6px;
}

.decision-llm-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* ==========================================================================
   Adaptive Context Node Styling (.context-draggable-node & .service-node)
   ========================================================================== */

.context-draggable-node,
.service-node {
  background: #11151e;
  border: 1px solid #252e3e;
  border-radius: 0.625rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  padding: 10px 14px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  user-select: none;
  cursor: pointer;
  position: relative;
  z-index: 12;
  box-sizing: border-box;
}

.context-draggable-node:hover,
.service-node:hover {
  border-color: #4b5e7d;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Card Header & Content Typography */
.node-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.node-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.node-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-port {
  font-size: 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.node-subtitle {
  font-size: 0.70rem;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-desc {
  font-size: 0.62rem;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges for IAM, Broker, Storage */
.badge-protocol {
  display: inline-flex;
  align-items: center;
  font-size: 0.60rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-iam {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.badge-storage {
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.3);
}

.badge-decision {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.1);
  border-color: rgba(192, 132, 252, 0.3);
}

.badge-broker {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.3);
}

.badge-llm {
  color: #e879f9;
  background: rgba(232, 121, 249, 0.1);
  border-color: rgba(232, 121, 249, 0.3);
}

.badge-sql {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}

.badge-nosql {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.3);
}

.r2-badge {
  font-size: 0.60rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.r2-badge.uploaded {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

/* Active Glowing Node Highlight States (Identical to Adaptive Context) */
.node-active,
.node-active-purple {
  border-color: #c084fc !important;
  box-shadow: 0 0 20px rgba(192, 132, 252, 0.6) !important;
  transform: translateY(-2px);
}

.node-active-emerald {
  border-color: #10b981 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6) !important;
  transform: translateY(-2px);
}

.node-active-blue {
  border-color: #60a5fa !important;
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.6) !important;
  transform: translateY(-2px);
}

.node-active-cyan {
  border-color: #22d3ee !important;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.6) !important;
  transform: translateY(-2px);
}

.node-active-amber {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.6) !important;
  transform: translateY(-2px);
}

/* ==========================================================================
   SVG Connection Paths & Moving Protocol Signal Packets
   ========================================================================== */

.arch-path {
  fill: none;
  stroke: rgba(100, 116, 139, 0.14);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  transition: stroke 0.3s ease, stroke-width 0.3s ease, filter 0.3s ease;
}

.arch-path-active {
  stroke: #38bdf8 !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.8)) !important;
}

.arch-path-purple {
  stroke: #a855f7 !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.85)) !important;
}

.arch-path-orange {
  stroke: #f97316 !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.85)) !important;
}

.arch-path-emerald {
  stroke: #10b981 !important;
  stroke-width: 2.5 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.85)) !important;
}

/* Moving Signal Packet with Protocol Badge Pill */
.moving-packet {
  pointer-events: none;
}

.packet-dot {
  fill: #38bdf8;
  filter: drop-shadow(0 0 8px #38bdf8);
}

.packet-dot-purple {
  fill: #c084fc;
  filter: drop-shadow(0 0 8px #c084fc);
}

.packet-dot-orange {
  fill: #fb923c;
  filter: drop-shadow(0 0 8px #fb923c);
}

.packet-dot-emerald {
  fill: #34d399;
  filter: drop-shadow(0 0 8px #34d399);
}

.packet-label-pill {
  fill: rgba(15, 23, 42, 0.94);
  stroke: currentColor;
  stroke-width: 1;
}

.packet-label-text {
  font-size: 8.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  fill: #f1f5f9;
  text-anchor: middle;
  dominant-baseline: central;
}

/* ==========================================================================
   Telemetry Status Panel
   ========================================================================== */

.telemetry-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 14px;
  z-index: 20;
}

.telemetry-step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.telemetry-desc {
  font-size: 0.78rem;
  color: #f1f5f9;
}

.telemetry-data-box {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  color: #34d399;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.metric-label {
  font-size: 0.62rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-val {
  font-size: 0.76rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  color: #38bdf8;
}

/* Audio Buffer Pill */
.audio-buffer-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: #38bdf8;
}

/* Architectural Compatibility Classes */
.tier-ingress,
.tier-services,
.tier-storage,
.tier-ai,
.mvc-card,
.mvc-controller,
.mvc-service,
.mvc-model,
.mvc-phase-1 {
  /* Topology mappings */
}

/* Calm Idle Subnodes & Inactive Buses */
.mvc-subnode {
  color: #64748b;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.mvc-bus-line {
  background: rgba(148, 163, 184, 0.12);
}

/* Hidden Model-View-Controller Subnodes (Temporary Hide as requested) */
.mvc-triad-stage,
.mvc-subnode,
.mvc-bus {
  display: none !important;
}
