/* Saat Chatbot floating widget */
#saat-chatbot {
	--saat-accent: #E8A800;
	--saat-icon: #000000;
	--saat-width: 380px;
	--saat-height: 580px;
	--saat-offset-x: 24px;
	--saat-offset-y: 24px;
	--saat-z: 99999;
	--saat-radius: 16px;

	position: fixed;
	bottom: var(--saat-offset-y);
	right: var(--saat-offset-x);
	z-index: var(--saat-z);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 16px;
	font-family: inherit;
	line-height: 1.4;
	/* Let clicks pass through the empty wrapper area. */
	pointer-events: none;
}

#saat-chatbot *,
#saat-chatbot *::before,
#saat-chatbot *::after {
	box-sizing: border-box;
}

#saat-chatbot.saat-chatbot--left {
	right: auto;
	left: var(--saat-offset-x);
	align-items: flex-start;
}

/* Floating button */
#saat-chatbot .saat-chatbot__toggle {
	pointer-events: auto;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--saat-accent);
	color: var(--saat-icon);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

#saat-chatbot .saat-chatbot__toggle:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

#saat-chatbot .saat-chatbot__toggle:focus-visible {
	outline: 3px solid var(--saat-icon);
	outline-offset: 3px;
}

#saat-chatbot .saat-chatbot__toggle svg {
	position: absolute;
	transition: transform 0.25s ease, opacity 0.2s ease;
}

#saat-chatbot .saat-chatbot__icon-close {
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}

#saat-chatbot.is-open .saat-chatbot__icon-open {
	opacity: 0;
	transform: rotate(90deg) scale(0.6);
}

#saat-chatbot.is-open .saat-chatbot__icon-close {
	opacity: 1;
	transform: none;
}

/* Chat box */
#saat-chatbot .saat-chatbot__panel {
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	width: var(--saat-width);
	max-width: calc(100vw - (var(--saat-offset-x) * 2));
	height: var(--saat-height);
	max-height: calc(100vh - var(--saat-offset-y) - 60px - 16px - 24px);
	max-height: calc(100dvh - var(--saat-offset-y) - 60px - 16px - 24px);
	overflow: hidden;
	background: #ffffff;
	border-radius: var(--saat-radius);
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
	transform-origin: bottom right;
	animation: saat-chatbot-in 0.22s ease-out;
}

#saat-chatbot.saat-chatbot--left .saat-chatbot__panel {
	transform-origin: bottom left;
}

#saat-chatbot .saat-chatbot__panel[hidden] {
	display: none;
}

@keyframes saat-chatbot-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

#saat-chatbot .saat-chatbot__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
	min-height: 48px;
	padding: 8px 8px 8px 16px;
	background: var(--saat-accent);
	color: var(--saat-icon);
}

#saat-chatbot .saat-chatbot__title {
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#saat-chatbot .saat-chatbot__actions {
	display: flex;
	align-items: center;
	gap: 2px;
}

#saat-chatbot .saat-chatbot__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
}

#saat-chatbot .saat-chatbot__action:hover,
#saat-chatbot .saat-chatbot__action:focus-visible {
	background: rgba(0, 0, 0, 0.1);
	color: inherit;
	outline: none;
}

#saat-chatbot .saat-chatbot__body {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	background: #ffffff;
}

#saat-chatbot .saat-chatbot__body iframe {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	background: #ffffff;
}

/* Loading dots shown until the iframe finishes loading */
#saat-chatbot .saat-chatbot__loader {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

#saat-chatbot.is-loaded .saat-chatbot__loader {
	display: none;
}

#saat-chatbot .saat-chatbot__loader span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--saat-accent);
	animation: saat-chatbot-dot 1s infinite ease-in-out;
}

#saat-chatbot .saat-chatbot__loader span:nth-child(2) {
	animation-delay: 0.15s;
}

#saat-chatbot .saat-chatbot__loader span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes saat-chatbot-dot {
	0%, 80%, 100% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	40% {
		opacity: 1;
		transform: scale(1);
	}
}

#saat-chatbot .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Mobile: chat box takes the full screen */
@media (max-width: 600px) {
	#saat-chatbot.saat-chatbot--hide-mobile {
		display: none;
	}

	#saat-chatbot .saat-chatbot__toggle {
		width: 56px;
		height: 56px;
	}

	#saat-chatbot .saat-chatbot__panel {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}

	/* The header close button is used instead of the floating button. */
	#saat-chatbot.is-open .saat-chatbot__toggle {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	#saat-chatbot .saat-chatbot__panel,
	#saat-chatbot .saat-chatbot__toggle,
	#saat-chatbot .saat-chatbot__toggle svg,
	#saat-chatbot .saat-chatbot__loader span {
		animation: none;
		transition: none;
	}
}

@media print {
	#saat-chatbot {
		display: none;
	}
}
