/*
 * survey-shared.css
 * Shared design tokens, base reset, typography, topbar and lang-switcher
 * used by ALL Survey tools (survey-configurator.html, actieplannen.html, index.html)
 *
 * DO NOT add page-specific styles here.
 */

/* ── Design tokens ────────────────────────────────────────────────── */
:root {
  /* Brand colours (modernized + bold) */
  --alabaster: #FBFBF9;
  --teal:      #0ea5a8;
  --teal-dark: #0a8c8f;
  --teal-soft: #d4f7f8;
  --teal-mid:  #5ed5d8;
  --terra:     #f97315;
  --terra-soft:#fde6d8;
  --terra-dark:#d85f0b;
  --amber:     #d48609;
  --amber-soft:#fef8e7;
  --accent:    #a855f7;
  --accent-soft:#f3e8ff;
  --success:   #10b981;
  --success-soft:#d1fae5;

  /* Error / status colours */
  --error:        #dc2626;
  --error-soft:   #fef2f2;
  --error-border: #fecaca;
  --success-dark: #16a34a;
  --success-border: #6ee7b7;
  --amber-border: #f0d080;
  --accent-border: #cac5ed;

  /* Code block */
  --code-bg:    #1c2b30;
  --code-color: #a8d8d4;

  /* Neutrals */
  --charcoal:    #334155;
  --charcoal-60: #6b7a90;
  --bg:          var(--alabaster);
  --surface:     #fff;
  --surface2:    #f7f8f9;
  --text:        var(--charcoal);
  --text-muted:  var(--charcoal-60);
  --border:      #dde2e8;
  --border-soft: #eef0f3;

  /* Radius & shadow (sharp — editorial brutal).
     Story 15-7: ~5px on interactive elements (the §15-4 "calm nudge", prototype-
     locked). --radius-lg deliberately EQUALS --radius — one radius, flat hierarchy;
     softer 8px+ is the generic look we explicitly rejected (Arne 2026-06-11). */
  --radius-sm: 3px;
  --radius:    5px;
  --radius-lg: 5px;
  --shadow-sm: 0 1px 4px rgba(51,65,85,.06);
  --shadow:    0 3px 16px rgba(51,65,85,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

  /* Focus identity (Story 15-7) — ONE variable, per-app overridable: the shared
     default is teal (informational); an app may claim its own focus colour the way
     itembank claims amber (itembank.css overrides its own focus rules). */
  --focus-ring: var(--teal);

  /* Type scale (Story 15-7, §15-4 DESIGN.md) — calibrated to sizes already in use. */
  --text-xs:   .72rem;    /* micro-labels / uppercase eyebrows */
  --text-sm:   .8125rem;  /* secondary / meta */
  --text-base: .875rem;   /* 14px body — the default */
  --text-md:   1rem;
  --text-lg:   1.1875rem; /* 19px — topbar-logo tier */
  --text-xl:   1.5rem;
  --text-2xl:  2rem;      /* page titles (Lora) */

  /* Spacing scale (Story 15-7) — 4px rhythm. */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* Brand fills (flat — no gradients) */
  --gradient-primary:   #0ea5a8;
  --gradient-secondary: #f97315;
  --gradient-accent:    #a855f7;

  /* IGLO level colours */
  --col-O: #d48609;
  --col-L: #a855f7;
  --col-G: #f97315;
  --col-I: #0ea5a8;

  /* ── Dataviz design tokens ─────────────────────────────────────── */
  /* 4-class risk spectrum  (-- worst → ++ most resilient) */
  --dv-risk-4:      #cc3d5a;   /* -- deep coral (highest risk) */
  --dv-risk-3:      #e88a7a;   /* -  coral salmon (elevated risk) */
  --dv-risk-2:      #5ed5d8;   /* +  teal-mid (low risk) */
  --dv-risk-1:      #0ea5a8;   /* ++ teal brand (resilient) */
  --dv-risk-4-soft: #fae8ec;
  --dv-risk-3-soft: #fdf0ed;
  --dv-risk-2-soft: #d4f7f8;
  --dv-risk-1-soft: #d4f7f8;

  /* 2-class collapse */
  --dv-vulnerable:  #cc3d5a;   /* kwetsbare groep */
  --dv-resilient:   #0ea5a8;   /* veerkrachtige groep */

  /* JD-R type colors */
  --dv-motivatie:   #0ea5a8;   /* teal — job resources */
  --dv-stress:      #cc3d5a;   /* coral — job demands */

  /* Structural data ink */
  --dv-slate:       #64748b;
  --dv-slate-soft:  #f1f5f9;
  --dv-slate-mid:   #94a3b8;

  /* 5-A grouping accents */
  --dv-a5-arbeidsinhoud:         #0ea5a8;
  --dv-a5-arbeidsomstandigheden: #a855f7;
  --dv-a5-arbeidsvoorwaarden:    #d48609;
  --dv-a5-arbeidsverhoudingen:   #cc3d5a;
  --dv-a5-arbeidsomgeving:       #5ed5d8;

  /* Semantic precision / CI width colours (Respons ribbons + shared) */
  --dv-teal:   #0ea5a8;   /* good / narrow CI */
  --dv-amber:  #d48609;   /* caution / medium CI */
  --dv-terra:  #cc3d5a;   /* warning / wide CI */

  /* OGGW (Ongewenst Gedrag) category colors — warm/serious spectrum */
  --dv-oggw-pesten:              #cc3d5a;   /* deep coral — bullying (most severe) */
  --dv-oggw-discriminatie:       #b8396b;   /* dark rose — discrimination */
  --dv-oggw-conflict-leiding:    #c06040;   /* burnt sienna — conflict with leader */
  --dv-oggw-conflict-collega:    #c07830;   /* warm amber — conflict with colleague */
  --dv-oggw-seksueel:            #a83050;   /* deep crimson — sexual harassment */
  --dv-oggw-onbeschoft:          #8e6080;   /* dusty mauve — incivility */
  /* Shared OGGW accents */
  --dv-oggw-hollow:              rgba(0,0,0,.12);  /* not-at-risk dot border */
  --dv-oggw-bg:                  #ffffff;   /* not-at-risk dot fill */

  /* Prevention type colours (refreshed) */
  --col-primair:      #0ea5a8;
  --col-primair-soft: #d4f7f8;
  --col-primair-mid:  #5ed5d8;
  --col-secundair:      #f97315;
  --col-secundair-soft: #fde6d8;
  --col-secundair-mid:  #fbb98b;
  --col-tertiair:      #a855f7;
  --col-tertiair-soft: #f3e8ff;
  --col-tertiair-mid:  #d8b4f5;
}

/* ── Reset ────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base typography ──────────────────────────────────────────────── */
body {
  font-family: 'Epilogue', system-ui, sans-serif;
  background: var(--bg);
  color: var(--charcoal);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--charcoal);
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--charcoal-40, #aaa); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-mid); }

/* ── Topbar (light, editorial) ───────────────────────────────────── */
.topbar {
  background: rgba(250,250,248,.95);
  backdrop-filter: blur(8px);
  color: var(--charcoal);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 300;
  border-bottom: 1px solid var(--border);
}
.topbar-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--charcoal);
}
.topbar-logo span {
  font-weight: 400;
  font-style: italic;
  color: var(--charcoal-60);
  margin-left: 1px;
}
.topbar-sub {
  font-size: 11px;
  font-weight: 300;
  color: var(--charcoal-60);
  margin-top: 2px;
  letter-spacing: .03em;
}
/* Filled by ui.js renderTopbar() */
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
}

