/* Assistant chat (§5.1), styled after the eCQare popups: grey header bar, white body, blue actions.
   Colours and type come from tokens.css (eCQare design system); themes/<product>.css overrides the colour roles (§2.3). */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
/* Soft blue glow around the chat column on wide screens (fixed, so it stays while scrolling). */
body { background: radial-gradient(900px 520px at 0% 0%, var(--glow-strong) 0%, transparent 70%) fixed,
  radial-gradient(800px 520px at 100% 100%, var(--glow-soft) 0%, transparent 70%) fixed, var(--bg-page);
  color: var(--text); font: 14px/1.5 var(--font); }
button, textarea, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: flex; flex-direction: column; height: 100%; max-width: 760px; margin: 0 auto; min-width: 0; background: var(--bg); box-shadow: 0 0 32px rgba(var(--shadow-tint), .10); }

/* Header: grey bar like the eCQare popups ("Header (Grey BG)") */
/* Header in the dark product colour (eCQare: white text on --blue has too little contrast, on --blue-d1 it passes). */
/* A slight gradient to a darker blue keeps the white text readable everywhere. */
.header { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; background: linear-gradient(120deg, var(--header-from) 0%, var(--header-to) 100%); color: var(--n00-white); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); position: relative; z-index: 1; }
/* App-style tile with a translucent ring, so the coloured icon stands out on the blue. */
.header-icon { width: 44px; height: 44px; flex-shrink: 0; padding: 5px; object-fit: contain; background: var(--n00-white); border-radius: 12px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .22), 0 2px 6px rgba(0, 0, 0, .18); }
.header-text { flex: 1; min-width: 0; }
.header h1 { margin: 0; font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: .01em; color: var(--n00-white); }
.subtitle { margin: 2px 0 0; color: var(--header-subtitle); font-size: 14px; line-height: 1.3; }
.header .icon-button { color: var(--n00-white); }
.header .icon-button:hover { background: rgba(255, 255, 255, .15); color: var(--n00-white); }
.header :focus-visible { outline-color: var(--n00-white); }
.header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: var(--radius-button); width: 32px; height: 32px; line-height: 1; color: var(--n02-text); font-size: 16px; }
.icon-button:hover { background: var(--n08-subtle-stroke); color: var(--title); }


/* Messages */
/* Light blue at the top fading to near white; the background stays in place while the messages scroll. */
.messages { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 18px;
  background: radial-gradient(600px 300px at 100% 100%, var(--glow-soft) 0%, transparent 70%),
  linear-gradient(180deg, var(--glow-soft) 0%, var(--messages-bg) 45%, var(--messages-bg) 100%); }
.state { color: var(--muted); text-align: center; margin: auto 0; }
/* Empty state: the assistant introduces itself in the middle of the window. */
.welcome { margin: auto; max-width: 420px; text-align: center; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 8px; }
/* The icon has a transparent background: straight on the light blue, no disc. */
.welcome-icon { width: 112px; height: 112px; object-fit: contain; margin-bottom: 4px; }
.welcome p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--title); }
/* Stop screens (no session, expired, not reachable): same place as the welcome, with the oops icon. */
.stop { margin: auto; max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 8px; }
.stop-icon { width: 152px; height: 152px; object-fit: contain; margin-bottom: 4px; }
.stop h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--title); }
.stop p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--n02-text); }
.stop-actions { display: flex; gap: 8px; margin-top: 8px; }
.stop-actions .primary { padding: 7px 16px; font-size: 14px; }
.stop .support-link { margin-top: 4px; }

.msg { max-width: 88%; min-width: 0; }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--title); white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; width: 92%; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; align-items: start; }
.avatar { width: 28px; height: 28px; object-fit: contain; margin-top: 2px; }
.msg-body { min-width: 0; }
.msg.assistant.pending { display: block; }
.msg.assistant.pending .avatar { display: none; }
.bubble { border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 10px 14px; overflow-wrap: anywhere; background: var(--bg); box-shadow: var(--shadow-popup); }
.msg.user .bubble { box-shadow: none; }
.bubble:empty { display: none; }
.bubble p { margin: 0 0 8px; }
.bubble > :last-child { margin-bottom: 0; }
.bubble ol, .bubble ul { margin: 0 0 8px; padding-left: 22px; }
.bubble li { margin: 2px 0; }
.bubble strong { color: var(--title); font-weight: 600; }
/* Subheadings in answers: "Title S 14 · semibold blue" */
.bubble h3, .bubble h4 { font-size: 14px; font-weight: 600; margin: 10px 0 4px; color: var(--accent-text); }
.bubble code { background: var(--bg-soft); border: 1px solid var(--border-subtle); border-radius: 3px; padding: 0 4px; font-size: 13px; }

