/**
 * MxChat Theme Options – frontend rules.
 *
 * Every value comes from the --mxct-* variables printed inline after this
 * file (see MXCT_Frontend::build_css()). The admin preview loads this same
 * file inside its iframe, so what you see there is what visitors get.
 *
 * !important is used only where MxChat writes inline style="" attributes
 * (colors on the header, bubbles, launcher, input, send icon) or uses
 * !important itself — nothing else can override those.
 */

/* ---------- Chat window ---------- */
.floating-chatbot {
	border-radius: var(--mxct-radius);
	box-shadow: var(--mxct-window-shadow);
	z-index: var(--mxct-z);
	transition-duration: var(--mxct-anim-speed);
	transform-origin: var(--mxct-origin);
}

.floating-chatbot:not(.visible) {
	transform: var(--mxct-anim-from);
}

.mxchat-chatbot-wrapper,
.floating-chatbot .mxchat-chatbot-wrapper {
	border-radius: var(--mxct-radius);
}

.mxchat-chatbot-wrapper .chatbot-top-bar {
	border-top-left-radius: var(--mxct-radius);
	border-top-right-radius: var(--mxct-radius);
}

/* ---------- Chat button (launcher) ---------- */
.floating-chatbot-button {
	box-sizing: border-box;
	width: var(--mxct-launcher-size);
	height: var(--mxct-launcher-size);
	background: var(--mxct-launcher-bg) !important;
	color: var(--mxct-launcher-icon) !important;
	border: var(--mxct-launcher-border);
	border-radius: var(--mxct-launcher-radius);
	box-shadow: var(--mxct-launcher-shadow) !important;
	z-index: var(--mxct-z);
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
}

.floating-chatbot-button:hover,
.floating-chatbot-button:focus-visible {
	transform: var(--mxct-launcher-hover);
	box-shadow: var(--mxct-launcher-hover-shadow) !important;
}

.floating-chatbot-button > svg,
.floating-chatbot-button > img {
	display: var(--mxct-orig-icon-display) !important;
	width: var(--mxct-launcher-icon-size) !important;
	height: var(--mxct-launcher-icon-size) !important;
	transition: transform 0.25s ease;
}

.floating-chatbot-button > svg {
	fill: var(--mxct-launcher-icon) !important;
}

.floating-chatbot-button::before {
	content: "";
	display: var(--mxct-glyph-display);
	flex: 0 0 auto;
	width: var(--mxct-launcher-icon-size);
	height: var(--mxct-launcher-icon-size);
	background-color: var(--mxct-glyph-color);
	background-image: var(--mxct-glyph-image);
	background-position: center;
	background-size: contain;
	background-repeat: no-repeat;
	-webkit-mask: var(--mxct-glyph-mask) center / contain no-repeat;
	mask: var(--mxct-glyph-mask) center / contain no-repeat;
	pointer-events: none;
	transition: transform 0.25s ease;
}

.floating-chatbot-button:hover::before,
.floating-chatbot-button:hover > svg,
.floating-chatbot-button:hover > img {
	transform: var(--mxct-icon-hover);
}

.floating-chatbot-button::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	animation: var(--mxct-pulse);
}

