.schl-widget-root {
	--schl-primary: #2563eb;
	--schl-secondary: #3b82f6;
	--schl-bot-bubble: #f1f5f9;
	--schl-user-bubble: #2563eb;
	--schl-font: system-ui, -apple-system, sans-serif;
	position: fixed;
	z-index: 999999;
	font-family: var(--schl-font);
}

.schl-widget-root * { box-sizing: border-box; }

.schl-widget-root.schl-pos-bottom-right { right: 20px; bottom: 20px; }
.schl-widget-root.schl-pos-bottom-left { left: 20px; bottom: 20px; }
.schl-widget-root.schl-pos-fullscreen { right: 16px; bottom: 16px; }

.schl-toggle-btn {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--schl-primary), var(--schl-secondary));
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0,0,0,.2);
	font-size: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease;
}
.schl-toggle-btn:hover { transform: scale(1.06); }

.schl-panel {
	position: absolute;
	bottom: 74px;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0,0,0,.22);
	border: 1px solid #e2e8f0;
	display: none;
	flex-direction: column;
	overflow: hidden;
}
.schl-widget-root.schl-pos-bottom-right .schl-panel { right: 0; }
.schl-widget-root.schl-pos-bottom-left .schl-panel { left: 0; }
.schl-widget-root.schl-pos-fullscreen .schl-panel {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	border-radius: 0;
	bottom: 0;
}
.schl-widget-root.schl-open .schl-panel { display: flex; }
.schl-widget-root.schl-open .schl-toggle-btn.schl-btn-open-icon { display: none; }

.schl-header {
	background: linear-gradient(135deg, var(--schl-primary), var(--schl-secondary));
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}
.schl-header-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255,255,255,.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
}
.schl-header-text { flex: 1; min-width: 0; }
.schl-header-text h3 { font-size: 15px; font-weight: 600; margin: 0; line-height: 1.3; }
.schl-header-text p { font-size: 11px; opacity: .9; margin: 2px 0 0; display: flex; align-items: center; gap: 5px; }
.schl-offline-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.schl-close-btn {
	background: rgba(255,255,255,.15);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 16px;
	flex-shrink: 0;
}

.schl-messages {
	flex: 1;
	padding: 14px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfc;
}

.schl-msg {
	max-width: 85%;
	padding: 10px 14px;
	font-size: 13.5px;
	line-height: 1.5;
	word-wrap: break-word;
	animation: schl-fade-in .18s ease;
}
@keyframes schl-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.schl-msg.schl-bot {
	align-self: flex-start;
	background: var(--schl-bot-bubble);
	color: #1e293b;
	border: 1px solid #e2e8f0;
}
.schl-msg.schl-user {
	align-self: flex-end;
	background: var(--schl-user-bubble);
	color: #fff;
}

/* Formes de bulles */
.schl-shape-rounded .schl-msg.schl-bot { border-radius: 16px 16px 16px 4px; }
.schl-shape-rounded .schl-msg.schl-user { border-radius: 16px 16px 4px 16px; }
.schl-shape-soft .schl-msg { border-radius: 12px; }
.schl-shape-pill .schl-msg { border-radius: 999px; }
.schl-shape-compact .schl-msg { border-radius: 6px; padding: 7px 10px; font-size: 13px; }

.schl-msg strong { font-weight: 700; }
.schl-msg em { font-style: italic; }

.schl-msg-time { font-size: 10px; opacity: .55; margin-top: 4px; }
.schl-badge {
	margin-top: 6px;
	font-size: 10px;
	color: #065f46;
	background: #d1fae5;
	padding: 2px 8px;
	border-radius: 4px;
	display: inline-block;
	font-weight: 600;
}
.schl-source-tag {
	margin-top: 6px;
	font-size: 10px;
	background: rgba(37,99,235,.1);
	color: var(--schl-primary);
	padding: 2px 8px;
	border-radius: 4px;
	display: inline-block;
}

.schl-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 14px;
	background: var(--schl-bot-bubble);
	border: 1px solid #e2e8f0;
	border-radius: 16px 16px 16px 4px;
}
.schl-typing span {
	width: 6px; height: 6px; border-radius: 50%;
	background: #94a3b8;
	animation: schl-bounce 1.2s infinite ease-in-out;
}
.schl-typing span:nth-child(2) { animation-delay: .15s; }
.schl-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes schl-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.schl-starters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 12px;
}
.schl-starter-btn {
	background: #fff;
	border: 1px solid #cbd5e1;
	color: var(--schl-primary);
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 11.5px;
	cursor: pointer;
	transition: all .15s ease;
}
.schl-starter-btn:hover { background: #eff6ff; border-color: var(--schl-primary); }

.schl-input-area {
	padding: 10px 12px;
	border-top: 1px solid #e2e8f0;
	background: #fff;
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}
.schl-input {
	flex: 1;
	border: 1px solid #cbd5e1;
	border-radius: 24px;
	padding: 10px 16px;
	font-size: 13.5px;
	outline: none;
	font-family: inherit;
}
.schl-input:focus { border-color: var(--schl-primary); }
.schl-send-btn {
	background: var(--schl-primary);
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 38px;
	height: 38px;
	cursor: pointer;
	flex-shrink: 0;
	font-size: 16px;
}
.schl-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.schl-footer-note {
	text-align: center;
	font-size: 10px;
	color: #94a3b8;
	padding: 4px 0 8px;
}

@media (max-width: 480px) {
	.schl-widget-root.schl-pos-bottom-right,
	.schl-widget-root.schl-pos-bottom-left {
		right: 12px;
		left: 12px;
	}
	.schl-panel { width: auto; }
}

/* =========================================================================
   Aperçu en direct dans le builder frontend (.schl-preview-instance)
   ========================================================================= */
.schl-widget-root.schl-preview-instance {
	position: relative !important;
	inset: 0;
	width: 100%;
	height: 100%;
}
.schl-widget-root.schl-preview-instance .schl-panel {
	position: static;
	display: flex;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	border-radius: 14px;
}
