/* ============================================================
   SUPPORT WIDGET
   Loads on every marketing page, so it owns a narrow set of
   class names and inherits nothing from the page around it.

   The launcher arrives as a pill that says what it is, then
   folds itself down to a circle a few seconds later. A bare
   bubble makes people guess; a permanent pill sits on the
   content. This does the introduction and then gets out of
   the way.
   ============================================================ */

.bk-sup-launch,
.bk-sup {
	--bk-ink: #0D1B1E;
	--bk-deep: #0F4C4A;
	--bk-deep-2: #0b3a38;
	--bk-mint: #CFE8DE;
	--bk-soft: #F7F9F8;
	--bk-line: rgba(13,27,30,.11);
	--bk-mute: #667085;
	font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
}

/* ---------------------------------------------------- launcher */

.bk-sup-launch {
	position: fixed; right: 24px; bottom: 24px; z-index: 99998;
	display: flex; align-items: center; gap: 0;
	height: 54px; padding: 0 15px; border: 0; cursor: pointer;
	border-radius: 999px;
	background: var(--bk-deep); color: #fff;
	font: inherit; font-size: 14px; font-weight: 650; line-height: 1;
	box-shadow: 0 10px 30px -10px rgba(13,27,30,.5), 0 0 0 0 rgba(15,76,74,.4);
	overflow: hidden;
	transition:
		padding .5s cubic-bezier(.16,1,.3,1),
		transform .18s ease,
		box-shadow .25s ease,
		background .18s ease;
}
.bk-sup-launch:hover { background: var(--bk-deep-2); transform: translateY(-2px); }
.bk-sup-launch:focus-visible { outline: 3px solid var(--bk-mint); outline-offset: 3px; }
.bk-sup-launch[hidden] { display: none; }

.bk-sup-launch .ic {
	flex: none; width: 24px; height: 24px; display: grid; place-items: center;
}

/* The label is what folds. Animating max-width rather than width means the
   pill sizes itself to whatever the label says, in any language. */
.bk-sup-launch .lab {
	max-width: 200px; margin-left: 9px;
	white-space: nowrap; overflow: hidden;
	opacity: 1;
	transition:
		max-width .5s cubic-bezier(.16,1,.3,1),
		margin-left .5s cubic-bezier(.16,1,.3,1),
		opacity .28s ease;
}
.bk-sup-launch.is-small { padding: 0 15px; }
.bk-sup-launch.is-small .lab { max-width: 0; margin-left: 0; opacity: 0; }

/* Something arrived while they were not looking. */
.bk-sup-launch .dot {
	position: absolute; top: 8px; right: 9px;
	width: 11px; height: 11px; border-radius: 50%;
	background: #E5484D; border: 2px solid #fff;
}
.bk-sup-launch .dot[hidden] { display: none; }

.bk-sup-launch.is-ping { animation: bk-sup-ping 1.6s ease-out 2; }
@keyframes bk-sup-ping {
	0%   { box-shadow: 0 10px 30px -10px rgba(13,27,30,.5), 0 0 0 0 rgba(15,76,74,.45); }
	70%  { box-shadow: 0 10px 30px -10px rgba(13,27,30,.5), 0 0 0 16px rgba(15,76,74,0); }
	100% { box-shadow: 0 10px 30px -10px rgba(13,27,30,.5), 0 0 0 0 rgba(15,76,74,0); }
}

/* ------------------------------------------------------- panel */

.bk-sup {
	position: fixed; right: 24px; bottom: 24px; z-index: 99999;
	width: min(392px, calc(100vw - 28px));
	height: min(618px, calc(100vh - 56px));
	display: flex; flex-direction: column; overflow: hidden;
	background: #fff; color: var(--bk-ink);
	border: 1px solid var(--bk-line); border-radius: 20px;
	box-shadow: 0 28px 70px -24px rgba(13,27,30,.45);
	font-size: 14px; line-height: 1.55;
	transform-origin: 100% 100%;
	transition: opacity .22s ease, transform .28s cubic-bezier(.16,1,.3,1);
}
.bk-sup[hidden] { display: none; }
.bk-sup.is-shut { opacity: 0; transform: translateY(14px) scale(.94); }

