/* MGASOUND AI-assistent – chatwidget */
.mgaai-root {
	--mgaai-primary: #111;
	--mgaai-accent: #e30613;
	--mgaai-on-accent: #fff;
	--mgaai-bg: #fff;
	--mgaai-soft: #f3f3f5;
	--mgaai-text: #1b1b1f;
	--mgaai-muted: #6b6b75;
	--mgaai-radius: 18px;
	position: fixed;
	bottom: 20px;
	z-index: 2147483000;
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--mgaai-text);
	-webkit-font-smoothing: antialiased;
}
.mgaai-root *, .mgaai-root *::before, .mgaai-root *::after { box-sizing: border-box; }
.mgaai-root.mgaai-pos-right { right: 20px; }
.mgaai-root.mgaai-pos-left { left: 20px; }
:where(.mgaai-root) :where(button, input, textarea) { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; margin: 0; }

/* Knop */
.mgaai-launcher {
	width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--mgaai-accent); color: var(--mgaai-on-accent);
	display: flex; align-items: center; justify-content: center; padding: 0;
	box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: transform .18s ease, box-shadow .18s ease;
}
.mgaai-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(0,0,0,.3); }
.mgaai-launcher:focus-visible { outline: 3px solid var(--mgaai-primary); outline-offset: 3px; }
.mgaai-launcher .mgaai-avatar { width: 52px; height: 52px; }
.mgaai-root.is-open .mgaai-launcher { transform: scale(.92); }
.mgaai-teaser {
	position: absolute; bottom: 12px; white-space: nowrap; background: var(--mgaai-bg); color: var(--mgaai-text);
	padding: 8px 14px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 14px; cursor: pointer;
	opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.mgaai-pos-right .mgaai-teaser { right: 72px; }
.mgaai-pos-left .mgaai-teaser { left: 72px; }
.mgaai-teaser.is-visible { opacity: 1; transform: none; pointer-events: auto; }

/* Paneel */
.mgaai-panel {
	position: absolute; bottom: 76px; width: 380px; height: min(640px, calc(100vh - 120px));
	background: var(--mgaai-bg); border-radius: var(--mgaai-radius); overflow: hidden;
	box-shadow: 0 18px 50px rgba(0,0,0,.28); display: none; flex-direction: column;
	transform-origin: bottom right; animation: mgaai-in .2s ease-out;
}
.mgaai-pos-right .mgaai-panel { right: 0; }
.mgaai-pos-left .mgaai-panel { left: 0; transform-origin: bottom left; }
.mgaai-root.is-open .mgaai-panel { display: flex; }
@keyframes mgaai-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.mgaai-head {
	display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px;
	background: var(--mgaai-primary); color: #fff;
	border-bottom: 3px solid var(--mgaai-accent);
}
.mgaai-head__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.mgaai-head__title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgaai-ai-badge { font-size: 11px; opacity: .75; text-transform: uppercase; letter-spacing: .06em; }
.mgaai-head__actions { display: flex; gap: 2px; }
.mgaai-icon-btn { background: transparent; border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; opacity: .85; }
.mgaai-icon-btn:hover, .mgaai-icon-btn:focus-visible { background: rgba(255,255,255,.14); opacity: 1; outline: none; }
.mgaai-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--mgaai-accent); color: var(--mgaai-on-accent); flex: 0 0 auto; }
.mgaai-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mgaai-avatar svg { width: 22px; height: 22px; }

