/* Trifurno chat-assistent – same look as trifurno.nl (Poppins, blue #1e73be, navy #0f1f3f). */
#bs-chat {
	--bsc-blue: #1e73be;
	--bsc-blue-dark: #165a96;
	--bsc-navy: #0f1f3f;
	--bsc-navy-2: #18305c;
	--bsc-tint: #edf3fb;
	--bsc-bg: #f5f8fc;
	--bsc-line: #dfe5ec;
	--bsc-text: #222;
	--bsc-muted: #5f6b7a;
	--bsc-green: #22a559;
	--bsc-radius: 18px;
	--bsc-shadow: 0 24px 60px rgba(15, 31, 63, .22), 0 4px 14px rgba(15, 31, 63, .08);
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 999990;
	font-family: "Poppins", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 14.5px;
	line-height: 1.55;
	color: var(--bsc-text);
	letter-spacing: normal;
	text-transform: none;
	-webkit-font-smoothing: antialiased;
}
#bs-chat *, #bs-chat *::before, #bs-chat *::after { box-sizing: border-box; }
#bs-chat button, #bs-chat input, #bs-chat textarea {
	-webkit-appearance: none; appearance: none; margin: 0; font: inherit; color: inherit; letter-spacing: normal;
	text-transform: none; text-shadow: none; box-shadow: none; min-height: 0; height: auto; max-width: none;
}
#bs-chat button { border: 0; background: none; padding: 0; cursor: pointer; line-height: 1.2; border-radius: 0; }
#bs-chat a { color: var(--bsc-blue); text-decoration: underline; text-underline-offset: 2px; }
#bs-chat svg { display: block; flex: none; }
#bs-chat [hidden] { display: none !important; }
#bs-chat :focus-visible { outline: 2px solid var(--bsc-blue); outline-offset: 2px; }

/* ---------- Launcher ---------- */
#bs-chat .bsc-launcher {
	position: relative; width: 62px; height: 62px; border-radius: 50% !important;
	background: var(--bsc-blue) !important; color: #fff !important;
	display: grid; place-items: center;
	box-shadow: 0 12px 30px rgba(30, 115, 190, .38), 0 2px 6px rgba(15, 31, 63, .18) !important;
	transition: transform .2s ease, background-color .2s ease;
}
#bs-chat .bsc-launcher:hover { transform: translateY(-2px) scale(1.04); background: var(--bsc-blue-dark) !important; }
#bs-chat .bsc-launcher svg { width: 28px; height: 28px; transition: transform .25s ease, opacity .2s ease; }
#bs-chat .bsc-launcher .bsc-i-close { position: absolute; opacity: 0; transform: rotate(-90deg); }
#bs-chat.is-open .bsc-launcher .bsc-i-chat { opacity: 0; transform: rotate(90deg); }
#bs-chat.is-open .bsc-launcher .bsc-i-close { opacity: 1; transform: none; }
.bsc-online {
	position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%;
	background: var(--bsc-green); border: 2.5px solid #fff;
}
.bsc-badge {
	position: absolute; top: -4px; left: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
	background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
#bs-chat .bsc-launcher.is-pulse::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--bsc-blue);
	animation: bsc-pulse 1.6s ease-out 2;
}
@keyframes bsc-pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(1.55); opacity: 0; } }

/* ---------- Teaser ---------- */
.bsc-teaser {
	position: absolute; right: 0; bottom: 78px; width: max-content; max-width: 290px;
	display: flex; gap: 10px; align-items: flex-start;
	background: #fff; border: 1px solid var(--bsc-line); border-radius: 16px 16px 4px 16px;
	padding: 12px 34px 12px 12px; box-shadow: 0 14px 34px rgba(15, 31, 63, .16);
	cursor: pointer; animation: bsc-up .35s cubic-bezier(.2, .8, .2, 1);
}
.bsc-teaser img, .bsc-teaser .bsc-ava { width: 34px; height: 34px; }
.bsc-teaser p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--bsc-navy); font-weight: 500; }
#bs-chat .bsc-teaser__close {
	position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50% !important;
	display: grid; place-items: center; color: var(--bsc-muted);
}
#bs-chat .bsc-teaser__close:hover { background: var(--bsc-bg) !important; color: var(--bsc-navy); }
#bs-chat .bsc-teaser__close svg { width: 14px; height: 14px; }
@keyframes bsc-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Panel ---------- */
.bsc-panel {
	position: absolute; right: 0; bottom: 78px;
	width: 390px; height: min(640px, calc(100vh - 120px));
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--bsc-bg); border-radius: var(--bsc-radius); box-shadow: var(--bsc-shadow);
	transform-origin: bottom right; animation: bsc-open .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes bsc-open { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }

.bsc-head {
	display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; color: #fff;
	background: linear-gradient(135deg, var(--bsc-navy) 0%, var(--bsc-navy-2) 100%);
	position: relative;
}
.bsc-head::after {
	content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%;
	background: radial-gradient(circle, rgba(30, 115, 190, .45) 0%, rgba(30, 115, 190, 0) 70%); pointer-events: none;
}
.bsc-ava {
	width: 42px; height: 42px; border-radius: 50%; background: #fff; flex: none;
	display: grid; place-items: center; overflow: hidden; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15);
}
.bsc-ava img { width: 78%; height: 78%; object-fit: contain; }
.bsc-ava svg { width: 22px; height: 22px; color: var(--bsc-blue); }
.bsc-head__txt { flex: 1; min-width: 0; position: relative; z-index: 1; }
.bsc-head__name { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.3; color: #fff; }
.bsc-head__status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255, 255, 255, .78); }
.bsc-head__status i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .2); }
#bs-chat .bsc-head__btn {
	position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 10px !important;
	display: grid; place-items: center; color: rgba(255, 255, 255, .85) !important;
	transition: background-color .15s;
}
#bs-chat .bsc-head__btn:hover { background: rgba(255, 255, 255, .12) !important; color: #fff !important; }
#bs-chat .bsc-head__btn svg { width: 19px; height: 19px; }