/* App menu trigger (hamburger button) */
.app-menu-trigger {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--charcoal-60);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  transition: background .15s, color .15s, border-color .15s;
}
.app-menu-trigger:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

/* App menu dropdown */
.app-menu {
  position: relative;
}
.app-menu-dropdown {
  position: absolute;
  top: 60px;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  list-style: none;
  overflow: hidden;
  animation: slideDownFade 0.2s ease-out;
  z-index: 301;
}
.app-menu-dropdown[hidden] {
  display: none;
}
.app-menu-item {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
  border-left: 3px solid transparent;
  position: relative;
}
.app-menu-item:hover:not([aria-disabled="true"]) {
  background: var(--teal-soft);
}
.app-menu-item.current {
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-left-color: var(--teal);
  font-weight: 600;
}
.app-menu-item[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.topbar-back {
  color: var(--charcoal-60);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.topbar-back:hover { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }

/* ── Traject context switcher (18b-8) ─────────────────────────────── */
.traject-switcher {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.traject-switcher-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--charcoal);
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  max-width: 260px;
}
.traject-switcher-trigger:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal-dark);
}
.traject-switcher-label {
  font-family: 'Lora', Georgia, serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--charcoal-60);
  flex-shrink: 0;
}
.traject-switcher-trigger:hover .traject-switcher-label {
  color: var(--teal-dark);
}
.traject-switcher-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.traject-switcher-trigger:hover .traject-switcher-name {
  color: var(--teal-dark);
}
.traject-switcher-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 2px 2px 0;
  cursor: pointer;
  color: var(--charcoal-60);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.traject-switcher-clear:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal-dark);
}
.traject-switcher-clear[hidden] { display: none; }
.traject-switcher-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  max-height: calc(5 * 44px);
  z-index: 302;
  animation: slideDownFade .2s ease-out;
}
.traject-switcher-dropdown[hidden] { display: none; }
.traject-switcher-item {
  display: block;
  padding: 10px 16px;
  color: var(--charcoal);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.traject-switcher-item:hover {
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.traject-switcher-item.active {
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-left-color: var(--teal);
  font-weight: 600;
}
.traject-switcher-empty {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--charcoal-60);
  font-style: italic;
}

.topbar-logo-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar-context-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 2px 5px;
  border-radius: 2px;
  margin-top: 2px;
  align-self: flex-start;
}

