/* MDesign Bonnie – Bonaire Assistent */
.bonnie {
	--bonnie-primary: #1B4F9C;
	--bonnie-accent: #F7C600;
	--b-pink: #F48FB1;
	--b-pink-deep: #D9578A;
	--b-bg: #F2F7FA;
	--b-surface: #FFFFFF;
	--b-fg: #1A2A3A;
	--b-muted: #5F7181;
	--b-line: #DCE6EE;
	--b-user-fg: #FFFFFF;
	--b-radius: 22px;
	--b-shadow: 0 18px 50px rgba(17, 42, 72, .22), 0 3px 10px rgba(17, 42, 72, .10);
	font-size: 15px;
	line-height: 1.45;
	color: var(--b-fg);
	-webkit-font-smoothing: antialiased;
}
.bonnie *, .bonnie *::before, .bonnie *::after { box-sizing: border-box; }
.bonnie [hidden] { display: none !important; }
.bonnie button { font: inherit; cursor: pointer; }

/* ---------- Paneel ---------- */
.bonnie-panel {
	display: flex;
	flex-direction: column;
	background: var(--b-bg);
	border-radius: var(--b-radius);
	overflow: hidden;
	box-shadow: var(--b-shadow);
}
.bonnie--inline .bonnie-panel { width: 100%; max-width: 760px; margin: 0 auto; height: 620px; box-shadow: 0 6px 24px rgba(17, 42, 72, .12); border: 1px solid var(--b-line); }

.bonnie--floating { position: fixed; z-index: 99990; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.bonnie--floating.bonnie--left { right: auto; left: calc(20px + env(safe-area-inset-left, 0px)); }
.bonnie--floating .bonnie-panel {
	position: absolute;
	right: 0;
	bottom: 80px;
	width: 380px;
	height: min(620px, calc(100vh - 130px));
	transform-origin: bottom right;
	animation: bonnie-pop .28s cubic-bezier(.2, .9, .3, 1.2);
}
.bonnie--floating.bonnie--left .bonnie-panel { right: auto; left: 0; transform-origin: bottom left; }
@keyframes bonnie-pop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- Launcher ---------- */
.bonnie-launcher {
	position: relative;
	width: 66px; height: 66px;
	border: 0; padding: 0;
	border-radius: 50%;
	background: var(--b-surface);
	box-shadow: 0 8px 24px rgba(17, 42, 72, .28), 0 0 0 4px var(--bonnie-accent);
	transition: transform .2s ease;
}
.bonnie-launcher:hover { transform: translateY(-2px); }
.bonnie-launcher:focus-visible { outline: 3px solid var(--bonnie-primary); outline-offset: 6px; }
.bonnie-launcher-avatar, .bonnie-launcher-avatar svg { display: block; width: 100%; height: 100%; border-radius: 50%; }
.bonnie-launcher-close {
	position: absolute; inset: 0;
	display: grid; place-items: center;
	border-radius: 50%;
	background: var(--bonnie-primary); color: #fff;
	font-size: 34px; line-height: 1;
	opacity: 0; transform: rotate(-90deg);
	transition: opacity .2s, transform .25s;
}
.bonnie.is-open .bonnie-launcher-close { opacity: 1; transform: none; }

/* Hover: tekstballon + Bonnie wiebelt en knipoogt */
.bonnie-launcher-label {
	position: absolute;
	right: calc(100% + 14px);
	top: 50%;
	padding: 9px 14px;
	border-radius: 999px;
	background: var(--b-surface);
	color: var(--b-fg);
	font-weight: 700;
	font-size: 14px;
	white-space: nowrap;
	box-shadow: 0 6px 20px rgba(17, 42, 72, .2);
	opacity: 0;
	transform: translate(10px, -50%);
	pointer-events: none;
	transition: opacity .2s ease, transform .25s cubic-bezier(.2, .9, .3, 1.3);
}
.bonnie-launcher-label::after {
	content: "";
	position: absolute;
	right: -5px; top: 50%;
	width: 10px; height: 10px;
	background: inherit;
	transform: translateY(-50%) rotate(45deg);
	border-radius: 2px;
}
.bonnie--left .bonnie-launcher-label { right: auto; left: calc(100% + 14px); transform: translate(-10px, -50%); }
.bonnie--left .bonnie-launcher-label::after { right: auto; left: -5px; }
.bonnie-launcher-label:empty { display: none; }
.bonnie-launcher:hover .bonnie-launcher-label,
.bonnie-launcher:focus-visible .bonnie-launcher-label { opacity: 1; transform: translate(0, -50%); }
.bonnie.is-open .bonnie-launcher-label { display: none; }

.bonnie-avatar-svg .bonnie-head { transform-box: view-box; transform-origin: 50% 72%; }
.bonnie-launcher:hover .bonnie-head { animation: bonnie-wiggle .9s ease-in-out; }
.bonnie-launcher:hover .bonnie-eye-r { animation: bonnie-wink .9s ease-in-out; }
@keyframes bonnie-wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-10deg); } 45% { transform: rotate(8deg); } 70% { transform: rotate(-4deg); } }
@keyframes bonnie-wink { 0%, 25%, 75%, 100% { transform: scaleY(1); } 40%, 60% { transform: scaleY(.08); } }
.bonnie.is-open .bonnie-launcher:hover .bonnie-head, .bonnie.is-open .bonnie-launcher:hover .bonnie-eye-r { animation: none; }

