/* Trovita chat: knop rechtsonder met klein chatvenster. */

.trv-chat {
	--trv-accent: #953a90;
	--trv-link: #119abd;
	--trv-donker: #1a2236;
	--trv-tekst: #3b4459;
	--trv-gedempt: #6b7385;
	--trv-font-kop: "Bricolage Grotesque", "Nunito", system-ui, sans-serif;
	--trv-font-tekst: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
	--trv-lijn: #e1e9eb;
	--trv-zacht: #e6f2f4;
	--trv-zacht-2: #d4eaee;
	position: fixed;
	right: max(1.25rem, env(safe-area-inset-right));
	bottom: max(1.25rem, env(safe-area-inset-bottom));
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: .85rem;
	font-family: var(--trv-font-tekst);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
	color: var(--trv-tekst);
}

.trv-chat button, .trv-chat input { font-family: var(--trv-font-tekst); }

@supports (color: color-mix(in srgb, red 10%, white)) {
	.trv-chat {
		--trv-zacht: color-mix(in srgb, var(--trv-link) 9%, #fff);
		--trv-zacht-2: color-mix(in srgb, var(--trv-link) 22%, #fff);
	}
}

.trv-chat *, .trv-chat *::before, .trv-chat *::after { box-sizing: border-box; }

.trv-chat svg { display: block; }

.trv-chat .trv-chat__verborgen {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Knop ---------- */

.trv-chat button.trv-chat__knop {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.6rem;
	height: 3.6rem;
	margin: 0;
	padding: 0;
	color: #fff;
	background: var(--trv-accent);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 10px 28px rgba(27, 42, 47, .22);
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}

.trv-chat button.trv-chat__knop:hover {
	color: #fff;
	background: var(--trv-accent);
	transform: translateY(-2px);
	box-shadow: 0 14px 32px rgba(27, 42, 47, .26);
}

/* Zacht heen en weer wiebelen om uit te nodigen tot klikken. Eerst 3 seconden rust,
   daarna elke 7 seconden even een kleine beweging. Stopt bij aanwijzen, zolang de chat open is,
   en bij "minder beweging" in het systeem. */
@keyframes trv-wiebel {
	0%, 78%, 100% { rotate: 0deg; scale: 1; }
	81% { rotate: -9deg; scale: 1.04; }
	85% { rotate: 7deg; scale: 1.04; }
	89% { rotate: -5deg; scale: 1.02; }
	93% { rotate: 3deg; scale: 1.01; }
	96% { rotate: 0deg; scale: 1; }
}

.trv-chat button.trv-chat__knop {
	animation: trv-wiebel 7s ease-in-out 3s infinite;
}

.trv-chat button.trv-chat__knop:hover,
.trv-chat button.trv-chat__knop:focus-visible {
	animation-play-state: paused;
}

.trv-chat.is-open button.trv-chat__knop {
	animation: none;
}

@media (prefers-reduced-motion: reduce) {
	.trv-chat button.trv-chat__knop { animation: none; }
}

.trv-chat button.trv-chat__knop:focus-visible,
.trv-chat button:focus-visible {
	outline: 3px solid var(--trv-link);
	outline-offset: 3px;
}

.trv-chat .trv-chat__ico-open svg { width: 1.6rem; height: 1.6rem; color: #fff; }
.trv-chat .trv-chat__knop .trv-chat__ico-sluit { display: none; width: 1.4rem; height: 1.4rem; }
.trv-chat.is-open .trv-chat__knop .trv-chat__ico-open { display: none; }
.trv-chat.is-open .trv-chat__knop .trv-chat__ico-sluit { display: block; }

/* ---------- Paneel ---------- */

.trv-chat__paneel {
	display: flex;
	flex-direction: column;
	width: 23.5rem;
	height: min(36rem, calc(100vh - 7.5rem));
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--trv-lijn);
	border-radius: var(--trv-r-kaart, 22px);
	box-shadow: 0 18px 50px rgba(27, 42, 47, .2);
	transform-origin: bottom right;
	animation: trv-chat-in .18s ease-out;
}

.trv-chat__paneel[hidden] { display: none; }

@keyframes trv-chat-in {
	from { opacity: 0; transform: translateY(8px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

.trv-chat__kop {
	display: flex;
	align-items: center;
	gap: .7rem;
	padding: 1rem 1rem 1rem 1.15rem;
	color: #fff;
	background: var(--trv-donker);
}

.trv-chat__kop-icoon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 2.2rem;
	height: 2.2rem;
	background: var(--trv-accent);
	border-radius: 50%;
}

.trv-chat__kop-icoon svg { width: 1.15rem; height: 1.15rem; color: #fff; }

.trv-chat__kop-tekst { flex: 1 1 auto; min-width: 0; }

.trv-chat .trv-chat__kop h2 {
	margin: 0;
	font-family: var(--trv-font-kop);
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: -.01em;
	text-transform: none;
	line-height: 1.3;
	color: #fff;
}

.trv-chat .trv-chat__kop p {
	margin: 0;
	font-size: .8rem;
	line-height: 1.3;
	color: #b8c0cf;
}

.trv-chat button.trv-chat__kopknop {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 2.1rem;
	height: 2.1rem;
	margin: 0;
	padding: 0;
	color: #fff;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: none;
}

.trv-chat button.trv-chat__kopknop:hover { color: #fff; background: rgba(255, 255, 255, .16); }
.trv-chat button.trv-chat__kopknop[hidden] { display: none; }
.trv-chat button.trv-chat__kopknop svg { width: 1.15rem; height: 1.15rem; }
.trv-chat .trv-chat__kop button:focus-visible { outline-color: #fff; outline-offset: 0; }

/* ---------- Berichten ---------- */

.trv-chat__berichten {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: .85rem;
	padding: 1.1rem 1.1rem .6rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.trv-chat__bericht { max-width: 90%; font-size: .92rem; line-height: 1.55; overflow-wrap: anywhere; }

.trv-chat__bericht p { margin: 0 0 .55rem; }
.trv-chat__bericht p:last-child { margin-bottom: 0; }
.trv-chat__bericht strong { font-weight: 600; color: var(--trv-donker); }

.trv-chat__bericht--bezoeker {
	align-self: flex-end;
	padding: .6rem .9rem;
	color: var(--trv-donker);
	background: var(--trv-zacht);
	border-radius: 16px 16px 4px 16px;
}

.trv-chat__bericht--assistent {
	align-self: flex-start;
	padding: .7rem .9rem;
	color: var(--trv-tekst);
	background: #f5f5f7;
	border-radius: 16px 16px 16px 4px;
}

.trv-chat a.trv-chat__bron {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.15rem;
	height: 1.15rem;
	margin: 0 .08rem 0 .12rem;
	padding: 0 .25rem;
	font-size: .66rem;
	font-weight: 700;
	line-height: 1;
	vertical-align: .18em;
	color: #fff;
	background: var(--trv-link);
	border-radius: var(--trv-r-pil, 999px);
	text-decoration: none;
}

.trv-chat a.trv-chat__bron:hover { color: #fff; filter: brightness(1.1); }

.trv-chat__bronnen {
	margin-top: .65rem;
	padding-top: .6rem;
	border-top: 1px solid var(--trv-lijn);
}

.trv-chat p.trv-chat__bronnen-titel {
	margin: 0 0 .35rem;
	font-size: .75rem;
	font-weight: 600;
	color: var(--trv-gedempt);
}

.trv-chat__bronnen ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; }

.trv-chat__bronnen li {
	display: flex;
	align-items: flex-start;
	gap: .45rem;
	margin: 0;
	font-size: .82rem;
	line-height: 1.4;
}

.trv-chat__bronnen .trv-chat__nr {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	min-width: 1.1rem;
	height: 1.1rem;
	margin-top: .08rem;
	font-size: .64rem;
	font-weight: 700;
	color: #fff;
	background: var(--trv-link);
	border-radius: var(--trv-r-pil, 999px);
}

.trv-chat__bronnen a {
	font-weight: 600;
	color: var(--trv-link);
	text-decoration: none;
}

.trv-chat__bronnen a:hover { text-decoration: underline; text-underline-offset: .2em; }

.trv-chat__suggesties {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.trv-chat__suggesties li { margin: 0; }

.trv-chat button.trv-chat__suggestie {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	min-height: 0;
	white-space: normal;
	overflow-wrap: anywhere;
	margin: 0;
	padding: .45rem .85rem;
	font: inherit;
	font-size: .84rem;
	line-height: 1.35;
	text-align: left;
	color: var(--trv-link);
	background: #fff;
	border: 1px solid var(--trv-zacht-2);
	border-radius: var(--trv-r-klein, 14px);
	cursor: pointer;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}

.trv-chat button.trv-chat__suggestie:hover { color: var(--trv-link); background: var(--trv-zacht); }

.trv-chat__laden { display: inline-flex; gap: .3rem; padding: .3rem 0; }

.trv-chat__laden span {
	width: .45rem;
	height: .45rem;
	background: var(--trv-link);
	border-radius: 50%;
	opacity: .35;
	animation: trv-chat-punt 1.2s ease-in-out infinite;
}

.trv-chat__laden span:nth-child(2) { animation-delay: .15s; }
.trv-chat__laden span:nth-child(3) { animation-delay: .3s; }

@keyframes trv-chat-punt { 40% { opacity: 1; transform: translateY(-2px); } }

.trv-chat p.trv-chat__melding {
	align-self: stretch;
	margin: 0;
	padding: .6rem .8rem;
	font-size: .84rem;
	color: var(--trv-gedempt);
	background: #f5f5f7;
	border-radius: var(--trv-r-klein, 12px);
}

.trv-chat button.trv-chat__opnieuw {
	align-self: flex-start;
	margin: 0;
	padding: .45rem .9rem;
	font: inherit;
	font-size: .84rem;
	font-weight: 600;
	color: #fff;
	background: var(--trv-link);
	border: 0;
	border-radius: var(--trv-r-pil, 999px);
	cursor: pointer;
}

/* ---------- Invoer ---------- */

.trv-chat form.trv-chat__form {
	display: flex;
	align-items: center;
	gap: .25rem;
	margin: .4rem .9rem 0;
	padding: .2rem .2rem .2rem .85rem;
	background: #fff;
	border: 1px solid var(--trv-lijn);
	border-radius: var(--trv-r-pil, 999px);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.trv-chat form.trv-chat__form:focus-within {
	border-color: var(--trv-link);
	box-shadow: 0 0 0 3px var(--trv-zacht-2);
}

.trv-chat input.trv-chat__invoer[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
	height: auto;
	margin: 0;
	padding: .55rem .3rem;
	font: inherit;
	font-size: .92rem;
	color: var(--trv-donker);
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	outline: none;
}

.trv-chat input.trv-chat__invoer::placeholder { color: var(--trv-gedempt); opacity: 1; }

.trv-chat button.trv-chat__verstuur {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 2.25rem;
	height: 2.25rem;
	margin: 0;
	padding: 0;
	color: #fff;
	background: var(--trv-accent);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: none;
}

.trv-chat button.trv-chat__verstuur:hover { color: #fff; background: var(--trv-accent); filter: brightness(1.08); }
.trv-chat button.trv-chat__verstuur svg { width: 1.05rem; height: 1.05rem; }
.trv-chat form.is-bezig { opacity: .6; }

.trv-chat p.trv-chat__let-op {
	margin: 0;
	padding: .55rem 1rem .8rem;
	font-size: .7rem;
	line-height: 1.4;
	text-align: center;
	color: var(--trv-gedempt);
}

/* ---------- Mobiel ---------- */

@media (max-width: 520px) {
	.trv-chat {
		right: max(.75rem, env(safe-area-inset-right));
		bottom: max(.75rem, env(safe-area-inset-bottom));
	}
	.trv-chat__paneel {
		width: calc(100vw - 1.5rem);
		height: calc(100vh - 6.5rem);
		height: calc(100dvh - 6.5rem);
	}
	.trv-chat input.trv-chat__invoer[type="text"] { font-size: 1rem; } /* voorkomt inzoomen op iPhone */
}

@media (prefers-reduced-motion: reduce) {
	.trv-chat__paneel { animation: none; }
	.trv-chat__laden span { animation: none; opacity: .7; }
	.trv-chat button.trv-chat__knop { transition: none; }
}

/* ---------- Doorverwijzen naar de offertepagina ---------- */

.trv-chat__contact { margin-top: .75rem; }
.trv-chat__contact + .trv-chat__bronnen { margin-top: .75rem; }

.trv-chat a.trv-chat__contact-knop {
	display: inline-flex;
	align-items: center;
	padding: .55rem 1rem;
	font-size: .85rem;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: var(--trv-accent);
	border-radius: var(--trv-r-pil, 999px);
	text-decoration: none;
}

.trv-chat a.trv-chat__contact-knop:hover { color: #fff; filter: brightness(1.1); }

.trv-chat p.trv-chat__let-op a {
	font-weight: 600;
	color: var(--trv-link);
	text-underline-offset: .2em;
}
