/* =========================================================
   CHAT SECTION — Container & Layout
   ========================================================= */
.chat-section {
  border: 1px solid rgb(var(--color-grey));
  border-radius: 20px;
  padding: 30px;
  margin-top: 40px;
}
.chat-section__title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
}
.chat-section__subtitle {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  margin-top: 4px;
}

/* =========================================================
   CHAT CHIPS — Quick-action buttons
   ========================================================= */
.chat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip {
  font-family: Poppins, sans-serif;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgb(var(--color-blue-primary));
  background: #fff;
  color: rgb(var(--color-blue-primary));
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover {
  background: rgb(var(--color-blue-primary));
  color: #fff;
}
.chip--active {
  background: rgb(var(--color-blue-primary));
  color: #fff;
}
.chip--active:hover {
  background: #fff;
  color: rgb(var(--color-blue-primary));
}

/* =========================================================
   CHAT GATE — e-mailverificatie vóór het eerste bericht
   Sober blok in de bestaande tokens: het is een drempel, geen
   promotie. Alleen de chat zit erachter; de premies, filters en
   de PDF blijven bruikbaar.
   ========================================================= */
.chat-gate {
  border: 1px solid rgb(var(--color-grey));
  border-radius: 16px;
  background: rgba(var(--color-blue-primary), 0.04);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.chat-gate__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}
.chat-gate__text {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 10px;
}
.chat-gate__fine {
  font-size: 13px;
  line-height: 1.5;
  color: rgb(var(--color-grey-placeholder));
  margin: 0 0 10px;
}
.chat-gate__step {
  margin-top: 4px;
}
.chat-gate__label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}
.chat-gate__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.chat-gate__row + .chat-gate__row {
  margin-top: 8px;
}
.chat-gate__input {
  font-family: Poppins, sans-serif;
  font-size: 16px;
  height: 40px;
  padding: 7px 16px;
  border: 1.5px solid rgb(var(--color-grey));
  border-radius: 30px;
  background: #ffffff;
  color: #000;
  flex: 1 1 220px;
  max-width: 320px;
}
.chat-gate__input:focus {
  outline: none;
  border-color: rgb(var(--color-blue-primary));
  box-shadow: 0 0 0 3px rgba(var(--color-blue-primary), 0.12);
}
/* Zes cijfers: kort veld, ruime letterafstand — dan leest de klant terug wat
   er in de mail stond. */
.chat-gate__input--code {
  flex: 0 0 auto;
  width: 150px;
  max-width: 150px;
  letter-spacing: 0.28em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chat-gate__btn {
  flex: 0 0 auto;
}
.chat-gate__btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.chat-gate__link {
  border: 0;
  padding: 0;
  background: none;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  color: rgb(var(--color-blue-primary));
  text-decoration: underline;
  cursor: pointer;
}
.chat-gate__link:hover {
  text-decoration: none;
}
.chat-gate__link:disabled {
  color: rgb(var(--color-grey-placeholder));
  cursor: default;
  text-decoration: none;
}
.chat-gate__error {
  font-size: 14px;
  line-height: 1.5;
  color: rgb(var(--color-red));
  margin: 10px 0 0;
}

/* =========================================================
   CHAT MESSAGES — Content container
   ========================================================= */
.chat-conversation {
  position: relative;
  border: 1px solid rgb(var(--color-grey));
  border-radius: 16px;
  margin-bottom: 16px;
  background: #ffffff;
}
/* Bewust géén :focus-within-accent op de buitenste box: de textarea draagt sinds
   ze een eigen rand heeft haar eigen focusstaat, en twee blauwe randen om elkaar
   heen wijzen de klant niet beter de weg. */
.chat-messages {
  position: relative;
  padding: 20px 20px 4px;
  overflow-y: auto;
}
.chat-messages--collapsed {
  max-height: 200px;
}
.chat-messages--expanded {
  max-height: 60vh;
}

/* =========================================================
   CHAT CONTROLS — Expand/collapse and loading
   ========================================================= */
.chat-expand-btn {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid rgb(var(--color-grey));
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
  color: #666;
  line-height: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.chat-expand-btn:hover {
  color: rgb(var(--color-blue-primary));
  border-color: rgb(var(--color-blue-primary));
}
.chat-loading-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid rgb(var(--color-grey));
  background: #f8f9fa;
  font-size: 14px;
  color: #555;
}
.chat-loading__spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(var(--color-grey));
  border-top-color: rgb(var(--color-blue-primary));
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

/* =========================================================
   CHAT BOTTOM ACTION — Start analyse button
   ========================================================= */
.chat-bottom-action {
  display: flex;
  justify-content: flex-end;
}
.chat-notice {
  font-size: 14px;
  color: rgb(var(--color-grey-placeholder));
  margin-top: 8px;
}

/* =========================================================
   CHAT TURNS + COMPOSER — het gesprek met de klantagent
   (resultatenpagina van de vergelijker; de dekkingsparser
   gebruikt alleen de blokken hierboven)
   ========================================================= */
.chat-turn + .chat-turn {
  margin-top: 14px;
}
/* Het eigen bericht moest onmiskenbaar een verzonden bericht zijn: als grijs
   blok links leek het op de typ-bel van de assistent. Nu rechts, in de
   huisstijlblauwe tint, en niet breder dan de tekst zelf — het antwoord van de
   assistent blijft links en plat, dat contrast is het hele punt. */
.chat-turn--user {
  display: flex;
  justify-content: flex-end;
}
.chat-turn--user .chat-result {
  max-width: min(85%, 480px);
  padding: 10px 14px;
  border: 1px solid rgba(var(--color-blue-primary), 0.25);
  /* Vierkante hoek rechtsonder: de staart van een uitgaande bubbel. */
  border-radius: 14px 14px 4px 14px;
  background: rgba(var(--color-blue-primary), 0.08);
  color: rgb(var(--color-blue-dark));
  font-weight: 500;
}
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 14px 14px 20px;
}
/* Een eigen zichtbare vorm: zonder rand viel het veld weg tegen de witte
   chatbox eromheen en zag de klant niet waar hij moest typen. */
