#asa-chat-widget {
	--asa-brand: #6d5ae6;
	--asa-brand-dark: #5a49d6;
	--asa-bg: #ffffff;
	--asa-bg-soft: #f1f4fb;
	--asa-text: #1f2430;
	--asa-text-muted: #7b8499;
	--asa-border: #e3e8f2;
	--asa-radius: 14px;
	--asa-shadow: 0 12px 40px rgba(20, 30, 80, 0.18);

	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: inherit;
	line-height: 1.6;
	color: var(--asa-text);
}

#asa-chat-widget *,
#asa-chat-widget *::before,
#asa-chat-widget *::after {
	box-sizing: border-box;
}

#asa-chat-widget button {
	font-family: inherit;
}

.asa-chat-toggle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	border: none;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--asa-brand), var(--asa-brand-dark));
	color: #fff;
	cursor: pointer;
	box-shadow: var(--asa-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.asa-chat-toggle:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 16px 44px rgba(20, 30, 80, 0.24);
}

.asa-chat-toggle:focus-visible {
	outline: 3px solid var(--asa-brand);
	outline-offset: 3px;
}

.asa-chat-toggle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.asa-chat-toggle-close {
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}

#asa-chat-widget.is-open .asa-chat-toggle-chat {
	opacity: 0;
	transform: rotate(90deg) scale(0.6);
}

#asa-chat-widget.is-open .asa-chat-toggle-close {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

.asa-chat-box {
	display: none;
	flex-direction: column;
	position: absolute;
	left: 0;
	bottom: 70px;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: var(--asa-bg);
	border: 1px solid var(--asa-border);
	border-radius: var(--asa-radius);
	box-shadow: var(--asa-shadow);
	overflow: hidden;
	font-size: 14px;
}

#asa-chat-widget.is-open .asa-chat-box {
	display: flex;
	animation: asa-chat-pop 0.22s ease;
}

@keyframes asa-chat-pop {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.asa-chat-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--asa-brand), var(--asa-brand-dark));
	color: #fff;
	flex-shrink: 0;
}

.asa-chat-header-avatar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	flex-shrink: 0;
}

.asa-chat-status-dot {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: #34d399;
	border: 2px solid var(--asa-brand-dark);
}

.asa-chat-header-text {
	min-width: 0;
}

.asa-chat-header-title {
	font-weight: 700;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.asa-chat-header-sub {
	font-size: 12px;
	opacity: 0.85;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.asa-chat-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	margin-inline-start: auto;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, transform 0.15s ease;
}

.asa-chat-close:hover {
	background: rgba(255, 255, 255, 0.28);
	transform: rotate(90deg);
}

.asa-chat-close:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.7);
	outline-offset: 2px;
}

.asa-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: var(--asa-bg-soft);
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: rgba(109, 90, 230, 0.4) transparent;
	scrollbar-color: color-mix(in srgb, var(--asa-scrollbar, #6d5ae6) 40%, transparent) transparent;
}

.asa-chat-messages::-webkit-scrollbar {
	width: 8px;
}

.asa-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}

