/* ── Whoon Chatbot Widget ── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─────────────────────────────────────
   Host-thema-afscherming (algemeen, geldt voor ELKE spoke-site)
   ─────────────────────────────────────
   Op klant-sites kleuren thema's álle button/input/a-elementen mee: eigen
   randen, achtergronden (vaak een fel accent → "roze doorschijn"), HOOFDLETTERS,
   letter-spacing, box-shadows en tekstschaduw. Onze knoppen erven dat ongewild.
   Deze reset schermt ALLE interactieve elementen BINNEN de widget af, zonder de
   host-site zelf te raken (alles is gescoped onder .whoon-toggle/.whoon-window/
   .whoon-teaser). Kleuren/vormen die we bewust willen, zetten de regels hieronder
   daarna gewoon weer — die staan verderop en winnen op specificiteit/volgorde. */
.whoon-toggle,
.whoon-teaser,
.whoon-teaser button,
.whoon-window button,
.whoon-window input,
.whoon-window textarea,
.whoon-window a,
.whoon-window select {
  font-family: inherit;
  text-transform: none !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  text-shadow: none !important;
  text-indent: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  line-height: normal;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  filter: none;
}

/* ─────────────────────────────────────
   Toggle button
───────────────────────────────────── */
.whoon-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;   /* STAGING: links, botst niet met Trengo (rechts). Zet terug op 'right: 24px' voor productie. */
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--whoon-merk, #463F51);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0,0,0,0.22);
  transition: transform 0.18s, background 0.18s;
  z-index: 2147483647;   /* max: boven thema-menu's én de winkelwagen-knop op spoke-sites */
  padding: 0;
  overflow: hidden;
}

.whoon-toggle:hover {
  filter: brightness(1.12);
  transform: scale(1.06);
}

.whoon-toggle img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  /* Defensief tegen lazy-load-plugins op spoke-sites die de (geïnjecteerde)
     afbeelding verbergen of leegmaken → anders lijkt de chatknop te verdwijnen. */
  display: block !important;
  opacity: 1 !important;
  max-width: none !important;
  visibility: visible !important;
}

/* ─────────────────────────────────────
   Chat window
───────────────────────────────────── */
.whoon-window {
  position: fixed;
  bottom: 88px;
  left: 24px;   /* STAGING: links, samen met de toggle. Zet terug op 'right: 24px' voor productie. */
  width: 420px;
  height: min(720px, calc(100vh - 120px));
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483646;   /* net onder de toggle, boven de winkelwagen-knop op spoke-sites */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.whoon-window.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ─────────────────────────────────────
   Header
───────────────────────────────────── */
.whoon-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: var(--whoon-merk, #463F51);
  color: #fff;
  flex-shrink: 0;
}

.whoon-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.25);
}

.whoon-header-info {
  flex: 1;
  min-width: 0;
}

.whoon-header-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.whoon-header-sub {
  font-size: 11px;
  opacity: 0.55;
  margin-top: 2px;
}

.whoon-reset {
  background: none !important;   /* !important: sommige thema's kleuren álle buttons (roze/accent) */
  border: none !important;
  box-shadow: none !important;
  color: rgba(255,255,255,0.7) !important;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.whoon-reset:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.1) !important;
}

/* ─────────────────────────────────────
   Messages
───────────────────────────────────── */
.whoon-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.whoon-messages::-webkit-scrollbar {
  width: 3px;
}
.whoon-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.w-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.w-row.bot  { justify-content: flex-start; }
.w-row.user { justify-content: flex-end; }

.w-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
}

.w-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-line;
}

