/* ============================================================
   NetGuard NIS2 - Design System
   Palette, Inter, navbar blanche, cards, boutons, tableaux,
   badges NIS2, hero card, login premium.
   ============================================================ */

:root {
  /* Palette indigo / slate */
  --ng-brand: #4f46e5;
  --ng-brand-dark: #4338ca;
  --ng-brand-ink: #0f172a;
  --ng-accent: #818cf8;

  --ng-ink: #0f172a;
  --ng-muted: #64748b;
  --ng-line: #e2e8f0;
  --ng-paper: #ffffff;
  --ng-wash: #f6f9fc;

  --ng-success: #059669;
  --ng-warning: #d97706;
  --ng-danger: #dc2626;
  --ng-info: #4f46e5;

  /* Typographie */
  --ng-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
             Helvetica, Arial, sans-serif;

  /* Forme et profondeur */
  --ng-radius: 10px;
  --ng-radius-lg: 14px;
  --ng-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --ng-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --ng-shadow-lg: 0 20px 44px rgba(16, 24, 40, 0.12);
}

/* ---------- Base ---------- */
body {
  font-family: var(--ng-font);
  background: var(--ng-wash);
  color: var(--ng-ink);
  letter-spacing: 0;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: 0;
  color: var(--ng-ink);
}

a {
  color: var(--ng-brand);
}
a:hover {
  color: var(--ng-brand-dark);
}

.app-shell {
  padding-bottom: 2.5rem;
}

/* ---------- Navbar blanche ---------- */
.navbar {
  background: var(--ng-paper);
  border-bottom: 1px solid var(--ng-line);
  box-shadow: var(--ng-shadow-sm);
}

.navbar .navbar-brand {
  color: var(--ng-ink);
  font-weight: 700;
  letter-spacing: 0;
}
.navbar .navbar-brand i {
  color: var(--ng-brand);
}

.navbar .nav-link {
  color: var(--ng-muted);
  font-weight: 500;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active {
  color: var(--ng-brand);
}

.navbar .navbar-text {
  color: var(--ng-muted);
}

.navbar .dropdown-menu {
  border: 1px solid var(--ng-line);
  box-shadow: var(--ng-shadow);
  border-radius: var(--ng-radius);
}
.navbar .dropdown-item {
  font-weight: 500;
  color: var(--ng-ink);
}
.navbar .dropdown-item:hover {
  color: var(--ng-brand);
  background: var(--ng-wash);
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--ng-line);
  border-radius: var(--ng-radius);
  background: var(--ng-paper);
  box-shadow: var(--ng-shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ng-line);
}

/* ---------- Boutons ---------- */
.btn {
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0;
}

.btn-primary {
  background: var(--ng-brand);
  border-color: var(--ng-brand);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--ng-brand-dark);
  border-color: var(--ng-brand-dark);
}

.btn-outline-primary {
  color: var(--ng-brand);
  border-color: var(--ng-brand);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--ng-brand);
  border-color: var(--ng-brand);
  color: #fff;
}

.btn-light {
  color: var(--ng-ink);
}

/* ---------- Tableaux ---------- */
.table {
  color: var(--ng-ink);
  margin-bottom: 0;
}
.table thead {
  background: var(--ng-wash);
  border-bottom: 1px solid var(--ng-line);
}
.table thead th {
  color: var(--ng-muted);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--ng-line);
}
.table-hover tbody tr:hover {
  background: var(--ng-wash);
}
.table-responsive {
  border-radius: var(--ng-radius);
  overflow: hidden;
}

/* ---------- Formulaires (premium) ---------- */
.form-control,
.form-select {
  border-radius: 8px;
  border-color: var(--ng-line);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ng-brand);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.18);
}
.form-label {
  font-weight: 600;
  color: var(--ng-ink);
}

/* ---------- Badges NIS2 ---------- */
.badge-nis2-conformant {
  background: #e7f6ef;
  color: var(--ng-success);
}
.badge-nis2-zombie {
  background: #fdeaea;
  color: var(--ng-danger);
}
.badge-nis2-obsolete {
  background: #fdf1e3;
  color: var(--ng-warning);
}
.badge-nis2-na {
  background: var(--ng-wash);
  color: var(--ng-muted);
  border: 1px solid var(--ng-line);
}

/* ---------- Mini-barre de répartition NIS2 ---------- */
.nis2-mini-bar {
  display: inline-flex;
  height: 4px;
  width: 80px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--ng-line);
  vertical-align: middle;
}
.nis2-mini-bar .seg {
  height: 100%;
}
.nis2-mini-bar .seg-conformant { background: var(--ng-success); }
.nis2-mini-bar .seg-zombie { background: var(--ng-danger); }
.nis2-mini-bar .seg-obsolete { background: var(--ng-warning); }

