.adv-chatbot {
	--adv-chatbot-accent: #c700a5;
	--adv-chatbot-offset-x: 20px;
	--adv-chatbot-offset-y: 20px;
	--adv-chatbot-launcher-size: 64px;
	--adv-chatbot-mobile-offset-x: 20px;
	--adv-chatbot-mobile-offset-y: 20px;
	--adv-chatbot-mobile-launcher-size: 44px;
	position: fixed;
	right: max(var(--adv-chatbot-offset-x), env(safe-area-inset-right));
	bottom: max(var(--adv-chatbot-offset-y), env(safe-area-inset-bottom));
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
}

/* Keep page-builder and theme button/heading rules out of the widget. */
.adv-chatbot,
.adv-chatbot * { box-sizing: border-box; }

.adv-chatbot--left {
	right: auto;
	left: max(var(--adv-chatbot-offset-x), env(safe-area-inset-left));
}

.adv-chatbot .adv-chatbot__panel {
	width: 300px;
	max-width: calc(100vw - 32px);
	max-height: min(520px, calc(100dvh - 100px));
	margin: 0 0 12px auto;
	overflow: hidden;
	color: #1f2937;
	background: #fff;
	border: 0;
	border-radius: 16px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
	transform-origin: bottom right;
	animation: adv-chatbot-open 160ms ease-out;
}

.adv-chatbot--left .adv-chatbot__panel {
	margin-right: auto;
	margin-left: 0;
	transform-origin: bottom left;
}

.adv-chatbot__panel[hidden] { display: none; }

.adv-chatbot .adv-chatbot__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	color: #fff;
	background: var(--adv-chatbot-accent);
}

.adv-chatbot__identity {
	display: flex;
	min-width: 0;
	align-items: center;
	gap: 10px;
}

.adv-chatbot__avatar {
	display: block;
	width: 44px;
	height: 44px;
	flex: 0 0 44px;
	object-fit: cover;
	border: 0;
	border-radius: 50%;
}

.adv-chatbot .adv-chatbot__title {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
}

.adv-chatbot .adv-chatbot__agent {
	margin: 2px 0 0;
	padding: 0;
	color: inherit;
	font-family: inherit;
	font-size: 12px;
	font-stretch: normal;
	font-style: normal;
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	opacity: 0.9;
}

.adv-chatbot .adv-chatbot__close {
	display: grid;
	width: 32px;
	height: 32px;
	margin: -8px -8px -8px 8px;
	padding: 0;
	place-items: center;
	color: #fff;
	font: inherit;
	font-size: 16px;
	background: none;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	appearance: none;
	cursor: pointer;
}

.adv-chatbot .adv-chatbot__body {
	max-height: calc(min(520px, 100dvh - 100px) - 60px);
	padding: 14px;
	overflow-y: auto;
}

.adv-chatbot__greeting {
	margin: 0 0 10px;
}

.adv-chatbot__greeting:empty { display: none; }

.adv-chatbot__questions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.adv-chatbot .adv-chatbot__question {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	color: #1f2937;
	font: inherit;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.35;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	background: #f4f4f7;
	border: 1px solid #e2e4e9;
	border-radius: 10px;
	box-shadow: none;
	appearance: none;
	cursor: pointer;
}

.adv-chatbot .adv-chatbot__question:hover,
.adv-chatbot .adv-chatbot__question:focus {
	color: #1f2937;
	background: #f4f4f7;
	border-color: #d5d8df;
}

.adv-chatbot__arrow {
	margin-left: 8px;
	color: var(--adv-chatbot-accent);
	font-size: 17px;
	font-weight: 700;
}

.adv-chatbot__search,
.adv-chatbot__ticket,
.adv-chatbot__contact {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
}

.adv-chatbot__search { margin-top: 14px; }

.adv-chatbot__visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.adv-chatbot__message { min-height: 90px; resize: vertical; border-radius: 12px; }

.adv-chatbot__label {
	font-size: 13px;
	font-weight: 600;
}

.adv-chatbot .adv-chatbot__input {
	width: 100%;
	box-sizing: border-box;
	padding: 9px 14px;
	color: #1f2937;
	font: inherit;
	font-size: 13px;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	box-shadow: none;
	appearance: none;
}

.adv-chatbot__actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.adv-chatbot .adv-chatbot__primary,
.adv-chatbot .adv-chatbot__secondary {
	min-height: 38px;
	padding: 7px 13px;
	font: inherit;
	font-weight: 600;
	border-radius: 20px;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	appearance: none;
	cursor: pointer;
}

.adv-chatbot__primary {
	color: #fff;
	background: var(--adv-chatbot-accent);
	border: 1px solid var(--adv-chatbot-accent);
}

.adv-chatbot__secondary {
	color: #374151;
	background: #fff;
	border: 1px solid #d1d5db;
}

.adv-chatbot__answer { margin: 0 0 12px; white-space: pre-line; }
.adv-chatbot__status { min-height: 0; margin-top: 8px; font-size: 13px; }
.adv-chatbot__status:empty { display: none; }
.adv-chatbot__primary:disabled { cursor: wait; opacity: 0.65; }

.adv-chatbot .adv-chatbot__launcher {
	display: flex;
	width: var(--adv-chatbot-launcher-size);
	height: var(--adv-chatbot-launcher-size);
	min-width: var(--adv-chatbot-launcher-size);
	min-height: var(--adv-chatbot-launcher-size);
	max-width: var(--adv-chatbot-launcher-size);
	max-height: var(--adv-chatbot-launcher-size);
	align-items: center;
	justify-content: center;
	margin-left: auto;
	padding: 0;
	overflow: hidden;
	color: #fff;
	background: var(--adv-chatbot-accent);
	border: 0;
	border-radius: 50% !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	appearance: none;
	cursor: pointer;
}

.adv-chatbot--left .adv-chatbot__launcher { margin-right: auto; margin-left: 0; }
.adv-chatbot .adv-chatbot__launcher svg { display: block; width: 62.5%; height: 62.5%; margin: 0; overflow: visible; fill: currentcolor; }
.adv-chatbot button:focus-visible, .adv-chatbot input:focus-visible { outline: 3px solid color-mix(in srgb, var(--adv-chatbot-accent) 35%, white); outline-offset: 2px; }

@keyframes adv-chatbot-open {
	from { opacity: 0; transform: translateY(6px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.adv-chatbot__panel { animation: none; }
}

/* Match Elementor's standard mobile breakpoint. */
@media (max-width: 767px) {
	.adv-chatbot {
		--adv-chatbot-offset-x: var(--adv-chatbot-mobile-offset-x);
		--adv-chatbot-offset-y: var(--adv-chatbot-mobile-offset-y);
		--adv-chatbot-launcher-size: var(--adv-chatbot-mobile-launcher-size);
	}
}

.admin-bar .adv-chatbot__panel { max-height: min(520px, calc(100dvh - 132px)); }
