/* Scolaphoto Assistant — styles isolés (préfixe .scoa-).
   La police et la couleur sont reprises du site : police héritée du <body>,
   couleur détectée par chat.js (--scoa-color) avec texte lisible (--scoa-on-color). */
.scoa-root {
	--scoa-color: #1f6feb;
	--scoa-on-color: #fff;
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 99999;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.45;
	color: #1d2330;
}
.scoa-root *, .scoa-root *::before, .scoa-root *::after { box-sizing: border-box; }

.scoa-root button {
	font: inherit;
	margin: 0;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	min-height: 0;
	min-width: 0;
	line-height: 1;
}

/* Petit personnage rond, discret et fin */
.scoa-launcher {
	width: 66px;
	height: 66px;
	border: 0 !important;
	border-radius: 50% !important;
	padding: 0 !important;
	background: transparent !important;
	cursor: pointer;
	display: block;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .2));
	transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
	margin-left: auto;
	overflow: visible;
}
.scoa-launcher:hover { transform: scale(1.08) rotate(-5deg); }
.scoa-launcher:active { transform: scale(.94); }
/* Pas de contour violet : juste une ombre légère, et seulement en navigation clavier */
.scoa-root button:focus, .scoa-root button:focus-visible, .scoa-launcher:focus { outline: none !important; }
.scoa-root .scoa-chip:focus-visible, .scoa-root .scoa-send:focus-visible, .scoa-root .scoa-close:focus-visible, .scoa-root .scoa-teaser-text:focus-visible {
	box-shadow: 0 0 0 3px rgba(0, 0, 0, .12) !important;
}
.scoa-launcher:focus-visible { filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .35)); }

/* Le visage (logo) */
.scoa-face { width: 100%; height: 100%; display: block; overflow: visible; clip-path: circle(50%); transition: transform .35s ease-out; }
.scoa-face-bg { fill: #fff; }
.scoa-look { transition: transform .25s ease-out; }
.scoa-part { transform-box: fill-box; transform-origin: center; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.scoa-launcher:hover .scoa-brow { transform: translateY(-55px); }
.scoa-launcher:hover .scoa-smile { transform: scale(1.1); }

.scoa-wiggle .scoa-brow-l { animation: scoa-brow-up .8s ease; }
.scoa-wiggle .scoa-brow-r { animation: scoa-brow-up .8s ease .08s; }
.scoa-hop { animation: scoa-hop .7s ease; }
.scoa-thinking .scoa-head-avatar .scoa-brow-l { animation: scoa-brow-up 1s ease infinite; }
.scoa-thinking .scoa-head-avatar .scoa-brow-r { animation: scoa-brow-up 1s ease .15s infinite; }
@keyframes scoa-brow-up { 0%, 100% { transform: none; } 30%, 60% { transform: translateY(-70px); } }
/* Rebond « je suis là » */
.scoa-bounce { animation: scoa-bounce 1s cubic-bezier(.28, .84, .42, 1); }
@keyframes scoa-bounce {
	0%   { transform: translateY(0) scale(1, 1); }
	12%  { transform: translateY(0) scale(1.08, .9); }
	35%  { transform: translateY(-18px) scale(.95, 1.06); }
	55%  { transform: translateY(0) scale(1.06, .94); }
	70%  { transform: translateY(-7px) scale(.98, 1.02); }
	85%  { transform: translateY(0) scale(1.02, .98); }
	100% { transform: translateY(0) scale(1, 1); }
}
@keyframes scoa-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-9px) rotate(-8deg); } 60% { transform: translateY(0) rotate(4deg); } }

.scoa-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; background: #fff; }

/* Bulle « Une question ? » */
.scoa-teaser {
	position: absolute;
	right: 4px;
	bottom: 76px;
	display: flex;
	align-items: center;
	background: #fff;
	color: var(--scoa-color);
	border-radius: 14px 14px 4px 14px;
	transform-origin: 100% 100%;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
	white-space: nowrap;
	animation: scoa-pop .6s cubic-bezier(.3, 1.5, .5, 1), scoa-nudge 2.4s ease-in-out .9s 2;
}
.scoa-teaser.scoa-teaser-out { animation: scoa-pop-out .45s ease-in forwards; }
.scoa-teaser[hidden] { display: none; }
.scoa-teaser-text {
	background: transparent !important;
	border: 0 !important;
	color: inherit !important;
	padding: 9px 4px 9px 13px !important;
	font-size: 13.5px !important;
	font-weight: 700;
	cursor: pointer;
}
.scoa-teaser-close {
	background: transparent !important;
	border: 0 !important;
	color: #8a93a3 !important;
	padding: 6px 8px 6px 4px !important;
	cursor: pointer;
	display: flex;
}
.scoa-teaser-close svg { width: 12px; height: 12px; }
@keyframes scoa-pop { 0% { opacity: 0; transform: translateY(14px) scale(.2) rotate(8deg); } 60% { opacity: 1; transform: translateY(-4px) scale(1.06) rotate(-2deg); } 100% { opacity: 1; transform: none; } }
@keyframes scoa-nudge { 0%, 100% { transform: none; } 12% { transform: translateY(-4px) rotate(-1.5deg); } 24% { transform: none; } 36% { transform: translateY(-2px); } 48% { transform: none; } }
@keyframes scoa-pop-out { 0% { opacity: 1; transform: none; } 30% { transform: scale(1.05); } 100% { opacity: 0; transform: translateY(14px) scale(.2) rotate(8deg); } }

