#ba-chat-widget {
	--ba-color: #00b884;
	--ba-radius: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	color: #1a1a1a;
}

.ba-chat {
	position: fixed;
	z-index: 99999;
	bottom: 20px;
}

.ba-chat--bottom-right { right: 20px; }
.ba-chat--bottom-left  { left: 20px; }

/* Toggle button */
.ba-chat-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--ba-color);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	color: #fff;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	padding: 12px 18px;
	transition: transform 0.15s ease, opacity 0.15s ease;
}

.ba-chat-toggle:hover { transform: translateY(-1px); }

.ba-chat-toggle.is-hidden {
	opacity: 0;
	pointer-events: none;
	transform: scale(0.9);
}

.ba-chat-toggle-icon { font-size: 16px; line-height: 1; }

/* Panel */
.ba-chat-panel {
	background: #fff;
	border-radius: var(--ba-radius);
	box-shadow: 0 16px 48px rgba(16, 24, 40, 0.22);
	display: flex;
	flex-direction: column;
	height: 460px;
	width: 360px;
	overflow: hidden;
	margin-bottom: 10px;
	border: 1px solid rgba(0, 0, 0, 0.05);
}

.ba-chat--bottom-right .ba-chat-panel { right: 0; }
.ba-chat--bottom-left  .ba-chat-panel { left: 0; }

/* Header */
.ba-chat-header {
	align-items: center;
	background: var(--ba-color);
	color: #fff;
	display: flex;
	justify-content: space-between;
	padding: 12px 14px;
}

.ba-chat-header-title {
	font-weight: 600;
	font-size: 14px;
}

.ba-chat-close {
	background: rgba(255, 255, 255, 0.18);
	border: 0;
	border-radius: 6px;
	color: #fff;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 2px 8px;
	transition: background 0.15s ease;
}

.ba-chat-close:hover { background: rgba(255, 255, 255, 0.32); }

/* Messages */
.ba-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	scrollbar-width: thin;
	scrollbar-color: #c8ccd1 transparent;
}

.ba-chat-messages::-webkit-scrollbar { width: 8px; }
.ba-chat-messages::-webkit-scrollbar-thumb {
	background: #c8ccd1;
	border-radius: 8px;
}
.ba-chat-messages::-webkit-scrollbar-track { background: transparent; }

.ba-chat-msg {
	margin-bottom: 10px;
	max-width: 88%;
}

.ba-chat-msg--user {
	background: rgba(0, 184, 132, 0.12);
	border-radius: 12px 12px 2px 12px;
	color: #0a3a2a;
	margin-left: auto;
	padding: 9px 12px;
	white-space: pre-wrap;
}

.ba-chat-msg--bot {
	background: #f2f4f7;
	border-radius: 12px 12px 12px 2px;
	color: #1a1a1a;
	padding: 10px 12px;
}

.ba-chat-msg-body {
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	line-height: 1.45;
}

/* Sources */
.ba-chat-sources {
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	font-size: 12px;
	margin-top: 8px;
	padding-top: 6px;
}

.ba-chat-sources strong {
	color: #555;
	font-weight: 600;
}

.ba-chat-sources ul {
	margin: 4px 0 0;
	padding-left: 18px;
}

.ba-chat-sources li { margin-bottom: 2px; }

.ba-chat-sources a {
	color: #2271b1;
	text-decoration: none;
}

.ba-chat-sources a:hover { text-decoration: underline; }

/* Feedback */
.ba-chat-feedback {
	align-items: center;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
	padding-top: 6px;
}

.ba-chat-feedback-label {
	color: #555;
	font-size: 12px;
}

.ba-chat-feedback-btn {
	background: #fff;
	border: 1px solid #d0d5dd;
	border-radius: 999px;
	color: #333;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 12px;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ba-chat-feedback-yes:hover {
	background: rgba(0, 184, 132, 0.12);
	border-color: var(--ba-color);
	color: var(--ba-color);
}

.ba-chat-feedback-no:hover {
	background: rgba(220, 60, 60, 0.08);
	border-color: #d23b3b;
	color: #d23b3b;
}

.ba-chat-feedback-done {
	color: #555;
	font-size: 12px;
	font-style: italic;
}

/* Lead form */
.ba-chat-lead {
	background: #fff8e6;
	border: 1px solid #f0d8a8;
	border-radius: 10px;
	margin: 6px 0 12px;
	max-width: 92%;
	margin-left: auto;
	padding: 12px;
}

.ba-chat-lead-prompt {
	color: #5a4500;
	font-size: 13px;
	font-weight: 600;
	margin: 0 0 8px;
}

.ba-chat-lead-form {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ba-chat-lead-input,
.ba-chat-lead-textarea {
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	font-family: inherit;
	font-size: 13px;
	padding: 7px 9px;
	resize: none;
	width: 100%;
	box-sizing: border-box;
}

.ba-chat-lead-input:focus,
.ba-chat-lead-textarea:focus {
	border-color: var(--ba-color);
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 184, 132, 0.15);
}

.ba-chat-lead-submit {
	background: var(--ba-color);
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 12px;
	transition: opacity 0.15s ease;
}

.ba-chat-lead-submit:hover { opacity: 0.92; }
.ba-chat-lead-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.ba-chat-lead-status {
	color: #666;
	font-size: 12px;
	min-height: 14px;
}

.ba-chat-lead-status.is-error { color: #d23b3b; }

.ba-chat-lead-ok {
	background: rgba(0, 184, 132, 0.1);
	border-radius: 8px;
	color: #0a3a2a;
	font-size: 13px;
	font-weight: 600;
	margin: 0;
	padding: 10px;
}

/* Input form */
.ba-chat-form {
	align-items: center;
	border-top: 1px solid #eaecf0;
	display: flex;
	gap: 8px;
	padding: 10px;
}

.ba-chat-input {
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	flex: 1;
	font-family: inherit;
	font-size: 14px;
	padding: 8px 10px;
}

.ba-chat-input:focus {
	border-color: var(--ba-color);
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 184, 132, 0.15);
}

.ba-chat-send {
	background: var(--ba-color);
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 14px;
	transition: opacity 0.15s ease;
}

.ba-chat-send:hover { opacity: 0.92; }

/* Mobile */
@media (max-width: 480px) {
	.ba-chat-panel {
		width: calc(100vw - 32px);
		height: 70vh;
		max-height: 560px;
	}
	.ba-chat--bottom-right,
	.ba-chat--bottom-left {
		right: 16px;
		left: 16px;
	}
	.ba-chat--bottom-right .ba-chat-panel,
	.ba-chat--bottom-left .ba-chat-panel {
		right: auto;
		left: auto;
	}
}