.bsc-body {
	flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px;
	display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
.bsc-body > * { flex-shrink: 0; } /* a full chat must scroll, never squeeze messages or cards */
.bsc-body::-webkit-scrollbar { width: 6px; }
.bsc-body::-webkit-scrollbar-thumb { background: #cfd8e3; border-radius: 3px; }

.bsc-row { display: flex; gap: 8px; align-items: flex-end; animation: bsc-up .25s ease; }
.bsc-row.is-user { justify-content: flex-end; }
.bsc-row .bsc-ava { width: 28px; height: 28px; box-shadow: 0 0 0 1px var(--bsc-line); }
.bsc-row .bsc-ava svg { width: 15px; height: 15px; }
.bsc-row.is-cont .bsc-ava { visibility: hidden; }
.bsc-bubble {
	max-width: 82%; padding: 10px 14px; border-radius: 16px 16px 16px 5px;
	background: #fff; border: 1px solid var(--bsc-line); color: var(--bsc-text);
	overflow-wrap: anywhere;
}
.bsc-bubble p { margin: 0 0 8px; }
.bsc-bubble p:last-child, .bsc-bubble ul:last-child { margin-bottom: 0; }
.bsc-bubble ul { margin: 4px 0 8px; padding-left: 18px; list-style: disc; }
.bsc-bubble li { margin: 2px 0; }
.bsc-bubble strong { font-weight: 600; color: var(--bsc-navy); }
.is-user .bsc-bubble { background: var(--bsc-blue); border-color: var(--bsc-blue); color: #fff; border-radius: 16px 16px 5px 16px; }
.is-user .bsc-bubble a, .is-user .bsc-bubble strong { color: #fff; }
.bsc-bubble.is-error { background: #fff5f5; border-color: #f3c7c9; }

.bsc-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.bsc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa7b8; animation: bsc-dot 1.2s infinite ease-in-out; }
.bsc-typing span:nth-child(2) { animation-delay: .15s; }
.bsc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bsc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Quick questions */
.bsc-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 4px 36px; animation: bsc-up .3s ease; }
#bs-chat .bsc-chip {
	padding: 7px 13px !important; border-radius: 20px !important; font-size: 13px; font-weight: 500; line-height: 1.3;
	background: #fff !important; color: var(--bsc-blue) !important; border: 1px solid #bcd5ee !important;
	transition: background-color .15s, color .15s, border-color .15s;
}
#bs-chat .bsc-chip:hover { background: var(--bsc-blue) !important; color: #fff !important; border-color: var(--bsc-blue) !important; }

/* Product cards: a slider (swipe on phones, arrows for the mouse). */
.bsc-slider { position: relative; margin: 2px -16px 4px; animation: bsc-up .3s ease; }
.bsc-cards {
	display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
	padding: 4px 16px 6px 52px; scroll-padding-left: 52px; scrollbar-width: none;
}
.bsc-cards::-webkit-scrollbar { display: none; }
.bsc-card {
	flex: 0 0 186px; scroll-snap-align: start; display: flex; flex-direction: column;
	background: #fff; border: 1px solid var(--bsc-line); border-radius: 14px; overflow: hidden;
	transition: box-shadow .2s;
}
.bsc-card:hover { box-shadow: 0 10px 24px rgba(15, 31, 63, .1); }
.bsc-card__img { display: block; height: 130px; background: #fff; padding: 10px; border-bottom: 1px solid #eef2f6; }
.bsc-card__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bsc-card__body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
#bs-chat .bsc-card__btns .bsc-btn { padding: 8px 4px !important; font-size: 12.5px; min-width: 0; }
#bs-chat .bsc-arrow {
	position: absolute; top: 52px; z-index: 2; width: 36px; height: 36px; border-radius: 50% !important;
	display: grid; place-items: center; background: #fff !important; color: var(--bsc-navy) !important;
	box-shadow: 0 4px 14px rgba(15, 31, 63, .22) !important; border: 1px solid var(--bsc-line) !important;
	transition: opacity .2s, background-color .15s, color .15s;
}
#bs-chat .bsc-arrow:hover { background: var(--bsc-blue) !important; color: #fff !important; border-color: var(--bsc-blue) !important; }
#bs-chat .bsc-arrow svg { width: 18px; height: 18px; }
#bs-chat .bsc-arrow.is-prev { left: 40px; }
#bs-chat .bsc-arrow.is-next { right: 8px; }
#bs-chat .bsc-arrow.is-off { opacity: 0; pointer-events: none; }
.bsc-dots { display: flex; justify-content: center; gap: 5px; padding: 2px 0 0 36px; }
.bsc-dots i { width: 6px; height: 6px; border-radius: 50%; background: #cfd8e3; transition: background-color .2s, width .2s; }
.bsc-dots i.is-on { background: var(--bsc-blue); width: 16px; border-radius: 3px; }
#bs-chat .bsc-card__name {
	color: var(--bsc-navy); font-weight: 600; font-size: 13px; line-height: 1.35; text-decoration: none;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px;
}
#bs-chat .bsc-card__name:hover { color: var(--bsc-blue); }
.bsc-card__price { font-weight: 700; color: var(--bsc-blue); font-size: 15px; line-height: 1.3; }
.bsc-card__price { white-space: nowrap; }
.bsc-card__price small { display: block; font-weight: 400; color: var(--bsc-muted); font-size: 11px; line-height: 1.2; }
.bsc-card__stock { font-size: 11.5px; color: var(--bsc-green); font-weight: 500; display: flex; align-items: center; gap: 5px; }
.bsc-card__stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bsc-card__stock.is-out { color: #b7791f; }
.bsc-card__btns { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }
#bs-chat .bsc-btn {
	flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 8px 10px !important; border-radius: 9px !important; font-size: 12.5px; font-weight: 600; line-height: 1.2;
	text-decoration: none; border: 1px solid var(--bsc-blue) !important; transition: background-color .15s, color .15s;
	background: #fff !important; color: var(--bsc-blue) !important;
}
#bs-chat .bsc-btn:hover { background: var(--bsc-tint) !important; }
#bs-chat .bsc-btn.is-solid { background: var(--bsc-blue) !important; color: #fff !important; }
#bs-chat .bsc-btn.is-solid:hover { background: var(--bsc-blue-dark) !important; }
#bs-chat .bsc-btn[disabled] { opacity: .6; cursor: wait; }

/* Cards in the chat: quote form + contact */
.bsc-box {
	margin-left: 36px; background: #fff; border: 1px solid var(--bsc-line); border-radius: 16px;
	padding: 14px 14px 16px; animation: bsc-up .3s ease;
}
.bsc-box__title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--bsc-navy); font-size: 14.5px; margin: 0 0 2px; }
.bsc-box__title svg { width: 18px; height: 18px; color: var(--bsc-blue); }
.bsc-box__sub { margin: 0 0 10px; font-size: 12.5px; color: var(--bsc-muted); }
.bsc-form { display: grid; gap: 8px; }
.bsc-form .bsc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bsc-field { display: grid; gap: 3px; }
.bsc-field span { font-size: 12px; font-weight: 500; color: var(--bsc-navy); }
#bs-chat .bsc-field input, #bs-chat .bsc-field textarea {
	width: 100%; padding: 9px 11px !important; border: 1px solid #d5dfec !important; border-radius: 10px !important;
	background: var(--bsc-bg) !important; font-size: 13.5px; line-height: 1.4; color: var(--bsc-navy); outline: 0;
	transition: border-color .15s, background-color .15s;
}
#bs-chat .bsc-field textarea { resize: vertical; min-height: 64px; }
#bs-chat .bsc-field input:focus, #bs-chat .bsc-field textarea:focus { border-color: var(--bsc-blue) !important; background: #fff !important; }
.bsc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.bsc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 4px; }
.bsc-tags span { font-size: 11.5px; padding: 3px 9px; border-radius: 12px; background: var(--bsc-tint); color: var(--bsc-navy); }
.bsc-form__note { font-size: 11px; color: var(--bsc-muted); margin: 0; line-height: 1.45; }
.bsc-form__err { font-size: 12.5px; color: #c53030; margin: 0; }
#bs-chat .bsc-form .bsc-btn { padding: 11px 12px !important; font-size: 13.5px; }

.bsc-contact { display: grid; gap: 2px; margin: 4px 0 0; }
#bs-chat .bsc-contact a, .bsc-contact div {
	display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px;
	color: var(--bsc-navy); text-decoration: none; font-size: 13.5px; line-height: 1.35;
}
#bs-chat .bsc-contact a:hover { background: var(--bsc-bg); }
.bsc-contact svg { width: 18px; height: 18px; color: var(--bsc-blue); }
.bsc-contact small { display: block; color: var(--bsc-muted); font-size: 11.5px; }
.bsc-box .bsc-handoff { margin-top: 8px; width: 100%; }

