/* BBKS AI Assistant widget styles
   Design intent: quiet, premium, agency-toned — not a generic bright-purple
   bot bubble. Charcoal surface, a single warm gold accent (swap via the
   accent colour setting), restrained motion. */

:root {
	--bbks-ai-accent: #C9A34E;
	--bbks-ai-ink: #1B1D22;
	--bbks-ai-surface: #ffffff;
	--bbks-ai-surface-soft: #F6F5F2;
	--bbks-ai-border: #E7E4DD;
	--bbks-ai-text: #24252A;
	--bbks-ai-text-soft: #6B6D74;
}

#bbks-ai-root * {
	box-sizing: border-box;
}

#bbks-ai-root {
	position: fixed;
	z-index: 999999;
	bottom: 20px;
	right: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Floating launcher button ---------- */
.bbks-ai-launcher {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: var(--bbks-ai-ink);
	border: 1px solid rgba(255,255,255,0.08);
	box-shadow: 0 8px 24px rgba(0,0,0,0.24);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.bbks-ai-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0,0,0,0.3);
}
.bbks-ai-launcher svg {
	width: 24px;
	height: 24px;
	stroke: var(--bbks-ai-accent);
}
.bbks-ai-launcher .bbks-ai-dot {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--bbks-ai-accent);
	border: 2px solid var(--bbks-ai-surface);
}

/* ---------- Chat panel ---------- */
.bbks-ai-panel {
	position: absolute;
	bottom: 72px;
	right: 0;
	width: clamp(320px, 22vw, 400px);
	height: min(640px, 70vh);
	background: var(--bbks-ai-surface);
	border-radius: 16px;
	border: 1px solid var(--bbks-ai-border);
	box-shadow: 0 20px 60px rgba(0,0,0,0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.16s ease, transform 0.16s ease;
}
.bbks-ai-panel.bbks-ai-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.bbks-ai-header {
	background: var(--bbks-ai-ink);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.bbks-ai-header-title {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
}
.bbks-ai-header-sub {
	font-size: 11px;
	color: rgba(255,255,255,0.55);
	margin-top: 2px;
}
.bbks-ai-close {
	background: transparent;
	border: none;
	color: rgba(255,255,255,0.7);
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 4px;
}
.bbks-ai-close:hover { color: #fff; }

.bbks-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--bbks-ai-surface-soft);
}

.bbks-ai-msg {
	max-width: 88%;
	font-size: 13.5px;
	line-height: 1.5;
	padding: 10px 13px;
	border-radius: 12px;
	white-space: pre-wrap;
}
.bbks-ai-msg-bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--bbks-ai-border);
	color: var(--bbks-ai-text);
	border-bottom-left-radius: 4px;
}
.bbks-ai-msg-user {
	align-self: flex-end;
	background: var(--bbks-ai-ink);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.bbks-ai-actions {
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-width: 88%;
}
.bbks-ai-action-btn {
	border: 1px solid var(--bbks-ai-accent);
	background: rgba(201,163,78,0.08);
	color: var(--bbks-ai-ink);
	font-size: 12.5px;
	font-weight: 600;
	padding: 7px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.bbks-ai-action-btn:hover {
	background: var(--bbks-ai-accent);
	color: #fff;
}

.bbks-ai-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 13px;
	background: #fff;
	border: 1px solid var(--bbks-ai-border);
	border-radius: 12px;
	border-bottom-left-radius: 4px;
}
.bbks-ai-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--bbks-ai-text-soft);
	animation: bbks-ai-bounce 1.1s infinite ease-in-out;
}
.bbks-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.bbks-ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bbks-ai-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.bbks-ai-inputbar {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid var(--bbks-ai-border);
	background: #fff;
	flex-shrink: 0;
}
.bbks-ai-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--bbks-ai-border);
	border-radius: 10px;
	padding: 9px 11px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 90px;
	outline: none;
}
.bbks-ai-input:focus {
	border-color: var(--bbks-ai-accent);
}
.bbks-ai-send {
	background: var(--bbks-ai-ink);
	color: var(--bbks-ai-accent);
	border: none;
	border-radius: 10px;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
}
.bbks-ai-send:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}
.bbks-ai-send svg { width: 16px; height: 16px; }

.bbks-ai-footer-note {
	text-align: center;
	font-size: 10px;
	color: var(--bbks-ai-text-soft);
	padding: 6px 0 10px;
	background: #fff;
}

/* ---------- Mobile: bottom sheet, ~50% of viewport height ---------- */
@media (max-width: 640px) {
	#bbks-ai-root {
		bottom: 14px;
		right: 14px;
	}
	.bbks-ai-panel {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 52vh;
		border-radius: 18px 18px 0 0;
		transform: translateY(100%);
	}
	.bbks-ai-panel.bbks-ai-open {
		transform: translateY(0);
	}
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
	.bbks-ai-panel, .bbks-ai-launcher, .bbks-ai-typing span {
		transition: none !important;
		animation: none !important;
	}
}