/* header */
.bk-sup-top {
	display: flex; align-items: center; gap: 11px;
	padding: 14px 15px;
	background: linear-gradient(140deg, #10514F 0%, #0F4C4A 55%, #0c403e 100%);
	color: #fff;
}
.bk-sup-mark {
	flex: none; width: 34px; height: 34px; border-radius: 11px;
	background: rgba(255,255,255,.14); display: grid; place-items: center;
}
.bk-sup-id { flex: 1; min-width: 0; }
.bk-sup-id b { display: block; font-size: 14.5px; font-weight: 650; }
.bk-sup-id span {
	display: flex; align-items: center; gap: 6px;
	font-size: 11.5px; opacity: .88; margin-top: 1px;
}
.bk-sup-id i {
	width: 6px; height: 6px; border-radius: 50%; background: var(--bk-mint);
	flex: none;
}
.bk-sup-id.is-live i { background: #6EE7B7; animation: bk-sup-live 1.8s ease-in-out infinite; }
@keyframes bk-sup-live { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.bk-sup-x {
	flex: none; width: 30px; height: 30px; border-radius: 9px;
	background: rgba(255,255,255,.1); border: 0; color: #fff;
	display: grid; place-items: center; cursor: pointer;
	transition: background .15s ease;
}
.bk-sup-x:hover { background: rgba(255,255,255,.22); }
.bk-sup-x:focus-visible { outline: 2px solid var(--bk-mint); outline-offset: 2px; }

/* transcript */
.bk-sup-body {
	flex: 1; min-height: 0; overflow-y: auto;
	padding: 16px 15px; display: flex; flex-direction: column; gap: 11px;
	background: var(--bk-soft);
	scroll-behavior: smooth;
}

.bk-sup-needs {
	display: flex; flex-direction: column; gap: 7px; margin-top: 2px;
	animation: bk-sup-in .32s cubic-bezier(.16,1,.3,1) both;
}
.bk-sup-needs-lab {
	font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
	color: var(--bk-mute); margin-bottom: 1px;
}
.bk-sup-chip {
	text-align: left; width: 100%; cursor: pointer;
	padding: 9px 13px; border-radius: 12px;
	background: #fff; border: 1px solid var(--bk-line); color: #41504f;
	font: inherit; font-size: 13px;
	transition: border-color .15s ease, transform .15s ease, color .15s ease;
}
.bk-sup-chip:hover { border-color: var(--bk-deep); color: var(--bk-deep); transform: translateX(2px); }
.bk-sup-chip:focus-visible { outline: 2px solid var(--bk-deep); outline-offset: 1px; }
.bk-sup-chip.is-person { background: none; border-style: dashed; color: var(--bk-mute); }
.bk-sup-chip.is-person:hover { background: #fff; border-style: solid; }

/* the intro form — name and email before anything else */
.bk-sup-who-form {
	background: #fff; border: 1px solid var(--bk-line); border-radius: 14px;
	padding: 16px 16px 15px; display: flex; flex-direction: column; gap: 10px;
	animation: bk-sup-in .3s cubic-bezier(.16,1,.3,1) both;
}
.bk-sup-who-form b { font-size: 16px; color: var(--bk-ink); }
.bk-sup-who-form p { margin: -5px 0 3px; font-size: 13px; color: var(--bk-mute); }
.bk-sup-who-form label {
	display: block; font-size: 11.5px; font-weight: 600; color: #41504f;
}
.bk-sup-who-form label small { font-weight: 400; color: var(--bk-mute); }
.bk-sup-who-form input {
	display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
	font: inherit; font-size: 14px; color: var(--bk-ink);
	border: 1px solid rgba(13,27,30,.18); border-radius: 10px; background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.bk-sup-who-form input:focus {
	outline: none; border-color: var(--bk-deep); box-shadow: 0 0 0 3px rgba(15,76,74,.13);
}
.bk-sup-who-form button {
	margin-top: 3px; padding: 11px; border: 0; border-radius: 11px;
	background: var(--bk-deep); color: #fff; font: inherit; font-weight: 650;
	cursor: pointer; transition: background .15s ease, opacity .15s ease;
}
.bk-sup-who-form button:hover:not(:disabled) { background: var(--bk-deep-2); }
.bk-sup-who-form button:disabled { opacity: .6; cursor: default; }
.bk-sup-priv { font-size: 11px; color: var(--bk-mute); text-align: center; }

.bk-sup-msg { max-width: 88%; animation: bk-sup-in .3s cubic-bezier(.16,1,.3,1) both; }
@keyframes bk-sup-in { from { opacity: 0; transform: translateY(7px) } to { opacity: 1; transform: none } }
.bk-sup-msg.is-you { align-self: flex-end; }

.bk-sup-txt {
	padding: 9px 13px; border-radius: 15px;
	background: #fff; border: 1px solid var(--bk-line);
}
.bk-sup-msg.is-you .bk-sup-txt {
	background: var(--bk-deep); color: #fff; border-color: var(--bk-deep);
	border-bottom-right-radius: 5px;
}
.bk-sup-msg.is-bot .bk-sup-txt,
.bk-sup-msg.is-agent .bk-sup-txt { border-bottom-left-radius: 5px; }
.bk-sup-txt p { margin: 0 0 7px; }
.bk-sup-txt > :last-child { margin-bottom: 0; }
.bk-sup-txt ul,
.bk-sup-txt ol { margin: 0 0 7px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.bk-sup-txt li { margin: 0; }
.bk-sup-txt li::marker { color: var(--bk-mute); }
.bk-sup-txt code {
	font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12.5px;
	background: rgba(13,27,30,.06); border-radius: 5px; padding: 1px 5px;
	word-break: break-word;
}
.bk-sup-msg.is-you .bk-sup-txt code { background: rgba(255,255,255,.16); }
.bk-sup-msg.is-you .bk-sup-txt li::marker { color: rgba(255,255,255,.6); }
.bk-sup-txt strong { font-weight: 650; }

.bk-sup-who {
	display: flex; align-items: center; gap: 6px;
	margin: 0 0 4px 3px; font-size: 11px; color: var(--bk-mute); font-weight: 600;
}
.bk-sup-av {
	width: 18px; height: 18px; border-radius: 6px; flex: none;
	display: grid; place-items: center;
	background: var(--bk-mint); color: var(--bk-deep);
	font-size: 9.5px; font-weight: 700;
}

/* where the answer came from */
.bk-sup-src { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 3px; }
.bk-sup-src a {
	display: inline-flex; align-items: center; gap: 5px;
	padding: 4px 9px; border-radius: 999px;
	background: #fff; border: 1px solid var(--bk-line);
	font-size: 11.5px; color: var(--bk-deep); text-decoration: none; font-weight: 600;
	transition: border-color .15s ease, background .15s ease;
}
.bk-sup-src a:hover { border-color: var(--bk-deep); background: #F2F8F6; }
.bk-sup-src a::before { content: '↗'; font-size: 10px; opacity: .7; }

/* Standing acknowledgement once a person owns the chat. */
.bk-sup-queued {
	display: flex; align-items: flex-start; gap: 10px;
	background: #fff; border: 1px solid var(--bk-line); border-radius: 13px;
	padding: 11px 13px; margin-top: 2px;
	animation: bk-sup-in .3s cubic-bezier(.16,1,.3,1) both;
}
.bk-sup-queued b { display: block; font-size: 13px; color: var(--bk-ink); }
.bk-sup-queued em { display: block; font-style: normal; font-size: 12px; color: var(--bk-mute); margin-top: 2px; }
.bk-sup-queued .ring {
	flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
	display: grid; place-items: center; background: var(--bk-mint);
}
.bk-sup-queued .ring i {
	width: 7px; height: 7px; border-radius: 50%; background: var(--bk-deep);
	animation: bk-sup-live 1.8s ease-in-out infinite;
}

.bk-sup-sys {
	align-self: center; text-align: center; max-width: 92%;
	font-size: 12px; color: var(--bk-mute); padding: 3px 0;
}

.bk-sup-typing { display: flex; gap: 4px; align-items: flex-end; height: 15px; padding-left: 8px; }
.bk-sup-typing i {
	width: 6px; height: 6px; border-radius: 50%; background: var(--bk-deep); opacity: .5;
	animation: bk-sup-bounce 1.05s infinite ease-in-out both;
}
.bk-sup-typing i:nth-child(2) { animation-delay: .14s; }
.bk-sup-typing i:nth-child(3) { animation-delay: .28s; }
@keyframes bk-sup-bounce {
	0%, 70%, 100% { transform: translateY(0); opacity: .4; }
	35% { transform: translateY(-6px); opacity: 1; }
}

/* composer */
.bk-sup-foot { padding: 11px 14px 13px; border-top: 1px solid var(--bk-line); background: #fff; }
.bk-sup-row {
	display: flex; gap: 8px; align-items: flex-end;
	border: 1px solid rgba(13,27,30,.18); border-radius: 14px;
	padding: 5px 5px 5px 12px; background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.bk-sup-row:focus-within { border-color: var(--bk-deep); box-shadow: 0 0 0 3px rgba(15,76,74,.13); }
.bk-sup-row textarea {
	flex: 1; min-height: 32px; max-height: 118px; resize: none;
	padding: 7px 0; font: inherit; border: 0; outline: none;
	background: none; color: var(--bk-ink);
}
.bk-sup-send {
	flex: none; width: 36px; height: 36px; border: 0; border-radius: 11px;
	background: var(--bk-deep); color: #fff; cursor: pointer;
	display: grid; place-items: center;
	transition: background .15s ease, opacity .15s ease, transform .15s ease;
}
.bk-sup-send:hover { background: var(--bk-deep-2); }
.bk-sup-send:disabled { opacity: .35; cursor: default; }
.bk-sup-send:not(:disabled):active { transform: scale(.94); }
.bk-sup-send:focus-visible { outline: 2px solid var(--bk-deep); outline-offset: 2px; }


@media (max-width: 520px) {
	.bk-sup { right: 8px; bottom: 8px; height: calc(100vh - 16px); border-radius: 16px; }
	.bk-sup-launch { right: 16px; bottom: 16px; }
}

/* Everything above still works with the motion removed — the pill snaps to a
   circle instead of folding, and nothing slides in. */
@media (prefers-reduced-motion: reduce) {
	.bk-sup-launch,
	.bk-sup-launch .lab,
	.bk-sup,
	.bk-sup-chip,
	.bk-sup-send,
	.bk-sup-row,
	.bk-sup-src a { transition: none; }
	.bk-sup-launch.is-ping { animation: none; }
	.bk-sup-msg,
	.bk-sup-queued { animation: none; }
	.bk-sup-body { scroll-behavior: auto; }
	.bk-sup-id.is-live i,
	.bk-sup-queued .ring i { animation: none; }
	.bk-sup-typing i { animation: bk-sup-pulse 1.4s infinite ease-in-out both; }
	@keyframes bk-sup-pulse { 0%,100% { opacity: .3 } 50% { opacity: .9 } }
}