.asa-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(109, 90, 230, 0.35);
	background: color-mix(in srgb, var(--asa-scrollbar, #6d5ae6) 40%, transparent);
	border-radius: 8px;
}

.asa-chat-messages::-webkit-scrollbar-thumb:hover {
	background: rgba(109, 90, 230, 0.55);
	background: color-mix(in srgb, var(--asa-scrollbar, #6d5ae6) 60%, transparent);
}

.asa-chat-msg {
	display: flex;
	margin-bottom: 10px;
}

.asa-chat-msg-user {
	justify-content: flex-start;
}

.asa-chat-msg-bot {
	justify-content: flex-end;
}

.asa-chat-msg-bubble {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	word-break: break-word;
	white-space: pre-wrap;
}

.asa-chat-msg-user .asa-chat-msg-bubble {
	background: var(--asa-bg);
	color: var(--asa-text);
	border: 1px solid var(--asa-border);
	border-bottom-left-radius: 4px;
}

.asa-chat-msg-bot .asa-chat-msg-bubble {
	background: var(--asa-bot-bg, linear-gradient(135deg, var(--asa-brand), var(--asa-brand-dark)));
	color: var(--asa-bot-text, #fff);
	border-bottom-right-radius: 4px;
}

.asa-chat-typing-bubble {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 12px 16px;
}

.asa-chat-typing-bubble span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	background: color-mix(in srgb, var(--asa-bot-text, #fff) 85%, transparent);
	animation: asa-chat-blink 1.2s infinite ease-in-out;
}

.asa-chat-typing-bubble span:nth-child(2) {
	animation-delay: 0.15s;
}

.asa-chat-typing-bubble span:nth-child(3) {
	animation-delay: 0.3s;
}

.asa-chat-msg-bubble-cards {
	padding: 12px 12px 10px;
}

.asa-chat-seg-text {
	white-space: pre-wrap;
	word-break: break-word;
}

.asa-chat-seg-text:not(:last-child) {
	margin-bottom: 4px;
}

.asa-chat-msg-bubble-cards .asa-chat-product-card {
	width: 100%;
	max-width: 100%;
	margin: 10px 0 4px;
	background: #fff;
	color: var(--asa-text);
	box-shadow: 0 1px 4px rgba(20, 30, 80, 0.14);
}

.asa-chat-msg-bubble-cards .asa-chat-product-card:hover {
	box-shadow: 0 4px 14px rgba(20, 30, 80, 0.2);
	transform: none;
}

.asa-chat-products {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 10px;
}

.asa-chat-product-card {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 82%;
	padding: 8px;
	background: var(--asa-bg);
	border: 1px solid var(--asa-border);
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.asa-chat-product-card:hover {
	box-shadow: 0 4px 14px rgba(20, 30, 80, 0.14);
	transform: translateY(-1px);
}

.asa-chat-product-img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
	background: var(--asa-bg-soft);
}

.asa-chat-product-info {
	min-width: 0;
	flex: 1;
}

.asa-chat-product-title {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
}

.asa-chat-product-price {
	font-size: 12px;
	font-weight: 700;
	color: var(--asa-brand-dark);
	margin-top: 2px;
}

@keyframes asa-chat-blink {
	0%,
	60%,
	100% {
		opacity: 0.35;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

.asa-chat-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--asa-border);
	background: var(--asa-bg);
	flex-shrink: 0;
}

.asa-chat-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--asa-border);
	border-radius: 10px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	color: var(--asa-text);
	background: var(--asa-bg-soft);
	min-height: 42px;
	max-height: 120px;
}

.asa-chat-input:focus {
	outline: none;
	border-color: var(--asa-brand);
	background: var(--asa-bg);
}

#asa-chat-widget .asa-chat-input,
#asa-chat-widget .asa-chat-input:focus,
#asa-chat-widget .asa-chat-input:focus-visible,
#asa-chat-widget .asa-chat-input:hover,
#asa-chat-widget .asa-chat-input:focus-within {
	border: 1px solid var(--asa-border) !important;
	border-left: 1px solid var(--asa-border) !important;
	border-right: 1px solid var(--asa-border) !important;
	border-top: 1px solid var(--asa-border) !important;
	border-bottom: 1px solid var(--asa-border) !important;
	border-inline: 1px solid var(--asa-border) !important;
	border-block: 1px solid var(--asa-border) !important;
	border-inline-start: 1px solid var(--asa-border) !important;
	border-inline-end: 1px solid var(--asa-border) !important;
	border-color: var(--asa-border) !important;
	border-top-color: var(--asa-border) !important;
	border-right-color: var(--asa-border) !important;
	border-bottom-color: var(--asa-border) !important;
	border-left-color: var(--asa-border) !important;
	outline: none !important;
	outline-offset: 0 !important;
	box-shadow: none !important;
}

.asa-chat-input::placeholder {
	color: var(--asa-text-muted);
}

.asa-chat-send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 10px;
	background: var(--asa-send, linear-gradient(135deg, var(--asa-brand), var(--asa-brand-dark)));
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
	transition: opacity 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

.asa-chat-send:hover:not(:disabled) {
	transform: translateY(-1px);
	filter: brightness(0.94);
}

.asa-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.asa-chat-send.is-loading {
	animation: asa-chat-pulse 0.9s infinite ease-in-out;
}

@keyframes asa-chat-pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.55;
	}
}

@media (max-width: 480px) {
	#asa-chat-widget {
		left: 12px;
		bottom: 12px;
	}

	.asa-chat-box {
		left: 0;
		bottom: 64px;
		width: calc(100vw - 24px);
		max-width: none;
		height: calc(100vh - 90px);
	}
}
