/*
 * newsenses Search & Chatbot
 *
 * Styling model
 * -------------
 * Search is a header icon that opens a lightbox (native <dialog>). It inherits
 * the active theme: colors come from the theme.json palette when the theme
 * exposes it (--wp--preset--color--base / contrast / primary), fonts are
 * inherited, and the submit button carries WordPress' own `wp-element-button`
 * class so block themes style it. Form controls use :where() so any theme or
 * child-theme rule wins without needing a higher specificity.
 *
 * Override points, lowest to highest priority:
 *   1. This file
 *   2. Appearance settings (inline CSS variables on .nsb)
 *   3. Uploaded CSS file
 *   4. Theme / child-theme CSS targeting the .nsb-* classes
 *
 * Useful variables: --nsb-bg --nsb-text --nsb-accent --nsb-accent-text
 * --nsb-border --nsb-muted --nsb-radius --nsb-lightbox-width --nsb-lightbox-top
 * --nsb-backdrop --nsb-stagger --nsb-anim-duration --nsb-trigger-offset
 */

.nsb {
	--nsb-bg: #ffffff;
	--nsb-text: #1a1a1a;
	--nsb-muted: #6b7280;
	--nsb-border: #e5e7eb;
	--nsb-accent: #111827;
	--nsb-accent-text: #ffffff;
	--nsb-radius: 12px;
	--nsb-input-bg: #ffffff;
	--nsb-input-text: #1a1a1a;
	--nsb-user-bg: #111827;
	--nsb-user-text: #ffffff;
	--nsb-bot-bg: #f3f4f6;
	--nsb-bot-text: #1a1a1a;
	--nsb-error-border: #dc2626;
	--nsb-chat-max-height: 24em;

	box-sizing: border-box;
	margin: 0 0 1.5em;
	max-width: 100%;
	color: var(--nsb-text);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
}

.nsb *,
.nsb *::before,
.nsb *::after {
	box-sizing: border-box;
}

/* Core defines this in most themes, but not all. */
.nsb .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ */
/* Search: tokens that follow the theme                                */
/* ------------------------------------------------------------------ */

