/* Spril voorinterviewer - huisstijl volgens DESIGN.md */

:root {
  --bg: #F7FAFB;
  --surface: #FFFFFF;
  --ink: #252525;
  --text: #444851;
  --accent: #80BFCB;
  --accent-diep: #5E9EAB;
  --amber: #FFBA00;
  --rand: #E3EBEE;
  --thema-1: #F5C600;
  --thema-2: #C8D96C;
  --thema-3: #AFDCDF;
  --thema-4: #A4D2AB;
  --thema-5: #80BFCB;
  --radius-kaart: 28px;
  --radius-bubbel: 22px;
  --schaduw: 0 2px 14px rgba(68, 72, 81, 0.07);
  --z-kop: 10;
  --z-invoer: 20;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    linear-gradient(165deg,
      rgba(245, 198, 0, 0.07) 0%,
      rgba(200, 217, 108, 0.06) 30%,
      rgba(247, 250, 251, 0) 55%),
    linear-gradient(345deg,
      rgba(128, 191, 203, 0.10) 0%,
      rgba(164, 210, 171, 0.05) 35%,
      rgba(247, 250, 251, 0) 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

/* --- Achtergronddiepte: trage organische vormen --- */

.achtergrond {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.vorm {
  position: absolute;
  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
  opacity: 0.07;
  animation: drift 90s ease-in-out infinite alternate;
}

.vorm-1 { width: 44vmax; height: 40vmax; top: -12vmax; left: -10vmax; background: var(--thema-5); }
.vorm-2 { width: 36vmax; height: 34vmax; bottom: -14vmax; right: -8vmax; background: var(--thema-4); animation-duration: 110s; animation-delay: -30s; }
.vorm-3 { width: 26vmax; height: 24vmax; top: 40%; left: 55%; background: var(--thema-1); opacity: 0.05; animation-duration: 130s; animation-delay: -60s; }

@keyframes drift {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(6vmax, 4vmax) rotate(24deg); }
}

/* --- Schermen --- */

.scherm {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#welkom { justify-content: center; padding: 24px; min-height: 100vh; }

/* --- Welkomstkaart --- */

.kaart {
  background: var(--surface);
  border-radius: var(--radius-kaart);
  box-shadow: var(--schaduw);
  padding: 40px 36px;
  width: 100%;
  max-width: 430px;
  animation: kaart-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.welkomkaart {
  max-width: 500px;
  padding: 0;
  overflow: hidden;
}

.kaart-deco {
  position: relative;
  height: 120px;
  overflow: hidden;
  background: linear-gradient(135deg,
    rgba(245, 198, 0, 0.18),
    rgba(200, 217, 108, 0.20) 35%,
    rgba(164, 210, 171, 0.22) 65%,
    rgba(128, 191, 203, 0.30));
}

.deco-vorm {
  position: absolute;
  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
}

.deco-vorm.d1 { width: 220px; height: 180px; top: -70px; left: -50px; background: rgba(245, 198, 0, 0.35); }
.deco-vorm.d2 { width: 190px; height: 160px; bottom: -80px; left: 130px; background: rgba(164, 210, 171, 0.45); }
.deco-vorm.d3 { width: 240px; height: 200px; top: -60px; right: -60px; background: rgba(128, 191, 203, 0.45); }
.deco-vorm.d4 { width: 120px; height: 100px; bottom: -40px; right: 150px; background: rgba(200, 217, 108, 0.5); }

.welkom-inhoud { padding: 28px 36px 40px; }

@keyframes kaart-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo { width: 130px; display: block; margin: 0 auto 20px; }
.logo-klein { width: 84px; display: block; }

h1 {
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 10px;
  text-wrap: balance;
}

.uitleg {
  margin: 0 0 26px;
  text-align: center;
  text-wrap: pretty;
}

.veld { display: block; margin-bottom: 14px; }

.veld span {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 5px 16px;
}

.veld input {
  width: 100%;
  border: 1.5px solid var(--rand);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.18s ease-out, box-shadow 0.18s ease-out;
}

.veld input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(128, 191, 203, 0.28);
}

.knop {
  width: 100%;
  margin-top: 10px;
  border: none;
  border-radius: 999px;
  padding: 14px 24px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.15s ease-out, background-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.knop:hover:not(:disabled) { background: #8FCAD5; box-shadow: 0 4px 14px rgba(128, 191, 203, 0.45); }
.knop:active:not(:disabled) { transform: scale(0.98); }
.knop:disabled { opacity: 0.55; cursor: default; }
.knop:focus-visible, .verstuur:focus-visible {
  outline: 3px solid var(--accent-diep);
  outline-offset: 2px;
}

.fout {
  color: #A4453C;
  font-size: 0.92rem;
  margin: 4px 0 0;
  text-align: center;
}

/* --- Chatscherm --- */

#chat {
  max-width: 58rem;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  padding: 0 16px;
}

.chatkop {
  position: sticky;
  top: 0;
  z-index: var(--z-kop);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 10px;
  background: linear-gradient(var(--bg) 78%, rgba(247, 250, 251, 0));
}

/* --- Voortgangsbalk --- */

.voortgang {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 180px;
}

.balk {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--rand);
  overflow: hidden;
}

.vulling {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg,
    var(--thema-1), var(--thema-2), var(--thema-4), var(--thema-5));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.voortgang.compleet .balk {
  animation: glow-ripple 1.1s ease-out both;
}

@keyframes glow-ripple {
  0%   { box-shadow: 0 0 0 0 rgba(128, 191, 203, 0.5); }
  100% { box-shadow: 0 0 0 12px rgba(128, 191, 203, 0); }
}

.voortgang-label {
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
}

/* --- Berichten --- */

.berichten {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 2px 18px;
  scrollbar-width: thin;
}

.bubbel {
  max-width: 85%;
  padding: 12px 18px;
  border-radius: var(--radius-bubbel);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  animation: bericht-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bericht-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubbel.bot {
  align-self: flex-start;
  background: var(--accent);
  color: var(--ink);
  border-bottom-left-radius: 8px;
}

.bubbel.medewerker {
  align-self: flex-end;
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--rand);
  border-bottom-right-radius: 8px;
}

.systeem {
  align-self: center;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(255, 186, 0, 0.12);
  border-radius: 14px;
  padding: 8px 16px;
  max-width: 90%;
  animation: bericht-in 0.35s ease-out both;
}

/* --- Typing-indicator --- */

.typing {
  align-self: flex-start;
  display: flex;
  gap: 6px;
  padding: 16px 18px;
  background: var(--accent);
  border-radius: var(--radius-bubbel);
  border-bottom-left-radius: 8px;
  animation: bericht-in 0.3s ease-out both;
}

.typing i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: punt 1.5s ease-in-out infinite;
}

.typing i:nth-child(1) { animation-delay: 0s; }
.typing i:nth-child(2) { animation-delay: 0.25s; }
.typing i:nth-child(3) { animation-delay: 0.5s; }

@keyframes punt {
  0%, 100% { background: var(--thema-1); transform: translateY(0); }
  25%      { background: var(--thema-2); transform: translateY(-4px); }
  50%      { background: var(--thema-4); transform: translateY(0); }
  75%      { background: var(--ink); }
}

/* --- Afsluitkaart --- */

.afsluitkaart {
  align-self: center;
  margin: 14px 0;
  max-width: 100%;
}

.afsluitkaart h2 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 6px;
  text-align: center;
  text-wrap: balance;
}

.afsluitkaart .subtekst { text-align: center; margin: 0 0 20px; }

.afsluitkaart ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.afsluitkaart li { display: flex; gap: 12px; align-items: baseline; }

.afsluitkaart .stip {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateY(1px);
}

.afsluitkaart .themanaam {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.afsluitkaart .slotregel {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1.5px solid var(--rand);
  text-align: center;
  font-weight: 500;
  color: var(--ink);
}

.knop-secundair {
  display: block;
  margin: 16px auto 0;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 10px 22px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}

.knop-secundair:hover { background: rgba(128, 191, 203, 0.16); }
.knop-secundair:active { transform: scale(0.97); }
.knop-secundair:focus-visible {
  outline: 3px solid var(--accent-diep);
  outline-offset: 2px;
}

/* --- Invoerbalk --- */

.invoerbalk {
  position: sticky;
  bottom: 0;
  z-index: var(--z-invoer);
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 0 max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(247, 250, 251, 0), var(--bg) 30%);
}

#invoer {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--rand);
  border-radius: 24px;
  padding: 13px 20px;
  font: inherit;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  max-height: 9.5em;
  transition: border-color 0.18s ease-out, box-shadow 0.18s ease-out, height 0.12s ease-out;
}

