/* ═══════════════════════════════════════════════════════
   Threatley App — Design System
   Gebaseerd op threatley.nl huisstijl
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Syne:wght@400;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  /* Kleuren */
  --bg:        #070d1a;
  --s1:        #0a1220;
  --s2:        #0d1628;
  --s3:        #111d30;
  --border:    #1a2540;
  --border2:   #243050;

  --lime:      #00e5ff;
  --lime-dim:  rgba(0,229,255,0.07);
  --lime-b:    rgba(0,229,255,0.15);
  --lime-d:    rgba(0,229,255,0.04);

  --red:       #ff3b3b;
  --red-dim:   rgba(255,59,59,0.08);
  --orange:    #ff8c00;
  --yellow:    #f5c842;
  --blue:      #4d9eff;
  --purple:    #a78bfa;
  --green:     #22c55e;

  --text:      #dce4f0;
  --muted:     #3d4a5c;
  --muted2:    #5a6e87;

  /* Typografie */
  --mono:      'Space Mono', monospace;
  --sans:      'Syne', sans-serif;

  /* Spacing */
  --nav-h:     56px;
  --radius:    2px;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(200,240,74,0.006) 3px,
    rgba(200,240,74,0.006) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ══════════════════════════════════════
   NAVIGATIE
   ══════════════════════════════════════ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(7,8,10,0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-box {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--lime);
  background: var(--lime-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.nav-logo-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.nav-logo-box span {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--lime);
}

/* Hide fallback T when image loads */
.nav-logo-box img.loaded + span { display: none; }

.nav-wordmark {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text);
}

.nav-wordmark em {
  color: var(--lime);
  font-style: normal;
}

.nav-subtitle {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 14px;
  margin-left: 4px;
}