.topbar-context-badge--standalone {
  background: var(--amber);
  color: #fff;
}

.topbar-context-badge--traject {
  background: var(--teal-soft);
  color: var(--teal-dark, var(--teal));
  border: 1px solid var(--teal);
}

/* ── Traject breadcrumb + stage pill (18a-4) ──────────────────────── */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--charcoal-60);
  min-width: 0;
  flex: 1 1 auto; /* take remaining space so logo-group + lang sit right */
  flex-wrap: wrap; /* graceful wrap before content clips */
  row-gap: 4px;
}
.topbar-breadcrumb-link {
  color: var(--charcoal-60);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28ch;
  transition: color .15s;
}
.topbar-breadcrumb-link:hover {
  color: var(--teal);
  text-decoration: underline;
}
.topbar-breadcrumb-sep {
  color: var(--charcoal-40);
  font-weight: 300;
  flex-shrink: 0;
}
.topbar-breadcrumb-current {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.topbar-stage-pill {
  display: inline-block;
  border: 1px solid var(--charcoal-40);
  background: transparent;
  color: var(--charcoal-60);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  margin-left: 4px;
  flex-shrink: 0;
}
/* Reuse the standard topbar-back styling for the traject variant —
   only the label is dynamic. No style override needed. */

/* ── Animations ───────────────────────────────────────────────────── */
@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shared button + input animations (sharp — no bouncy scale) */
button, input[type="button"], input[type="submit"], a.btn {
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, background-color 0.2s ease, border-color 0.2s ease;
}
button:active, input[type="button"]:active, input[type="submit"]:active, a.btn:active {
  transform: translateY(0);
}
button:hover, input[type="button"]:hover, input[type="submit"]:hover, a.btn:hover {
  transform: translateY(-1px);
}

/* ── Base form controls (Story 15-7 / §15-4 foundation) ──────────────────────
   Element-level, LOW specificity — per-app stylesheets load after this file and
   win wherever they style their own inputs. This layer exists so the surfaces
   that never styled theirs (login, apps, trajecten, …) inherit a designed look
   for free. Deliberately NO width / appearance / margin here: the base layer
   owns the LOOK, never the layout. */
input[type="text"], input[type="email"], input[type="number"], input[type="search"],
input[type="password"], input[type="tel"], input[type="url"],
select, textarea {
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { min-height: 84px; resize: vertical; }

input[type="text"]:hover:not(:disabled):not([readonly]),
input[type="email"]:hover:not(:disabled):not([readonly]),
input[type="number"]:hover:not(:disabled):not([readonly]),
input[type="search"]:hover:not(:disabled):not([readonly]),
input[type="password"]:hover:not(:disabled):not([readonly]),
input[type="tel"]:hover:not(:disabled):not([readonly]),
input[type="url"]:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--charcoal-60);
}

