/* ==========================================================================
   VERITAS INTELLIGENCE — ULTRA-PREMIUM DESIGN SYSTEM (ENTERPRISE v4.0)
   Aesthetic: Palantir Foundry / Linear / Bloomberg Institutional Dark UI
   Typography: Plus Jakarta Sans (Display/UI) + IBM Plex Mono (Forensic Data)
   ========================================================================== */

:root {
  /* Deep Obsidian & Carbon Slate Surfaces */
  --bg-void: #03060c;
  --bg-canvas: #060a12;
  --bg-surface-1: #0a101d;
  --bg-surface-2: #0f172a;
  --bg-surface-3: #162038;
  --bg-surface-hover: #1b2845;

  /* Precision Hairline Borders & Specular Refraction */
  --border-subtle: rgba(148, 163, 184, 0.08);
  --border-default: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.25);
  --border-accent: rgba(59, 130, 246, 0.55);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Semantic Risk Tokens */
  --accent-primary: #2563eb;
  --accent-primary-hover: #3b82f6;
  --accent-primary-soft: rgba(37, 99, 235, 0.15);

  --risk-critical: #f43f5e;
  --risk-critical-bg: rgba(244, 63, 94, 0.12);
  --risk-critical-border: rgba(244, 63, 94, 0.35);

  --risk-high: #f59e0b;
  --risk-high-bg: rgba(245, 158, 11, 0.12);
  --risk-high-border: rgba(245, 158, 11, 0.35);

  --risk-low: #10b981;
  --risk-low-bg: rgba(16, 185, 129, 0.12);
  --risk-low-border: rgba(16, 185, 129, 0.35);

  /* Institutional Typography Stack */
  --font-sans: 'Plus Jakarta Sans', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans) !important;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: -0.008em;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

h1, h2, h3, h4, .font-extrabold, .font-bold {
  font-family: var(--font-sans);
  letter-spacing: -0.022em;
}

.font-mono, code, pre, .tabular-nums {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: -0.01em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 10, 18, 0.6);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Technical Grid & Matrix Backgrounds */
.bg-tech-grid {
  background-color: var(--bg-void);
  background-image: 
    linear-gradient(to right, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

.bg-dot-matrix {
  background-color: #050912;
  background-image: 
    radial-gradient(rgba(59, 130, 246, 0.12) 1px, transparent 1px),
    radial-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* Ultra-Premium Panels & Cards with Top Light Refraction */
.nx-panel {
  background: linear-gradient(180deg, rgba(16, 24, 42, 0.92) 0%, rgba(10, 16, 29, 0.96) 100%);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 
    0 8px 24px -4px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  position: relative;
}

.nx-card {
  background: linear-gradient(180deg, rgba(20, 30, 52, 0.78) 0%, rgba(12, 19, 34, 0.88) 100%);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.nx-card:hover {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(25, 37, 64, 0.85) 0%, rgba(15, 23, 42, 0.92) 100%);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
}

/* Ambient Risk Glows for Ultra-Premium Cards */
.nx-glow-critical {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(244, 63, 94, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(244, 63, 94, 0.28);
}
.nx-glow-critical:hover {
  border-color: rgba(244, 63, 94, 0.5);
}

.nx-glow-amber {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(245, 158, 11, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(245, 158, 11, 0.28);
}
.nx-glow-amber:hover {
  border-color: rgba(245, 158, 11, 0.5);
}

.nx-glow-blue {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(59, 130, 246, 0.11) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(59, 130, 246, 0.28);
}

.nx-glow-emerald {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(16, 185, 129, 0.09) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(16, 185, 129, 0.26);
}

/* Evidence Data Pill inside Forensic Cards */
.nx-data-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(6, 10, 18, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
}

/* Screen Transition Architecture (Natural Height, No Empty Stretching) */
.nx-screen {
  display: none !important;
}

.nx-screen.active {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  animation: nxScreenFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nxScreenFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Module Tab Content Transitions */
.nx-module-pane {
  display: none !important;
}

.nx-module-pane.active {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  animation: nxScreenFadeIn 0.15s ease-out forwards;
}

/* Sidebar Navigation Links */
.nx-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: left;
  white-space: nowrap;
}

.nx-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nx-nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0.06) 100%);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: inset 2px 0 0 #3b82f6;
  font-weight: 600;
}

.nx-nav-item.active .nx-nav-code {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.25);
}

.nx-nav-code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Sub-navigation Segmented Module Bar (Full Width Distributed) */
.nx-module-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 7px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  border-right: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.nx-module-tab:last-child {
  border-right: none;
}

.nx-module-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nx-module-tab.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.04) 0%, rgba(37, 99, 235, 0.16) 100%);
  font-weight: 600;
}

/* Status Dots & Semantic Badges */
.nx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.nx-dot-critical {
  background-color: var(--risk-critical);
  box-shadow: 0 0 8px var(--risk-critical);
}

.nx-dot-high {
  background-color: var(--risk-high);
  box-shadow: 0 0 8px var(--risk-high);
}

.nx-dot-low {
  background-color: var(--risk-low);
  box-shadow: 0 0 8px var(--risk-low);
}

.nx-dot-live {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: nxPulse 2s infinite;
}

