#ai-agent-root {
	--ai-agent-color: #4F46E5;
	--ai-agent-button-color: var(--ai-agent-color);
	--ai-agent-radius: 18px;
	--ai-agent-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	position: fixed;
	z-index: 999999;
	bottom: 24px;
	right: 24px;
	font-family: var(--ai-agent-font);
}

/* Bulle flottante */
#ai-agent-root .ai-agent-bubble {
	width: 60px;
	height: 60px;
	min-width: 60px;
	min-height: 60px;
	padding: 0;
	border-radius: 999px !important;
	background: var(--ai-agent-button-color) !important;
	background-color: var(--ai-agent-button-color) !important;
	background-image: none !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	border: 0 !important;
	color: #fff !important;
	appearance: none;
	-webkit-appearance: none;
}

#ai-agent-root .ai-agent-bubble:hover,
#ai-agent-root .ai-agent-bubble:focus {
	background: var(--ai-agent-button-color) !important;
	background-color: var(--ai-agent-button-color) !important;
	background-image: none !important;
	color: #fff !important;
	outline: none;
	transform: scale(1.06);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

#ai-agent-root .ai-agent-bubble svg {
	width: 26px;
	height: 26px;
	fill: #fff !important;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.ai-agent-bubble .ai-agent-icon-close {
	position: absolute;
	opacity: 0;
	transform: rotate(-45deg);
}

#ai-agent-root.is-open .ai-agent-bubble .ai-agent-icon-chat {
	opacity: 0;
	transform: rotate(45deg);
}

#ai-agent-root.is-open .ai-agent-bubble .ai-agent-icon-close {
	opacity: 1;
	transform: rotate(0deg);
}

/* Panneau de chat */
.ai-agent-panel {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 140px);
	background: #ffffff;
	border-radius: var(--ai-agent-radius);
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

#ai-agent-root.is-open .ai-agent-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* En-tête */
.ai-agent-header {
	background: var(--ai-agent-color);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.ai-agent-header-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.25);
	overflow: hidden;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
}

.ai-agent-header-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ai-agent-header-text {
	line-height: 1.25;
}

.ai-agent-header-name {
	font-weight: 600;
	font-size: 14.5px;
}

.ai-agent-header-status {
	font-size: 12px;
	opacity: 0.85;
	display: flex;
	align-items: center;
	gap: 5px;
}

.ai-agent-header-status::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

#ai-agent-root.is-offline .ai-agent-header .ai-agent-header-status::before {
	background: #ef4444 !important;
}

.ai-agent-sleep-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 2px;
	padding: 1px 4px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.3;
}

/* Messages */
.ai-agent-messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafafa;
}

.ai-agent-msg {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.ai-agent-msg--assistant {
	align-self: flex-start;
	background: #fff;
	color: #1f2937;
	border: 1px solid #eee;
	border-bottom-left-radius: 4px;
}

.ai-agent-msg--license {
	max-width: 88%;
}

.ai-agent-license-link {
	display: inline-flex;
	align-items: center;
	margin-top: 8px;
	padding: 8px 10px;
	border-radius: 999px;
	background: var(--ai-agent-color);
	color: #fff !important;
	font-weight: 600;
	line-height: 1;
	text-decoration: none !important;
}

.ai-agent-license-link:hover,
.ai-agent-license-link:focus {
	background: var(--ai-agent-color);
	color: #fff !important;
	text-decoration: none !important;
}

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

.ai-agent-msg--typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 12px 16px;
}

.ai-agent-msg--typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #c7c7c7;
	animation: ai-agent-bounce 1.2s infinite ease-in-out;
}

.ai-agent-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-agent-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-agent-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Zone de saisie */
.ai-agent-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #eee;
	background: #fff;
}

#ai-agent-root.is-offline .ai-agent-input-row {
	display: none !important;
}

.ai-agent-input {
	flex: 1;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	max-height: 90px;
	outline: none;
	transition: border-color 0.15s ease;
}

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

#ai-agent-root .ai-agent-send {
	width: 40px;
	height: 40px;
	min-width: 40px;
	min-height: 40px;
	padding: 0;
	border-radius: 50% !important;
	border: 0 !important;
	background: var(--ai-agent-color) !important;
	background-color: var(--ai-agent-color) !important;
	background-image: none !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: opacity 0.15s ease, transform 0.1s ease;
	color: #fff !important;
	appearance: none;
	-webkit-appearance: none;
}

.ai-agent-powered-by {
	padding: 0 12px 10px;
	background: #fff;
	color: #6b7280;
	font-size: 11px;
	line-height: 1.3;
	text-align: center;
}

.ai-agent-powered-by a {
	color: var(--ai-agent-color);
	text-decoration: none;
	font-weight: 600;
}

.ai-agent-powered-by a:hover {
	text-decoration: underline;
}

#ai-agent-root .ai-agent-send:hover,
#ai-agent-root .ai-agent-send:focus {
	background: var(--ai-agent-color) !important;
	background-color: var(--ai-agent-color) !important;
	background-image: none !important;
	color: #fff !important;
	outline: none;
	transform: scale(1.05);
}

#ai-agent-root .ai-agent-send:disabled {
	opacity: 0.5;
	cursor: default;
	transform: none;
}

#ai-agent-root .ai-agent-send svg {
	width: 17px;
	height: 17px;
	fill: #fff !important;
	margin-left: -1px;
}

@media (max-width: 480px) {
	#ai-agent-root {
		bottom: 16px;
		right: 16px;
	}
	.ai-agent-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 120px);
		bottom: 64px;
	}
	#ai-agent-root .ai-agent-bubble {
		width: 50px;
		height: 50px;
		min-width: 50px;
		min-height: 50px;
		border-radius: 999px;
	}
	#ai-agent-root .ai-agent-bubble svg {
		width: 22px;
		height: 22px;
	}
}

.ai-agent-link-button{display:inline-flex;align-items:center;justify-content:center;margin:6px 4px 2px 0;padding:9px 14px;border-radius:7px;background:var(--ai-agent-color,#f27835);color:#fff!important;text-decoration:none!important;font-weight:600;line-height:1.3;overflow-wrap:anywhere}.ai-agent-link-button:hover,.ai-agent-link-button:focus{filter:brightness(.93);color:#fff!important}.ai-agent-msg--assistant{white-space:normal}

.ai-agent-conversation-ended{display:grid;gap:8px;margin:12px 0;padding:12px;border:1px solid #e5e7eb;border-radius:8px;background:#f8fafc;color:#475569;font-size:12px}.ai-agent-new-conversation{justify-self:start;padding:7px 11px;border:0;border-radius:6px;background:var(--ai-agent-color,#f27835);color:#fff;font:inherit;font-weight:600;cursor:pointer}.ai-agent-new-conversation:hover{filter:brightness(.94)}