/* ---------- Input ---------- */
.bsc-foot { background: #fff; border-top: 1px solid var(--bsc-line); padding: 10px 12px 8px; }
.bsc-input { display: flex; align-items: flex-end; gap: 8px; }
#bs-chat .bsc-input textarea {
	flex: 1; resize: none; max-height: 110px; min-height: 42px; padding: 10px 14px !important;
	border: 1px solid #d5dfec !important; border-radius: 21px !important; background: var(--bsc-bg) !important;
	font-size: 14px; line-height: 1.45; color: var(--bsc-navy); outline: 0; overflow-y: auto;
	transition: border-color .15s, background-color .15s;
}
#bs-chat .bsc-input textarea:focus { border-color: var(--bsc-blue) !important; background: #fff !important; }
#bs-chat .bsc-input textarea::placeholder { color: #8a94a6; }
#bs-chat .bsc-send {
	width: 42px; height: 42px; border-radius: 50% !important; background: var(--bsc-blue) !important; color: #fff !important;
	display: grid; place-items: center; transition: background-color .15s, transform .15s, opacity .15s; flex: none;
}
#bs-chat .bsc-send:hover { background: var(--bsc-blue-dark) !important; }
#bs-chat .bsc-send:disabled { opacity: .4; cursor: default; }
#bs-chat .bsc-send svg { width: 19px; height: 19px; transform: translateX(1px); }
.bsc-legal { margin: 7px 0 0; text-align: center; font-size: 10.5px; color: #8a94a6; line-height: 1.4; }
#bs-chat .bsc-legal a { color: #8a94a6; }

/* ---------- Phone ---------- */
@media (max-width: 600px) {
	#bs-chat { right: 16px; bottom: 16px; }
	#bs-chat .bsc-launcher { width: 56px; height: 56px; }
	.bsc-teaser { bottom: 70px; max-width: calc(100vw - 48px); }
	.bsc-panel {
		position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0;
		padding-bottom: env(safe-area-inset-bottom);
	}
	#bs-chat.is-open .bsc-launcher, #bs-chat.is-open .bsc-teaser { display: none; }
	.bsc-head { padding-top: max(14px, env(safe-area-inset-top)); }
	.bsc-bubble { max-width: 88%; }
	#bs-chat .bsc-input textarea { font-size: 16px; } /* no zoom on iOS */
	#bs-chat .bsc-field input, #bs-chat .bsc-field textarea { font-size: 16px; }
}
html.bsc-lock, html.bsc-lock body { overflow: hidden !important; }

/* Product pages: stay above the theme's sticky "add to cart" bar while it is shown. */
body:has(.product-sticky-content.fix-bottom.fixed) #bs-chat { bottom: 140px; transition: bottom .25s ease; }
body:has(.product-sticky-content.fix-bottom.fixed) #bs-chat .bsc-panel { height: min(640px, calc(100vh - 236px)); }
@media (max-width: 600px) {
	body:has(.product-sticky-content.fix-bottom.fixed) #bs-chat { bottom: 96px; }
}

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

/* WhatsApp in the contact block (only within opening hours) */
#bs-chat .bsc-wa {
	margin-top: 10px; width: 100%; padding: 11px 12px !important; font-size: 14px;
	background: #25d366 !important; border-color: #25d366 !important; color: #fff !important;
}
#bs-chat .bsc-wa:hover { background: #1ebe5b !important; border-color: #1ebe5b !important; }
#bs-chat .bsc-wa svg { width: 19px; height: 19px; }
.bsc-wa-closed { margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--bsc-bg); }
.bsc-wa-closed p { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 12.5px; color: var(--bsc-muted); line-height: 1.4; }
.bsc-wa-closed p svg { width: 17px; height: 17px; color: #25d366; }
#bs-chat .bsc-wa-closed .bsc-btn { width: 100%; }

/* Header with up to four icons: keep name and status on one line */
.bsc-head { gap: 8px; }
.bsc-head__name, .bsc-head__status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bs-chat .bsc-head__btn { width: 32px; height: 32px; }
#bs-chat .bsc-head__btn svg { width: 18px; height: 18px; }

/* Wide launcher with text (desktop, after a few seconds) */
.bsc-launcher__label { display: none; }
#bs-chat .bsc-launcher.is-wide {
	width: auto; border-radius: 31px !important; padding: 0 24px 0 18px; gap: 10px;
	display: flex; align-items: center; animation: bsc-widen .45s cubic-bezier(.2, .8, .2, 1);
}
#bs-chat .bsc-launcher.is-wide .bsc-launcher__label {
	display: inline; white-space: nowrap; font-size: 15px; font-weight: 600; letter-spacing: .1px; color: #fff;
}
#bs-chat .bsc-launcher.is-wide .bsc-i-close { display: none; }
#bs-chat .bsc-launcher.is-wide .bsc-online { top: 4px; right: 8px; }
#bs-chat .bsc-launcher.is-wide.is-pulse::after { border-radius: 31px; }
@keyframes bsc-widen { from { opacity: .4; transform: scale(.92); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { #bs-chat .bsc-launcher.is-wide .bsc-launcher__label { display: none; } }