/* Focus — a thick SOLID edge in the app's focus colour (--focus-ring, default
   teal; itembank overrides with amber). Solid, not a soft glow — prototype-
   locked (Arne 2026-06-11, variant B). Never remove the outline without this. */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 1.5px var(--focus-ring);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface2);
  color: var(--text-muted);
  cursor: not-allowed;
}
/* Read-only = display, not blocked — dashed distinguishes it from disabled. */
input[readonly] {
  background: var(--surface2);
  color: var(--text-muted);
  border-style: dashed;
}
/* Invalid pairs with a message via aria-describedby — never colour alone. */
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--error);
  background: var(--error-soft);
}

/* ── Language switcher ────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}
.lang-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--charcoal-60);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: .05em;
  transition: all .15s;
}
.lang-btn:hover  { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }
.lang-btn.active { background: var(--teal-soft); color: var(--teal-dark); border-color: var(--teal); font-weight: 700; }

.topbar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--charcoal-60);
  flex-shrink: 0;
  transition: color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.topbar-logout-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--teal-dark);
}

/* ── "Preview as" — control + picker + read-only banner (Story 35-8) ──
   Calm/editorial: a quiet text-button trigger, an app-menu-style picker, and an amber
   "heads-up" banner (never alarm-red — preview is low-stakes, look-only). */
.preview-control { position: relative; flex-shrink: 0; }
.preview-control-trigger {
  background: none;
  border: none;
  color: var(--charcoal-60);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 2px;
  transition: color .15s;
}
.preview-control-trigger:hover { color: var(--teal); }

.preview-picker {
  position: absolute;
  top: 40px;
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 301;
  padding: 8px;
  animation: slideDownFade 0.2s ease-out;
}
.preview-picker[hidden] { display: none; }
.preview-picker-search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  margin-bottom: 6px;
}
.preview-picker-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.preview-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 2px;
}
.preview-picker-item:hover { background: var(--teal-soft); color: var(--teal); }
.preview-picker-org { color: var(--charcoal-60); font-size: 11px; margin-left: 6px; }
.preview-picker-empty { padding: 10px; font-size: 12px; color: var(--charcoal-60); text-align: center; }

/* When the read-only banner is present the topbar grows to a second row (the banner strip
   sits under the controls, pushing page content down). :has() is baseline in evergreen browsers. */
.topbar:has(.preview-banner) {
  flex-direction: column;
  align-items: stretch;
  height: auto;
  padding: 0;
}
.topbar:has(.preview-banner) .topbar-inner { height: 60px; padding: 0 32px; box-sizing: border-box; }
.preview-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 32px;
  background: var(--amber-soft);
  border-top: 1px solid var(--amber-border);
  font-size: 12px;
  color: var(--charcoal);
}
.preview-banner-label { color: var(--amber); font-weight: 600; letter-spacing: .02em; }
.preview-banner-user { font-weight: 600; }
.preview-banner-dot { color: var(--charcoal-60); }
.preview-banner-countdown { font-variant-numeric: tabular-nums; color: var(--charcoal-60); }
.preview-banner-stop {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
}
.preview-banner-stop:hover { color: var(--charcoal); }

/* ── Footer (shared across all apps) ──────────────────────────────── */
footer.app-footer {
  background: var(--surface2);
  border-top: 1px solid var(--border-soft);
  padding: 20px 32px;
  margin-top: auto;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
footer.app-footer a {
  color: var(--teal);
  text-decoration: none;
  transition: color .15s;
}
footer.app-footer a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}
