.ssaca-chat-widget,
.ssaca-chat-widget * {
	box-sizing: border-box;
}

.ssaca-chat-widget {
	--ssaca-primary: #2271b1;
	--ssaca-surface: #ffffff;
	--ssaca-border: #dcdcde;
	--ssaca-text: #1d2327;
	--ssaca-muted: #646970;
	--ssaca-soft: #f6f7f7;
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 9998;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--ssaca-text);
	direction: inherit;
}

.ssaca-chat-widget .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
	word-wrap: normal;
}

.ssaca-position-bottom_left {
	right: auto;
	left: 22px;
}

.ssaca-chat-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	border: 0;
	border-radius: 8px;
	padding: 12px 16px;
	background: var(--ssaca-primary);
	color: #fff;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
}

.ssaca-chat-toggle:focus-visible,
.ssaca-chat-close:focus-visible,
.ssaca-chat-send:focus-visible,
.ssaca-suggestion:focus-visible,
.ssaca-product-link:focus-visible,
.ssaca-product-cart:focus-visible {
	outline: 2px solid color-mix(in srgb, var(--ssaca-primary), #fff 45%);
	outline-offset: 2px;
}

.ssaca-chat-toggle-icon {
	display: inline-grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	font-weight: 800;
}

.ssaca-chat-panel {
	position: absolute;
	right: 0;
	bottom: 64px;
	display: none;
	width: min(380px, calc(100vw - 32px));
	height: min(640px, calc(100vh - 120px));
	overflow: hidden;
	border: 1px solid var(--ssaca-border);
	border-radius: 8px;
	background: var(--ssaca-surface);
	box-shadow: 0 20px 54px rgba(0, 0, 0, 0.22);
}

.ssaca-position-bottom_left .ssaca-chat-panel {
	right: auto;
	left: 0;
}

.ssaca-is-open .ssaca-chat-panel {
	display: flex;
	flex-direction: column;
}

.ssaca-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 64px;
	padding: 14px 16px;
	background: var(--ssaca-primary);
	color: #fff;
}

.ssaca-chat-header strong,
.ssaca-chat-header span {
	display: block;
}

.ssaca-chat-header strong {
	font-size: 16px;
	line-height: 1.25;
}

.ssaca-chat-header span {
	margin-top: 2px;
	font-size: 12px;
	opacity: 0.88;
}

.ssaca-chat-close {
	display: inline-grid;
	place-items: center;
	flex: 0 0 34px;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	cursor: pointer;
	font-size: 24px;
	line-height: 1;
}

.ssaca-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: linear-gradient(180deg, #fff 0%, #f8f9fa 100%);
}

.ssaca-message-row {
	display: flex;
	margin-bottom: 10px;
}

.ssaca-message-user {
	justify-content: flex-end;
}

.ssaca-message-bubble {
	max-width: 86%;
	border-radius: 8px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--ssaca-border);
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.ssaca-message-user .ssaca-message-bubble {
	background: var(--ssaca-primary);
	border-color: var(--ssaca-primary);
	color: #fff;
}

.ssaca-loading {
	position: relative;
	color: var(--ssaca-muted);
}

.ssaca-product-row {
	display: grid;
	gap: 10px;
	margin: 8px 0 12px;
}

.ssaca-product-card {
	display: grid;
	grid-template-columns: 82px minmax(0, 1fr);
	gap: 12px;
	border: 1px solid var(--ssaca-border);
	border-radius: 8px;
	background: #fff;
	padding: 10px;
}

.ssaca-product-card img {
	width: 82px;
	height: 82px;
	object-fit: cover;
	border-radius: 6px;
	background: var(--ssaca-soft);
}

.ssaca-product-body {
	min-width: 0;
}

.ssaca-product-body h3 {
	margin: 0 0 6px;
	font-size: 14px;
	line-height: 1.25;
	color: var(--ssaca-text);
	overflow-wrap: anywhere;
}

.ssaca-product-price {
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 700;
	color: var(--ssaca-text);
}

.ssaca-product-stock {
	margin-bottom: 8px;
	font-size: 12px;
	color: var(--ssaca-muted);
}

.ssaca-product-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ssaca-product-link,
.ssaca-product-cart {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	border-radius: 6px;
	padding: 7px 10px;
	text-decoration: none;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
}

.ssaca-product-link {
	background: var(--ssaca-primary);
	color: #fff;
}

.ssaca-product-cart {
	border: 1px solid var(--ssaca-border);
	background: #fff;
	color: var(--ssaca-text);
}

.ssaca-quick-suggestions {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 10px 14px;
	border-top: 1px solid var(--ssaca-border);
	background: #fff;
}

.ssaca-suggestion {
	flex: 0 0 auto;
	border: 1px solid var(--ssaca-border);
	border-radius: 999px;
	padding: 7px 10px;
	background: #fff;
	color: var(--ssaca-text);
	cursor: pointer;
	font-size: 12px;
	line-height: 1.2;
}

.ssaca-suggestion:hover {
	border-color: var(--ssaca-primary);
	color: var(--ssaca-primary);
}

.ssaca-chat-form {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--ssaca-border);
	background: #fff;
}

.ssaca-chat-input {
	width: 100%;
	min-height: 42px;
	border: 1px solid var(--ssaca-border);
	border-radius: 6px;
	padding: 10px 12px;
	background: #fff;
	color: var(--ssaca-text);
	font-size: 14px;
	line-height: 1.2;
}

.ssaca-chat-send {
	min-height: 42px;
	border: 0;
	border-radius: 6px;
	padding: 0 14px;
	background: var(--ssaca-primary);
	color: #fff;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
}

.ssaca-chat-send:disabled,
.ssaca-chat-input:disabled {
	opacity: 0.62;
	cursor: progress;
}

@media (max-width: 720px) {
	.ssaca-chat-widget,
	.ssaca-position-bottom_left {
		right: 0;
		left: 0;
		bottom: 0;
	}

	.ssaca-chat-toggle {
		position: absolute;
		right: 14px;
		bottom: 14px;
	}

	.ssaca-position-bottom_left .ssaca-chat-toggle {
		right: auto;
		left: 14px;
	}

	.ssaca-chat-panel,
	.ssaca-position-bottom_left .ssaca-chat-panel {
		position: fixed;
		right: 0;
		left: 0;
		bottom: 0;
		width: 100%;
		height: min(82vh, 680px);
		border-right: 0;
		border-bottom: 0;
		border-left: 0;
		border-radius: 12px 12px 0 0;
	}

	.ssaca-chat-form {
		padding-bottom: max(12px, env(safe-area-inset-bottom));
	}
}

@supports not (color: color-mix(in srgb, #000, #fff)) {
	.ssaca-chat-toggle:focus-visible,
	.ssaca-chat-close:focus-visible,
	.ssaca-chat-send:focus-visible,
	.ssaca-suggestion:focus-visible,
	.ssaca-product-link:focus-visible,
	.ssaca-product-cart:focus-visible {
		outline-color: #8ccef0;
	}
}
