/* ============================================================================================================
   chat.css — opmaak van de chat-assistent (hoort bij chat.js). Op elke demo hetzelfde; per demo te kleuren met
   custom properties op .cb, die chat.js zet uit CHAT_KENNIS.thema. Elke waarde heeft een terugval.
     --cb-accent     knop, eigen berichten, verstuurknop      --cb-accent-2   hover
     --cb-donker     kop van het venster (verloop naar --cb-donker-2)      --cb-op-donker  bijtekst in die kop
     --cb-licht      ondergrond van het gesprek      --cb-tekst  tekst      --cb-grijs  bijtekst      --cb-lijn  randen
     --cb-wa         WhatsApp-knop      --cb-font / --cb-kopfont  letters      --cb-z / --cb-z-paneel  stapelvolgorde
   De launcher ligt bewust laag (onder een geopend mobiel menu), het venster hoog (boven een vaste kopbalk).
   [hidden] wint altijd: een eigen display-regel mag een gesloten venster nooit tonen (sluitknop-bug 30-08).
   ============================================================================================================ */
.cb {
  margin: 0;
  padding: 0;
  font-family: var(--cb-font, inherit);
}
.cb [hidden] {
  display: none !important;
}
.cb *,
.cb *::before,
.cb *::after {
  box-sizing: border-box;
}
.cb .cb-ic {
  display: block;
  flex: none;
}

