/* MKB Coach chat-widget — clean, minimalistische chat (OpenAI-achtig),
   als bottom-sheet die van onderaf omhoogschuift.
   Klassen geprefixt met mkbc- om botsingen met Tailwind te vermijden. */

.mkbc-root {
  --mkbc-bg: #1e1f24;       /* sheet-achtergrond, neutraal donker */
  --mkbc-surface: #2a2c33;  /* user-bubbel, kaarten, input */
  --mkbc-surface2: #33353d; /* hover */
  --mkbc-text: #ececef;
  --mkbc-muted: #9a9ca6;
  --mkbc-line: #34363d;
  /* Huisstijl v2, zie docs/huisstijl-tokens.md. Tint van dezelfde oranje, lichter. */
  --mkbc-accent: #FF883D;
  --mkbc-accent2: #FF9B5C;
  --mkbc-h: 70dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Overlay */
.mkbc-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(8, 10, 16, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}
.mkbc-overlay.mkbc-open { opacity: 1; visibility: visible; }

/* De sheet zelf */
.mkbc-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  margin-inline: auto; width: 100%; max-width: 720px;
  height: var(--mkbc-h); max-height: 96dvh;
  z-index: 9999;
  display: flex; flex-direction: column;
  background: var(--mkbc-bg);
  border-top-left-radius: 20px; border-top-right-radius: 20px;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
  transform: translateY(101%);
  transition: transform .42s cubic-bezier(.32, .72, 0, 1), height .3s ease;
  color: var(--mkbc-text);
  overflow: hidden;
}
.mkbc-sheet.mkbc-open { transform: translateY(0); }
.mkbc-sheet.mkbc-expanded { --mkbc-h: 94dvh; }

