/* HAP Performance Platform — design system (#47)
   Professioneel, sober, consistent. Light + dark via data-bs-theme. */

:root {
  /* Kleurpalet */
  --hap-primary: #1A56DB;
  --hap-success: #0E9F6E;
  --hap-warning: #E3A008;
  --hap-danger: #E02424;
  --hap-neutral: #6B7280;

  /* Bootstrap-tokens overriden zodat alle componenten meekleuren */
  --bs-primary: #1A56DB;
  --bs-success: #0E9F6E;
  --bs-warning: #E3A008;
  --bs-danger: #E02424;
  --bs-secondary: #6B7280;
  --bs-primary-rgb: 26, 86, 219;
  --bs-success-rgb: 14, 159, 110;
  --bs-warning-rgb: 227, 160, 8;
  --bs-danger-rgb: 224, 36, 36;

  /* Typografie */
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-font-size: 0.875rem;        /* 14px */
  --bs-body-line-height: 1.55;
  --hap-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Spacing-schaal (4px-grid) */
  --hap-s1: 4px; --hap-s2: 8px; --hap-s3: 12px; --hap-s4: 16px;
  --hap-s6: 24px; --hap-s8: 32px; --hap-s12: 48px; --hap-s16: 64px;
}

[data-bs-theme="light"] {
  --bs-body-bg: #F9FAFB;
  --hap-surface: #FFFFFF;
  --hap-surface-border: #E5E7EB;
  --bs-secondary-color: #6B7280;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #111827;
  --hap-surface: #1F2937;
  --hap-surface-border: #374151;
  --bs-body-color: #E5E7EB;
}

body { letter-spacing: -0.01em; }

/* Typografische hiërarchie */
h1, .h1 { font-size: 24px; font-weight: 700; }
h2, .h2 { font-size: 20px; font-weight: 600; }
h3, .h3 { font-size: 16px; font-weight: 600; }
.small, small { font-size: 12px; }

/* Verrichtingscodes monospace */
code, .hap-mono, .verr-code { font-family: var(--hap-font-mono); font-size: 0.85em; }

/* Kaarten */
.card {
  background: var(--hap-surface);
  border: 1px solid var(--hap-surface-border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.card-body { padding: var(--hap-s4) var(--hap-s6); }
.card-header { background: transparent; border-bottom: 1px solid var(--hap-surface-border); }

/* Navbar */
.navbar { background: var(--hap-surface) !important; border-bottom: 1px solid var(--hap-surface-border); }
.navbar .nav-link.active { color: var(--hap-primary); font-weight: 600; }

/* Knoppen — subtiele radius + gewicht */
.btn { border-radius: 6px; font-weight: 500; }

/* Badges iets ruimer */
.badge { font-weight: 600; padding: 0.35em 0.6em; }

/* Progress-bar voor gap-visualisatie */
.hap-progress {
  height: 8px; border-radius: 4px; background: var(--hap-surface-border);
  overflow: hidden; min-width: 80px;
}
.hap-progress__fill { height: 100%; border-radius: 4px; }
.hap-progress__fill--boven { background: var(--hap-success); }
.hap-progress__fill--onder { background: var(--hap-warning); }
.hap-progress__fill--op_niveau { background: var(--hap-neutral); }

/* KPI benchmark-balk (#128): landelijk = tick op 50%, eigen waarde 0–200% geschaald */
.kpi-bench {
  position: relative; height: 6px; border-radius: 3px;
  background: var(--hap-surface-border); overflow: hidden;
}
.kpi-bench__fill { height: 100%; border-radius: 3px; }
.kpi-bench__fill--gunstig { background: var(--hap-success); }
.kpi-bench__fill--ongunstig { background: var(--hap-warning); }
.kpi-bench__tick {
  position: absolute; top: -1px; bottom: -1px; left: 50%;
  width: 2px; background: var(--hap-neutral); opacity: 0.7;
}

/* Klikbare rij-affordance */
.hap-rij { cursor: pointer; transition: background-color 0.12s ease; }
.hap-rij:hover { background: color-mix(in srgb, var(--hap-primary) 6%, transparent); }
.hap-chevron { transition: transform 0.18s ease; display: inline-block; }
.hap-rij[aria-expanded="true"] .hap-chevron { transform: rotate(90deg); }

/* Onboarding progress-indicator (#48) */
.onboarding-stap { flex: 0 0 auto; width: 5.5rem; color: var(--hap-neutral); }
.onboarding-stap.is-gedaan { color: var(--hap-success); }
.onboarding-bol {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  border: 2px solid var(--hap-surface-border); background: var(--hap-surface);
  font-weight: 600;
}
.onboarding-stap.is-gedaan .onboarding-bol {
  border-color: var(--hap-success); background: var(--hap-success); color: #fff;
}
.onboarding-lijn {
  flex: 1 1 auto; height: 2px; background: var(--hap-surface-border); margin: 0 4px;
  align-self: flex-start; margin-top: 1.125rem;
}
.onboarding-lijn.is-gedaan { background: var(--hap-success); }

/* Verrichtingen-tabel → kaartjes op mobiel (#50) */
@media (max-width: 767.98px) {
  .verr-tabel thead { display: none; }
  .verr-tabel, .verr-tabel tbody { display: block; width: 100%; }
  .verr-tabel tr.verr-rij {
    display: block; position: relative;
    border: 1px solid var(--hap-surface-border); border-radius: 8px;
    padding: 10px 12px; margin-bottom: 8px;
  }
  .verr-tabel tr.verr-rij > td {
    display: flex; justify-content: space-between; align-items: center;
    text-align: right; border: 0; padding: 3px 0;
  }
  .verr-tabel tr.verr-rij > td[data-label]::before {
    content: attr(data-label); color: var(--hap-neutral); font-weight: 400; text-align: left;
  }
  .verr-tabel tr.verr-rij > td.verr-naam {
    justify-content: flex-start; text-align: left; font-weight: 600; padding-right: 26px;
  }
  .verr-tabel tr.verr-rij > td.verr-chevron-cel {
    position: absolute; top: 10px; right: 12px; width: auto; padding: 0;
  }
  .verr-tabel tr.collapse > td, .verr-tabel tr.collapsing > td { display: block; border: 0; }
}

/* Compacte KPI-tegels (#77): kleinere body-padding, niet meegerekt met de chart */
.kpi-body { padding: 0.75rem 0.9rem; }
.kpi-tegel .fs-3 { line-height: 1.15; }

/* KPI-info-icoon + popover (#71, #73) */
.kpi-info {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 1px; cursor: pointer;
  color: var(--bs-secondary-color); transition: color 0.12s ease;
  line-height: 1;
}
.kpi-info svg { display: block; }
.kpi-info:hover, .kpi-info:focus-visible { color: var(--bs-primary); outline: none; }
.kpi-info:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--bs-primary) 35%, transparent); border-radius: 3px; }
.popover { max-width: 320px; }
.popover-body .small { line-height: 1.45; }

/* Touch targets ≥ 44px op tablet/mobiel (WCAG 2.5.5) */
@media (max-width: 991.98px) {
  .navbar .nav-link, .dropdown-item { min-height: 44px; display: flex; align-items: center; }
  .btn:not(.btn-link) { min-height: 44px; }
}