.bonnie-teaser {
	position: absolute; right: 4px; bottom: 82px;
	width: max-content; max-width: 230px;
	padding: 10px 14px;
	background: var(--b-surface); color: var(--b-fg);
	border-radius: 16px 16px 4px 16px;
	box-shadow: 0 8px 24px rgba(17, 42, 72, .2);
	font-weight: 600; font-size: 14px;
	cursor: pointer;
	animation: bonnie-pop .3s ease;
}
.bonnie--left .bonnie-teaser { right: auto; left: 4px; border-radius: 16px 16px 16px 4px; }

/* ---------- Header ---------- */
.bonnie-head {
	display: flex; align-items: center; gap: 12px;
	padding: 14px 14px 14px 16px;
	background: var(--bonnie-primary);
	background-image: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .16) 0, rgba(255, 255, 255, 0) 55%);
	color: #fff;
	flex: none;
}
.bonnie-head-avatar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 0 0 3px var(--bonnie-accent); }
.bonnie-head-avatar svg { display: block; width: 100%; height: 100%; border-radius: 50%; }
.bonnie-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bonnie-head-text strong { font-size: 18px; letter-spacing: .01em; }
.bonnie-head-text small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bonnie-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #5BE38C; box-shadow: 0 0 0 2px rgba(91, 227, 140, .3); }
.bonnie.is-thinking .bonnie-dot { background: var(--bonnie-accent); animation: bonnie-pulse 1s infinite; }
@keyframes bonnie-pulse { 50% { box-shadow: 0 0 0 5px rgba(247, 198, 0, 0); } }
.bonnie-reset, .bonnie-close {
	flex: none; display: grid; place-items: center;
	width: 34px; height: 34px;
	border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, .14); color: #fff;
	font-size: 24px; line-height: 1;
}
.bonnie-reset svg { width: 18px; height: 18px; }
.bonnie-reset:hover, .bonnie-close:hover { background: rgba(255, 255, 255, .26); }

/* Bonnie beweegt */
.bonnie-avatar-svg .bonnie-eye { transform-box: fill-box; transform-origin: center; animation: bonnie-blink 5s infinite; }
@keyframes bonnie-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
/* In de chat: zacht wiegen, huppeltje bij een antwoord, af en toe een knipoog */
.bonnie-head-avatar .bonnie-head { animation: bonnie-sway 4.5s ease-in-out infinite; }
@keyframes bonnie-sway { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-3deg); } 70% { transform: rotate(3deg); } }
.bonnie-head-avatar.is-wink .bonnie-head, .bonnie-msg-avatar.is-wink .bonnie-head { animation: bonnie-wiggle .9s ease-in-out; }
.bonnie-head-avatar.is-wink .bonnie-eye-r, .bonnie-msg-avatar.is-wink .bonnie-eye-r { animation: bonnie-wink .9s ease-in-out; }
.bonnie-msg-avatar.is-hop { animation: bonnie-hop .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bonnie-hop { 0% { transform: translateY(0); } 40% { transform: translateY(-6px) rotate(-6deg); } 100% { transform: translateY(0); } }
.bonnie.is-thinking .bonnie-head-avatar .bonnie-head { animation: bonnie-bob 1.1s ease-in-out infinite; }
@keyframes bonnie-bob { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg) translateY(1px); } 65% { transform: rotate(5deg); } }

/* ---------- Berichten ---------- */
.bonnie-msgs {
	flex: 1; min-height: 0;
	overflow-y: auto;
	padding: 16px 14px 8px;
	display: flex; flex-direction: column; gap: 14px;
	overscroll-behavior: contain;
	scroll-behavior: smooth;
}
.bonnie-group { display: flex; align-items: flex-end; gap: 8px; }
.bonnie-group--user { justify-content: flex-end; }
.bonnie-msg-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; align-self: flex-start; box-shadow: 0 0 0 2px var(--b-surface); }
.bonnie-msg-avatar svg { display: block; width: 100%; height: 100%; }
.bonnie-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; max-width: 84%; }
.bonnie-group--user .bonnie-col { align-items: flex-end; }