/* ---------- de ronde knop rechtsonder ---------- */
.cb .cb-knop {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: var(--cb-z, 30);
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: var(--cb-accent, #0B5CAD);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(5, 12, 30, .34), 0 2px 6px rgba(5, 12, 30, .18);
  transition: transform .16s ease, background-color .16s ease;
}
.cb .cb-knop:hover {
  transform: translateY(-2px);
  background: var(--cb-accent-2, var(--cb-accent, #0B5CAD));
}
.cb .cb-knop:focus-visible {
  outline: 3px solid var(--cb-accent, #0B5CAD);
  outline-offset: 3px;
}
.cb .cb-knop .cb-ic-dicht,
.cb .cb-knop[aria-expanded="true"] .cb-ic-open {
  display: none;
}
.cb .cb-knop[aria-expanded="true"] .cb-ic-dicht {
  display: block;
}

/* ---------- het venster ---------- */
.cb .cb-paneel {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: var(--cb-z-paneel, 900);
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 220px));
  height: min(580px, calc(100dvh - 220px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  color: var(--cb-tekst, #0F172A);
  border: 1px solid var(--cb-lijn, #D7DFEA);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(5, 12, 30, .42), 0 6px 18px rgba(5, 12, 30, .16);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  letter-spacing: normal;
}
.cb .cb-paneel:not([hidden]) {
  display: flex;
}
.cb .cb-top {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none;
  margin: 0;
  padding: 12px 12px 12px 14px;
  color: #fff;
  background: linear-gradient(150deg, var(--cb-donker, #0F172A) 0%, var(--cb-donker-2, #1E293B) 100%);
}
.cb .cb-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--cb-op-donker, #9CC4E4);
  color: var(--cb-donker, #0F172A);
  font-family: var(--cb-kopfont, inherit);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}
.cb .cb-naam {
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.25;
  color: #fff;
}
.cb .cb-naam strong {
  display: block;
  overflow: hidden;
  font-family: var(--cb-kopfont, inherit);
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cb .cb-naam span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cb-op-donker, #9CC4E4);
}
.cb .cb-dicht {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}
.cb .cb-dicht:hover {
  background: rgba(255, 255, 255, .22);
}
.cb .cb-dicht:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- groter / kleiner (04-10, zoals de Bijrijder van Rob) ---------- */
.cb .cb-groter {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}
.cb .cb-groter + .cb-dicht {
  margin-left: 6px;
}
.cb .cb-groter:hover {
  background: rgba(255, 255, 255, .22);
}
.cb .cb-groter:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.cb .cb-groter .cb-ic-klein,
.cb.cb-vol .cb-groter .cb-ic-groot {
  display: none;
}
.cb.cb-vol .cb-groter .cb-ic-klein {
  display: block;
}
.cb .cb-scherm {
  position: fixed;
  inset: 0;
  z-index: calc(var(--cb-z-paneel, 900) - 1);
  margin: 0;
  padding: 0;
  background: rgba(5, 12, 30, .58);
}
.cb.cb-vol .cb-paneel {
  right: 50%;
  bottom: 50%;
  transform: translate(50%, 50%);
  width: min(900px, calc(100vw - 48px));
  height: min(880px, calc(100vh - 48px));
  height: min(880px, calc(100dvh - 48px));
  font-size: 16px;
}
.cb.cb-vol .cb-berichten {
  padding: 22px 24px 14px;
  gap: 14px;
}
.cb.cb-vol .cb-bericht {
  max-width: 80%;
  padding: 13px 17px;
  font-size: 16.5px;
}
html.cb-slot,
html.cb-slot body {
  overflow: hidden;
}

/* ---------- het gesprek ---------- */
.cb .cb-berichten {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: 14px 14px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cb-licht, #F4F7FB);
}
.cb .cb-berichten:focus-visible {
  outline: 2px solid var(--cb-accent, #0B5CAD);
  outline-offset: -2px;
}
.cb .cb-bericht {
  max-width: 88%;
  margin: 0;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: break-word;
}
.cb .cb-bot {
  align-self: flex-start;
  background: #fff;
  color: var(--cb-tekst, #0F172A);
  border: 1px solid var(--cb-lijn, #D7DFEA);
  border-bottom-left-radius: 4px;
}
.cb .cb-jij {
  align-self: flex-end;
  background: var(--cb-accent, #0B5CAD);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cb .cb-bot strong {
  font-weight: 700;
}
.cb .cb-bot a {
  color: var(--cb-accent, #0B5CAD);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cb .cb-bot .cb-actie {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 9px 15px;
  border-radius: 11px;
  background: var(--cb-accent, #0B5CAD);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}
.cb .cb-bot .cb-actie + .cb-actie {
  margin-top: 7px;
}
.cb .cb-bot .cb-wa {
  background: var(--cb-wa, #107A42);
}
.cb .cb-bot .cb-bel {
  background: var(--cb-accent, #0B5CAD);
}
.cb .cb-bot .cb-actie:hover {
  filter: brightness(1.08);
}
.cb .cb-typt {
  display: flex;
  gap: 5px;
  padding: 13px 15px;
}
.cb .cb-typt span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cb-grijs, #64748B);
  opacity: .55;
  animation: cb-typt 1s ease-in-out infinite;
}
.cb .cb-typt span:nth-child(2) {
  animation-delay: .16s;
}
.cb .cb-typt span:nth-child(3) {
  animation-delay: .32s;
}
@keyframes cb-typt {
  0%, 60%, 100% { transform: none; opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- vervolgvragen ---------- */
.cb .cb-chips {
  flex: none;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 2px 14px 10px;
  background: var(--cb-licht, #F4F7FB);
}
.cb .cb-chips:not([hidden]) {
  display: flex;
}
.cb .cb-chip {
  margin: 0;
  padding: 6px 12px;
  border: 1.5px solid var(--cb-lijn, #D7DFEA);
  border-radius: 999px;
  background: #fff;
  color: var(--cb-accent, #0B5CAD);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.cb .cb-chip:hover {
  border-color: var(--cb-accent, #0B5CAD);
}
.cb .cb-chip:focus-visible {
  outline: 2px solid var(--cb-accent, #0B5CAD);
  outline-offset: 2px;
}
.cb .cb-chip-of {
  border-style: dashed;
}

/* ---------- invoer en voetnoot ---------- */
.cb .cb-form {
  display: flex;
  flex: none;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 8px;
  border-top: 1px solid var(--cb-lijn, #D7DFEA);
  background: #fff;
}
.cb .cb-invoer {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 13px;
  border: 1.5px solid var(--cb-lijn, #C9D6E6);
  border-radius: 12px;
  background: #fff;
  color: var(--cb-tekst, #0F172A);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.2;
  box-shadow: none;
}
.cb .cb-invoer::placeholder {
  color: var(--cb-grijs, #64748B);
  opacity: 1;
}
.cb .cb-invoer:focus {
  outline: 2px solid var(--cb-accent, #0B5CAD);
  outline-offset: 1px;
  border-color: var(--cb-accent, #0B5CAD);
}
.cb .cb-verstuur {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--cb-accent, #0B5CAD);
  color: #fff;
  cursor: pointer;
}
.cb .cb-verstuur:hover {
  background: var(--cb-accent-2, var(--cb-accent, #0B5CAD));
}
.cb .cb-verstuur:focus-visible {
  outline: 2px solid var(--cb-accent, #0B5CAD);
  outline-offset: 2px;
}
.cb .cb-noot {
  flex: none;
  margin: 0;
  padding: 0 14px 10px;
  background: #fff;
  color: var(--cb-grijs, #475569);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.cb .cb-noot {
  text-wrap: balance;
}
.cb .cb-noot a {
  color: var(--cb-accent, #0B5CAD);
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
}

/* lege strook onderaan in de voet: helemaal onderaan ligt de knop op lege voet, niet op de laatste regel (chat.js) */
.cb-ruimte {
  display: block;
  flex: 0 0 100%;
  grid-column: 1 / -1;
  width: 100%;
  height: calc(82px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  padding: 0;
}

/* ---------- telefoon: het venster als blad onderaan ---------- */
@media (max-width: 600px) {
  .cb .cb-knop {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: 54px;
    height: 54px;
  }
  .cb .cb-paneel {
    right: 8px;
    left: 8px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: min(600px, calc(100vh - 92px));
    height: min(600px, calc(100dvh - 92px - env(safe-area-inset-bottom, 0px)));
    border-radius: 16px;
  }
  .cb-ruimte {
    height: calc(74px + env(safe-area-inset-bottom, 0px));
  }
  /* volledig scherm op de telefoon: het hele scherm, zonder ronde hoeken */
  .cb.cb-vol .cb-paneel {
    inset: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .cb.cb-vol .cb-berichten {
    padding: 14px 14px 10px;
  }
  .cb.cb-vol .cb-bericht {
    max-width: 88%;
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cb .cb-knop,
  .cb .cb-chip {
    transition: none;
  }
  .cb .cb-typt span {
    animation: none;
  }
}
@media print {
  .cb {
    display: none;
  }
}
