#aba-chat-widget {
	--aba-primary: var(--accent, #0E6E5A);
	--aba-primary-gradient: linear-gradient(135deg, #25D366, #128C7E);
	--aba-dark: var(--ink, #122019);
	--aba-online: #22c55e;
	--aba-text: var(--ink, #122019);
	--aba-muted: var(--muted, #5B6B62);
	--aba-bg: var(--bg-card, #ffffff);
	--aba-bubble-bot: var(--bg-alt, #EEF1EC);
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	animation: aba-slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
	animation-delay: 0.8s;
}

/* Toggle button — pill with avatar + title/tagline when closed,
   collapses into a plain round close button when the panel is open. */
#aba-chat-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 60px;
	padding: 8px 20px 8px 8px;
	background: var(--aba-primary-gradient);
	border: none;
	border-radius: 999px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#aba-chat-widget:not(.is-open) #aba-chat-toggle {
	animation: aba-pulse-glow 3s infinite, aba-wiggle 8s infinite;
}

#aba-chat-toggle:hover {
	animation: none !important;
	transform: translateY(-3px) scale(1.02);
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28), 0 0 0 4px rgba(37, 211, 102, 0.2);
}

/* Entry and Attention animations */
@keyframes aba-slide-up {
	from {
		opacity: 0;
		transform: translateY(30px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes aba-pulse-glow {
	0% {
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(37, 211, 102, 0.5);
	}
	70% {
		box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26), 0 0 0 12px rgba(37, 211, 102, 0);
	}
	100% {
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

@keyframes aba-wiggle {
	0%, 90%, 100% { transform: rotate(0); }
	92% { transform: rotate(-3deg) scale(1.02); }
	94% { transform: rotate(3deg) scale(1.02); }
	96% { transform: rotate(-2deg) scale(1.02); }
	98% { transform: rotate(1deg) scale(1.01); }
}

#aba-chat-widget.is-open #aba-chat-toggle {
	width: 56px;
	height: 56px;
	padding: 0;
	border-radius: 50%;
	justify-content: center;
}

#aba-toggle-pill {
	display: flex;
	align-items: center;
	gap: 10px;
}

#aba-chat-widget.is-open #aba-toggle-pill {
	display: none;
}

#aba-toggle-close-icon {
	display: none;
}

#aba-chat-widget.is-open #aba-toggle-close-icon {
	display: block;
}

#aba-toggle-avatar {
	position: relative;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

#aba-toggle-avatar img,
#aba-chat-avatar img {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

#aba-status-dot,
#aba-header-status-dot {
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--aba-online);
	border: 2px solid var(--aba-bg, #ffffff);
}

#aba-toggle-text {
	display: flex;
	flex-direction: column;
	text-align: left;
	line-height: 1.3;
}

#aba-toggle-text strong {
	color: #fff;
	font-size: 13.5px;
	font-weight: 700;
}

#aba-toggle-text span {
	color: rgba(255, 255, 255, 0.65);
	font-size: 11.5px;
}

#aba-chat-panel {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: min(600px, 75vh);
	background: var(--aba-bg);
	border-radius: 18px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#aba-chat-panel[hidden] {
	display: none;
}

#aba-chat-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px;
	background: var(--aba-primary-gradient);
	color: #fff;
	flex-shrink: 0;
}

#aba-chat-avatar {
	position: relative;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 14px;
	flex-shrink: 0;
}

#aba-header-status-dot {
	border-color: var(--aba-bg, #ffffff);
}

#aba-chat-header-text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	flex-grow: 1;
	min-width: 0;
}

#aba-chat-header-text strong {
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#aba-chat-header-text span {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.65);
}

#aba-chat-lead-btn {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 12px;
	padding: 6px 12px;
	border-radius: 20px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
}

#aba-chat-lead-btn:hover {
	background: rgba(255, 255, 255, 0.18);
}

#aba-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--aba-bg);
}

.aba-msg {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	word-wrap: break-word;
}

.aba-msg-user {
	align-self: flex-end;
	background: var(--aba-primary-gradient);
	color: #fff;
	border-bottom-right-radius: 4px;
	white-space: pre-wrap;
}

.aba-msg-assistant {
	align-self: flex-start;
	background: var(--aba-bubble-bot);
	color: var(--aba-text);
	border-bottom-left-radius: 4px;
}

.aba-msg-assistant p {
	margin: 0 0 8px;
}

.aba-msg-assistant p:last-child {
	margin-bottom: 0;
}