.w-row.bot  .w-bubble {
  background: #f1f1f1;
  color: var(--whoon-merk, #463F51);
  border-bottom-left-radius: 4px;
}

.w-row.user .w-bubble {
  background: var(--whoon-merk, #463F51);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing dots */
.w-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: #f1f1f1;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.w-typing span {
  width: 6px;
  height: 6px;
  background: #b0b0b0;
  border-radius: 50%;
  animation: wbounce 1.1s infinite ease-in-out;
}
.w-typing span:nth-child(2) { animation-delay: 0.18s; }
.w-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes wbounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* Opsommingen in botberichten */
.w-bubble ul {
  margin: 4px 0 4px 2px;
  padding-left: 18px;
}
.w-bubble li {
  margin: 2px 0;
}

/* ─────────────────────────────────────
   Productkaartjes
───────────────────────────────────── */
.w-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 4px 4px 33px; /* uitlijnen met botberichten (naast avatar) */
}

.w-product {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border-radius: 14px;
  background: #f5f5f5;
  text-decoration: none;
  color: var(--whoon-merk, #463F51);
  border: 1px solid #ececec;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.w-product.alt {
  background: #eef1f0;
}

.w-product:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  background: var(--whoon-merk, #463F51);
  color: #fff;
}

.w-product-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: #fff;
}

.w-product-info {
  flex: 1;
  min-width: 0;
}

.w-product-naam {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
}

.w-product-prijs {
  font-size: 13px;
  margin-top: 3px;
  white-space: nowrap;
  opacity: 0.85;
}

.w-product-meer {
  display: inline-block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--whoon-merk, #463F51);
  text-decoration: none;
}
.w-product-meer:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────
   Link-kaartjes (medewerker stuurt een link in de live chat)
   Zelfde look als de productkaartjes: nette klikbare kaart i.p.v. kale link.
───────────────────────────────────── */
.w-linkcard {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 14px;
  background: #f5f5f5;
  text-decoration: none !important;
  color: var(--whoon-merk, #463F51);
  border: 1px solid #ececec;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, color 0.12s;
}
.w-linkcard:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  background: var(--whoon-merk, #463F51);
  color: #fff;
}
.w-linkcard-ico {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
/* Echte (product)afbeelding uit het link-voorbeeld — zelfde formaat als productkaartjes */
.w-linkcard-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: #fff;
}
/* Omschrijving uit het link-voorbeeld: max 2 regels, netjes afgekapt */
.w-linkcard-desc {
  word-break: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.w-linkcard-sub {
  font-size: 12px;
  margin-top: 3px;
  opacity: 0.7;
  word-break: break-all;
  line-height: 1.3;
}
.w-linkcard-arr {
  flex-shrink: 0;
  font-size: 16px;
  opacity: 0.6;
}

/* Systeemmelding (bv. "Je praat nu met …") */
.w-system {
  align-self: center;
  text-align: center;
  font-size: 11px;
  color: #888;
  background: #f3f3f3;
  border-radius: 10px;
  padding: 4px 10px;
  margin: 6px auto;
  max-width: 90%;
  white-space: pre-line;
}

/* Feedback (👍/👎) — compact, onopvallend */
.w-feedback {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px 2px 33px;
  margin-top: -2px;
}
.w-feedback-label {
  font-size: 10px;
  color: #aaa;
}
.w-fb-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 5px;
  opacity: 0.45;
  transition: opacity 0.15s, transform 0.1s;
}
.w-fb-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* Sterbeoordeling na afronding live chat (0,5 – 5 sterren) */
.w-rating {
  align-self: center;
  text-align: center;
  background: #faf7f2;
  border: 1px solid #efe7da;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px auto;
  max-width: 90%;
}
.w-rating-titel {
  font-size: 13px;
  color: #333;
  margin-bottom: 8px;
}
.w-stars {
  display: inline-flex;
  gap: 2px;
  cursor: pointer;
  user-select: none;
}
.w-star {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 30px;
  font-size: 28px;
  line-height: 30px;
  color: #dcdcdc;
}
.w-star::before { content: '★'; }
.w-star.full { color: #f5b301; }
.w-star.half::before {
  background: linear-gradient(90deg, #f5b301 50%, #dcdcdc 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.w-star .w-half {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  z-index: 2;
}
.w-star .w-left  { left: 0; }
.w-star .w-right { right: 0; }
.w-rating-waarde {
  font-size: 12px;
  color: #777;
  margin: 6px 0;
  min-height: 14px;
}
.w-rating-verstuur {
  background: var(--whoon-merk, #463F51);
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.w-rating-verstuur:disabled {
  opacity: 0.4;
  cursor: default;
}
.w-rating-skip {
  display: block;
  margin: 8px auto 0;
  background: none;
  border: none;
  color: #999;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* ─────────────────────────────────────
   Bottom area
───────────────────────────────────── */
.whoon-bottom {
  flex-shrink: 0;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  position: relative;   /* anker voor de drop-up knoppen */
}

/* FAQ drop-up toggle */
.whoon-faq-toggle {
  display: none;        /* getoond zodra er knoppen zijn */
  width: 100%;
  background: #fafafa !important;   /* !important's: schermen af tegen host-thema's button-stijlen (spoke-sites) */
  border: none !important;
  border-bottom: 1px solid #f0f0f0 !important;   /* alléén de scheidingslijn, geen thema-rand rondom */
  border-radius: 0 !important;
  color: #555 !important;
  font-family: inherit;
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  text-transform: none;     /* host-thema mag geen HOOFDLETTERS forceren */
  text-decoration: none;
  letter-spacing: normal;
  box-shadow: none;
}
/* Kleur expliciet forceren: sommige thema's maken button-tekst wit bij hover
   → op onze lichtgrijze achtergrond werd dat onleesbaar (spoke-sites). */
.whoon-faq-toggle:hover { background: #f0f0f0 !important; color: #333 !important; }
.whoon-faq-caret { float: right; transition: transform 0.15s; }
.whoon-faq-toggle.open .whoon-faq-caret { transform: rotate(180deg); }

/* Quick-reply buttons — drop-up overlay boven de onderbalk */
.whoon-buttons {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  box-shadow: 0 -8px 22px rgba(0,0,0,0.10);
  max-height: 320px;
  overflow-y: auto;
}
.whoon-buttons.open { display: flex; }

.w-btn {
  background: #fff !important;   /* !important's: schermen af tegen host-thema's op spoke-sites */
  border: 1.5px solid var(--whoon-merk, #463F51);
  color: var(--whoon-merk, #463F51) !important;
  padding: 9px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  text-transform: none;
  text-decoration: none;
  letter-spacing: normal;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.w-btn:hover {
  background: var(--whoon-merk, #463F51) !important;
  color: #fff !important;
}

/* Text input row */
.whoon-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 14px;
}

.whoon-input {
  flex: 1;
  border: 1.5px solid #e2e2e2;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: none;
  line-height: 1.4;
  max-height: 90px;
  overflow-y: auto;
  transition: border-color 0.15s;
  color: var(--whoon-merk, #463F51);
}

.whoon-input:focus {
  border-color: var(--whoon-accent, #8BD2C9);
}

.whoon-input::placeholder {
  color: #b0b0b0;
}

.whoon-send {
  width: 48px;
  height: 48px;
  background: var(--whoon-accent, #8BD2C9) !important;   /* !important: thema mag onze accentknop niet overkleuren */
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.whoon-send:hover {
  filter: brightness(0.94);
}
.whoon-send:active {
  transform: scale(0.94);
}

.whoon-send svg {
  width: 26px;
  height: 26px;
  fill: var(--whoon-merk, #463F51);
  position: relative;
  left: 1px;   /* optisch centreren van de paper-plane */
}

/* ─────────────────────────────────────
   Utility
───────────────────────────────────── */
.whoon-hidden {
  display: none !important;
}

/* ─────────────────────────────────────
   Proactief pop-up-bericht (teaser)
───────────────────────────────────── */
.whoon-teaser {
  position: fixed;
  bottom: 94px;
  left: 24px;   /* STAGING: links, boven de toggle. Zet terug op 'right: 24px' voor productie. */
  z-index: 2147483645;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--whoon-accent, #8BD2C9);
  color: var(--whoon-merk, #463F51);
  border-radius: 24px;
  padding: 14px 20px;
  box-shadow: 0 10px 34px rgba(0,0,0,0.20);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.whoon-teaser.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.whoon-teaser .whoon-teaser-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.whoon-teaser .whoon-teaser-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--whoon-merk, #463F51);
  opacity: 0.7;
  animation: whoon-teaser-bounce 1.1s infinite ease-in-out;
}
.whoon-teaser .whoon-teaser-dots i:nth-child(2) { animation-delay: 0.18s; }
.whoon-teaser .whoon-teaser-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes whoon-teaser-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}
.whoon-teaser .whoon-teaser-close {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--whoon-merk, #463F51);
  color: #fff;
  border: 2px solid #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
@media (max-width: 480px) {
  .whoon-teaser {
    bottom: 78px;
    left: 16px;   /* STAGING: links. Zet terug op 'right: 16px' voor productie. */
    font-size: 15px;
    padding: 12px 16px;
    max-width: calc(100vw - 32px);
    white-space: normal;
  }
}

/* ─────────────────────────────────────
   Mobile
───────────────────────────────────── */
@media (max-width: 480px) {
  .whoon-window {
    width: calc(100vw - 16px);
    left: 8px;    /* STAGING: links. Zet terug op 'right: 8px' voor productie. */
    bottom: 78px;
    height: calc(100dvh - 92px);   /* vrijwel volledig scherm, ruimte voor de toggle */
    max-height: none;
    border-radius: 16px;
  }
  .whoon-toggle {
    bottom: 16px;
    left: 16px;   /* STAGING: links. Zet terug op 'right: 16px' voor productie. */
  }
}

/* ─────────────────────────────────────
   Geen-animatie-modus (kapotte animatie-pijplijn op de host-site)
   widget.js zet .whoon-geen-animatie op <html> wanneer een proef-transitie
   niet binnen ~0,7 s afrondt. Gezien op de Room-site: transities blijven
   eeuwig 'running' en de browser tekent de animatie-laag niet meer → de
   chatknop "verdwijnt" bij hover/klik en het venster loopt visueel één klik
   achter. Zonder animaties wordt alles atomisch met de klik getekend.
───────────────────────────────────── */
.whoon-geen-animatie .whoon-toggle,
.whoon-geen-animatie .whoon-toggle img,
.whoon-geen-animatie .whoon-window,
.whoon-geen-animatie .whoon-teaser,
.whoon-geen-animatie .whoon-teaser .whoon-teaser-dots i,
.whoon-geen-animatie .whoon-faq-caret,
.whoon-geen-animatie .whoon-reset,
.whoon-geen-animatie .w-btn,
.whoon-geen-animatie .whoon-send {
  transition: none !important;
  animation: none !important;
}
.whoon-geen-animatie .whoon-toggle:hover { transform: none !important; filter: none !important; }
.whoon-geen-animatie .whoon-window       { transform: none !important; }
.whoon-geen-animatie .whoon-teaser       { transform: none !important; }

/* ─────────────────────────────────────
   Top-layer (popover) neutralisatie
   widget.js promoveert knop/venster/teaser naar de top layer: immuun voor
   ancestor-transforms van de host-site (die position:fixed breken — knop
   "teleporteert" weg onder de cursor) en altijd boven alles. De browser-
   standaardstijlen voor [popover] (inset:0, margin:auto, rand, verbergen)
   zetten we hier terug; :where() houdt de specificiteit op 0, zodat al onze
   gewone klasse-regels (maat, kleur, positie) blijven winnen.
───────────────────────────────────── */
:where(.whoon-toggle[popover], .whoon-window[popover], .whoon-teaser[popover]) {
  position: fixed;
  inset: auto;
  top: auto;
  margin: 0;
  border: none;
  padding: 0;
  width: auto;
  height: auto;
  overflow: visible;
  background: none;
  color: inherit;
  display: flex;
}
