/**
 * ChatBolt frontend styles. All selectors scoped under .chatbolt-root.
 * System font stack: no external requests (GDPR-friendly).
 */

.chatbolt-root {
	--cb-primary: #25d366;
	--cb-btn-text: #ffffff;
	--cb-header: #075e54;
	--cb-header-text: #ffffff;
	--cb-radius: 16px;
	position: fixed;
	bottom: 24px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: #1f2937;
}
.chatbolt-root.chatbolt-right { right: 24px; }
.chatbolt-root.chatbolt-left { left: 24px; }
.chatbolt-root[hidden] { display: none; }

/* Launcher */
.chatbolt-launcher {
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--cb-primary);
	color: var(--cb-btn-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	padding: 0;
}
.chatbolt-launcher:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.chatbolt-launcher:focus-visible { outline: 3px solid var(--cb-primary); outline-offset: 3px; }
.chatbolt-root.chatbolt-right .chatbolt-launcher { margin-left: auto; }
.chatbolt-icon-close[hidden], .chatbolt-icon-chat[hidden] { display: none; }

/* Greeting bubble */
.chatbolt-greeting {
	position: absolute;
	bottom: 72px;
	width: 230px;
	background: #fff;
	border-radius: var(--cb-radius);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
	padding: 12px 34px 12px 14px;
	cursor: pointer;
	animation: chatbolt-pop 0.25s ease;
}
.chatbolt-root.chatbolt-right .chatbolt-greeting { right: 0; }
.chatbolt-root.chatbolt-left .chatbolt-greeting { left: 0; }
.chatbolt-greeting strong { display: block; font-size: 14px; margin-bottom: 2px; }
.chatbolt-greeting span { font-size: 13px; color: #4b5563; }
.chatbolt-greeting-close {
	position: absolute;
	top: 6px;
	right: 8px;
	border: 0;
	background: none;
	font-size: 18px;
	line-height: 1;
	color: #9ca3af;
	cursor: pointer;
	padding: 2px 6px;
}

/* Panel */
.chatbolt-panel {
	position: absolute;
	bottom: 72px;
	width: 380px;
	max-width: calc(100vw - 48px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: var(--cb-radius);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: chatbolt-pop 0.25s ease;
}
.chatbolt-root.chatbolt-right .chatbolt-panel { right: 0; }
.chatbolt-root.chatbolt-left .chatbolt-panel { left: 0; }
.chatbolt-panel[hidden] { display: none; }
@keyframes chatbolt-pop {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

/* Header */
.chatbolt-header {
	background: var(--cb-header);
	color: var(--cb-header-text);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}
.chatbolt-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 20px;
	flex-shrink: 0;
	overflow: hidden;
}
.chatbolt-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chatbolt-header-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chatbolt-header-name { font-size: 15px; }
.chatbolt-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: 0.95; }
.chatbolt-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.chatbolt-status.is-open .chatbolt-dot { background: #4ade80; }
.chatbolt-reply { font-size: 11px; opacity: 0.8; }
.chatbolt-close {
	border: 0;
	background: none;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	opacity: 0.9;
}

/* Tabs */
.chatbolt-tabs { display: flex; border-bottom: 1px solid #e5e7eb; }
.chatbolt-tabs[hidden] { display: none; }
.chatbolt-tab {
	flex: 1;
	border: 0;
	background: #f9fafb;
	padding: 10px;
	font-size: 13px;
	font-weight: 600;
	color: #6b7280;
	cursor: pointer;
}
.chatbolt-tab.is-active { background: #fff; color: var(--cb-header); border-bottom: 2px solid var(--cb-primary); }

/* Body */
.chatbolt-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chatbolt-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 16px; overflow-y: auto; }
.chatbolt-pane[hidden] { display: none; }
.chatbolt-intro { margin: 0 0 12px; color: #4b5563; }
.chatbolt-offline {
	background: #fef3c7;
	border: 1px solid #fcd34d;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 13px;
	margin: 0 0 12px;
}

/* Agents */
.chatbolt-agents { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.chatbolt-agent {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.chatbolt-agent:hover { border-color: var(--cb-primary); background: #f9fafb; }
.chatbolt-agent-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--cb-primary);
	color: var(--cb-btn-text);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 18px;
	flex-shrink: 0;
}
.chatbolt-agent-text { display: flex; flex-direction: column; }
.chatbolt-agent-text strong { font-size: 14px; }
.chatbolt-agent-role { font-size: 12px; color: #6b7280; }
.chatbolt-agent-note { font-size: 12px; color: var(--cb-header); }

/* WhatsApp button */
.chatbolt-wa-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: var(--cb-primary);
	color: var(--cb-btn-text);
	text-decoration: none;
	font-weight: 600;
	font-size: 15px;
	padding: 13px 16px;
	border-radius: 12px;
	margin-top: auto;
	transition: filter 0.15s ease;
}
.chatbolt-wa-btn:hover { filter: brightness(0.94); color: var(--cb-btn-text); }
.chatbolt-wa-icon { display: inline-flex; }
.chatbolt-wa-btn-inline { margin-top: 8px; padding: 10px 14px; font-size: 14px; }

/* FAQ bot */
.chatbolt-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: -16px -16px 0; padding: 16px 16px 8px; }
.chatbolt-msg { display: flex; }
.chatbolt-msg-bot { justify-content: flex-start; }
.chatbolt-msg-user { justify-content: flex-end; }
.chatbolt-bubble {
	max-width: 85%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}
.chatbolt-msg-bot .chatbolt-bubble { background: #f3f4f6; color: #1f2937; border-bottom-left-radius: 4px; }
.chatbolt-msg-user .chatbolt-bubble { background: var(--cb-primary); color: var(--cb-btn-text); border-bottom-right-radius: 4px; }
.chatbolt-typing { display: inline-flex; gap: 4px; padding: 12px 16px; }
.chatbolt-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: chatbolt-blink 1.2s infinite; }
.chatbolt-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbolt-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbolt-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.chatbolt-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 4px; }
.chatbolt-chip {
	border: 1px solid var(--cb-primary);
	background: #fff;
	color: var(--cb-header);
	border-radius: 20px;
	padding: 6px 12px;
	font-size: 12px;
	cursor: pointer;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.chatbolt-chip:hover { background: var(--cb-primary); color: var(--cb-btn-text); }

.chatbolt-inputrow { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid #e5e7eb; margin-top: 8px; }
.chatbolt-inputrow input {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	padding: 10px 14px;
	font-size: 14px;
	font-family: inherit;
}
.chatbolt-inputrow input:focus { outline: none; border-color: var(--cb-primary); }
.chatbolt-inputrow button {
	border: 0;
	background: var(--cb-primary);
	color: var(--cb-btn-text);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
	.chatbolt-root { bottom: 16px; }
	.chatbolt-root.chatbolt-right { right: 16px; }
	.chatbolt-root.chatbolt-left { left: 16px; }
	.chatbolt-panel {
		width: calc(100vw - 32px);
		height: calc(100vh - 110px);
		bottom: 76px;
	}
	.chatbolt-greeting { width: 200px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.chatbolt-launcher, .chatbolt-panel, .chatbolt-greeting { animation: none; transition: none; }
	.chatbolt-typing span { animation: none; opacity: 1; }
}