.scoa-open .scoa-launcher, .scoa-open .scoa-teaser { display: none; }

/* Fenêtre de discussion compacte */
.scoa-panel {
	width: 320px;
	max-width: calc(100vw - 24px);
	height: 440px;
	max-height: calc(100vh - 36px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.scoa-panel[hidden] { display: none; }

.scoa-header {
	background: var(--scoa-color);
	color: var(--scoa-on-color);
	padding: 10px 8px 10px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.scoa-title { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.scoa-head-avatar { width: 30px; height: 30px; flex: none; display: block; }
.scoa-close {
	background: transparent !important;
	border: 0 !important;
	color: inherit !important;
	cursor: pointer;
	padding: 5px !important;
	border-radius: 6px !important;
	display: flex;
}
.scoa-close svg { width: 18px; height: 18px; }
.scoa-close:hover { background: rgba(127, 127, 127, .18) !important; }

.scoa-log {
	flex: 1;
	overflow-y: auto;
	padding: 12px 12px 6px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f6f7f9;
}
.scoa-msg {
	max-width: 86%;
	padding: 8px 11px;
	border-radius: 12px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.scoa-assistant {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e3e6eb;
	border-bottom-left-radius: 4px;
}
.scoa-user {
	align-self: flex-end;
	background: var(--scoa-color);
	color: var(--scoa-on-color);
	border-bottom-right-radius: 4px;
}
.scoa-msg a { color: var(--scoa-color); text-decoration: underline; }
.scoa-user a { color: inherit; }
.scoa-msg a.scoa-link-btn {
	display: inline-block;
	margin-top: 4px;
	padding: 5px 11px;
	border-radius: 999px;
	background: var(--scoa-color);
	color: var(--scoa-on-color);
	text-decoration: none;
	font-size: 13px;
	white-space: nowrap;
}
.scoa-msg a.scoa-link-btn:hover { opacity: .9; }
.scoa-error { border-color: #f1c4c4; background: #fff6f6; }
.scoa-typing { color: #8a93a3; letter-spacing: 2px; animation: scoa-blink 1.2s infinite; }
@keyframes scoa-blink { 50% { opacity: .35; } }

.scoa-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	padding: 2px 12px 8px;
	background: #f6f7f9;
}
.scoa-chips[hidden] { display: none; }
.scoa-chip {
	background: #fff !important;
	color: #1d2330 !important;
	border: 1px solid var(--scoa-color) !important;
	border-radius: 999px !important;
	padding: 6px 10px !important;
	font-size: 12.5px !important;
	line-height: 1.2 !important;
	cursor: pointer;
	text-align: left;
}
.scoa-chip:hover { background: #f0f2f5 !important; }

.scoa-form {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 8px 10px;
	border-top: 1px solid #e3e6eb;
	background: #fff;
	margin: 0;
}
.scoa-input {
	flex: 1;
	resize: none;
	border: 1px solid #e3e6eb !important;
	border-radius: 10px !important;
	padding: 8px 10px !important;
	font-family: inherit !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	max-height: 110px;
	min-height: 36px;
	margin: 0 !important;
	background: #fff !important;
	color: #1d2330 !important;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .07) !important;
	width: auto !important;
	transition: box-shadow .2s ease;
}
/* Pas de contour quand on clique dans le champ : juste une ombre */
.scoa-root .scoa-input:focus, .scoa-root .scoa-input:focus-visible {
	outline: none !important;
	border-color: #e3e6eb !important;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .14) !important;
}
.scoa-send {
	width: 36px;
	height: 36px;
	flex: none;
	border: 0 !important;
	border-radius: 50% !important;
	padding: 0 !important;
	background: var(--scoa-color) !important;
	color: var(--scoa-on-color) !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.scoa-send svg { width: 17px; height: 17px; }
.scoa-send:disabled { opacity: .5; cursor: default; }

.scoa-note {
	font-size: 11px;
	color: #7a8291;
	padding: 0 12px 8px;
	background: #fff;
	line-height: 1.3;
}

/* Mobile : petit bouton, et la discussion s'ouvre en plein écran */
@media (max-width: 480px) {
	.scoa-root { right: 12px; bottom: 12px; }
	.scoa-launcher { width: 58px; height: 58px; }
	.scoa-teaser { bottom: 68px; }
	/* Ouverte : occupe exactement la zone visible (au-dessus du clavier quand il est ouvert) */
	.scoa-root.scoa-open {
		left: 0;
		right: 0;
		top: var(--scoa-top, 0px);
		bottom: auto;
		height: var(--scoa-h, 100%);
	}
	.scoa-open .scoa-panel {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border-radius: 0;
	}
	.scoa-open .scoa-header { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
	.scoa-open .scoa-note { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
	.scoa-open .scoa-close svg { width: 22px; height: 22px; }
	.scoa-input { font-size: 16px !important; } /* évite le zoom auto sur iPhone */
}

@media (prefers-reduced-motion: reduce) {
	.scoa-part, .scoa-teaser, .scoa-typing, .scoa-launcher { animation: none !important; transition: none !important; }
}

/* Page bloquée derrière la discussion ouverte sur mobile */
html.scoa-lock, html.scoa-lock body { overflow: hidden !important; overscroll-behavior: none; }