@keyframes nxPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.2); }
}

.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nx-badge-critical {
  background: var(--risk-critical-bg);
  color: #fb7185;
  border-color: var(--risk-critical-border);
}

.nx-badge-high {
  background: var(--risk-high-bg);
  color: #fbbf24;
  border-color: var(--risk-high-border);
}

.nx-badge-low {
  background: var(--risk-low-bg);
  color: #34d399;
  border-color: var(--risk-low-border);
}

.nx-badge-info {
  background: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.nx-badge-neutral {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.22);
}

/* Institutional Data Tables */
.nx-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: rgba(8, 13, 24, 0.8);
}

.nx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.nx-table th {
  background: #0c1323;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.nx-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  vertical-align: middle;
}

.nx-table tbody tr {
  transition: background-color 0.12s ease;
}

.nx-table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

.nx-table tbody tr:last-child td {
  border-bottom: none;
}

/* Enterprise Buttons & Inputs */
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nx-btn:hover:not(:disabled) {
  background: var(--bg-surface-3);
  border-color: var(--border-strong);
}

.nx-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nx-btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nx-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: #60a5fa;
}

.nx-input, .nx-select, .nx-textarea {
  width: 100%;
  background: #060a12;
  border: 1px solid var(--border-default);
  border-radius: 5px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nx-input:focus, .nx-select:focus, .nx-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Impede o Chrome/Edge de deixar o campo branco no autopreenchimento */
.nx-input:-webkit-autofill,
.nx-input:-webkit-autofill:hover,
.nx-input:-webkit-autofill:focus,
.nx-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 40px #060a12 inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc !important;
  border-color: var(--border-default) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Section Micro-Headers */
.nx-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Slide-over Drawer */
.nx-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.78);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
}

.nx-drawer-backdrop.open {
  display: flex;
  justify-content: flex-end;
}

.nx-drawer {
  width: 100%;
  max-width: 580px;
  background: var(--bg-surface-1);
  border-left: 1px solid var(--border-strong);
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.8);
  animation: nxDrawerSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nxDrawerSlide {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ==========================================================================
   CYBER FORENSIC GRAPH VISUALIZATION ENGINE (ENTERPRISE PALANTIR GRADE)
   ========================================================================== */

/* Running energy flow on alert / defensive links */
@keyframes cyberFlowDash {
  to {
    stroke-dashoffset: -32;
  }
}

/* Holographic breathing pulse on nodes */
@keyframes cyberAuraPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.18;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.38;
  }
}

/* Radar scan rotation */
@keyframes cyberRadarSweep {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.cyber-graph-svg {
  user-select: none;
  background-color: transparent;
  outline: none;
}

/* Node Elements */
.cyber-node-group {
  cursor: pointer;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cyber-node-aura {
  transform-origin: center;
  animation: cyberAuraPulse 3s ease-in-out infinite;
  pointer-events: none;
}

.cyber-node-ring {
  transition: all 0.25s ease;
}

.cyber-node-core {
  transition: all 0.25s ease;
}

.cyber-node-label-plate {
  pointer-events: none;
  transition: all 0.2s ease;
}

/* Link Elements */
.cyber-link-path {
  fill: none;
  transition: stroke 0.25s ease, stroke-width 0.25s ease, opacity 0.25s ease;
}

.cyber-link-path.is-alert {
  stroke-dasharray: 6 5;
  animation: cyberFlowDash 1.4s linear infinite;
}

.cyber-edge-pill {
  cursor: pointer;
  transition: all 0.2s ease;
}

.cyber-edge-pill rect {
  transition: all 0.2s ease;
}

.cyber-edge-pill:hover rect {
  fill: #0c1527 !important;
  stroke: #38bdf8 !important;
  stroke-width: 1.6px !important;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.45));
}

/* Spotlight & Neighborhood Focus States */
.cyber-graph-active .cyber-node-group.is-dimmed,
.cyber-graph-active .cyber-link-group.is-dimmed {
  opacity: 0.08 !important;
  filter: grayscale(0.9) blur(0.5px);
}

.cyber-graph-active .cyber-node-group.is-highlighted {
  opacity: 1 !important;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.2));
}

.cyber-graph-active .cyber-node-group.is-highlighted .cyber-node-ring {
  stroke-width: 3.5px !important;
}

.cyber-graph-active .cyber-link-group.is-highlighted .cyber-link-path {
  opacity: 1 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 8px currentColor);
}

.cyber-graph-active .cyber-link-group.is-highlighted .cyber-edge-pill rect {
  stroke-width: 1.5px !important;
  stroke: #38bdf8 !important;
}

/* Floating Cyber HUD Toolbar */
.cyber-graph-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 10, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.cyber-hud-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cyber-hud-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.cyber-hud-btn.active {
  background: rgba(37, 99, 235, 0.35);
  color: #60a5fa;
  border-color: #3b82f6;
}

/* Floating Forensic Tooltip */
.cyber-forensic-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  display: none;
  min-width: 260px;
  max-width: 340px;
  background: rgba(6, 11, 22, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(56, 189, 248, 0.15);
  transform: translate(-50%, -100%);
  margin-top: -16px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.cyber-forensic-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(6, 11, 22, 0.94);
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

