/**
 * Sauna AI floating chatbot — migrated from Sauna-Ai-Agent.html
 */

#sai-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: #ffffff;
	border: 2px solid #3b3fd6;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(59, 63, 214, 0.35);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#sai-launcher:hover {
	transform: scale(1.05);
	transition: transform 0.15s;
}

#sai-launcher svg {
	width: 40px;
	height: 40px;
}

#sai-panel {
	position: fixed;
	right: 20px;
	bottom: 96px;
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 540px;
	max-height: 70vh;
	background: #fff;
	border: 2px solid #000;
	border-radius: 14px;
	display: none;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	z-index: 99999;
	box-sizing: border-box;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#sai-panel *,
#sai-panel *::before,
#sai-panel *::after {
	box-sizing: border-box;
}

#sai-panel.open {
	display: flex;
}

.sai-header {
	background: #000;
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.sai-header svg {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
}

.sai-header strong {
	font-size: 16px;
	display: block;
}

.sai-header small {
	display: block;
	color: #bbb;
	font-size: 12px;
}

.sai-close {
	margin-left: auto;
	background: none;
	border: none;
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	line-height: 1;
	padding: 0 4px;
}

#sai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafafa;
}

.sai-msg {
	padding: 11px 13px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
	max-width: 92%;
	white-space: pre-line;
	word-break: break-word;
}

.sai-bot {
	background: #fff;
	border: 1px solid #e5e5e5;
	align-self: flex-start;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	color: #111;
}

.sai-user {
	background: #3b3fd6;
	color: #fff;
	align-self: flex-end;
}

.sai-link {
	display: block;
	margin-top: 10px;
	padding: 9px 12px;
	background: #f0f1ff;
	color: #2a2eb0;
	font-weight: 600;
	text-decoration: none;
	border-radius: 8px;
	font-size: 13px;
}

.sai-link:hover {
	background: #e2e4ff;
}

.sai-opts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 2px;
}

.sai-opts button {
	border: 1px solid #3b3fd6;
	background: #fff;
	color: #2a2eb0;
	border-radius: 20px;
	padding: 7px 13px;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	font-family: inherit;
}

.sai-opts button:hover {
	background: #3b3fd6;
	color: #fff;
}

.sai-opts button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.sai-turnstile {
	padding: 0 12px 8px;
	display: flex;
	justify-content: flex-end;
}

.sai-turnstile[hidden] {
	display: none !important;
}

.sai-privacy {
	margin: 0;
	padding: 6px 12px;
	font-size: 11px;
	line-height: 1.35;
	color: #777;
	background: #f5f5f5;
	border-top: 1px solid #eee;
}

/* WooCommerce product cards inside chat */
.sai-products {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	max-width: 100%;
	align-self: stretch;
}

.sai-product-card {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 12px;
	padding: 10px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sai-product-card__img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
	background: #f0f0f0;
}

.sai-product-card__body {
	min-width: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sai-product-card__name {
	font-size: 13px;
	font-weight: 700;
	color: #111;
	line-height: 1.35;
}

.sai-product-card__price {
	font-size: 13px;
	font-weight: 600;
	color: #2a2eb0;
}

.sai-product-card__stock {
	font-size: 11px;
	color: #2e7d4f;
}

.sai-product-card__stock--out {
	color: #8b2e2e;
}

.sai-product-card__link {
	display: inline-block;
	margin-top: 4px;
	padding: 7px 10px;
	background: #f0f1ff;
	color: #2a2eb0;
	font-weight: 600;
	text-decoration: none;
	border-radius: 8px;
	font-size: 12px;
	align-self: flex-start;
}

.sai-product-card__link:hover {
	background: #e2e4ff;
}

.sai-view-all {
	padding: 4px 0 2px;
}

.sai-view-all__link {
	display: block;
	text-align: center;
	padding: 10px 12px;
	background: #3b3fd6;
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	text-decoration: none;
	border-radius: 10px;
}

.sai-view-all__link:hover {
	background: #2a2eb0;
}

#sai-form {
	display: flex;
	border-top: 1px solid #ddd;
	background: #fff;
}

#sai-input {
	flex: 1;
	border: none;
	padding: 12px;
	font-size: 14px;
	outline: none;
	font-family: inherit;
	min-width: 0;
}

#sai-input:disabled {
	opacity: 0.7;
}

#sai-form button[type="submit"] {
	border: none;
	background: #3b3fd6;
	color: #fff;
	padding: 0 16px;
	cursor: pointer;
	font-weight: 600;
	font-family: inherit;
}

#sai-form button[type="submit"]:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.sai-status {
	font-size: 12px;
	color: #666;
	padding: 0 2px;
}

.sai-status--error {
	color: #8b2e2e;
}

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

@media (max-width: 480px) {
	#sai-launcher {
		right: 14px;
		bottom: 14px;
	}

	#sai-panel {
		right: 14px;
		left: 14px;
		bottom: 88px;
		width: auto;
		max-width: none;
		height: min(70vh, 540px);
	}
}