@media (min-width: 760px) {
  .mkbc-sheet { border-radius: 18px; bottom: 18px; max-height: 86dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .mkbc-sheet, .mkbc-overlay { transition: none; }
}

/* Header — minimaal */
.mkbc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border-bottom: 1px solid var(--mkbc-line);
  flex-shrink: 0;
}
.mkbc-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--mkbc-accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.mkbc-titles { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.mkbc-title { font-weight: 600; font-size: 14.5px; }
.mkbc-sub { font-size: 11.5px; color: var(--mkbc-muted); }
/* 40 px in plaats van 32: op een telefoon zijn sluiten en uitklappen kleine doelen om
   met een duim te raken, en juist die twee zitten dicht bij de rand van het scherm.
   Gemeten 18-08 op 320 px. Het icoon zelf blijft even groot. */
.mkbc-iconbtn {
  width: 40px; height: 40px; border-radius: 10px; border: none; cursor: pointer;
  background: transparent; color: var(--mkbc-muted); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.mkbc-iconbtn:hover { background: var(--mkbc-surface); color: var(--mkbc-text); }

/* Berichtenlijst */
.mkbc-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 30px 26px 16px; display: flex; flex-direction: column; gap: 28px;
  scrollbar-width: thin; scrollbar-color: var(--mkbc-line) transparent;
}
.mkbc-body::-webkit-scrollbar { width: 8px; }
.mkbc-body::-webkit-scrollbar-thumb { background: var(--mkbc-line); border-radius: 8px; }

.mkbc-msg { font-size: 15px; line-height: 1.78; word-wrap: break-word; }

/* Assistent: GEEN bubbel — gewoon tekst op de achtergrond (OpenAI-stijl) */
.mkbc-msg.mkbc-bot { align-self: stretch; max-width: 100%; background: none; padding: 0; color: var(--mkbc-text); }

/* Gebruiker: subtiele bubbel, rechts uitgelijnd */
.mkbc-msg.mkbc-user {
  align-self: flex-end; max-width: 85%;
  background: var(--mkbc-surface); color: var(--mkbc-text);
  padding: 10px 14px; border-radius: 18px; border-bottom-right-radius: 6px;
  white-space: pre-wrap;
}

/* Inhoud-opmaak binnen het assistent-antwoord */
.mkbc-msg strong { font-weight: 600; }
.mkbc-msg em { font-style: italic; }
.mkbc-msg ul, .mkbc-msg ol { margin: 12px 0; padding-left: 22px; }
.mkbc-msg li { margin: 7px 0; padding-left: 2px; }
.mkbc-msg li::marker { color: var(--mkbc-muted); }
.mkbc-msg a { color: var(--mkbc-accent2); text-decoration: underline; text-underline-offset: 2px; }
.mkbc-msg p { margin: 0 0 14px; }
.mkbc-msg h4 { font-size: 18px; font-weight: 600; line-height: 1.35; margin: 26px 0 10px; }
.mkbc-msg h5 { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 22px 0 8px; }
.mkbc-msg > :first-child { margin-top: 0; }
.mkbc-msg > :last-child { margin-bottom: 0; }

/* Welkom + voorbeeldchips */
.mkbc-welcome { color: var(--mkbc-text); font-size: 15px; line-height: 1.65; }
.mkbc-welcome strong { display: block; font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.mkbc-welcome { color: var(--mkbc-muted); }
.mkbc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.mkbc-chip {
  border: 1px solid var(--mkbc-line); background: transparent; color: var(--mkbc-text);
  border-radius: 10px; padding: 9px 13px; font-size: 13px; cursor: pointer; text-align: left;
  transition: border-color .2s, background .2s;
}
.mkbc-chip:hover { border-color: var(--mkbc-muted); background: var(--mkbc-surface); }

/* Typing-indicator */
.mkbc-typing { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.mkbc-typing span { width: 6px; height: 6px; border-radius: 999px; background: var(--mkbc-muted); animation: mkbc-blink 1.2s infinite both; }
.mkbc-typing span:nth-child(2) { animation-delay: .2s; }
.mkbc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes mkbc-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Wachtregel onder de stipjes: laat zien dat er nagedacht wordt bij een lang
   antwoord. De regelhoogte wordt vooraf gereserveerd (min-height op .mkbc-wait),
   zodat het verschijnen van de tekst de berichtenlijst niet laat verspringen. */
.mkbc-msg.mkbc-thinking { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.mkbc-wait {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 19px;
  font-size: 12.5px; line-height: 1.5; color: var(--mkbc-muted);
  opacity: 0; transition: opacity .4s ease;
}
.mkbc-wait::before {
  content: ""; width: 5px; height: 5px; border-radius: 999px;
  background: var(--mkbc-accent); flex-shrink: 0;
}
.mkbc-wait.mkbc-wait-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .mkbc-wait { transition: none; } }

/* Bronnen — subtiel, met scheidingslijn */
.mkbc-sources {
  align-self: stretch; max-width: 100%; font-size: 12.5px; color: var(--mkbc-muted);
  line-height: 1.6; padding-top: 12px; margin-top: -6px; border-top: 1px solid var(--mkbc-line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.mkbc-sources b { color: var(--mkbc-text); font-weight: 600; }
.mkbc-sources-label { color: var(--mkbc-muted); font-weight: 600; }
.mkbc-source-link {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--mkbc-line); border-radius: 999px; padding: 5px 12px;
  color: var(--mkbc-text); text-decoration: none; transition: border-color .2s, background .2s;
}
.mkbc-source-link::before { content: "\2192"; color: var(--mkbc-accent); }
.mkbc-source-link:hover { border-color: var(--mkbc-accent); background: var(--mkbc-surface); }

/* CTA-kaart (adviesgesprek) — rustig */
.mkbc-cta {
  align-self: stretch; border: 1px solid var(--mkbc-line);
  background: var(--mkbc-surface);
  border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.mkbc-cta-title { font-weight: 600; font-size: 15px; }
.mkbc-cta-text { font-size: 13.5px; color: var(--mkbc-muted); line-height: 1.6; }
.mkbc-cta-btn {
  background: var(--mkbc-accent); color: #141824; border: none; border-radius: 10px;
  padding: 10px 16px; font-weight: 600; font-size: 13.5px;
  cursor: pointer; text-align: center; text-decoration: none; align-self: flex-start;
  transition: background .2s;
}
.mkbc-cta-btn:hover { background: var(--mkbc-accent2); }

/* Composer */
.mkbc-composer { border-top: 1px solid var(--mkbc-line); padding: 12px; flex-shrink: 0; background: var(--mkbc-bg); }
.mkbc-inputrow {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--mkbc-surface); border: 1px solid var(--mkbc-line);
  border-radius: 16px; padding: 8px 8px 8px 16px; transition: border-color .2s;
}
.mkbc-inputrow:focus-within { border-color: var(--mkbc-muted); }
/* Geen blauwe focus-ring (Tailwind forms-plugin) op het tekstveld. */
/* De invoer heeft bewust geen eigen ring: de hele invoerbalk licht op via
   .mkbc-inputrow:focus-within, en dat is duidelijker dan een ring om alleen het tekstvlak. */
.mkbc-input:focus, .mkbc-input:focus-visible { outline: none; box-shadow: none; border: none; }
/* Alle andere bedieningselementen in het venster krijgen wél een zichtbare ring. */
.mkbc-sheet :focus-visible { outline: 3px solid var(--mkbc-accent); outline-offset: 2px; border-radius: 6px; }
.mkbc-input {
  flex: 1; resize: none; border: none; outline: none; background: transparent; color: var(--mkbc-text);
  font-family: inherit; font-size: 15px; line-height: 1.5; max-height: 120px; padding: 5px 0;
}
.mkbc-input::placeholder { color: var(--mkbc-muted); }
/* De verstuurknop is de meest gebruikte knop in het hele venster en stond op 34 px.
   40 px scheelt merkbaar op een telefoon en kost verder niets. */
.mkbc-send {
  width: 40px; height: 40px; border-radius: 12px; border: none; cursor: pointer; flex-shrink: 0;
  background: var(--mkbc-accent); color: #141824; font-size: 17px; display: flex; align-items: center; justify-content: center;
  transition: background .2s, opacity .2s;
}
.mkbc-send:hover { background: var(--mkbc-accent2); }
.mkbc-send:disabled { opacity: .45; cursor: default; }
/* Foutmelding */
.mkbc-error { align-self: flex-start; background: rgba(255, 136, 61, .1); color: var(--mkbc-accent2); border-radius: 10px; padding: 8px 12px; font-size: 13px; }

/* Keuze-bubbels (groeiplafondscan) */
.mkbc-options { align-self: stretch; display: flex; flex-direction: column; gap: 8px; margin-top: -6px; }
.mkbc-progress { font-size: 12px; color: var(--mkbc-muted); margin-bottom: 4px; }
/* Voortgangsbalk onder de teller. Smal en rustig: hij informeert, hij schreeuwt niet. */
.mkbc-progressbar { height: 3px; background: rgba(255,255,255,.10); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.mkbc-progressbar-vul { height: 100%; background: var(--mkbc-accent, #ff6200); border-radius: 999px; transition: width .35s ease; }
@media (prefers-reduced-motion: reduce) { .mkbc-progressbar-vul { transition: none; } }
.mkbc-option {
  text-align: left; border: 1px solid var(--mkbc-line); background: var(--mkbc-surface);
  color: var(--mkbc-text); border-radius: 12px; padding: 11px 14px; font-size: 14px; line-height: 1.5;
  cursor: pointer; transition: border-color .15s, background .15s; font-family: inherit;
}
.mkbc-option:hover { border-color: var(--mkbc-accent); background: var(--mkbc-surface2); }
.mkbc-option:active { transform: scale(.995); }

/* Inline formulier (e-mailgate) */
.mkbc-form {
  align-self: stretch; display: flex; flex-direction: column; gap: 10px;
  background: var(--mkbc-surface); border: 1px solid var(--mkbc-line);
  border-radius: 14px; padding: 16px; margin-top: -6px;
}
.mkbc-form-intro { font-size: 13.5px; color: var(--mkbc-muted); line-height: 1.55; }
.mkbc-form-input {
  border: 1px solid var(--mkbc-line); background: var(--mkbc-bg); color: var(--mkbc-text);
  border-radius: 10px; padding: 11px 13px; font-size: 14.5px; font-family: inherit; outline: none;
  transition: border-color .15s;
}
.mkbc-form-input:focus { border-color: var(--mkbc-muted); }
.mkbc-form-input.mkbc-form-invalid { border-color: var(--mkbc-accent); }
.mkbc-form-submit {
  background: var(--mkbc-accent); color: #141824; border: none; border-radius: 10px;
  padding: 12px 16px; font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit;
  transition: background .2s; align-self: flex-start;
}
.mkbc-form-submit:hover { background: var(--mkbc-accent2); }

/* Polish: leesbare welkomsttitel, logo, gloed, primaire chip, meer lucht */
.mkbc-welcome strong { color: #ffffff; font-size: 18px; }
.mkbc-logo { height: 18px; width: auto; display: block; }
.mkbc-sheet.mkbc-open { box-shadow: 0 -20px 60px rgba(0, 0, 0, .55), 0 0 110px rgba(255, 136, 61, .13); }
.mkbc-header { padding: 16px 18px; gap: 12px; }
.mkbc-body { padding: 32px 26px 18px; gap: 30px; }
.mkbc-chip { padding: 10px 15px; }
.mkbc-chip-primary { border-color: var(--mkbc-accent); color: #fff; background: rgba(255, 136, 61, .12); font-weight: 600; }
.mkbc-chip-primary:hover { background: rgba(255, 136, 61, .22); border-color: var(--mkbc-accent); }
.mkbc-composer { padding: 14px; }
.mkbc-logo { height: 22px; }