.nsb-search {
	--nsb-bg: var(--wp--preset--color--base, #ffffff);
	--nsb-text: var(--wp--preset--color--contrast, #1a1a1a);
	--nsb-accent: var(--wp--preset--color--primary, var(--wp--preset--color--contrast, #111827));
	--nsb-accent-text: var(--wp--preset--color--base, #ffffff);
	--nsb-border: color-mix(in srgb, var(--nsb-text) 16%, transparent);
	--nsb-muted: color-mix(in srgb, var(--nsb-text) 62%, transparent);
	--nsb-input-bg: var(--nsb-bg);
	--nsb-input-text: var(--nsb-text);

	max-width: 100%;
}

/* ------------------------------------------------------------------ */
/* Search: headings and copy                                           */
/* ------------------------------------------------------------------ */

.nsb-search__intro {
	margin: 0 0 0.85em;
}

.nsb-search__title {
	margin: 0;
	padding: 0;
	font-size: 1.35em;
	font-weight: 650;
	line-height: 1.25;
	color: var(--nsb-text);
}

.nsb-search__subtext {
	margin: 0 0 0.85em;
	color: var(--nsb-muted);
	font-size: 0.975em;
	line-height: 1.45;
	white-space: pre-wrap;
}

.nsb-search__intro .nsb-search__subtext {
	margin: 0.35em 0 0;
}

.nsb-search__intro[hidden],
.nsb-search__title[hidden],
.nsb-search__subtext[hidden] {
	display: none !important;
}

/* ------------------------------------------------------------------ */
/* Search: form. :where() keeps specificity at zero so themes win.     */
/* ------------------------------------------------------------------ */

.nsb-search__form,
.nsb-chat__form {
	display: flex;
	gap: 0.5em;
	margin: 0;
	align-items: stretch;
}

:where(.nsb-search__input) {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0.7em 0.95em;
	font: inherit;
	line-height: 1.4;
	color: var(--nsb-input-text);
	background: var(--nsb-input-bg);
	border: 1px solid var(--nsb-border);
	border-radius: var(--nsb-radius);
	box-shadow: none;
}

:where(.nsb-search__input)::placeholder {
	color: var(--nsb-muted);
	opacity: 1;
}

:where(.nsb-search__input):focus-visible {
	outline: 2px solid var(--nsb-accent);
	outline-offset: 0;
	border-color: var(--nsb-accent);
}

:where(.nsb-search__submit) {
	flex: 0 0 auto;
	margin: 0;
	padding: 0.7em 1.25em;
	font: inherit;
	line-height: 1.4;
	cursor: pointer;
	color: var(--nsb-accent-text);
	background: var(--nsb-accent);
	border: 1px solid var(--nsb-accent);
	border-radius: var(--nsb-radius);
}

:where(.nsb-search__submit):hover {
	filter: brightness(1.1);
}

:where(.nsb-search__submit):focus-visible {
	outline: 2px solid var(--nsb-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Search: results                                                     */
/* ------------------------------------------------------------------ */

.nsb-search__status {
	margin: 0.85em 0 0;
	color: var(--nsb-muted);
	font-size: 0.875em;
}

.nsb-search__status:empty,
.nsb-search__results:empty {
	display: none;
}

.nsb-search__results {
	list-style: none;
	margin: 0.4em 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.nsb-result {
	position: relative;
	margin: 0;
	padding: 0.95em 0.75em;
	min-width: 0;
	border-bottom: 1px solid var(--nsb-border);
	transition: background-color 0.15s ease;
}

.nsb-result:last-child {
	border-bottom-color: transparent;
}

.nsb-result:hover {
	background: color-mix(in srgb, var(--nsb-text) 5%, transparent);
}

.nsb-result:has(a:focus-visible) {
	outline: 2px solid var(--nsb-accent);
	outline-offset: -2px;
}

.nsb-result__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4em 0.65em;
	margin: 0 0 0.3em;
}

.nsb-result__crumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--nsb-muted);
	font-size: 0.78em;
	line-height: 1.35;
	min-width: 0;
}

.nsb-result__crumb li {
	display: inline-flex;
	align-items: center;
	max-width: 11em;
	margin: 0;
	padding: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nsb-result__crumb li:not(:last-child)::after {
	content: "/";
	margin: 0 0.4em;
	opacity: 0.55;
	flex-shrink: 0;
}

.nsb-result__category {
	display: inline-flex;
	align-items: center;
	padding: 0.12em 0.55em;
	border-radius: 999px;
	border: 1px solid var(--nsb-border);
	color: var(--nsb-accent);
	font-size: 0.68em;
	font-weight: 650;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.4;
}

.nsb-result__title {
	margin: 0 0 0.25em;
	padding: 0;
	font-size: 1.1em;
	font-weight: 600;
	line-height: 1.3;
	color: var(--nsb-text);
}

.nsb-result__title a {
	color: inherit;
	text-decoration: none;
}

.nsb-result__title a:hover {
	text-decoration: underline;
}

/* Make the whole row clickable. */
.nsb-result__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.nsb-result__title a:focus {
	outline: none;
	text-decoration: underline;
}

.nsb-result__snippet {
	margin: 0;
	color: color-mix(in srgb, var(--nsb-text) 78%, transparent);
	font-size: 0.9375em;
	line-height: 1.45;
}

.nsb-search--hide-crumbs .nsb-result__crumb,
.nsb-search--hide-category .nsb-result__category,
.nsb-search--hide-snippet .nsb-result__snippet {
	display: none !important;
}

.nsb-search--hide-crumbs.nsb-search--hide-category .nsb-result__meta {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Search: staggered result animation (toggle: .nsb-search--anim)      */
/* ------------------------------------------------------------------ */

@keyframes nsb-in-rise {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes nsb-in-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes nsb-in-slide {
	from {
		opacity: 0;
		transform: translateX(-18px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes nsb-in-scale {
	from {
		opacity: 0;
		transform: scale(0.94);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.nsb-search--anim .nsb-result {
	animation-name: nsb-in-rise;
	animation-duration: var(--nsb-anim-duration, 0.5s);
	animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
	animation-fill-mode: both;
	animation-delay: calc(var(--nsb-i, 0) * var(--nsb-stagger, 60ms));
}

.nsb-search--anim-fade .nsb-result {
	animation-name: nsb-in-fade;
}

.nsb-search--anim-slide .nsb-result {
	animation-name: nsb-in-slide;
}

.nsb-search--anim-scale .nsb-result {
	animation-name: nsb-in-scale;
}

/* Used by the admin preview to re-render without replaying the animation. */
.nsb-search--no-replay .nsb-result {
	animation: none;
}

/* ------------------------------------------------------------------ */
/* Search: header icon                                                 */
/* ------------------------------------------------------------------ */

.nsb-search--lightbox {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	width: auto;
	max-width: none;
	margin: 0;
	color: inherit;
}

.nsb-search__trigger {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	font: inherit;
	line-height: 1;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	text-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.nsb-search__trigger:hover,
.nsb-search__trigger:focus-visible,
.nsb-search__trigger[aria-expanded="true"] {
	color: inherit;
	background: color-mix(in srgb, currentColor 12%, transparent);
}

.nsb-search__trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.nsb-search__trigger-icon {
	display: block;
	width: 1.4rem;
	height: 1.4rem;
}

.nsb-search__trigger-icon svg,
.nsb-search__trigger-icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Hidden until the script has moved it into the theme header. */
.nsb-search--header-mount:not([data-nsb-mounted]) {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.nsb-search--header-mount {
	position: relative;
}

.nsb-has-header-search:not(.nsb-has-header-search--positioned) {
	position: relative;
}

/* Header is not flex/grid: overlay the icon on the right edge. */
.nsb-has-header-search > .nsb-search--header-mount:not(.nsb-search--header-flow) {
	position: absolute;
	top: 50%;
	right: var(--nsb-trigger-offset, 0.85rem);
	z-index: 30;
	transform: translateY(-50%);
}

/* Header is flex/grid: sit in the flow. */
.nsb-search--header-flow {
	position: relative;
	align-self: center;
	margin: 0 0.25rem;
}

header[data-scroll-header] > .nsb-search--header-flow {
	order: 3;
}

/* No theme header found: fall back to a floating corner button. */
.nsb-search--header-mount[data-nsb-mounted="float"] {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 9990;
	color: var(--nsb-text);
	background: var(--nsb-bg);
	border: 1px solid var(--nsb-border);
	border-radius: 999px;
	box-shadow: 0 4px 16px rgba(15, 23, 42, 0.14);
}

/* ------------------------------------------------------------------ */
/* Search: lightbox                                                    */
/* ------------------------------------------------------------------ */

@keyframes nsb-lightbox-in {
	from {
		opacity: 0;
		transform: translateY(-12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes nsb-backdrop-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.nsb-lightbox {
	position: fixed;
	inset: 0;
	width: min(var(--nsb-lightbox-width, 40rem), calc(100vw - 2rem));
	max-width: none;
	height: -moz-fit-content;
	height: fit-content;
	max-height: calc(100vh - 2 * var(--nsb-lightbox-top, 8vh));
	max-height: calc(100dvh - 2 * var(--nsb-lightbox-top, 8vh));
	margin: var(--nsb-lightbox-top, 8vh) auto auto;
	padding: 0;
	overflow: hidden;
	font: inherit;
	line-height: 1.5;
	color: var(--nsb-text);
	background: var(--nsb-bg);
	border: 1px solid var(--nsb-border);
	border-radius: calc(var(--nsb-radius) + 4px);
	box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.nsb-lightbox[open] {
	animation: nsb-lightbox-in 0.22s ease-out;
}

.nsb-lightbox::backdrop {
	background: var(--nsb-backdrop, rgba(15, 23, 42, 0.55));
}

.nsb-lightbox[open]::backdrop {
	animation: nsb-backdrop-in 0.22s ease-out;
}

/* Browsers without <dialog>.showModal(): fake the backdrop. */
.nsb-lightbox.is-fallback {
	z-index: 99999;
	box-shadow: 0 0 0 100vmax rgba(15, 23, 42, 0.55);
}

html.nsb-lightbox-open {
	overflow: hidden;
}

.nsb-lightbox__inner {
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 2 * var(--nsb-lightbox-top, 8vh));
	max-height: calc(100dvh - 2 * var(--nsb-lightbox-top, 8vh));
	padding: 1.1rem 1.5rem 1.5rem;
}

.nsb-lightbox__head {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 0.75rem;
	min-height: 2.5rem;
	margin: 0 -0.5rem 0.65rem 0;
}

.nsb-lightbox__head .nsb-search__title {
	flex: 1 1 auto;
	min-width: 0;
}

.nsb-lightbox__close {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 2.5rem;
	height: 2.5rem;
	margin: 0 0 0 auto;
	padding: 0;
	color: var(--nsb-muted);
	background: transparent;
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.nsb-lightbox__close:hover,
.nsb-lightbox__close:focus-visible {
	color: var(--nsb-text);
	background: color-mix(in srgb, var(--nsb-text) 8%, transparent);
}

.nsb-lightbox__close:focus-visible {
	outline: 2px solid var(--nsb-accent);
	outline-offset: 1px;
}

.nsb-lightbox__close svg {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
}

.nsb-lightbox .nsb-search__panel {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.nsb-lightbox .nsb-search__form,
.nsb-lightbox .nsb-search__subtext,
.nsb-lightbox .nsb-search__status {
	flex: 0 0 auto;
}

.nsb-lightbox .nsb-search__results {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	margin-right: -0.5rem;
	padding-right: 0.5rem;
}

/* Admin preview: render the lightbox in flow instead of as a modal. */
.nsb-search--preview {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.nsb-search--preview .nsb-lightbox {
	position: relative;
	inset: auto;
	margin: 0.75rem 0 0;
	width: min(var(--nsb-lightbox-width, 40rem), 100%);
	max-height: none;
	animation: none;
	box-shadow: 0 8px 30px rgba(15, 23, 42, 0.14);
}

.nsb-search--preview .nsb-lightbox__inner {
	max-height: none;
}

.nsb-search--preview .nsb-lightbox:not([open]) {
	display: none;
}

@media (max-width: 640px) {
	.nsb-lightbox {
		width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		margin: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	.nsb-lightbox__inner {
		height: 100%;
		max-height: none;
		padding: 0.85rem 1rem max(1rem, env(safe-area-inset-bottom));
	}

	/* 16px stops iOS from zooming the page on focus. */
	.nsb-search__input {
		font-size: 16px;
	}

	.nsb-search--preview .nsb-lightbox {
		height: auto;
	}

	.nsb-search--preview .nsb-lightbox__inner {
		height: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nsb-search--anim .nsb-result,
	.nsb-lightbox[open],
	.nsb-lightbox[open]::backdrop {
		animation: none;
	}

	.nsb-search__trigger,
	.nsb-lightbox__close,
	.nsb-result {
		transition: none;
	}
}

/* ------------------------------------------------------------------ */
/* Chat form controls                                                  */
/* ------------------------------------------------------------------ */

.nsb input[type="text"].nsb-chat__input,
.nsb button[type="submit"].nsb-chat__submit {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	font: inherit;
	line-height: 1.4;
	border-radius: var(--nsb-radius);
	height: auto;
	min-height: 0;
	box-shadow: none;
	text-shadow: none;
}

.nsb input[type="text"].nsb-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.65em 0.9em;
	color: var(--nsb-input-text);
	background: var(--nsb-input-bg);
	border: 1px solid var(--nsb-border);
}

.nsb input[type="text"].nsb-chat__input::placeholder {
	color: var(--nsb-muted);
	opacity: 1;
}

.nsb input[type="text"].nsb-chat__input:focus {
	outline: 2px solid var(--nsb-accent);
	outline-offset: 1px;
	border-color: var(--nsb-accent);
	box-shadow: none;
}

.nsb button[type="submit"].nsb-chat__submit {
	flex: 0 0 auto;
	padding: 0.65em 1.1em;
	color: var(--nsb-accent-text);
	background: var(--nsb-accent);
	border: 1px solid var(--nsb-accent);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4em;
}

.nsb button[type="submit"].nsb-chat__submit:hover {
	filter: brightness(1.08);
	color: var(--nsb-accent-text);
	background: var(--nsb-accent);
}

/* ------------------------------------------------------------------ */
/* Chat                                                                */
/* ------------------------------------------------------------------ */

.nsb-chat {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	max-height: 100%;
	min-height: var(--nsb-chat-max-height);
	margin: 0;
	background: var(--nsb-bg);
	border: 1px solid var(--nsb-border);
	border-radius: var(--nsb-radius);
	padding: 0.85em;
}

.nsb-chat__panel {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.nsb-chat__header {
	display: flex;
	align-items: center;
	gap: 0.6em;
	flex-shrink: 0;
	margin: 0 0 0.65em;
	padding: 0 0.15em 0.65em;
	border-bottom: 1px solid var(--nsb-border);
	min-height: 2.1em;
}

.nsb-chat__header[hidden] {
	display: none !important;
}

.nsb-chat__avatar,
.nsb-chat__bubble-avatar {
	width: 2em;
	height: 2em;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: var(--nsb-bot-bg);
}

.nsb-chat__bubble-avatar {
	width: 1.6em;
	height: 1.6em;
}

.nsb-chat__avatar[hidden],
.nsb-chat__name[hidden],
.nsb-chat__close[hidden] {
	display: none !important;
}

.nsb-chat__name {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: 600;
	font-size: 0.95em;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nsb-chat__close {
	flex: 0 0 auto;
	margin-left: auto;
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--nsb-muted);
	cursor: pointer;
	padding: 0.2em;
	line-height: 1;
	font-size: 1.25em;
	border-radius: 4px;
}

.nsb-chat__close:hover {
	color: var(--nsb-text);
	background: var(--nsb-bot-bg);
}

.nsb-chat__log {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.5em;
	min-height: 0;
	overflow-y: auto;
	padding: 0.25em 0.15em 0.75em;
	margin: 0 0 0.75em;
	background: transparent;
	border: 0;
}

.nsb-chat__form {
	flex-shrink: 0;
}

.nsb-chat__row {
	display: flex;
	align-items: flex-end;
	gap: 0.4em;
	max-width: 85%;
}

.nsb-chat__row--bot {
	align-self: flex-start;
}

.nsb-chat__row--user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

/* Fill Elementor / wrapper boxes that set an explicit height on the parent. */
.elementor-widget-container:has(.nsb-chat:not(.nsb-chat--floating)),
.elementor-shortcode:has(.nsb-chat:not(.nsb-chat--floating)) {
	height: 100%;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.elementor-widget-container:has(.nsb-chat:not(.nsb-chat--floating)) .nsb-chat,
.elementor-shortcode:has(.nsb-chat:not(.nsb-chat--floating)) .nsb-chat {
	flex: 1 1 auto;
	min-height: 0;
}

.nsb-chat__message {
	max-width: 100%;
	padding: 0.55em 0.85em;
	border-radius: var(--nsb-radius);
	border: 1px solid transparent;
	white-space: pre-wrap;
	overflow-wrap: break-word;
}

.nsb-chat__message--user {
	align-self: flex-end;
	color: var(--nsb-user-text);
	background: var(--nsb-user-bg);
}

.nsb-chat__message--bot {
	align-self: flex-start;
	color: var(--nsb-bot-text);
	background: var(--nsb-bot-bg);
}

.nsb-chat__sources {
	margin-top: 0.55em;
	padding-top: 0.45em;
	border-top: 1px solid var(--nsb-border);
}

.nsb-chat__sources-label {
	margin: 0 0 0.25em;
	color: var(--nsb-muted);
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.nsb-chat__sources ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nsb-chat__sources a {
	color: var(--nsb-accent);
	font-size: 0.8125em;
	overflow-wrap: anywhere;
}

.nsb-chat__message.is-pending {
	opacity: 0.6;
}

.nsb-chat__message.is-error {
	border-color: var(--nsb-error-border);
	border-style: solid;
}

.nsb.is-loading .nsb-search__submit,
.nsb.is-loading .nsb-chat__submit {
	opacity: 0.6;
	pointer-events: none;
}

.nsb-chat__launcher {
	appearance: none;
	-webkit-appearance: none;
	width: 3.5em;
	height: 3.5em;
	border-radius: 50%;
	border: 0;
	padding: 0;
	background: var(--nsb-accent);
	color: var(--nsb-accent-text);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(17, 24, 39, 0.2);
	flex-shrink: 0;
}

.nsb-chat__launcher[hidden] {
	display: none !important;
}

.nsb-chat__launcher img,
.nsb-chat__launcher svg {
	width: 1.55em;
	height: 1.55em;
	object-fit: contain;
}

.nsb-chat__launcher--html {
	width: auto;
	height: auto;
	min-width: 3.5em;
	min-height: 3.5em;
	border-radius: var(--nsb-radius);
	overflow: hidden;
	background: transparent;
	box-shadow: none;
	color: inherit;
}

.nsb-chat__launcher--html img,
.nsb-chat__launcher--html svg {
	width: auto;
	height: auto;
	max-width: 4.5em;
	max-height: 4.5em;
}

.nsb-chat--launcher {
	background: transparent;
	border: 0;
	padding: 0;
	min-height: 0;
	align-items: flex-end;
}

.nsb-chat--launcher .nsb-chat__panel {
	background: var(--nsb-bg);
	border: 1px solid var(--nsb-border);
	border-radius: var(--nsb-radius);
	padding: 0.85em;
	min-height: var(--nsb-chat-max-height);
	width: 100%;
	margin-bottom: 0.65em;
}

.nsb-chat--launcher:not(.is-open) .nsb-chat__panel {
	display: none;
}

.nsb-chat--launcher.is-open .nsb-chat__launcher {
	display: none !important;
}

.nsb-chat--floating {
	position: fixed;
	z-index: 99999;
	width: 22em;
	max-width: calc(100vw - 2em);
	margin: 0;
	height: auto;
	max-height: calc(100vh - 2em);
}

.nsb-chat--floating.nsb-chat--launcher:not(.is-open) {
	width: auto;
	background: transparent;
	border: 0;
}

.nsb-chat--pos-bottom-right {
	right: 1.25em;
	bottom: 1.25em;
}

.nsb-chat--pos-bottom-left {
	left: 1.25em;
	bottom: 1.25em;
}

.nsb-chat--pos-bottom-center {
	left: 50%;
	bottom: 1.25em;
	transform: translateX(-50%);
}

.nsb-chat--floating:not(.nsb-chat--launcher) {
	min-height: 0;
	height: min(32em, calc(100vh - 2.5em));
}

@keyframes nsb-pulse {
	0%,
	100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.08);
	}
}

@keyframes nsb-bounce {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-8px);
	}
}

@keyframes nsb-wiggle {
	0%,
	100% {
		transform: rotate(0);
	}
	25% {
		transform: rotate(-8deg);
	}
	75% {
		transform: rotate(8deg);
	}
}

@keyframes nsb-ring {
	0% {
		box-shadow: 0 0 0 0 rgba(17, 24, 39, 0.35);
	}
	70% {
		box-shadow: 0 0 0 14px rgba(17, 24, 39, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(17, 24, 39, 0);
	}
}

@keyframes nsb-ping {
	0% {
		transform: scale(1);
		opacity: 1;
	}
	80% {
		transform: scale(1.2);
		opacity: 0;
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

@keyframes nsb-float {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-6px);
	}
}

@keyframes nsb-sparkle {
	0%,
	100% {
		filter: brightness(1);
	}
	50% {
		filter: brightness(1.35);
	}
}

.nsb-chat__launcher--pulse {
	animation: nsb-pulse 2s ease-in-out infinite;
}

.nsb-chat__launcher--bounce {
	animation: nsb-bounce 1.4s ease-in-out infinite;
}

.nsb-chat__launcher--wiggle {
	animation: nsb-wiggle 1.6s ease-in-out infinite;
}

.nsb-chat__launcher--ring {
	animation: nsb-ring 1.8s ease-out infinite;
}

.nsb-chat__launcher--ping {
	animation: nsb-ping 1.6s ease-out infinite;
}

.nsb-chat__launcher--float {
	animation: nsb-float 2.4s ease-in-out infinite;
}

.nsb-chat__launcher--sparkle {
	animation: nsb-sparkle 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
	.nsb-chat__launcher {
		animation: none !important;
	}
}