.nav-spacer { flex: 1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ══════════════════════════════════════
   KNOPPEN
   ══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 9px 18px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--lime);
  color: var(--bg);
}
.btn-primary:hover { background: #33eeff; }
.btn-primary:disabled { background: var(--muted); cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-ghost:hover {
  border-color: var(--lime-b);
  color: var(--lime);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #ff5555; }

.btn-sm { padding: 6px 12px; font-size: 9px; }
.btn-lg { padding: 12px 24px; font-size: 11px; }

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ══════════════════════════════════════
   FORMULIEREN
   ══════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted2);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
  border-radius: var(--radius);
}

.form-input:focus { border-color: var(--lime); }
.form-input::placeholder { color: var(--muted); }

.form-input.error { border-color: var(--red); }

.form-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6e87' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-select:focus { border-color: var(--lime); outline: none; }

.form-hint {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

.form-error {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--red);
  margin-top: 4px;
}

/* ══════════════════════════════════════
   KAARTEN & CONTAINERS
   ══════════════════════════════════════ */
.card {
  background: var(--s1);
  border: 1px solid var(--border);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.page-wrap {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-md {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ══════════════════════════════════════
   BADGES & TAGS
   ══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
}

.badge-lime    { background: var(--lime); color: var(--bg); }
.badge-red     { background: var(--red); color: #fff; }
.badge-orange  { background: var(--orange); color: #fff; }
.badge-yellow  { background: var(--yellow); color: #000; }
.badge-blue    { background: var(--blue); color: #fff; }
.badge-muted   { background: var(--s3); border: 1px solid var(--border); color: var(--muted2); }

/* Severity badges */
.sev-KRITIEK { background: var(--red); color: #fff; }
.sev-HOOG    { background: var(--orange); color: #fff; }
.sev-MIDDEL  { background: var(--yellow); color: #000; }
.sev-LAAG    { background: var(--muted); color: #fff; }
.sev-INFO    { background: var(--blue); color: #fff; }

/* ══════════════════════════════════════
   ALERTS
   ══════════════════════════════════════ */
.alert {
  padding: 12px 14px;
  border-left: 3px solid;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.alert-info    { background: rgba(77,158,255,0.08); border-color: var(--blue); color: var(--blue); }
.alert-success { background: rgba(200,240,74,0.08); border-color: var(--lime); color: var(--lime); }
.alert-warning { background: rgba(245,200,66,0.08); border-color: var(--yellow); color: var(--yellow); }
.alert-error   { background: rgba(255,59,59,0.08); border-color: var(--red); color: var(--red); }

/* ══════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: var(--nav-h) 1fr;
  min-height: 100vh;
  grid-template-areas:
    "nav nav"
    "sidebar main";
}

.sidebar {
  grid-area: sidebar;
  background: var(--s1);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: 220px;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-section {
  padding: 16px 16px 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 12px;
  color: var(--muted2);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.02);
}

.sidebar-item.active {
  color: var(--lime);
  border-left-color: var(--lime);
  background: var(--lime-dim);
}

.sidebar-item .si-icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 8px;
  padding: 1px 5px;
  font-weight: 700;
}

.main-content {
  grid-area: main;
  margin-left: 220px;
  padding: calc(var(--nav-h) + 24px) 24px 24px;
  min-height: 100vh;
}

/* ══════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════ */
.page-header {
  margin-bottom: 24px;
}

.page-tag {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted2);
}

/* ══════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--s1);
  border: 1px solid var(--border);
  padding: 16px;
}

.stat-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--lime);
}

.stat-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted2);
  margin-top: 4px;
}

/* ══════════════════════════════════════
   TABELLEN
   ══════════════════════════════════════ */
.table-wrap {
  background: var(--s1);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table th {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(28,34,48,0.5);
  color: var(--muted2);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tr:hover td {
  background: rgba(255,255,255,0.01);
  color: var(--text);
}

/* ══════════════════════════════════════
   CVE TICKER
   ══════════════════════════════════════ */
.cve-ticker {
  background: var(--s1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}

.cve-ticker-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--red);
  white-space: nowrap;
  flex-shrink: 0;
}

.cve-ticker-content {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════
   LOADING SPINNER
   ══════════════════════════════════════ */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   ANIMATIES
   ══════════════════════════════════════ */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
@keyframes fadeUp  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes slideIn { from { opacity:0; transform:translateX(-8px); } to { opacity:1; transform:translateX(0); } }
@keyframes blink   { 0%,100% { opacity:1; } 50% { opacity:0; } }

.animate-fadeUp  { animation: fadeUp  0.4s ease both; }
.animate-fadeIn  { animation: fadeIn  0.3s ease both; }
.animate-slideIn { animation: slideIn 0.3s ease both; }

/* ══════════════════════════════════════
   MODAL
   ══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--s1);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  animation: fadeUp 0.2s ease;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text);
}

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted2);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ══════════════════════════════════════
   STAP INDICATOR (RoE / Register)
   ══════════════════════════════════════ */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.step-num {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.step.active .step-num {
  border-color: var(--lime);
  background: var(--lime-dim);
  color: var(--lime);
}

.step.done .step-num {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--bg);
}

.step-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.step.active .step-label { color: var(--text); }
.step.done .step-label   { color: var(--lime); }

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

.step-line.done { background: var(--lime); }

/* ══════════════════════════════════════
   PAKKETKAARTEN
   ══════════════════════════════════════ */
.pakket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.pakket-card {
  background: var(--s1);
  border: 2px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.pakket-card:hover {
  border-color: var(--lime-b);
}

.pakket-card.selected {
  border-color: var(--lime);
  background: var(--lime-dim);
}

.pakket-popular {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  padding: 3px 10px;
  background: var(--lime);
  color: var(--bg);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.pakket-name {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted2);
  margin-bottom: 6px;
}

.pakket-price {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 2px;
}

.pakket-period {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 12px;
}

.pakket-features {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted2);
  line-height: 2;
}

.pakket-feature {
  display: flex;
  gap: 6px;
}

.pf-check { color: var(--lime); }
.pf-x     { color: var(--muted); }

/* ══════════════════════════════════════
   COMPLIANT BADGES
   ══════════════════════════════════════ */
.compliance-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.comp-badge {
  font-family: var(--mono);
  font-size: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--muted2);
}

.comp-badge.active {
  border-color: var(--lime-b);
  color: var(--lime);
}

/* ══════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 40px;
  opacity: 0.2;
  margin-bottom: 16px;
}

.empty-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.empty-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ══════════════════════════════════════
   TOTP / QR CODE
   ══════════════════════════════════════ */
.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #fff;
  margin: 16px 0;
}

.qr-wrap img { max-width: 180px; }

.totp-input {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.totp-digit {
  width: 42px;
  height: 50px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.totp-digit:focus { border-color: var(--lime); }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.footer-copy {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--lime); }

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "nav"
      "main";
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pakket-grid {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════
   UTILITY
   ══════════════════════════════════════ */
.text-lime   { color: var(--lime); }
.text-red    { color: var(--red); }
.text-orange { color: var(--orange); }
.text-muted  { color: var(--muted2); }
.text-mono   { font-family: var(--mono); }
.text-sm     { font-size: 11px; }
.text-xs     { font-size: 9px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.hidden { display: none !important; }

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.pulse-dot.red { background: var(--red); }
