/* Suitepay Chat — widget visiteur (style Crisp, violet) */
:root {
	--spc-primary: #6A2FF6;
	--spc-primary-dark: #5B1DD9;
	--spc-radius: 24px;
}

#spc-root {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}
#spc-root * { box-sizing: border-box; }

/* ------------------------------------------------------------------ */
/* Bouton flottant                                                     */
/* ------------------------------------------------------------------ */
.spc-launcher {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 66px;
	height: 66px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: linear-gradient(135deg, var(--spc-primary), var(--spc-primary-dark));
	color: #fff;
	box-shadow: 0 8px 24px rgba(80, 30, 180, 0.45), 0 0 0 6px rgba(106, 47, 246, 0.10);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	animation: spc-pop 0.35s ease;
}
.spc-launcher:hover { transform: scale(1.05); }
.spc-launcher .spc-icon-close { display: none; }
.spc-launcher.spc-open .spc-icon-chat { display: none; }
.spc-launcher.spc-open .spc-icon-close { display: block; }
@keyframes spc-pop {
	from { transform: scale(0); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Panneau                                                             */
/* ------------------------------------------------------------------ */
.spc-panel {
	position: absolute;
	bottom: 84px;
	right: 0;
	width: 400px;
	max-width: calc(100vw - 32px);
	height: 700px;
	max-height: calc(100vh - 140px);
	background: #fff;
	border-radius: var(--spc-radius);
	box-shadow: 0 16px 60px rgba(30, 10, 80, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: scale(0.9);
	transform-origin: bottom right;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.spc-panel.spc-open {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

/* ------------------------------------------------------------------ */
/* En-tête violet (dégradé + motif discret)                            */
/* ------------------------------------------------------------------ */
.spc-header {
	position: relative;
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M36 6l6 12-6 12-6-12zM36 42l6 12-6 12-6-12zM6 24l12 6-12 6-6-6zM54 24l12 6-12 6-6-6z' fill='%23ffffff' fill-opacity='0.045'/%3E%3C/svg%3E"),
		linear-gradient(165deg, var(--spc-primary) 0%, var(--spc-primary-dark) 100%);
	color: #fff;
	padding: 16px 20px 22px;
	text-align: center;
	flex-shrink: 0;
}
.spc-header-top {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	margin-bottom: 16px;
}
.spc-header-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: rgba(0, 0, 0, 0.18);
	box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 999px;
	padding: 8px 22px;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
}
.spc-minimize {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.9);
	cursor: pointer;
	padding: 6px;
	display: flex;
	border-radius: 8px;
	transition: background 0.15s ease;
}
.spc-minimize:hover { background: rgba(255, 255, 255, 0.14); }

.spc-header-avatars {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-bottom: 14px;
}
.spc-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
	border: 3px solid rgba(255, 255, 255, 0.9);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	margin-right: -10px;
	background: #fff;
	position: relative;
	z-index: 2;
}
.spc-avatar-fallback {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 24px;
	color: var(--spc-primary);
}
.spc-avatar-logo {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--spc-primary-dark);
	border: 3px solid rgba(255, 255, 255, 0.9);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 22px;
	z-index: 1;
}
.spc-avatar-logo img { width: 60%; height: 60%; object-fit: contain; }

.spc-header-title {
	font-weight: 800;
	font-size: 22px;
	letter-spacing: -0.01em;
	margin-bottom: 6px;
}
.spc-header-status {
	font-size: 14px;
	opacity: 0.95;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
}
.spc-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	display: inline-block;
}
.spc-dot-on {
	background: #35d475;
	animation: spc-pulse 2s infinite;
}
.spc-dot-off { background: #f0a13a; box-shadow: 0 0 0 3px rgba(240, 161, 58, 0.25); }
@keyframes spc-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(53, 212, 117, 0.55); }
	70%  { box-shadow: 0 0 0 7px rgba(53, 212, 117, 0); }
	100% { box-shadow: 0 0 0 0 rgba(53, 212, 117, 0); }
}

/* ------------------------------------------------------------------ */
/* Zone de conversation                                                */
/* ------------------------------------------------------------------ */
.spc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: #fff;
	scroll-behavior: smooth;
}
.spc-msg {
	margin-bottom: 14px;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	animation: spc-msg-in 0.25s ease;
}
@keyframes spc-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}
.spc-msg-side {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--spc-primary);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	overflow: hidden;
}
.spc-msg-side img { width: 100%; height: 100%; object-fit: cover; }
.spc-msg-body { max-width: 82%; display: flex; flex-direction: column; }
.spc-bubble {
	padding: 14px;
	border-radius: 18px;
	word-wrap: break-word;
	white-space: pre-line;
}
.spc-msg-bot .spc-bubble,
.spc-msg-agent .spc-bubble {
	background: #f0f2f7;
	color: #2b2b3d;
	border-bottom-left-radius: 6px;
}
.spc-msg-visitor { justify-content: flex-end; }
.spc-msg-visitor .spc-msg-body { align-items: flex-end; }
.spc-msg-visitor .spc-bubble {
	background: linear-gradient(135deg, var(--spc-primary), var(--spc-primary-dark));
	color: #fff;
	border-bottom-right-radius: 6px;
}
.spc-msg-name {
	font-size: 12px;
	color: #8a8aa3;
	margin: 0 0 3px 6px;
	font-weight: 600;
}
.spc-msg-time {
	font-size: 11px;
	color: #b6b6c9;
	margin-top: 3px;
	padding: 0 6px;
}
.spc-msg-visitor .spc-msg-time { text-align: right; }

