/* ELF AI Chatbot — front-end widget
   Accent is injected as --elf-aicb-accent. Everything else stays quiet so the
   client's colour carries the identity. */

:root {
	--elf-aicb-accent: #2563eb;
	--elf-aicb-bg: #ffffff;
	--elf-aicb-fg: #1f2430;
	--elf-aicb-muted: #6b7280;
	--elf-aicb-line: #e7e9ee;
	--elf-aicb-user: #f2f4f8;
	--elf-aicb-radius: 16px;
	--elf-aicb-shadow: 0 12px 40px rgba(17, 24, 39, 0.18);
}

#elf-aicb-root,
#elf-aicb-root * {
	box-sizing: border-box;
}

#elf-aicb-root {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

/* Launcher */
.elf-aicb-launcher {
	position: fixed;
	bottom: 22px;
	z-index: 2147483000;
	display: inline-flex !important;
	align-items: center;
	gap: 5px;
	padding: 12px 18px 12px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--elf-aicb-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: var(--elf-aicb-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.elf-aicb-launcher:hover { transform: translateY(-2px); }
.elf-aicb-launcher.elf-aicb-hidden { display: none !important; }
.elf-aicb-launcher:focus-visible { outline: 3px solid var(--elf-aicb-accent); outline-offset: 3px; }
.elf-aicb-launcher svg { width: 22px; height: 22px; flex: none; }
.elf-aicb-pos-right .elf-aicb-launcher { right: 22px; }
.elf-aicb-pos-left  .elf-aicb-launcher { left: 22px; }

/* Panel */
.elf-aicb-panel {
	position: fixed;
	bottom: 22px;
	z-index: 2147483000;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 620px;
	max-height: calc(100vh - 44px);
	display: none;
	flex-direction: column;
	background: var(--elf-aicb-bg);
	border: 1px solid var(--elf-aicb-line);
	border-radius: var(--elf-aicb-radius);
	box-shadow: var(--elf-aicb-shadow);
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.985);
	transition: opacity 0.18s ease, transform 0.18s ease;
}
.elf-aicb-panel.is-open { display: flex; opacity: 1; transform: none; }
.elf-aicb-pos-right .elf-aicb-panel { right: 22px; }
.elf-aicb-pos-left  .elf-aicb-panel { left: 22px; }

/* Header */
.elf-aicb-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--elf-aicb-accent);
	color: #fff;
}
.elf-aicb-header .elf-aicb-title { font-weight: 650; font-size: 16px; }
.elf-aicb-header .elf-aicb-status {
	font-size: 12px; opacity: 0.85; display: block; margin-top: 1px;
}
.elf-aicb-dot {
	width: 8px; height: 8px; border-radius: 50%;
	background: #34d399; display: inline-block; margin-right: 5px;
}
.elf-aicb-close {
	margin-left: auto; background: transparent; border: 0; color: #fff;
	cursor: pointer; padding: 4px; border-radius: 8px; line-height: 0;
}
.elf-aicb-close:hover { background: rgba(255,255,255,0.18); }
.elf-aicb-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.elf-aicb-close svg { width: 20px; height: 20px; }

/* Message list */
.elf-aicb-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfc;
}
.elf-aicb-msg {
	max-width: 84%;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.elf-aicb-msg a { color: var(--elf-aicb-accent); }
.elf-aicb-msg.user {
	align-self: flex-end;
	background: var(--elf-aicb-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.elf-aicb-msg.bot {
	align-self: flex-start;
	background: #fff;
	color: var(--elf-aicb-fg);
	border: 1px solid var(--elf-aicb-line);
	border-bottom-left-radius: 4px;
}
.elf-aicb-msg.error {
	align-self: center; text-align: center; color: #b42318;
	background: #fef3f2; border: 1px solid #fecdc9; font-size: 13.5px;
}

/* Typing indicator */
.elf-aicb-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.elf-aicb-typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--elf-aicb-muted); opacity: 0.5;
	animation: elf-aicb-bounce 1.2s infinite;
}
.elf-aicb-typing span:nth-child(2) { animation-delay: 0.15s; }
.elf-aicb-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes elf-aicb-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Starter chips */
.elf-aicb-starters {
	display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 8px;
	background: #fafbfc;
}
.elf-aicb-chip {
	border: 1px solid var(--elf-aicb-line);
	background: #fff;
	color: var(--elf-aicb-fg);
	border-radius: 999px;
	padding: 7px 13px;
	font-size: 13.5px;
	cursor: pointer;
	transition: border-color 0.12s ease, color 0.12s ease;
}
.elf-aicb-chip:hover { border-color: var(--elf-aicb-accent); color: var(--elf-aicb-accent); }
.elf-aicb-chip:focus-visible { outline: 2px solid var(--elf-aicb-accent); outline-offset: 2px; }

/* Composer */
.elf-aicb-form {
	display: flex; align-items: flex-end; gap: 8px;
	padding: 12px; border-top: 1px solid var(--elf-aicb-line); background: #fff;
}
.elf-aicb-input {
	flex: 1; resize: none; border: 1px solid var(--elf-aicb-line);
	border-radius: 12px; padding: 10px 12px; font: inherit;
	color: var(--elf-aicb-fg); max-height: 120px; min-height: 42px;
}
.elf-aicb-input:focus { outline: none; border-color: var(--elf-aicb-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--elf-aicb-accent) 18%, transparent); }
.elf-aicb-send {
	border: 0; border-radius: 12px; background: var(--elf-aicb-accent);
	color: #fff; width: 42px; height: 42px; cursor: pointer; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
}
.elf-aicb-send:disabled { opacity: 0.45; cursor: default; }
.elf-aicb-send:focus-visible { outline: 3px solid var(--elf-aicb-accent); outline-offset: 2px; }
.elf-aicb-send svg { width: 20px; height: 20px; }

/* Footer credit */
.elf-aicb-credit {
	text-align: center; font-size: 11.5px; color: var(--elf-aicb-muted);
	padding: 6px 12px 10px; background: #fff;
}
.elf-aicb-credit a { color: var(--elf-aicb-muted); text-decoration: none; }
.elf-aicb-credit a:hover { text-decoration: underline; }

@media (max-width: 480px) {
	.elf-aicb-panel {
		width: 100vw; height: 100dvh; max-height: 100dvh;
		right: 0; left: 0; bottom: 0; border-radius: 0; border: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.elf-aicb-launcher, .elf-aicb-panel, .elf-aicb-typing span { transition: none; animation: none; }
}