#invoer:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(128, 191, 203, 0.28);
}

.verstuur {
  flex: none;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease-out, background-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.verstuur:hover:not(:disabled) { background: #8FCAD5; box-shadow: 0 4px 14px rgba(128, 191, 203, 0.45); }
.verstuur:active:not(:disabled) { transform: scale(0.92); }
.verstuur:disabled { opacity: 0.45; cursor: default; }

/* --- Mobiel --- */

@media (max-width: 480px) {
  .kaart { padding: 30px 22px; }
  .welkomkaart { padding: 0; }
  .welkom-inhoud { padding: 22px 22px 30px; }
  .kaart-deco { height: 90px; }
  .bubbel { max-width: 92%; }
  #chat { padding: 0 10px; }
  .voortgang { min-width: 120px; }
  .voortgang-label { font-size: 0.72rem; }
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .vorm { animation: none; }
  .kaart, .bubbel, .systeem, .typing { animation: fade-alleen 0.2s ease-out both; }
  .vulling { transition: none; }
  .voortgang.compleet .balk { animation: none; }
  .typing i { animation: punt-stil 1.5s ease-in-out infinite; }
  #invoer { transition: none; }

  @keyframes fade-alleen {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes punt-stil {
    0%, 100% { background: var(--thema-1); }
    25%      { background: var(--thema-2); }
    50%      { background: var(--thema-4); }
    75%      { background: var(--ink); }
  }
}