/* "Bezig met zoeken" with a gently pulsing spark and three dots, like a typing indicator. */
.thinking { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 4px 2px 8px; }
.thinking .spark-anim { color: var(--accent); font-size: 15px; line-height: 1; display: inline-block; animation: spark 1.6s ease-in-out infinite; }
.thinking .dots { display: inline-flex; gap: 3px; margin-left: -2px; }
.thinking .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: .3; animation: dot 1.2s ease-in-out infinite; }
.thinking .dots i:nth-child(2) { animation-delay: .15s; }
.thinking .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes spark { 0%, 100% { transform: scale(.85) rotate(0deg); opacity: .6; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
@keyframes dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: .9; transform: translateY(-2px); } }
@keyframes blink { 50% { opacity: .3; } }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s infinite; }
@media (prefers-reduced-motion: reduce) {
  .thinking .spark-anim, .thinking .dots i, .cursor::after { animation: none; }
  .thinking .dots i { opacity: .6; }
}

.notice { margin-top: 6px; font-size: 12px; color: var(--muted); }
.error-box { border: 1px solid var(--error); background: var(--error-bg); color: var(--error); border-radius: var(--radius); padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumb { border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 0; background: var(--bg); width: 96px; height: 64px; overflow: hidden; }
.thumb:hover { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.actions { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.actions .spacer { flex: 1; }
/* Copy button left of the user's question: takes no vertical space. */
.msg.user { position: relative; }
.user-actions { position: absolute; right: 100%; bottom: 4px; margin: 0 4px 0 0; opacity: 0; transition: opacity .15s; }
.msg.user:hover .user-actions, .user-actions:focus-within { opacity: 1; }
@media (hover: none) { .user-actions { opacity: 1; } }
.action { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 1px solid transparent; background: none; border-radius: var(--radius-button); color: var(--muted); }
.actions .action + .action { margin-left: -2px; }
.action:hover:not(:disabled) { background: var(--hover); color: var(--accent-text); }
.action[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-select); }
.action[aria-pressed="true"] svg { fill: var(--accent-soft); }
.action:disabled { opacity: .4; cursor: default; }
.link, .support-link { border: none; background: none; padding: 0; color: var(--accent-text); font-size: 12px; text-decoration: none; }
.link:hover, .support-link:hover { text-decoration: underline; }
.feedback-form { display: flex; gap: 6px; margin-top: 6px; }
.feedback-form input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-button); padding: 4px 8px; font-size: 12px; }

/* Buttons: eCQare blue, small radius */
.primary, .secondary { border-radius: var(--radius-button); padding: 5px 12px; font-size: 13px; font-weight: 500; }
.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.secondary:hover { background: var(--hover); }

/* Composer */
.composer { border-top: 1px solid var(--border-subtle); padding: 12px 16px 8px; background: var(--bg); box-shadow: 0 -4px 16px rgba(var(--shadow-tint), .05); position: relative; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.suggestions:empty { display: none; }
.suggestion { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text); }
.suggestion:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
/* Input and send button in one field, like a chat bar. */
.input-row { display: flex; gap: 6px; align-items: flex-end; border: 1px solid var(--border); border-radius: 12px; padding: 5px 5px 5px 12px; background: var(--bg); }
.input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.input-row textarea { flex: 1; min-width: 0; resize: none; border: 0; padding: 6px 0; max-height: 140px; background: transparent; color: var(--title); overflow-y: hidden; }
.input-row textarea::placeholder { color: var(--muted); }
.input-row textarea:focus { outline: none; }
.send { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--n00-white); border: 1px solid var(--accent); border-radius: var(--radius-button); width: 34px; height: 32px; flex-shrink: 0; }
.send:hover:not(:disabled) { background: var(--accent-hover); }
.send:disabled { background: var(--n08-subtle-stroke); border-color: var(--n08-subtle-stroke); color: var(--n04-inactive); cursor: default; }
.footer-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.disclaimer { margin: 0; font-size: 11px; color: var(--muted); }
.counter { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pii-warning { border: 1px solid var(--warn-border); background: var(--warn-bg); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; font-size: 12px; }
.pii-warning p { margin: 0 0 6px; }
.pii-actions { display: flex; gap: 10px; align-items: center; }

/* Lightbox (inside the modal, not a new window) */
.lightbox { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; max-width: 96vw; max-height: 92vh; background: var(--bg); box-shadow: var(--shadow-popup); }
.lightbox::backdrop { background: var(--t-lightbox); }
.lightbox img { display: block; max-width: calc(96vw - 24px); max-height: calc(92vh - 24px); }
.lightbox-close { position: absolute; top: 8px; right: 8px; background: var(--bg); }

@media (max-width: 480px) {
  .header { padding: 10px 8px 10px 12px; gap: 10px; }
  .header-icon { width: 36px; height: 36px; padding: 4px; }
  .header h1 { font-size: 18px; }
  .subtitle { display: none; }
  .welcome-icon { width: 88px; height: 88px; }
  .stop-icon { width: 120px; height: 120px; }
  .messages, .composer { padding-left: 12px; padding-right: 12px; }
  .msg, .msg.assistant { max-width: 100%; width: 100%; }
  .msg.user { max-width: 90%; width: auto; }
}