.bonnie-bubble {
	padding: 9px 13px;
	border-radius: 18px;
	overflow-wrap: anywhere;
	min-width: 0;
}
.bonnie-bubble p { margin: 0; }
.bonnie-bubble p + p, .bonnie-bubble p + ul, .bonnie-bubble ul + p, .bonnie-bubble p + ol, .bonnie-bubble ol + p { margin-top: 6px; }
.bonnie-bubble ul, .bonnie-bubble ol { margin: 0; padding-left: 20px; }
.bonnie-bubble li + li { margin-top: 2px; }
.bonnie-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bonnie-bubble--bot { background: var(--b-surface); color: var(--b-fg); box-shadow: 0 1px 2px rgba(17, 42, 72, .08); }
.bonnie-bubble--bot:first-child { border-top-left-radius: 6px; }
.bonnie-bubble--bot a { color: var(--bonnie-primary); }
.bonnie-bubble--user { background: var(--bonnie-primary); color: var(--b-user-fg); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bonnie-bubble.is-new { animation: bonnie-in .25s ease-out; }
@keyframes bonnie-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.bonnie-typing { padding: 12px 14px; }
.bonnie-dots { display: inline-flex; gap: 4px; }
.bonnie-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--b-pink-deep); opacity: .35; animation: bonnie-dot 1.2s infinite; }
.bonnie-dots i:nth-child(2) { animation-delay: .15s; }
.bonnie-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bonnie-dot { 30% { opacity: 1; transform: translateY(-3px); } }

.bonnie-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 2px; font-size: 12px; color: var(--b-muted); }
.bonnie-sources a {
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--b-surface);
	border: 1px solid var(--b-line);
	color: var(--b-muted);
	text-decoration: none;
	max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bonnie-sources a:hover { color: var(--bonnie-primary); border-color: var(--bonnie-primary); }

/* ---------- Actieknoppen ---------- */
.bonnie-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.bonnie-action {
	display: inline-flex; align-items: center;
	padding: 9px 15px;
	border-radius: 999px;
	background: var(--bonnie-primary);
	color: #fff !important;
	font-weight: 700; font-size: 14px;
	text-decoration: none !important;
	box-shadow: 0 2px 8px rgba(17, 42, 72, .18);
	transition: transform .15s;
}
.bonnie-action:hover { transform: translateY(-1px); }
.bonnie-action:focus-visible { outline: 2px solid var(--bonnie-accent); outline-offset: 2px; }

/* ---------- Voorbeeldvragen ---------- */
.bonnie-related { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.bonnie-related .bonnie-chip { font-size: 13px; padding: 6px 11px; }
.bonnie-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px 52px; flex: none; }
.bonnie-chip {
	padding: 7px 12px;
	border-radius: 999px;
	border: 1.5px solid var(--b-pink);
	background: var(--b-surface);
	color: var(--b-fg);
	font-size: 13.5px;
	text-align: left;
	transition: background .15s, border-color .15s;
}
.bonnie-chip:hover { background: #FDEEF4; border-color: var(--b-pink-deep); }
.bonnie-chip:focus-visible { outline: 2px solid var(--bonnie-primary); outline-offset: 2px; }

/* ---------- Invoer ---------- */
.bonnie-form {
	display: flex; align-items: flex-end; gap: 8px;
	margin: 0 12px;
	padding: 6px 6px 6px 14px;
	background: var(--b-surface);
	border: 1.5px solid var(--b-line);
	border-radius: 26px;
	flex: none;
	transition: border-color .15s;
}
.bonnie-form:focus-within { border-color: var(--bonnie-primary); }
.bonnie-form textarea {
	flex: 1; min-width: 0;
	border: 0; outline: 0; resize: none;
	background: transparent; color: var(--b-fg);
	font: inherit; font-size: 15px;
	padding: 8px 0; max-height: 120px;
}
.bonnie-form textarea::placeholder { color: var(--b-muted); }
.bonnie-send {
	flex: none; display: grid; place-items: center;
	width: 40px; height: 40px;
	border: 0; border-radius: 50%;
	background: var(--bonnie-accent); color: var(--b-fg);
	transition: transform .15s, opacity .15s;
}
.bonnie-send svg { width: 19px; height: 19px; margin-left: 2px; }
.bonnie-send:hover { transform: scale(1.06); }
.bonnie-send:disabled { opacity: .45; transform: none; cursor: default; }
.bonnie-send:focus-visible { outline: 2px solid var(--bonnie-primary); outline-offset: 2px; }
.bonnie-disc { margin: 0; padding: 7px 16px 10px; font-size: 11px; color: var(--b-muted); text-align: center; flex: none; }

/* ---------- Mobiel: schermvullend ---------- */
@media (max-width: 599px) {
	.bonnie--floating { right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
	.bonnie--floating .bonnie-panel {
		position: fixed;
		inset: 0;
		width: auto; height: auto;
		border-radius: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		z-index: 2;
	}
	.bonnie--floating .bonnie-head { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
	.bonnie--floating.is-open .bonnie-launcher, .bonnie--floating.is-open .bonnie-teaser { display: none; }
	.bonnie-launcher-label { font-size: 13px; }
	.bonnie-form textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.bonnie *, .bonnie *::before, .bonnie *::after { animation: none !important; transition: none !important; }
}
