/* ============================================================
   Vragen-dashboard — stijl
   Kleuren volgen de dataviz-methodiek (categorisch/ordinaal/status).
   ============================================================ */

:root {
  color-scheme: light;

  /* chrome & ink */
  --page:          #f9f9f7;
  --surface:       #fcfcfb;
  --surface-2:     #f2f1ee;
  --text-primary:  #0b0b0b;
  --text-secondary:#52514e;
  --text-muted:    #898781;
  --gridline:      #e1e0d9;
  --border:        rgba(11,11,11,0.10);

  /* categorisch: thema (vaste volgorde, nooit wisselen) */
  --thema-sport:   #2a78d6; /* slot 1 blauw */
  --thema-werk:    #eb6834; /* slot 2 oranje */
  --thema-gezond:  #1baf7a; /* slot 3 aqua */
  --thema-overig:  #eda100; /* slot 4 geel */

  /* ordinaal: moeilijkheidsgraad (sequentieel blauw, licht -> donker) */
  --niveau-1-bg:   #cde2fb;
  --niveau-1-fg:   #0d366b;
  --niveau-2-bg:   #2a78d6;
  --niveau-2-fg:   #ffffff;
  --niveau-3-bg:   #0d366b;
  --niveau-3-fg:   #ffffff;

  /* status (vast, nooit voor series) */
  --status-warning: #fab219;
  --status-good:    #0ca30c;

  --radius: 12px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page:          #0d0d0d;
    --surface:       #1a1a19;
    --surface-2:     #232322;
    --text-primary:  #ffffff;
    --text-secondary:#c3c2b7;
    --text-muted:    #898781;
    --gridline:      #2c2c2a;
    --border:        rgba(255,255,255,0.10);

    --thema-sport:   #3987e5;
    --thema-werk:    #d95926;
    --thema-gezond:  #199e70;
    --thema-overig:  #c98500;

    --niveau-1-bg:   #184f95;
    --niveau-1-fg:   #e8f0fc;
    --niveau-2-bg:   #256abf;
    --niveau-2-fg:   #ffffff;
    --niveau-3-bg:   #0d366b;
    --niveau-3-fg:   #ffffff;

    --status-warning: #fab219;
    --status-good:    #0ca30c;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: 16px;
  padding-bottom: 48px;
  max-width: 880px;
  margin: 0 auto;
}

img, svg { max-width: 100%; }

/* ---------- header ---------- */

header.app-header {
  margin-bottom: 20px;
}

header.app-header h1 {
  font-size: 1.4rem;
  margin: 0 0 4px 0;
}

header.app-header p.sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

#data-mode-banner {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--status-warning) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--status-warning) 45%, transparent);
  color: var(--text-primary);
  font-size: 0.82rem;
  display: none;
}
#data-mode-banner.visible { display: block; }
#data-mode-banner strong { font-weight: 600; }

/* ---------- overview ---------- */

section.overview {
  margin-bottom: 24px;
}

section.overview h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 700px) {
  .overview-grid {
    grid-template-columns: minmax(120px, 0.8fr) 1.4fr 1.4fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-tile .stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: proportional-nums;
}

.stat-tile .stat-label {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.dist-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  font-weight: 600;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dist-row:last-child { margin-bottom: 0; }

.dist-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.dist-label {
  flex: none;
  width: 92px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dist-track {
  flex: 1 1 auto;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  min-width: 30px;
}

.dist-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 3px;
}

.dist-count {
  flex: none;
  width: 22px;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ---------- tabs ---------- */

nav.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
  -ms-overflow-style: none;
  scrollbar-width: thin;
}

nav.tabs button {
  flex: none;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

nav.tabs button.active {
  background: var(--text-primary);
  color: var(--page);
  border-color: var(--text-primary);
}

nav.tabs button .tab-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- week groups ---------- */

section.week-group {
  margin-bottom: 28px;
}

.week-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.week-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.week-heading .week-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- question card ---------- */

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.q-card.niveau-3 {
  border-left: 3px solid var(--status-warning);
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 10px;
}

.q-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 2px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}

.tag .tag-swatch {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: rgba(255,255,255,0.85);
}

.tag.theme-sport   { background: var(--thema-sport); }
.tag.theme-werk    { background: var(--thema-werk); }
.tag.theme-gezond  { background: var(--thema-gezond); }
.tag.theme-overig  { background: var(--thema-overig); color: #2b2200; }
.tag.theme-overig .tag-swatch { background: rgba(0,0,0,0.35); }

.badge-niveau {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge-niveau.n1 { background: var(--niveau-1-bg); color: var(--niveau-1-fg); }
.badge-niveau.n2 { background: var(--niveau-2-bg); color: var(--niveau-2-fg); }
.badge-niveau.n3 { background: var(--niveau-3-bg); color: var(--niveau-3-fg); }

.badge-niveau .n-flag {
  font-size: 0.8rem;
  line-height: 1;
}

.badge-status-nieuw {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-warning) 30%, var(--surface));
  color: var(--text-primary);
  border: 1px solid color-mix(in srgb, var(--status-warning) 55%, transparent);
}

.q-text {
  font-size: 0.98rem;
  line-height: 1.45;
  margin: 0 0 10px 0;
  font-weight: 500;
}

.q-synthese {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  white-space: pre-wrap;
}

.q-synthese.placeholder {
  font-style: italic;
  color: var(--text-muted);
}

.q-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.q-sources a {
  font-size: 0.78rem;
  color: var(--thema-sport);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
}
.q-sources a:hover { text-decoration: underline; }
.q-sources .src-type {
  color: var(--text-muted);
  margin-left: 4px;
  font-size: 0.72rem;
}

/* ---------- empty state ---------- */

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
  font-size: 0.9rem;
}

footer.app-footer {
  margin-top: 32px;
  color: var(--text-muted);
  font-size: 0.76rem;
  text-align: center;
}
