/**
 * =============================================================================
 * NEXGUARD AI — Design System Central (v0.1.8)
 * SOC / Observability Center / API Operations Center Design System
 * Dark Enterprise Theme: Azul NEXGUARD, Grafite, Ciano Discreto
 * =============================================================================
 */

:root {
  /* =========================================================================
     1. Surface & Background Tokens
     ========================================================================= */
  --bg-app: #080c14;
  --bg-surface: #0e1524;
  --bg-surface-elevated: #151f33;
  --bg-surface-hover: #1c2a45;
  --bg-hover: #1c2a45;
  --bg-card: #0e1524;
  --bg-sidebar: #0a0f1a;
  --bg-topbar: #0d1422;
  --bg-glass: rgba(14, 21, 36, 0.85);

  /* =========================================================================
     2. Border Tokens
     ========================================================================= */
  --border-subtle: #1a263d;
  --border-default: #243554;
  --border-strong: #3b527e;
  --border-focus: #0284c7;

  /* =========================================================================
     3. Typography & Text Tokens
     ========================================================================= */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #080c14;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* =========================================================================
     4. Brand & Accent Tokens
     ========================================================================= */
  --accent-primary: #0284c7;       /* Azul NEXGUARD */
  --accent-primary-hover: #0369a1;
  --accent-primary-subtle: rgba(2, 132, 199, 0.12);
  --accent-secondary: #06b6d4;     /* Ciano Discreto */
  --accent-secondary-subtle: rgba(6, 182, 212, 0.12);

  /* =========================================================================
     5. Semantic & Status Tokens
     ========================================================================= */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);

  --color-healthy: #10b981;
  --color-warning: #f59e0b;
  --color-critical: #ef4444;
  --status-healthy: #10b981;
  --status-warning: #f59e0b;
  --status-critical: #ef4444;

  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.35);

  --ai: #8b5cf6;
  --ai-bg: rgba(139, 92, 246, 0.12);
  --ai-border: rgba(139, 92, 246, 0.35);

  --unknown: #64748b;
  --unknown-bg: rgba(100, 116, 139, 0.12);
  --unknown-border: rgba(100, 116, 139, 0.35);

  /* Severities */
  --severity-p0: #ef4444;
  --severity-p1: #f97316;
  --severity-p2: #eab308;
  --severity-p3: #3b82f6;

  /* =========================================================================
     6. Radii & Shadows
     ========================================================================= */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);

  /* =========================================================================
     7. Spacing System
     ========================================================================= */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;

  /* =========================================================================
     8. Layout Dimensions
     ========================================================================= */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 56px;
  --content-max-width: 1600px;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* Base resets & box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   Universal Focus Ring (WCAG AA Compliance)
   ========================================================================= */
:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 1px;
}

/* =========================================================================
   Standardized Badges
   ========================================================================= */
.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.nx-badge-healthy,
.nx-badge-success {
  background: var(--success-bg);
  color: #34d399;
  border-color: var(--success-border);
}

.nx-badge-warning {
  background: var(--warning-bg);
  color: #fbbf24;
  border-color: var(--warning-border);
}

.nx-badge-critical,
.nx-badge-danger {
  background: var(--danger-bg);
  color: #f87171;
  border-color: var(--danger-border);
}

.nx-badge-info {
  background: var(--info-bg);
  color: #60a5fa;
  border-color: var(--info-border);
}

.nx-badge-ai {
  background: var(--ai-bg);
  color: #a78bfa;
  border-color: var(--ai-border);
}

.nx-badge-neutral,
.nx-badge-unknown {
  background: var(--unknown-bg);
  color: #94a3b8;
  border-color: var(--unknown-border);
}

.nx-badge-p0 { background: rgba(239, 68, 68, 0.16); color: #f87171; border-color: rgba(239, 68, 68, 0.4); }
.nx-badge-p1 { background: rgba(249, 115, 22, 0.16); color: #fb923c; border-color: rgba(249, 115, 22, 0.4); }
.nx-badge-p2 { background: rgba(234, 179, 8, 0.16); color: #facc15; border-color: rgba(234, 179, 8, 0.4); }
.nx-badge-p3 { background: rgba(59, 130, 246, 0.16); color: #60a5fa; border-color: rgba(59, 130, 246, 0.4); }

/* =========================================================================
   Standardized Button System
   ========================================================================= */
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.nx-btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}
.nx-btn-primary:hover:not(:disabled) {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.nx-btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.nx-btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.nx-btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.nx-btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nx-btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
.nx-btn-danger:hover:not(:disabled) {
  background-color: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.nx-btn:disabled,
.nx-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================================================================
   Standardized Form System
   ========================================================================= */
.nx-form-group {
  margin-bottom: var(--space-4);
}

.nx-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.nx-input,
.nx-select,
.nx-textarea {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-app);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nx-input:focus,
.nx-select:focus,
.nx-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-subtle);
  outline: none;
}

.nx-input::placeholder,
.nx-textarea::placeholder {
  color: var(--text-muted);
}

/* =========================================================================
   Standardized Tables
   ========================================================================= */
.nx-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.nx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.nx-table th {
  background: rgba(14, 21, 36, 0.95);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.nx-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.nx-table tr:hover td {
  background-color: rgba(28, 42, 69, 0.4);
  color: var(--text-primary);
}

/* =========================================================================
   Standardized Empty States
   ========================================================================= */
.nx-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
}

.nx-empty-icon {
  width: 36px;
  height: 36px;
  stroke: var(--text-muted);
  margin-bottom: var(--space-3);
  opacity: 0.7;
}

.nx-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-1) 0;
}

.nx-empty-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0;
}

/* =========================================================================
   Telemetry Inconsistency Alert Banner
   ========================================================================= */
.nx-telemetry-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  color: #fbbf24;
  font-size: 0.85rem;
  margin-bottom: var(--space-4);
}

/* =========================================================================
   Accessibility & Animations (Respect Reduced Motion)
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
