/* =================================================================
   DOMETRA — Chat-widget (AI-assistent via n8n + Claude)
   ================================================================= */
.chat { position: fixed; right: clamp(14px, 3vw, 28px); bottom: clamp(14px, 3vw, 28px); z-index: 200; }

.chat__launcher { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent-grad, linear-gradient(118deg, #10b981 0%, #059669 100%)); color: #fff; box-shadow: 0 16px 34px -12px rgba(16,185,129,.7); display: grid; place-items: center; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -12px rgba(16,185,129,.85); }
.chat__launcher:focus-visible { outline: 2px solid var(--green-2); outline-offset: 3px; }
.chat__launcher svg { width: 26px; height: 26px; position: absolute; transition: opacity .2s, transform .2s; }
.chat__launcher-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.chat.is-open .chat__launcher-icon { opacity: 0; transform: rotate(90deg) scale(.6); }
.chat.is-open .chat__launcher-close { opacity: 1; transform: none; }

.chat__panel { position: absolute; right: 0; bottom: 74px; width: min(370px, calc(100vw - 28px)); height: min(540px, calc(100vh - 120px)); background: var(--surface, #ffffff); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 40px 90px -30px rgba(15,28,22,.45); display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right; animation: chatPop .25s cubic-bezier(.2,.8,.2,1); }
.chat__panel[hidden] { display: none; }
@keyframes chatPop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

.chat__head { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem; background: var(--accent-grad, linear-gradient(118deg, #10b981 0%, #059669 100%)); color: #fff; }
.chat__avatar { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.chat__avatar svg { width: 20px; height: 20px; color: #fff; }
.chat__head-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.chat__head-text strong { font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.chat__status { font-size: .68rem; opacity: .85; }
.chat__close { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: .9rem; flex: none; transition: background .2s; }
.chat__close:hover { background: rgba(255,255,255,.32); }

.chat__log { flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: .7rem; background: var(--bg-2); }
.chat__msg { max-width: 85%; padding: .65rem .85rem; border-radius: 14px; font-size: .86rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat__msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 4px; }
.chat__msg--user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.chat__msg a { color: inherit; text-decoration: underline; }

.chat__typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: .75rem .85rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chatBlink 1.2s infinite; }
.chat__typing span:nth-child(2) { animation-delay: .2s; }
.chat__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes chatBlink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat__suggest { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1.1rem .7rem; background: var(--bg-2); }
.chat__chip { background: #fff; border: 1px solid var(--line-2); color: var(--text-2); font-family: var(--font-mono, 'Inter', system-ui, sans-serif); font-size: .72rem; padding: .45em .8em; border-radius: 999px; cursor: pointer; transition: border-color .2s, color .2s; }
.chat__chip:hover { border-color: var(--green); color: var(--green-2); }

/* Primaire actie-chip: de gratis website-scan, extra opvallend (volle breedte, accentkleur, icoon) */
.chat__chip[data-chat-suggest="Doe een gratis check van mijn site"] {
  background: var(--accent-grad, linear-gradient(118deg, #10b981 0%, #059669 100%));
  color: #fff; border: 0; width: 100%;
  font-family: var(--font-display, 'Jost', system-ui, sans-serif);
  font-weight: 600; font-size: .84rem; letter-spacing: .01em;
  padding: .8em 1.1em;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  box-shadow: 0 10px 22px -10px rgba(16,185,129,.65);
  transition: transform .18s, filter .18s, box-shadow .18s;
}
.chat__chip[data-chat-suggest="Doe een gratis check van mijn site"]::before {
  content: ''; width: 17px; height: 17px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat;
}
.chat__chip[data-chat-suggest="Doe een gratis check van mijn site"]:hover {
  border: 0; color: #fff; filter: brightness(1.06); transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(16,185,129,.8);
}

.chat__form { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--line); background: var(--surface, #ffffff); }
.chat__input { flex: 1; min-width: 0; font-family: inherit; font-size: .9rem; color: var(--text); background: var(--surface-2, #f3f8f5); border: 1px solid var(--line-2); border-radius: 999px; padding: .7em 1em; }
.chat__input::placeholder { color: var(--muted); }
.chat__input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
.chat__send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--green); color: #fff; cursor: pointer; display: grid; place-items: center; transition: filter .2s, opacity .2s; }
.chat__send:hover { filter: brightness(1.06); }
.chat__send:disabled { opacity: .5; cursor: default; }
.chat__send svg { width: 18px; height: 18px; }

.chat__disclaimer { font-size: .62rem; color: var(--muted); text-align: center; padding: 0 1rem .7rem; background: var(--surface, #ffffff); }
.chat__disclaimer a { color: var(--green-2); }

@media (max-width: 480px) {
  .chat { right: 12px; bottom: 12px; }
  .chat__launcher { width: 54px; height: 54px; }
  .chat__panel { width: calc(100vw - 24px); height: min(72vh, 520px); bottom: 68px; }
}
@media (prefers-reduced-motion: reduce) { .chat__panel { animation: none; } }