.chat-composer__input {
  flex: 1;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  border: 1.5px solid rgb(var(--color-grey));
  border-radius: 12px;
  background: #ffffff;
  resize: vertical;
  min-height: 48px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* Dezelfde focusvorm als een gekozen dekkingsniveau (.price-tier--selected). */
.chat-composer__input:focus {
  outline: none;
  border-color: rgb(var(--color-blue-primary));
  box-shadow: 0 0 0 3px rgba(var(--color-blue-primary), 0.12);
}
/* Zonder selectie uitgeschakeld: herkenbaar als veld, zichtbaar niet in gebruik. */
.chat-composer__input:disabled {
  background: rgb(var(--color-grey-light));
  border-color: rgba(var(--color-grey), 0.6);
  color: rgb(var(--color-grey-placeholder));
}
.chat-composer__send.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.chat-composer__spacer {
  flex: 1;
}
.chat-privacy {
  font-size: 13px;
  line-height: 1.5;
  color: rgb(var(--color-grey-placeholder));
  margin-top: 10px;
}

/* =========================================================
   PROSE — Markdown content rendering (Claude-stijl)
   Alle styling voor door de LLM gegenereerde content.
   Strak, compact, sans-serif — geïnspireerd op Claude.ai
   ========================================================= */

/* --- Base typography --- */
.prose {
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a18;
  max-width: 720px;
  overflow-wrap: break-word;
}

/* --- Paragraphs --- */
.prose p {
  margin: 0 0 12px 0;
}
.prose p:last-child {
  margin-bottom: 0;
}

/* --- Headers — compact sans-serif, geen kleuraccent --- */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: 'Poppins', sans-serif;
  color: #1a1a18;
  line-height: 1.3;
}

.prose h1 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 8px;
}
.prose h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 8px;
}
.prose h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 6px;
}
.prose h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 4px;
}

/* Eerste header: geen extra top-margin */
.prose > h1:first-child,
.prose > h2:first-child,
.prose > h3:first-child,
.prose > h4:first-child {
  margin-top: 0;
}

/* Header direct na header: minimale tussenruimte */
.prose h1 + h2,
.prose h1 + h3,
.prose h2 + h3,
.prose h2 + h4,
.prose h3 + h4 {
  margin-top: 4px;
}

/* --- Lists --- */
.prose ul,
.prose ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
}
.prose li {
  margin-bottom: 4px;
  line-height: 1.6;
}
.prose li:last-child {
  margin-bottom: 0;
}
/* Geneste lijsten */
.prose li ul,
.prose li ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* --- Bold & Italic --- */
.prose strong {
  font-weight: 700;
  color: #1a1a18;
}
.prose em {
  font-style: italic;
}

/* --- Links --- */
.prose a {
  color: rgb(var(--color-blue-primary));
  text-decoration: underline;
  text-decoration-color: rgba(var(--color-blue-primary), 0.3);
}
.prose a:hover {
  text-decoration-color: rgb(var(--color-blue-primary));
}

/* --- Horizontal rules — subtiel, meer ademruimte --- */
.prose hr {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 28px 0;
}

/* --- Tables --- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  display: block;
  overflow-x: auto;
}
.prose thead th {
  background: #f5f5f5;
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid #ddd;
  white-space: nowrap;
  font-size: 13px;
  color: #333;
}
.prose tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
/* Zebra striping */
.prose tbody tr:nth-child(even) {
  background: #fafafa;
}
.prose tbody tr:hover {
  background: #f0f4ff;
}

/* --- Blockquotes --- */
.prose blockquote {
  border-left: 3px solid rgb(var(--color-blue-primary));
  margin: 16px 0;
  padding: 10px 18px;
  background: #f8f9fa;
  color: #555;
}
.prose blockquote p {
  margin: 0;
}

/* --- Code (inline) --- */
.prose code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Code blocks --- */
.prose pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.5;
}
.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* =========================================================
   RESPONSIVE — Mobile (≤ 768px)
   ========================================================= */
@media (max-width: 768px) {
  .chat-section {
    padding: 16px;
    border-radius: 16px;
    margin-top: 20px;
  }
  .chat-section__title {
    font-size: 18px;
  }
  .chat-section__subtitle {
    font-size: 14px;
  }
  .chip {
    font-size: 13px;
    padding: 6px 12px;
  }
  .chat-messages {
    padding: 14px;
  }
  .chat-gate {
    padding: 14px;
    border-radius: 12px;
  }
  /* Naast de knop bleef er te weinig breedte over voor het adres. */
  .chat-gate__input {
    max-width: 100%;
  }
  .prose {
    font-size: 14px;
  }
}

/* =========================================================
   RESPONSIVE — Smalle telefoons (≤ 560px)
   ========================================================= */
@media (max-width: 560px) {
  /* Naast de Verstuur-knop bleef er zo weinig breedte over dat de placeholder
     halverwege werd afgekapt. Gestapeld krijgt de textarea de volle breedte. */
  .chat-composer {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }
  .chat-composer__send {
    align-self: flex-end;
  }
}