.mgaai-list { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--mgaai-soft); scroll-behavior: smooth; overscroll-behavior: contain; }
.mgaai-msg { display: flex; flex-direction: column; margin-bottom: 10px; max-width: 88%; }
.mgaai-msg.is-new { animation: mgaai-pop .18s ease-out; }
@keyframes mgaai-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.mgaai-msg--user { margin-left: auto; align-items: flex-end; }
.mgaai-msg--bot { margin-right: auto; align-items: flex-start; }
.mgaai-bubble { padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.mgaai-msg--bot .mgaai-bubble { background: var(--mgaai-bg); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.mgaai-msg--user .mgaai-bubble { background: var(--mgaai-primary); color: #fff; border-bottom-right-radius: 5px; }
.mgaai-bubble a { color: var(--mgaai-accent); text-decoration: underline; font-weight: 500; }
.mgaai-msg--user .mgaai-bubble a { color: #fff; }
.mgaai-bubble ul { margin: 4px 0; padding-left: 18px; }
.mgaai-bubble li { margin: 2px 0; }
.mgaai-bubble strong { font-weight: 600; }
.mgaai-note { font-size: 12.5px; margin-top: 5px; padding: 6px 10px; border-radius: 10px; }
.mgaai-note--warn { background: #fff4d6; color: #6b4a00; }
.mgaai-sources { font-size: 12.5px; color: var(--mgaai-muted); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.mgaai-sources a { color: var(--mgaai-accent); }
.mgaai-feedback { font-size: 12px; color: var(--mgaai-muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.mgaai-fb-btn { background: transparent; border: 0; cursor: pointer; padding: 3px 5px; border-radius: 6px; color: var(--mgaai-muted); display: inline-flex; line-height: 0; }
.mgaai-fb-btn:hover, .mgaai-fb-btn:focus-visible { background: rgba(0,0,0,.06); color: var(--mgaai-text); outline: none; }

.mgaai-fb-btn--down svg { transform: rotate(180deg); }
.mgaai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.mgaai-chip { background: var(--mgaai-bg); border: 1px solid #d9d9df; border-radius: 16px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; text-align: left; line-height: 1.3; }
.mgaai-chip:hover, .mgaai-chip:focus-visible { border-color: var(--mgaai-accent); color: var(--mgaai-accent); outline: none; }

.mgaai-typing .mgaai-bubble { display: flex; gap: 4px; padding: 12px 14px; }
.mgaai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #a0a0aa; animation: mgaai-dot 1.2s infinite ease-in-out; }
.mgaai-typing i:nth-child(2) { animation-delay: .15s; }
.mgaai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mgaai-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

/* Kaarten (samenvatting / medewerker) */
.mgaai-card { background: var(--mgaai-bg); border: 1px solid #e3e3e8; border-left: 4px solid var(--mgaai-accent); border-radius: 12px; padding: 12px 14px; margin: 4px 0 12px; font-size: 14px; }
.mgaai-card p { margin: 6px 0; }
.mgaai-card__title { display: block; font-size: 15px; margin-bottom: 6px; }
.mgaai-card__note { color: var(--mgaai-muted); font-size: 12.5px; }
.mgaai-card__error { color: #b00020; font-size: 13px; margin-top: 6px; }
.mgaai-card__error:empty { display: none; }
.mgaai-summary { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 6px 0; }
.mgaai-summary dt { color: var(--mgaai-muted); font-size: 13px; }
.mgaai-summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.mgaai-card__buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mgaai-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 10px; border: 1px solid #d0d0d8; background: var(--mgaai-bg); color: var(--mgaai-text); cursor: pointer; text-decoration: none !important; font-size: 13.5px; font-weight: 500; line-height: 1.2; }
.mgaai-btn:hover, .mgaai-btn:focus-visible { border-color: var(--mgaai-primary); outline: none; }
.mgaai-btn--primary { background: var(--mgaai-accent); border-color: var(--mgaai-accent); color: var(--mgaai-on-accent); }
.mgaai-btn--primary:hover { filter: brightness(.95); border-color: var(--mgaai-accent); }
.mgaai-btn[disabled] { opacity: .6; cursor: default; }
.mgaai-consent { display: block; font-size: 12.5px; color: var(--mgaai-muted); margin-top: 6px; }
.mgaai-consent input { vertical-align: middle; margin-right: 4px; }
.mgaai-contact { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mgaai-contact label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--mgaai-muted); }
.mgaai-contact input:not([type=checkbox]), .mgaai-contact textarea { border: 1px solid #d0d0d8; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--mgaai-text); width: 100%; }
.mgaai-contact .mgaai-consent { display: block; }

/* Voet */
.mgaai-foot { background: var(--mgaai-bg); border-top: 1px solid #ececf0; padding: 8px 10px 10px; }
.mgaai-disclosure { font-size: 11.5px; color: var(--mgaai-muted); margin: 0 4px 6px; line-height: 1.35; }
.mgaai-disclosure a { color: inherit; text-decoration: underline; }
.mgaai-form { display: flex; align-items: flex-end; gap: 6px; background: var(--mgaai-soft); border-radius: 14px; padding: 4px 4px 4px 12px; border: 1px solid transparent; }
.mgaai-form:focus-within { border-color: var(--mgaai-primary); background: #fff; }
.mgaai-input { flex: 1; border: 0 !important; background: transparent !important; resize: none; padding: 8px 0 !important; max-height: 120px; min-height: 22px; outline: none !important; box-shadow: none !important; font-size: 15px !important; line-height: 1.4 !important; }
.mgaai-send { width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--mgaai-accent); color: var(--mgaai-on-accent); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; flex: 0 0 auto; }
.mgaai-send[disabled] { opacity: .5; cursor: default; }
.mgaai-human { margin-top: 6px; background: transparent; border: 0; color: var(--mgaai-muted); font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px; }
.mgaai-human:hover, .mgaai-human:focus-visible { color: var(--mgaai-text); text-decoration: underline; outline: none; }
.mgaai-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Mobiel: volledig scherm */
@media (max-width: 600px) {
	.mgaai-root { bottom: 14px; }
	.mgaai-root.mgaai-pos-right { right: 14px; }
	.mgaai-root.mgaai-pos-left { left: 14px; }
	.mgaai-root.mgaai-no-mobile { display: none; }
	.mgaai-panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; bottom: 0; }
	.mgaai-root.is-open .mgaai-launcher, .mgaai-root.is-open .mgaai-teaser { display: none; }
	.mgaai-input { font-size: 16px !important; } /* voorkomt inzoomen op iOS */
	html.mgaai-open, html.mgaai-open body { overflow: hidden; }
	.mgaai-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
	.mgaai-panel, .mgaai-msg.is-new, .mgaai-typing i { animation: none; }
	.mgaai-launcher, .mgaai-teaser { transition: none; }
}
@media print { .mgaai-root { display: none; } }