.aba-msg-assistant ul {
	margin: 0 0 8px;
	padding-left: 18px;
}

.aba-msg-assistant ul:last-child {
	margin-bottom: 0;
}

.aba-msg-assistant li {
	margin-bottom: 3px;
}

.aba-msg-assistant strong {
	font-weight: 700;
}

.aba-msg-typing {
	align-self: flex-start;
	background: var(--aba-bubble-bot);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	padding: 12px 16px;
	display: flex;
	gap: 4px;
}

.aba-msg-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--aba-muted);
	animation: aba-bounce 1.2s infinite ease-in-out;
}

.aba-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.aba-msg-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes aba-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.aba-msg-actions {
	display: flex;
	margin-top: 8px;
}

.aba-msg-actions a {
	background: var(--aba-primary-gradient);
	color: #fff;
	text-decoration: none;
	font-size: 12.5px;
	font-weight: 600;
	padding: 7px 14px;
	border-radius: 20px;
	transition: transform 0.2s ease;
}
.aba-msg-actions a:hover {
	transform: translateY(-1px);
}

.aba-showcase {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-self: flex-start;
	width: 88%;
	margin-top: 4px;
}

.aba-showcase-card {
	background: var(--aba-bg);
	border: 1px solid rgba(18, 32, 25, 0.08);
	border-radius: 14px;
	padding: 14px 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
}

.aba-showcase-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(18, 32, 25, 0.08);
	border-color: rgba(14, 110, 90, 0.2);
}

.aba-showcase-title {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--aba-text);
	margin-bottom: 6px;
	line-height: 1.35;
}

.aba-showcase-price-row {
	display: flex;
	align-items: baseline;
	gap: 7px;
	margin-bottom: 8px;
}

.aba-showcase-price {
	font-size: 14px;
	font-weight: 700;
	color: var(--aba-primary);
}

.aba-showcase-original-price {
	font-size: 12px;
	color: var(--aba-muted);
	text-decoration: line-through;
}

.aba-showcase-meta {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	color: var(--aba-primary);
	background: rgba(14, 110, 90, 0.08);
	padding: 3px 8px;
	border-radius: 6px;
	margin-bottom: 10px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.aba-showcase-book {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--aba-primary-gradient);
	color: #fff;
	text-decoration: none;
	font-size: 11.5px;
	font-weight: 700;
	padding: 7px 16px;
	border-radius: 100px;
	transition: all 0.2s ease;
	box-shadow: 0 4px 10px rgba(18, 140, 126, 0.15);
	width: 100%;
	text-align: center;
	box-sizing: border-box;
	margin-top: 4px;
}

.aba-showcase-book:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 14px rgba(18, 140, 126, 0.25);
}

#aba-chat-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px 12px;
	flex-shrink: 0;
}

.aba-suggestion {
	background: var(--aba-bubble-bot);
	border: 1px solid #e5e7eb;
	color: var(--aba-text);
	font-size: 12px;
	padding: 6px 12px;
	border-radius: 20px;
	cursor: pointer;
}

.aba-suggestion:hover {
	background: #e9ebef;
}

#aba-chat-lead-form {
	padding: 12px 16px;
	border-top: 1px solid #eee;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex-shrink: 0;
}

#aba-chat-lead-form[hidden] {
	display: none;
}

#aba-chat-lead-form input {
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13px;
}

#aba-chat-lead-form button {
	background: var(--aba-primary-gradient);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 9px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s ease;
}
#aba-chat-lead-form button:hover {
	opacity: 0.95;
}

#aba-chat-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
}

#aba-chat-input {
	flex: 1;
	resize: none;
	overflow-y: hidden;
	border: 1px solid #dcdcde;
	border-radius: 18px;
	padding: 9px 14px;
	font-size: 13.5px;
	max-height: 90px;
	font-family: inherit;
}

#aba-chat-input:focus {
	outline: none;
	border-color: var(--aba-primary);
}

#aba-chat-send {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--aba-primary-gradient);
	border: none;
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease;
}
#aba-chat-send:hover:not(:disabled) {
	transform: scale(1.05);
}

#aba-chat-send:disabled {
	opacity: 0.5;
	cursor: default;
}

#aba-chat-footer {
	text-align: center;
	font-size: 10.5px;
	color: var(--aba-muted);
	padding: 6px;
	flex-shrink: 0;
}

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

	#aba-chat-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 100px);
		bottom: 70px;
	}
}