/* Questions fréquentes cliquables */
.spc-quick {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	margin: 2px 0 16px 40px;
	animation: spc-msg-in 0.25s ease;
}
.spc-quick button {
	font-family: inherit;
	font-size: 13.5px;
	line-height: 1.35;
	text-align: left;
	color: #2b2b3d;
	background: #f0f2f7;
	border: none;
	border-radius: 18px;
	padding: 12px 14px;
	cursor: pointer;
	max-width: 100%;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.spc-quick button:hover {
	background: var(--spc-primary);
	color: #fff;
	transform: scale(1.03);
	box-shadow: 0 4px 14px rgba(106, 47, 246, 0.25);
}

/* Indicateur de frappe */
.spc-typing .spc-bubble { display: inline-flex; gap: 4px; padding: 15px 16px; }
.spc-typing .spc-bubble span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b0b0c4;
	animation: spc-bounce 1.2s infinite;
}
.spc-typing .spc-bubble span:nth-child(2) { animation-delay: 0.15s; }
.spc-typing .spc-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes spc-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30% { transform: translateY(-5px); }
}

/* ------------------------------------------------------------------ */
/* Zone de saisie                                                      */
/* ------------------------------------------------------------------ */
.spc-composer {
	flex-shrink: 0;
	padding: 12px 14px 6px;
	background: #fff;
	position: relative;
}
.spc-composer-box {
	border: 2px solid var(--spc-primary);
	border-radius: 26px;
	padding: 10px 14px 8px;
	background: #fff;
	box-shadow: 0 2px 10px rgba(106, 47, 246, 0.08);
	transition: box-shadow 0.15s ease;
}
.spc-composer-box:focus-within { box-shadow: 0 2px 16px rgba(106, 47, 246, 0.2); }
.spc-composer-box textarea {
	display: block;
	width: 100%;
	border: none;
	resize: none;
	font-family: inherit;
	font-size: 15px;
	outline: none;
	max-height: 96px;
	background: transparent;
	color: #2b2b3d;
	padding: 2px 2px 6px;
}
.spc-composer-box textarea::placeholder { color: #9d9db3; }
.spc-composer-tools {
	display: flex;
	align-items: center;
	gap: 4px;
}
.spc-tool {
	border: none;
	background: none;
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	color: #6b6b85;
	font-size: 16px;
	line-height: 1;
	display: inline-flex;
	transition: background 0.15s ease, transform 0.15s ease;
}
.spc-tool:hover { background: #f2edfd; transform: scale(1.05); }
.spc-tool[disabled] { opacity: 0.4; cursor: not-allowed; }
.spc-tool[disabled]:hover { background: none; transform: none; }
.spc-send {
	margin-left: auto;
	border: none;
	background: none;
	cursor: pointer;
	padding: 7px;
	border-radius: 10px;
	color: #b6b6c9;
	display: inline-flex;
	transition: color 0.15s ease, transform 0.2s ease, background 0.15s ease;
}
.spc-send.spc-active { color: var(--spc-primary); }
.spc-send.spc-active:hover { transform: rotate(-14deg) scale(1.08); background: #f2edfd; }

/* Champ honeypot : hors écran, invisible pour les humains */
.spc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* Palette emoji */
.spc-emoji-pop {
	position: absolute;
	bottom: 100%;
	left: 16px;
	background: #fff;
	border: 1px solid #e5e2f2;
	border-radius: 14px;
	box-shadow: 0 8px 30px rgba(30, 10, 80, 0.18);
	padding: 8px;
	display: none;
	grid-template-columns: repeat(6, 1fr);
	gap: 2px;
	z-index: 5;
}
.spc-emoji-pop.spc-show { display: grid; }
.spc-emoji-pop button {
	border: none;
	background: none;
	cursor: pointer;
	font-size: 19px;
	padding: 5px;
	border-radius: 8px;
}
.spc-emoji-pop button:hover { background: #f2edfd; }

/* Pied du widget */
.spc-footer {
	flex-shrink: 0;
	text-align: center;
	padding: 2px 16px 10px;
	background: #fff;
}
.spc-warning {
	font-size: 10.5px;
	color: #b6b6c9;
	margin: 0 0 2px;
	line-height: 1.35;
}
.spc-branding {
	font-size: 11px;
	color: #b6b6c9;
}
.spc-branding strong { color: #9d9db3; }

/* ------------------------------------------------------------------ */
/* Mobile : plein écran, comme une application native                  */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
	#spc-root { bottom: 16px; right: 16px; }
	.spc-panel.spc-open {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
		bottom: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	#spc-root * { animation: none !important; transition: none !important; }
}
