/* ═══════════════════════════════════════════════════════════════
   VIBRANEXUS — Red neuronal viva de la organización
   VibraWorld · 2026
   ═══════════════════════════════════════════════════════════════ */

/* ── Tab button ─────────────────────────────────────────────── */
.bn-tab[data-tab="nexus"] .bn-icon { font-size: 20px; }

/* ── Panel base ─────────────────────────────────────────────── */
#panel-nexus {
  position: fixed;
  inset: 0;
  background: #04020d;
  z-index: 120;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#panel-nexus.vn-active { display: flex; }

/* ── Header ─────────────────────────────────────────────────── */
.vn-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: env(safe-area-inset-top, 44px) 16px 12px;
  background: linear-gradient(180deg, rgba(4,2,13,.95) 70%, transparent);
  display: flex;
  align-items: center;
  gap: 12px;
}
.vn-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex: 1;
}
.vn-subtitle {
  font-size: 11px;
  color: rgba(167,139,250,.6);
  font-family: 'DM Mono', monospace;
  margin-top: 1px;
}
.vn-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(167,139,250,.12);
  border: 1px solid rgba(167,139,250,.25);
  color: #a78bfa;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s;
}
.vn-back:hover { background: rgba(167,139,250,.22); }

/* ── Canvas ─────────────────────────────────────────────────── */
#vn-canvas {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}
#vn-canvas:active { cursor: grabbing; }

/* ── HUD top-right ──────────────────────────────────────────── */
.vn-hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 44px) + 64px);
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.vn-hud-pill {
  background: rgba(4,2,13,.82);
  border: 1px solid rgba(167,139,250,.18);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}
.vn-hud-pill span { color: #a78bfa; font-weight: 700; }

/* ── Filter pills ───────────────────────────────────────────── */
.vn-filters {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 70px);
  left: 0; right: 0;
  display: flex;
  gap: 8px;
  padding: 0 12px;
  overflow-x: auto;
  z-index: 10;
  scrollbar-width: none;
}
.vn-filters::-webkit-scrollbar { display: none; }
.vn-filter-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(167,139,250,.25);
  background: rgba(4,2,13,.75);
  color: rgba(255,255,255,.65);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all .25s;
  backdrop-filter: blur(6px);
}
.vn-filter-btn.active,
.vn-filter-btn:hover {
  background: rgba(167,139,250,.2);
  border-color: #a78bfa;
  color: #fff;
}

/* ── Node detail panel ──────────────────────────────────────── */
.vn-detail {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 110px);
  left: 12px; right: 12px;
  background: rgba(8,4,24,.92);
  border: 1px solid rgba(167,139,250,.25);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(20px);
  z-index: 20;
  transform: translateY(120%);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
.vn-detail.visible {
  transform: translateY(0);
  pointer-events: all;
}
.vn-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.vn-detail-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border: 2px solid;
  flex-shrink: 0;
}
.vn-detail-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.vn-detail-role {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  font-family: 'DM Mono', monospace;
  margin-top: 2px;
}
.vn-detail-close {
  margin-left: auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.vn-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.vn-stat {
  background: rgba(167,139,250,.07);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.vn-stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #a78bfa;
}
.vn-stat-lbl {
  font-size: 9px;
  color: rgba(255,255,255,.45);
  font-family: 'DM Mono', monospace;
  margin-top: 3px;
}
.vn-detail-connections {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  font-family: 'DM Mono', monospace;
  margin-bottom: 10px;
}
.vn-detail-connections strong { color: #60a5fa; }
.vn-detail-btn {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
}
.vn-detail-btn:hover { opacity: .85; }

/* ── Legend ─────────────────────────────────────────────────── */
.vn-legend {
  position: absolute;
  top: calc(env(safe-area-inset-top, 44px) + 64px);
  left: 12px;
  background: rgba(4,2,13,.82);
  border: 1px solid rgba(167,139,250,.18);
  border-radius: 14px;
  padding: 10px 12px;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.vn-legend-title {
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 7px;
}
.vn-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-size: 10px;
  color: rgba(255,255,255,.65);
  font-family: 'DM Mono', monospace;
}
.vn-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Pulse ring animation ───────────────────────────────────── */
@keyframes vn-pulse {
  0%   { transform: scale(1); opacity: .8; }
  50%  { transform: scale(1.15); opacity: .4; }
  100% { transform: scale(1); opacity: .8; }
}

/* ── Loading state ──────────────────────────────────────────── */
.vn-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
}
.vn-loading-text {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: rgba(167,139,250,.7);
  animation: vn-pulse 1.5s ease-in-out infinite;
}
.vn-spinner {
  width: 40px; height: 40px;
  border: 2px solid rgba(167,139,250,.15);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tooltip ────────────────────────────────────────────────── */
.vn-tooltip {
  position: absolute;
  background: rgba(8,4,24,.92);
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11px;
  color: #fff;
  font-family: 'DM Mono', monospace;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.vn-tooltip.visible { opacity: 1; }