/* ---------- Puces de statut lumineuses ---------- */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ng-ink);
  white-space: nowrap;
}
.status-dot .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.status-dot.dot-green .dot {
  background: var(--ng-success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}
.status-dot.dot-red .dot {
  background: var(--ng-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
.status-dot.dot-amber .dot {
  background: var(--ng-warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
}
.status-dot.dot-gray .dot {
  background: var(--ng-muted);
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.14);
}

/* ---------- Boutons icônes discrets ---------- */
.btn-icon {
  color: var(--ng-muted);
  border: none;
  background: transparent;
  padding: 4px 7px;
  border-radius: 6px;
  line-height: 1;
}
.btn-icon:hover,
.btn-icon:focus {
  background: var(--ng-wash);
  color: var(--ng-ink);
}
.btn-icon.danger:hover,
.btn-icon.danger:focus {
  background: #fef2f2;
  color: var(--ng-danger);
}

/* ---------- Command palette ---------- */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1055;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}
.command-palette-overlay[hidden] {
  display: none;
}
.command-palette-modal {
  width: min(560px, 100%);
  background: var(--ng-paper);
  border-radius: 14px;
  box-shadow: var(--ng-shadow-lg);
  border: 1px solid var(--ng-line);
  overflow: hidden;
}
.command-palette-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 16px 18px;
  font-size: 1rem;
  font-family: var(--ng-font);
  border-bottom: 1px solid var(--ng-line);
}
.command-palette-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 320px;
  overflow: auto;
}
.command-palette-results li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ng-ink);
  font-weight: 500;
  text-decoration: none;
}
.command-palette-results li a:hover,
.command-palette-results li a.active {
  background: var(--ng-wash);
  color: var(--ng-brand);
}
.command-palette-empty {
  padding: 16px;
  color: var(--ng-muted);
  font-size: 0.9rem;
}

/* ---------- Puces de statut (alertes) ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}
.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.status-pill-danger .dot {
  background: var(--ng-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
.status-pill-danger { color: var(--ng-danger); }
.status-pill-warning .dot {
  background: var(--ng-warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
}
.status-pill-warning { color: var(--ng-warning); }
.status-pill-success .dot {
  background: var(--ng-success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}
.status-pill-success { color: var(--ng-success); }

/* ---------- Boutons subtils ---------- */
.btn-subtle-success {
  background: #ecfdf5;
  color: var(--ng-success);
  border: 1px solid #a7f3d0;
}
.btn-subtle-success:hover,
.btn-subtle-success:focus {
  background: #d1fae5;
  color: #047857;
}
.btn-ghost-secondary {
  background: transparent;
  color: var(--ng-muted);
  border: 1px solid transparent;
}
.btn-ghost-secondary:hover,
.btn-ghost-secondary:focus {
  background: var(--ng-wash);
  color: var(--ng-ink);
}

/* ---------- Barre de score ---------- */
.ng-score-progress {
  height: 8px;
  border-radius: 9999px;
  background-color: var(--ng-wash);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
.ng-score-progress-bar {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Toasts flottants ---------- */
.toast-container {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1080;
  padding: 1rem;
}
.toast-container .toast {
  min-width: 280px;
  max-width: 380px;
  border: none;
  box-shadow: var(--ng-shadow-lg);
  border-radius: 10px;
}

/* ---------- Vue matrice (densité) ---------- */
.hide-advanced .col-advanced {
  display: none;
}

/* ---------- Hero card ---------- */
.hero-card {
  background: linear-gradient(135deg, var(--ng-brand-ink) 0%, var(--ng-brand-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--ng-radius-lg);
  box-shadow: var(--ng-shadow-lg);
}
.hero-card h1,
.hero-card h2,
.hero-card h3,
.hero-card .lead {
  color: #fff;
}
.hero-card .text-muted,
.hero-card .opacity-75,
.hero-card .opacity-90 {
  color: rgba(255, 255, 255, 0.72) !important;
}

/* ---------- Login premium ---------- */
.auth-shell {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 430px;
  border: 1px solid var(--ng-line);
  border-radius: var(--ng-radius-lg);
  box-shadow: var(--ng-shadow-lg);
  background: var(--ng-paper);
  padding: 2rem;
}
.auth-card .auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ng-ink);
  margin-bottom: 1.5rem;
}
.auth-card .auth-brand i {
  color: var(--ng-brand);
}

/* ---------- Monospace réseau ---------- */
.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.3px;
}
