/* CartBot AI Widget Styles */
:root {
	--cartbot-color: #6366f1;
	--cartbot-text: #1f2937;
	--cartbot-bg: #ffffff;
	--cartbot-light: #f3f4f6;
	--cartbot-border: #e5e7eb;
	--cartbot-radius: 16px;
	--cartbot-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* Toggle Button */
.cartbot-toggle {
	position: fixed;
	z-index: 99998;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--cartbot-color);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(0,0,0,0.2);
	transition: transform 0.2s, box-shadow 0.2s;
}

.cartbot-toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

.cartbot-toggle.bottom-right {
	bottom: 24px;
	right: 24px;
}

.cartbot-toggle.bottom-left {
	bottom: 24px;
	left: 24px;
}

.cartbot-toggle svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}

.cartbot-toggle .cartbot-close-icon {
	display: none;
}

.cartbot-toggle.open .cartbot-chat-icon {
	display: none;
}

.cartbot-toggle.open .cartbot-close-icon {
	display: block;
}

/* Chat Window */
.cartbot-window {
	position: fixed;
	z-index: 99999;
	width: 400px;
	height: 600px;
	max-height: calc(100vh - 120px);
	background: var(--cartbot-bg);
	border-radius: var(--cartbot-radius);
	box-shadow: var(--cartbot-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.cartbot-window.open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: all;
}

.cartbot-window.bottom-right {
	bottom: 96px;
	right: 24px;
}

.cartbot-window.bottom-left {
	bottom: 96px;
	left: 24px;
}

/* Header */
.cartbot-header {
	background: var(--cartbot-color);
	color: #fff;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.cartbot-header-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.cartbot-header-avatar svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

.cartbot-header-info {
	flex: 1;
	min-width: 0;
}

.cartbot-header-name {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
}

.cartbot-header-status {
	font-size: 12px;
	opacity: 0.8;
}

/* Messages Area */
.cartbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cartbot-messages::-webkit-scrollbar {
	width: 4px;
}

.cartbot-messages::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 4px;
}

/* Message Bubbles */
.cartbot-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	animation: cartbot-msg-in 0.2s ease;
}

@keyframes cartbot-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.cartbot-msg-user {
	background: var(--cartbot-color);
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

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

.cartbot-msg-assistant strong {
	font-weight: 600;
}

/* Typing Indicator */
.cartbot-typing {
	display: flex;
	gap: 4px;
	padding: 12px 14px;
	background: var(--cartbot-light);
	border-radius: 12px;
	border-bottom-left-radius: 4px;
	align-self: flex-start;
	width: fit-content;
}

.cartbot-typing span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #9ca3af;
	animation: cartbot-bounce 1.4s infinite;
}

.cartbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.cartbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cartbot-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30% { transform: translateY(-6px); }
}

/* Product Cards */
.cartbot-products {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 4px 0;
	align-self: flex-start;
	max-width: 100%;
}

.cartbot-product-card {
	flex-shrink: 0;
	width: 160px;
	background: #fff;
	border: 1px solid var(--cartbot-border);
	border-radius: 10px;
	overflow: hidden;
	font-size: 12px;
}

.cartbot-product-card img {
	width: 100%;
	height: 100px;
	object-fit: cover;
}

.cartbot-product-card-body {
	padding: 8px;
}

.cartbot-product-card-name {
	font-weight: 600;
	font-size: 13px;
	line-height: 1.3;
	margin-bottom: 4px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cartbot-product-card-price {
	color: var(--cartbot-color);
	font-weight: 700;
	margin-bottom: 6px;
}

.cartbot-product-card-btn {
	display: block;
	width: 100%;
	padding: 6px;
	background: var(--cartbot-color);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	text-align: center;
	transition: opacity 0.15s;
}

.cartbot-product-card-btn:hover {
	opacity: 0.9;
}

.cartbot-product-card-btn.added {
	background: #10b981;
}

/* Action Buttons */
.cartbot-action-btn {
	display: inline-block;
	margin-top: 6px;
	padding: 8px 16px;
	background: var(--cartbot-color);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: opacity 0.15s;
}

.cartbot-action-btn:hover {
	opacity: 0.9;
}

.cartbot-action-btn.success {
	background: #10b981;
}

/* Input Area */
.cartbot-input-area {
	padding: 12px 16px;
	border-top: 1px solid var(--cartbot-border);
	display: flex;
	gap: 8px;
	align-items: flex-end;
	flex-shrink: 0;
}

.cartbot-input {
	flex: 1;
	border: 1px solid var(--cartbot-border);
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 14px;
	resize: none;
	max-height: 100px;
	outline: none;
	font-family: inherit;
	line-height: 1.4;
}

.cartbot-input:focus {
	border-color: var(--cartbot-color);
}

.cartbot-send {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--cartbot-color);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: opacity 0.15s;
}

.cartbot-send:hover {
	opacity: 0.9;
}

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

.cartbot-send svg {
	width: 18px;
	height: 18px;
	fill: #fff;
}

/* Lead Capture Form */
.cartbot-lead-form {
	padding: 16px;
	background: var(--cartbot-light);
	border-top: 1px solid var(--cartbot-border);
}

.cartbot-lead-form h4 {
	margin: 0 0 8px;
	font-size: 14px;
}

.cartbot-lead-form input {
	display: block;
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--cartbot-border);
	border-radius: 8px;
	font-size: 13px;
	margin-bottom: 8px;
	box-sizing: border-box;
}

.cartbot-lead-form label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #6b7280;
	margin-bottom: 8px;
}

.cartbot-lead-form button {
	width: 100%;
	padding: 8px;
	background: var(--cartbot-color);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
}

.cartbot-lead-dismiss {
	text-align: center;
	margin-top: 6px;
}

.cartbot-lead-dismiss a {
	color: #6b7280;
	font-size: 12px;
	cursor: pointer;
	text-decoration: none;
}

/* Powered by */
.cartbot-powered {
	text-align: center;
	padding: 6px;
	font-size: 10px;
	color: #9ca3af;
}

.cartbot-powered a {
	color: #9ca3af;
	text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
	.cartbot-window {
		width: calc(100vw - 16px);
		height: calc(100vh - 80px);
		max-height: calc(100vh - 80px);
		bottom: 8px !important;
		right: 8px !important;
		left: 8px !important;
		border-radius: 12px;
	}

	.cartbot-toggle {
		width: 52px;
		height: 52px;
		bottom: 16px !important;
	}

	.cartbot-toggle.bottom-right { right: 16px; }
	.cartbot-toggle.bottom-left { left: 16px; }
}