@keyframes mxct-pulse {
	0% {
		box-shadow: 0 0 0 0 var(--mxct-pulse-color);
	}
	70% {
		box-shadow: 0 0 0 18px rgba(0, 0, 0, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
	}
}

/* ---------- Greeting = MxChat's "Chat Teaser Pop-up" ----------
 * frontend.js tags MxChat's #pre-chat-message-{bot} with .mxct-teaser and
 * data-mxct-style / -pos / -anim / -corner. MxChat still shows and hides it.
 * --mxct-tb / -ts / -tz = chat button bottom, side offset and size. */
.pre-chat-message.mxct-teaser {
	--mxct-tb: var(--mxct-offset-y);
	--mxct-ts: var(--mxct-offset-x);
	--mxct-tz: var(--mxct-launcher-size);
	box-sizing: border-box;
	top: auto;
	width: max-content;
	max-width: min(var(--mxct-tip-width), calc(100vw - 24px));
	margin: 0;
	padding: 10px 14px;
	border: 0;
	border-radius: 14px;
	background: var(--mxct-tip-bg);
	color: var(--mxct-tip-text);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
	font-size: var(--mxct-tip-size);
	line-height: 1.45;
	text-align: start;
	z-index: var(--mxct-z);
	transform-origin: bottom right;
}

.pre-chat-message.mxct-teaser[data-mxct-corner="right"] {
	left: auto;
	right: var(--mxct-ts);
}

.pre-chat-message.mxct-teaser[data-mxct-corner="left"] {
	right: auto;
	left: var(--mxct-ts);
	transform-origin: bottom left;
}

.pre-chat-message.mxct-teaser .mxct-tip-title {
	display: block;
	margin-bottom: 2px;
	font-size: 1.08em;
	font-weight: 700;
}

.pre-chat-message.mxct-teaser .mxct-tip-text {
	display: block;
}

/* Position */
.pre-chat-message.mxct-teaser[data-mxct-pos="above"] {
	bottom: calc(var(--mxct-tb) + var(--mxct-tz) + 14px);
}

.pre-chat-message.mxct-teaser[data-mxct-pos="side"] {
	bottom: calc(var(--mxct-tb) + var(--mxct-tz) / 2);
	translate: 0 50%;
	max-width: min(var(--mxct-tip-width), calc(100vw - var(--mxct-ts) - var(--mxct-tz) - 32px));
}

.pre-chat-message.mxct-teaser[data-mxct-pos="side"][data-mxct-corner="right"] {
	right: calc(var(--mxct-ts) + var(--mxct-tz) + 14px);
	transform-origin: center right;
}

.pre-chat-message.mxct-teaser[data-mxct-pos="side"][data-mxct-corner="left"] {
	left: calc(var(--mxct-ts) + var(--mxct-tz) + 14px);
	transform-origin: center left;
}

.pre-chat-message.mxct-teaser[data-mxct-pos="corner"] {
	bottom: calc(var(--mxct-tb) + var(--mxct-tz) - 6px);
	max-width: min(var(--mxct-tip-width), calc(100vw - var(--mxct-ts) - var(--mxct-tz) - 24px));
}

.pre-chat-message.mxct-teaser[data-mxct-pos="corner"][data-mxct-corner="right"] {
	right: calc(var(--mxct-ts) + var(--mxct-tz) - 6px);
	border-bottom-right-radius: 4px;
}

.pre-chat-message.mxct-teaser[data-mxct-pos="corner"][data-mxct-corner="left"] {
	left: calc(var(--mxct-ts) + var(--mxct-tz) - 6px);
	border-bottom-left-radius: 4px;
}

/* Style */
.pre-chat-message.mxct-teaser[data-mxct-style="classic"] {
	padding: 10px;
	border-radius: 5px;
	box-shadow: 0 0 10px rgba(150, 150, 150, 0.3);
}

.pre-chat-message.mxct-teaser[data-mxct-style="bubble"],
.pre-chat-message.mxct-teaser[data-mxct-style="brand"] {
	border-radius: 16px;
}

.pre-chat-message.mxct-teaser[data-mxct-style="pill"] {
	padding: 10px 18px;
	border-radius: 24px;
}

.pre-chat-message.mxct-teaser[data-mxct-style="card"] {
	padding: 14px 16px;
	border-top: 3px solid var(--mxct-accent);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.pre-chat-message.mxct-teaser[data-mxct-style="dark"] {
	border-radius: 12px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.pre-chat-message.mxct-teaser[data-mxct-style="outline"] {
	border: 2px solid var(--mxct-accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pre-chat-message.mxct-teaser[data-mxct-style="glass"] {
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 16px;
	-webkit-backdrop-filter: blur(14px) saturate(1.5);
	backdrop-filter: blur(14px) saturate(1.5);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

/* Speech tail pointing at the chat button */
.pre-chat-message.mxct-teaser:is([data-mxct-style="bubble"], [data-mxct-style="brand"], [data-mxct-style="dark"]):not([data-mxct-pos="corner"])::before {
	content: "";
	position: absolute;
	width: 12px;
	height: 12px;
	background: inherit;
	transform: rotate(45deg);
	pointer-events: none;
}

.pre-chat-message.mxct-teaser[data-mxct-pos="above"]::before {
	bottom: -5px;
}

.pre-chat-message.mxct-teaser[data-mxct-pos="above"][data-mxct-corner="right"]::before {
	right: calc(var(--mxct-tz) / 2 - 6px);
}

.pre-chat-message.mxct-teaser[data-mxct-pos="above"][data-mxct-corner="left"]::before {
	left: calc(var(--mxct-tz) / 2 - 6px);
}

.pre-chat-message.mxct-teaser[data-mxct-pos="side"]::before {
	top: calc(50% - 6px);
}

.pre-chat-message.mxct-teaser[data-mxct-pos="side"][data-mxct-corner="right"]::before {
	right: -5px;
}

.pre-chat-message.mxct-teaser[data-mxct-pos="side"][data-mxct-corner="left"]::before {
	left: -5px;
}

/* Close (×) button */
.pre-chat-message.mxct-teaser .close-pre-chat-message {
	display: var(--mxct-tip-close);
	z-index: 1;
}

.pre-chat-message.mxct-teaser:not([data-mxct-style="classic"]) .close-pre-chat-message {
	top: -8px;
	right: -8px;
	width: 22px;
	height: 22px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: var(--mxct-tip-bg);
	color: var(--mxct-tip-text);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
	font-size: 15px;
}

/* Timing modes (classes set by frontend.js) */
.pre-chat-message.mxct-teaser.mxct-wait,
.pre-chat-message.mxct-teaser.mxct-gone,
.pre-chat-message.mxct-teaser.mxct-chat-open,
.pre-chat-message.mxct-teaser.mxct-hover-only:not(.mxct-hover) {
	display: none !important;
}

.pre-chat-message.mxct-teaser.mxct-out:not(.mxct-hover) {
	opacity: 0 !important;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* Entrance animation (runs each time the pop-up becomes visible) */
.pre-chat-message.mxct-teaser[data-mxct-anim="fade"] {
	animation: mxct-tip-fade 0.35s ease both;
}

.pre-chat-message.mxct-teaser[data-mxct-anim="slide"] {
	animation: mxct-tip-slide 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.pre-chat-message.mxct-teaser[data-mxct-anim="pop"] {
	animation: mxct-tip-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.pre-chat-message.mxct-teaser[data-mxct-anim="bounce"] {
	animation: mxct-tip-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both, mxct-tip-bob 2.6s ease-in-out 0.6s infinite;
}

@keyframes mxct-tip-fade {
	from {
		opacity: 0;
	}
}

@keyframes mxct-tip-slide {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
}

@keyframes mxct-tip-pop {
	from {
		opacity: 0;
		transform: scale(0.6);
	}
}

@keyframes mxct-tip-bob {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-6px);
	}
}

/* ---------- Position & size (desktop / tablet) ---------- */
@media (min-width: 551px) {
	.floating-chatbot {
		width: var(--mxct-width);
		height: min(var(--mxct-height), calc(100vh - var(--mxct-offset-y) * 2));
		height: min(var(--mxct-height), calc(100dvh - var(--mxct-offset-y) * 2));
		max-height: calc(100vh - var(--mxct-offset-y) * 2);
		max-height: calc(100dvh - var(--mxct-offset-y) * 2);
		bottom: var(--mxct-offset-y);
		left: var(--mxct-side-left);
		right: var(--mxct-side-right);
	}

	.floating-chatbot-button {
		bottom: var(--mxct-offset-y);
		left: var(--mxct-side-left);
		right: var(--mxct-side-right);
	}

	/* Before frontend.js tags it: sit above the button like MxChat does. */
	.pre-chat-message {
		bottom: calc(var(--mxct-offset-y) + var(--mxct-launcher-size) + 14px);
		left: var(--mxct-side-left);
		right: var(--mxct-side-right);
	}
}

/* ---------- Phones ---------- */
@media (max-width: 550px) {
	.floating-chatbot-button {
		display: var(--mxct-launcher-mdisplay);
		width: var(--mxct-launcher-msize);
		height: var(--mxct-launcher-msize);
		bottom: 15px;
		left: var(--mxct-mside-left);
		right: var(--mxct-mside-right);
	}

	/* Also before frontend.js runs (e.g. script delayed by an optimizer). */
	.pre-chat-message {
		left: var(--mxct-mside-left);
		right: var(--mxct-mside-right);
		visibility: var(--mxct-tip-mvis, visible);
	}

	.pre-chat-message.mxct-teaser {
		--mxct-tb: 15px;
		--mxct-ts: 10px;
		--mxct-tz: var(--mxct-launcher-msize);
		visibility: var(--mxct-tip-mvis);
	}
}

/* ---------- Header ---------- */
.mxchat-chatbot-wrapper .chatbot-top-bar {
	background: var(--mxct-header-bg) !important;
	color: var(--mxct-header-text) !important;
	min-height: var(--mxct-header-height);
}

.mxchat-chatbot-wrapper .chatbot-top-bar .chatbot-title,
.mxchat-chatbot-wrapper .chatbot-top-bar .mxchat-header-btn,
.mxchat-chatbot-wrapper .chatbot-top-bar button.exit-chat,
.mxchat-chatbot-wrapper .chatbot-top-bar .mxct-subtitle {
	color: var(--mxct-header-text) !important;
}

/* MxChat's "AI Agent" status chip follows the header colors. */
.mxchat-chatbot-wrapper .chatbot-top-bar .chat-mode-indicator {
	background: var(--mxct-header-chip) !important;
	color: var(--mxct-header-text) !important;
}

.mxchat-chatbot-wrapper .chatbot-top-bar .chatbot-title-icon {
	width: var(--mxct-avatar-size);
	height: var(--mxct-avatar-size);
	border-radius: var(--mxct-avatar-radius);
	object-fit: var(--mxct-avatar-fit);
	flex: 0 0 auto;
}

.mxchat-chatbot-wrapper .mxct-title-stack {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
}

.mxchat-chatbot-wrapper .chatbot-top-bar .mxct-subtitle {
	font-size: 12px;
	line-height: 1.3;
	opacity: 0.85;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mxchat-chatbot-wrapper .chatbot-top-bar button.exit-chat {
	background: var(--mxct-close-bg);
	border-radius: var(--mxct-close-radius);
}

.mxchat-chatbot-wrapper .chatbot-top-bar button.exit-chat:hover {
	opacity: 1;
	filter: brightness(1.15);
}

.mxchat-chatbot-wrapper .chatbot-top-bar button.exit-chat > svg {
	display: var(--mxct-close-orig) !important;
}

.mxchat-chatbot-wrapper .chatbot-top-bar button.exit-chat::before {
	content: "";
	display: var(--mxct-close-glyph);
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: var(--mxct-close-mask) center / contain no-repeat;
	mask: var(--mxct-close-mask) center / contain no-repeat;
}

/* ---------- Chat body & messages ---------- */
.mxchat-chatbot-wrapper .mxchat-chatbot {
	background-color: var(--mxct-body-bg) !important;
	background-image: var(--mxct-body-image);
	background-size: var(--mxct-body-image-size);
	background-repeat: var(--mxct-body-image-repeat);
	background-position: center;
}

.mxchat-chatbot .chat-container .chat-box .user-message {
	background: var(--mxct-user-bg) !important;
	color: var(--mxct-user-text) !important;
	border-radius: var(--mxct-user-radius);
	padding: var(--mxct-user-pad);
	font-size: var(--mxct-font-size);
	line-height: 1.7;
}

.mxchat-chatbot .chat-container .chat-box .bot-message {
	background: var(--mxct-bot-bg) !important;
	color: var(--mxct-bot-text) !important;
	border-radius: var(--mxct-bot-radius);
	padding: var(--mxct-bot-pad);
	font-size: var(--mxct-font-size);
	line-height: 1.7;
}

/* MxChat colors the intro text through an inline style on a child div. */
.mxchat-chatbot .chat-container .chat-box .mxchat-intro-message > div,
.mxchat-chatbot .chat-container .chat-box .bot-message a {
	color: inherit !important;
}

.mxchat-chatbot .chat-container .chat-box .bot-message.temporary-message .thinking-dots .dot {
	background-color: var(--mxct-typing) !important;
}

.mxchat-chatbot .chat-container .chat-box [data-mxct-time]::after {
	content: attr(data-mxct-time);
	display: block;
	margin-top: 4px;
	font-size: 11px;
	line-height: 1.2;
	opacity: 0.7;
	color: var(--mxct-time-color);
	white-space: nowrap;
}

.mxchat-chatbot .chat-container .chat-box .user-message[data-mxct-time]::after {
	text-align: right;
}

/* ---------- Message box & send button ---------- */
.mxchat-chatbot .chat-container .input-container {
	background: var(--mxct-input-bg);
	border-color: var(--mxct-input-border);
	border-radius: var(--mxct-input-radius);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mxchat-chatbot .chat-container .input-container:focus-within {
	border-color: var(--mxct-input-focus);
	box-shadow: 0 0 0 3px var(--mxct-input-ring);
}

.mxchat-chatbot .chat-container .input-container .chat-input {
	color: var(--mxct-input-text) !important;
	border-radius: var(--mxct-input-radius);
}

.mxchat-chatbot .chat-container .input-container .chat-input::placeholder {
	color: var(--mxct-input-placeholder);
	opacity: 1;
}

.mxchat-chatbot .chat-container .input-container .send-button {
	background: var(--mxct-send-fill) !important;
	color: var(--mxct-send-glyph);
	transition: background-color 0.2s ease, color 0.2s ease;
}

.mxchat-chatbot .chat-container .input-container .send-button:hover {
	background: var(--mxct-send-fill-hover) !important;
	color: var(--mxct-send-glyph-hover);
	opacity: 1;
}

.mxchat-chatbot .chat-container .input-container .send-button > svg {
	display: var(--mxct-send-orig) !important;
	fill: currentColor !important;
}

.mxchat-chatbot .chat-container .input-container .send-button::before {
	content: "";
	display: var(--mxct-send-glyph-display);
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: var(--mxct-send-mask) center / contain no-repeat;
	mask: var(--mxct-send-mask) center / contain no-repeat;
	pointer-events: none;
}

/* While a reply streams, MxChat swaps in its own stop icon: always show it. */
.mxchat-chatbot .chat-container .input-container .send-button.mxchat-stop-mode > svg {
	display: inline-block !important;
}

.mxchat-chatbot .chat-container .input-container .send-button.mxchat-stop-mode::before {
	display: none;
}

/* ---------- Lead capture form (MxChat → Lead Capture) ----------
 * MxChat's .email-blocker is styled with fixed blue/grey colors in
 * chat-style.css; these selectors are one class more specific, so no
 * !important is needed. "MxChat original" sets the variables back to
 * MxChat's own values. */
.mxchat-chatbot .email-blocker {
	margin: auto var(--mxct-lead-surface-margin);
	background: var(--mxct-lead-surface);
	border-radius: var(--mxct-lead-surface-radius);
	box-shadow: var(--mxct-lead-surface-shadow);
	text-align: var(--mxct-lead-align);
	scrollbar-color: var(--mxct-sb-color) transparent;
}

.mxchat-chatbot .email-blocker::-webkit-scrollbar-thumb {
	background-color: var(--mxct-sb-color);
}

.mxchat-chatbot .email-blocker .email-blocker-header,
.mxchat-chatbot .email-blocker .email-collection-form {
	align-self: stretch;
}

.mxchat-chatbot .email-blocker :is(h1, h2, h3, h4) {
	color: var(--mxct-lead-title);
	line-height: 1.25;
	text-align: var(--mxct-lead-align);
}

.mxchat-chatbot .email-blocker h2 {
	font-size: var(--mxct-lead-title-size);
}

.mxchat-chatbot .email-blocker :is(p, li, .mxchat-consent-label, .email-blocker-footer) {
	color: var(--mxct-lead-text);
}

.mxchat-chatbot .email-blocker p {
	text-align: var(--mxct-lead-align);
}

.mxchat-chatbot .email-blocker a,
.mxchat-chatbot .email-blocker .mxchat-consent-label a {
	color: var(--mxct-lead-check);
}

.mxchat-chatbot .email-blocker input[type="email"],
.mxchat-chatbot .email-blocker input[type="text"],
.mxchat-chatbot .email-blocker .mxchat-name-input {
	box-sizing: border-box;
	background: var(--mxct-lead-field-bg);
	color: var(--mxct-lead-field-text);
	border-style: solid;
	border-color: var(--mxct-lead-field-border);
	border-width: var(--mxct-lead-field-bw);
	border-radius: var(--mxct-lead-field-radius);
	box-shadow: var(--mxct-lead-field-shadow);
}

.mxchat-chatbot .email-blocker input::placeholder {
	color: var(--mxct-lead-placeholder);
	opacity: 1;
}

.mxchat-chatbot .email-blocker input[type="email"]:focus,
.mxchat-chatbot .email-blocker input[type="text"]:focus,
.mxchat-chatbot .email-blocker .mxchat-name-input:focus {
	border-color: var(--mxct-lead-focus);
	box-shadow: 0 0 0 3px var(--mxct-lead-ring);
	outline: none;
}

.mxchat-chatbot .email-blocker .mxchat-consent-checkbox {
	accent-color: var(--mxct-lead-check);
}

.mxchat-chatbot .email-blocker .email-submit-button {
	background: var(--mxct-lead-btn-bg);
	color: var(--mxct-lead-btn-text);
	border-radius: var(--mxct-lead-btn-radius);
	transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.mxchat-chatbot .email-blocker .email-submit-button:hover,
.mxchat-chatbot .email-blocker .email-submit-button:focus-visible {
	background: var(--mxct-lead-btn-bg);
	filter: var(--mxct-lead-btn-filter);
	transform: var(--mxct-lead-btn-lift);
	box-shadow: var(--mxct-lead-btn-glow);
}

/* ---------- Scrollbar & footer ---------- */
.mxchat-chatbot .chat-container .chat-box {
	scrollbar-width: var(--mxct-sb-ff);
	scrollbar-color: var(--mxct-sb-color) transparent;
}

.mxchat-chatbot .chat-container .chat-box::-webkit-scrollbar {
	width: var(--mxct-sb-width);
}

.mxchat-chatbot .chat-container .chat-box::-webkit-scrollbar-thumb {
	background-color: var(--mxct-sb-color);
}

.mxchat-chatbot-wrapper .mxct-branding {
	margin: 2px 10px 8px;
	font-size: 11px;
	line-height: 1.4;
	text-align: center;
	color: var(--mxct-footer-text);
}

.mxchat-chatbot-wrapper .mxct-branding a {
	color: inherit;
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	.floating-chatbot {
		transition-duration: 0ms;
	}

	.floating-chatbot-button::after,
	.pre-chat-message.mxct-teaser {
		animation: none !important;
	}
}
