/* VibraSignals — NERHIA Urban Intelligence Bridge */

#vibra-signals-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  flex-direction: column;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

#vibra-signals-panel.active {
  display: flex;
}

/* ── Header ── */
.vs-header {
  background: #050505;
  border-bottom: 1px solid #0f3;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.vs-header-back {
  background: none;
  border: none;
  color: #0f3;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.vs-header-back:hover { background: rgba(0,255,51,0.1); }

.vs-header-title {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.vs-header-title h2 {
  font-size: 14px;
  font-weight: 700;
  color: #0f3;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
}

.vs-header-title span {
  font-size: 10px;
  color: rgba(0,255,51,0.5);
  letter-spacing: 1px;
}

.vs-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #0f3;
  letter-spacing: 1px;
}

.vs-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0f3;
  animation: vs-pulse 1s ease-in-out infinite;
  box-shadow: 0 0 6px #0f3;
}

@keyframes vs-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ── City Brain Status Bar ── */
.vs-brain-bar {
  background: #050e05;
  border-bottom: 1px solid #0a2a0a;
  padding: 10px 16px;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.vs-brain-bar::-webkit-scrollbar { display: none; }

.vs-brain-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
  flex-shrink: 0;
}

.vs-brain-metric-label {
  font-size: 9px;
  color: rgba(0,255,51,0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.vs-brain-metric-value {
  font-size: 15px;
  font-weight: 700;
  color: #0f3;
}

.vs-brain-metric-value.warning { color: #ff0; }
.vs-brain-metric-value.critical { color: #f33; }

.vs-brain-metric-bar {
  width: 100%;
  height: 2px;
  background: rgba(0,255,51,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.vs-brain-metric-fill {
  height: 100%;
  background: #0f3;
  border-radius: 2px;
  transition: width 0.8s ease;
  box-shadow: 0 0 4px #0f3;
}

/* ── Main Layout ── */
.vs-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Signal Terminal ── */
.vs-terminal {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0a2a0a;
}

.vs-terminal-header {
  padding: 8px 12px;
  border-bottom: 1px solid #0a2a0a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.vs-terminal-header span {
  font-size: 10px;
  color: rgba(0,255,51,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.vs-terminal-controls {
  display: flex;
  gap: 8px;
}

.vs-terminal-btn {
  background: rgba(0,255,51,0.08);
  border: 1px solid rgba(0,255,51,0.2);
  color: #0f3;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.vs-terminal-btn:hover { background: rgba(0,255,51,0.15); border-color: #0f3; }
.vs-terminal-btn.active { background: rgba(0,255,51,0.2); border-color: #0f3; color: #fff; }

.vs-terminal-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column-reverse;
  scrollbar-width: thin;
  scrollbar-color: #0a3a0a transparent;
}

.vs-terminal-feed::-webkit-scrollbar { width: 4px; }
.vs-terminal-feed::-webkit-scrollbar-track { background: transparent; }
.vs-terminal-feed::-webkit-scrollbar-thumb { background: #0a3a0a; border-radius: 2px; }

.vs-signal-entry {
  display: flex;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 1.4;
  transition: background 0.2s;
  animation: vs-entry-in 0.3s ease;
  cursor: default;
}

@keyframes vs-entry-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.vs-signal-entry:hover { background: rgba(0,255,51,0.05); }

.vs-signal-entry.priority-5 { border-left: 2px solid #f33; background: rgba(255,51,51,0.05); }
.vs-signal-entry.priority-4 { border-left: 2px solid #f80; background: rgba(255,136,0,0.05); }
.vs-signal-entry.priority-3 { border-left: 2px solid #ff0; background: rgba(255,255,0,0.04); }
.vs-signal-entry.priority-2 { border-left: 2px solid #0f3; }
.vs-signal-entry.priority-1 { border-left: 2px solid rgba(0,255,51,0.2); opacity: 0.7; }

.vs-signal-time {
  color: rgba(0,255,51,0.4);
  font-size: 10px;
  min-width: 48px;
  flex-shrink: 0;
}

.vs-signal-type-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.badge-crowd    { background: rgba(147,51,234,0.3); color: #c084fc; }
.badge-motion   { background: rgba(59,130,246,0.3); color: #93c5fd; }
.badge-acoustic { background: rgba(236,72,153,0.3); color: #f9a8d4; }
.badge-thermal  { background: rgba(239,68,68,0.3); color: #fca5a5; }
.badge-optical  { background: rgba(234,179,8,0.3); color: #fde047; }
.badge-chemical { background: rgba(16,185,129,0.3); color: #6ee7b7; }
.badge-seismic  { background: rgba(245,158,11,0.3); color: #fcd34d; }
.badge-unknown  { background: rgba(100,116,139,0.3); color: #94a3b8; }

.vs-signal-body {
  flex: 1;
  color: rgba(255,255,255,0.8);
}

.vs-signal-body strong { color: #fff; }

.vs-signal-geo {
  font-size: 10px;
  color: rgba(0,255,51,0.4);
  flex-shrink: 0;
}

/* ── Side Panel ── */
.vs-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vs-sidebar-section {
  border-bottom: 1px solid #0a2a0a;
  padding: 10px;
}

.vs-sidebar-title {
  font-size: 9px;
  color: rgba(0,255,51,0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Zone Heatmap */
.vs-zone-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vs-zone-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}
.vs-zone-item:hover { background: rgba(0,255,51,0.05); }

.vs-zone-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vs-zone-name {
  font-size: 11px;
  color: #fff;
}

.vs-zone-score {
  font-size: 11px;
  font-weight: 700;
  color: #0f3;
}

.vs-zone-bar {
  height: 3px;
  background: rgba(0,255,51,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.vs-zone-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease;
}

/* Signal Stats */
.vs-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.vs-stat-item {
  background: rgba(0,255,51,0.04);
  border: 1px solid rgba(0,255,51,0.08);
  border-radius: 4px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vs-stat-label {
  font-size: 9px;
  color: rgba(0,255,51,0.4);
  letter-spacing: 0.5px;
}

.vs-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: #0f3;
}

/* ── Export Button ── */
.vs-export-bar {
  border-top: 1px solid #0a2a0a;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.vs-export-btn {
  background: rgba(0,255,51,0.1);
  border: 1px solid rgba(0,255,51,0.3);
  color: #0f3;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 7px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
  text-align: center;
}
.vs-export-btn:hover { background: rgba(0,255,51,0.2); border-color: #0f3; }

.vs-export-btn.batman {
  background: rgba(0,0,0,0.8);
  border-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
}
.vs-export-btn.batman:hover { background: #111; color: #fff; border-color: #fff; }

/* ── Bottom NERHIA Status ── */
.vs-nerhia-footer {
  background: #020a02;
  border-top: 1px solid #0a2a0a;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.vs-nerhia-id {
  font-size: 10px;
  color: rgba(0,255,51,0.3);
  letter-spacing: 1px;
}

.vs-signals-counter {
  font-size: 11px;
  color: #0f3;
  font-weight: 700;
}

.vs-city-health {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #0f3;
}

/* Scanline overlay */
#vibra-signals-panel::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Glitch flash effect on new critical signal */
@keyframes vs-critical-flash {
  0%, 100% { background: #000; }
  10%, 30%, 50% { background: rgba(255,0,0,0.08); }
  20%, 40% { background: #000; }
}

#vibra-signals-panel.critical-flash {
  animation: vs-critical-flash 0.6s ease;
}

/* Toast for signal milestones */
.vs-milestone-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f3;
  color: #000;
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: 4px;
  z-index: 9999;
  animation: vs-toast-in 0.3s ease, vs-toast-out 0.3s ease 2.5s forwards;
}

@keyframes vs-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes vs-toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
