/* Assistant formation Ambient IT (voir ambient-assistant.php). Couleurs reprises des options Divi du site. */
#aa-root {
	--aa-accent: #3d4093;
	--aa-accent-dark: #2c2e6e;
	--aa-accent-soft: #eef0fb;
	--aa-secondary: #2ea3f2;
	--aa-text: #2b2b33;
	--aa-muted: #6b6f80;
	--aa-border: #e2e4ee;
	--aa-bg: #ffffff;
	--aa-bg-log: #f6f7fb;
	--aa-shadow: 0 12px 40px rgba(28, 30, 70, 0.22);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.45;
	color: var(--aa-text);
}

#aa-root *,
#aa-root *::before,
#aa-root *::after {
	box-sizing: border-box;
}

#aa-root [hidden] {
	display: none !important;
}

/* Bouton flottant */
#aa-root .aa-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999990;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--aa-accent);
	box-shadow: var(--aa-shadow);
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease;
}

#aa-root .aa-launcher:hover {
	background: var(--aa-accent-dark);
	transform: scale(1.06);
}

#aa-root .aa-launcher svg {
	width: 28px;
	height: 28px;
	margin: auto;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

#aa-root .aa-launcher .aa-icon-close,
#aa-root.aa-open .aa-launcher .aa-icon-chat {
	display: none;
}

#aa-root.aa-open .aa-launcher .aa-icon-close {
	display: block;
}

/* Bulle d'accroche */
#aa-root .aa-teaser {
	position: fixed;
	right: 20px;
	bottom: 92px;
	z-index: 999990;
	display: flex;
	align-items: flex-start;
	max-width: 280px;
	border-radius: 14px 14px 4px 14px;
	background: var(--aa-bg);
	box-shadow: var(--aa-shadow);
	animation: aa-pop 0.35s ease both;
}

#aa-root .aa-teaser-text {
	flex: 1;
	padding: 14px 4px 14px 16px;
	border: 0;
	background: none;
	font: inherit;
	font-weight: 600;
	font-size: 15px;
	text-align: left;
	color: var(--aa-accent);
	cursor: pointer;
}

#aa-root .aa-teaser-close {
	padding: 6px 10px;
	border: 0;
	background: none;
	font-size: 18px;
	line-height: 1;
	color: var(--aa-muted);
	cursor: pointer;
}

/* Panneau */
#aa-root .aa-panel {
	position: fixed;
	right: 20px;
	bottom: 92px;
	z-index: 999991;
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(620px, calc(100vh - 120px));
	overflow: hidden;
	border-radius: 16px;
	background: var(--aa-bg);
	box-shadow: var(--aa-shadow);
	animation: aa-pop 0.25s ease both;
}

#aa-root .aa-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: linear-gradient(135deg, var(--aa-accent), var(--aa-accent-dark));
	color: #fff;
}

#aa-root .aa-titles {
	flex: 1;
}

#aa-root .aa-title {
	font-weight: 700;
	font-size: 16px;
}

#aa-root .aa-subtitle {
	font-size: 12.5px;
	opacity: 0.9;
}

#aa-root .aa-subtitle a {
	color: #fff;
	font-weight: 600;
	text-decoration: underline;
}

#aa-root .aa-restart {
	display: flex;
	padding: 4px;
	border: 0;
	border-radius: 6px;
	background: none;
	cursor: pointer;
	opacity: 0.85;
}

#aa-root .aa-restart:hover {
	background: rgba(255, 255, 255, 0.15);
	opacity: 1;
}

#aa-root .aa-restart svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: #fff;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

#aa-root .aa-close {
	padding: 0 4px;
	border: 0;
	background: none;
	font-size: 26px;
	line-height: 1;
	color: #fff;
	cursor: pointer;
}

/* Conversation */
#aa-root .aa-log {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--aa-bg-log);
}

#aa-root .aa-msg {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
	animation: aa-fade 0.2s ease both;
}

#aa-root .aa-msg p {
	margin: 0 0 6px;
	padding: 0;
}

#aa-root .aa-bot {
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	background: var(--aa-bg);
	border: 1px solid var(--aa-border);
}

#aa-root .aa-bot a {
	color: var(--aa-accent);
}

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

#aa-root .aa-typing {
	display: flex;
	gap: 4px;
	padding: 14px;
}

#aa-root .aa-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--aa-muted);
	animation: aa-dot 1s infinite ease-in-out;
}

#aa-root .aa-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

#aa-root .aa-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

#aa-root .aa-dates {
	margin: 0 0 6px;
	padding-left: 18px;
}

/* Fiches formation */
#aa-root .aa-cards {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 4px;
}

#aa-root .aa-card {
	padding: 8px 10px;
	border: 1px solid var(--aa-border);
	border-radius: 10px;
	background: var(--aa-bg-log);
}

#aa-root .aa-card-title {
	display: block;
	font-weight: 700;
	color: var(--aa-accent);
	text-decoration: none;
}

#aa-root .aa-card-title:hover {
	text-decoration: underline;
}

#aa-root .aa-card-meta,
#aa-root .aa-card-date {
	margin-top: 2px;
	font-size: 12.5px;
	color: var(--aa-muted);
}

#aa-root .aa-badge {
	display: inline-block;
	padding: 0 6px;
	border-radius: 4px;
	background: var(--aa-secondary);
	font-size: 11px;
	font-weight: 700;
	color: #fff;
}

#aa-root .aa-card-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 6px;
}

#aa-root .aa-card-btn {
	padding: 4px 10px;
	border: 0;
	border-radius: 6px;
	background: var(--aa-accent);
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	color: #fff;
	cursor: pointer;
}

#aa-root .aa-card-btn:hover {
	background: var(--aa-accent-dark);
}

#aa-root .aa-card-link {
	font-size: 12.5px;
}

/* Réponses rapides : chaque ligne s'étire sur toute la largeur, pour qu'aucun bouton ne reste seul dans un coin */
#aa-root .aa-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	max-height: 168px;
	padding: 0 16px;
	overflow-y: auto;
	background: var(--aa-bg-log);
}

#aa-root .aa-chips .aa-chip {
	flex: 1 1 auto;
	text-align: center;
}

/* Longue liste de choix courts (domaines) : colonnes égales, toute la liste visible */
#aa-root .aa-chips.aa-chips-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	max-height: none;
}

#aa-root .aa-chips.aa-chips-grid .aa-chip {
	padding-right: 4px;
	padding-left: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
}

#aa-root .aa-chips:not(:empty) {
	padding: 6px 16px 10px;
	border-top: 1px solid var(--aa-border);
}

#aa-root .aa-chip {
	flex: none;
	padding: 5px 11px;
	border: 1.5px solid var(--aa-accent);
	border-radius: 999px;
	background: var(--aa-bg);
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	white-space: nowrap;
	color: var(--aa-accent);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

#aa-root .aa-chip:hover,
#aa-root .aa-chip:focus-visible {
	background: var(--aa-accent);
	color: #fff;
}

/* Saisie */
#aa-root .aa-input {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 10px 12px;
	border-top: 1px solid var(--aa-border);
	background: var(--aa-bg);
}

#aa-root .aa-input input {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--aa-border);
	border-radius: 10px;
	background: var(--aa-bg);
	font: inherit;
	font-size: 16px;
	color: var(--aa-text);
}

#aa-root .aa-input input:focus {
	outline: 2px solid var(--aa-accent-soft);
	border-color: var(--aa-accent);
}

#aa-root .aa-send {
	flex: none;
	width: 42px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: var(--aa-accent);
	cursor: pointer;
}

#aa-root .aa-send svg {
	width: 20px;
	height: 20px;
	margin: auto;
	fill: #fff;
}

#aa-root .aa-note {
	padding: 0 12px 8px;
	background: var(--aa-bg);
	font-size: 11px;
	text-align: center;
	color: var(--aa-muted);
}

#aa-root .aa-note a {
	color: var(--aa-muted);
}

/* Formulaire de coordonnées */
#aa-root .aa-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 250px;
	margin: 0;
}

#aa-root .aa-recap {
	padding: 6px 8px;
	border-radius: 6px;
	background: var(--aa-accent-soft);
	font-size: 12.5px;
	font-weight: 600;
	color: var(--aa-accent);
}

#aa-root .aa-field {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin: 0;
	font-size: 12.5px;
	font-weight: 600;
}

#aa-root .aa-field input,
#aa-root .aa-field textarea,
#aa-root .aa-field select {
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid var(--aa-border);
	border-radius: 8px;
	background: var(--aa-bg);
	font: inherit;
	font-size: 16px;
	font-weight: 400;
	color: var(--aa-text);
}

#aa-root .aa-field textarea {
	resize: vertical;
}

/* Société : suggestions au fil de la saisie */
#aa-root .aa-company-list {
	max-height: 220px;
	margin-top: 2px;
	overflow-y: auto;
	border: 1px solid var(--aa-border);
	border-radius: 8px;
	background: var(--aa-bg);
	box-shadow: 0 6px 16px rgba(28, 30, 70, 0.12);
	font-weight: 400;
}

#aa-root .aa-company-option,
#aa-root .aa-company-empty {
	padding: 7px 10px;
	font-size: 12.5px;
	color: var(--aa-text);
}

#aa-root .aa-company-option {
	cursor: pointer;
}

#aa-root .aa-company-option + .aa-company-option {
	border-top: 1px solid var(--aa-border);
}

#aa-root .aa-company-option:hover,
#aa-root .aa-company-option.aa-active {
	background: var(--aa-accent-soft);
}

#aa-root .aa-company-option strong {
	color: var(--aa-accent);
}

#aa-root .aa-company-option span {
	display: block;
	color: var(--aa-muted);
}

#aa-root .aa-company-empty {
	color: var(--aa-muted);
}

#aa-root .aa-company-ok {
	font-weight: 600;
	color: #2e7d32;
}

#aa-root .aa-company-ok:empty {
	display: none;
}

/* Calendrier des sessions */
#aa-root .aa-cal {
	margin-top: 6px;
	padding: 8px;
	border: 1px solid var(--aa-border);
	border-radius: 10px;
	background: var(--aa-bg);
}

#aa-root .aa-cal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
	font-weight: 700;
}

#aa-root .aa-cal-head span:first-letter {
	text-transform: uppercase;
}

#aa-root .aa-cal-head button {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	font-size: 20px;
	line-height: 1;
	color: var(--aa-accent);
	cursor: pointer;
}

#aa-root .aa-cal-head button:disabled {
	opacity: 0.25;
	cursor: default;
}

#aa-root .aa-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 3px 0;
	text-align: center;
	font-size: 12.5px;
}

#aa-root .aa-cal-weekday {
	padding: 2px 0;
	font-weight: 600;
	color: var(--aa-muted);
}

#aa-root .aa-cal-day {
	padding: 6px 0;
	border-radius: 6px;
	color: var(--aa-muted);
}

#aa-root button.aa-cal-day {
	border: 0;
	font: inherit;
	font-size: 12.5px;
	cursor: pointer;
}

/* Une session = une bande continue, du premier au dernier jour */
#aa-root .aa-cal-on {
	border-radius: 0;
	background: var(--aa-accent-soft);
	font-weight: 600;
	color: var(--aa-accent);
}

#aa-root .aa-cal-first {
	border-top-left-radius: 8px;
	border-bottom-left-radius: 8px;
}

#aa-root .aa-cal-last {
	border-top-right-radius: 8px;
	border-bottom-right-radius: 8px;
}

/* Survol : un peu plus marqué ; bleu plein seulement pour la session choisie */
#aa-root .aa-cal-on.aa-cal-hover {
	background: #d9dcf4;
}

#aa-root .aa-cal-on.aa-cal-selected {
	background: var(--aa-accent);
	color: #fff;
}

/* Liste des sessions de la période, sous le calendrier */
#aa-root .aa-cal-sessions {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--aa-border);
}

#aa-root .aa-cal-session {
	padding: 6px 8px;
	border: 1px solid var(--aa-border);
	border-radius: 8px;
	background: var(--aa-bg-log);
	font: inherit;
	font-size: 12.5px;
	text-align: left;
	color: var(--aa-text);
	cursor: pointer;
}

#aa-root .aa-cal-session strong {
	color: var(--aa-accent);
}

#aa-root .aa-cal-session span {
	white-space: nowrap;
	color: var(--aa-muted);
}

#aa-root .aa-cal-session.aa-cal-hover {
	border-color: var(--aa-accent);
	background: var(--aa-accent-soft);
}

#aa-root .aa-cal-session.aa-cal-selected {
	border-color: var(--aa-accent);
	background: var(--aa-accent);
}

#aa-root .aa-cal-session.aa-cal-selected strong,
#aa-root .aa-cal-session.aa-cal-selected span {
	color: #fff;
}

/* Date souhaitée */
#aa-root .aa-date-line {
	display: flex;
	gap: 8px;
	margin-top: 6px;
}

#aa-root .aa-date {
	flex: 1;
	min-width: 0;
	padding: 6px 8px;
	border: 1px solid var(--aa-border);
	border-radius: 8px;
	font: inherit;
	font-size: 16px;
}

#aa-root .aa-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

#aa-root .aa-error {
	margin: 0;
	font-size: 12.5px;
	color: #c0392b;
}

#aa-root .aa-error:empty {
	display: none;
}

#aa-root .aa-submit {
	padding: 10px;
	border: 0;
	border-radius: 8px;
	background: var(--aa-accent);
	font: inherit;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
}

#aa-root .aa-submit:disabled {
	opacity: 0.6;
	cursor: wait;
}

#aa-root .aa-legal {
	margin: 0;
	font-size: 11px;
	color: var(--aa-muted);
}

#aa-root button:focus-visible,
#aa-root a:focus-visible {
	outline: 2px solid var(--aa-secondary);
	outline-offset: 2px;
}

/* Mobile : le panneau occupe tout l'écran */
@media (max-width: 600px) {
	#aa-root .aa-launcher {
		right: 16px;
		bottom: 16px;
		width: 56px;
		height: 56px;
	}

	#aa-root .aa-teaser {
		right: 16px;
		bottom: 82px;
		max-width: calc(100vw - 32px);
	}

	#aa-root .aa-panel {
		inset: 0;
		width: auto;
		height: auto;
		border-radius: 0;
	}

	#aa-root.aa-open .aa-launcher {
		display: none;
	}

	/* Page bloquée derrière le panneau plein écran */
	html.aa-scroll-lock,
	html.aa-scroll-lock body {
		overflow: hidden !important;
	}

	/* Cibles tactiles d'au moins 36 px */
	#aa-root .aa-chip,
	#aa-root .aa-card-btn {
		min-height: 36px;
	}

	#aa-root .aa-card-link {
		display: inline-flex;
		align-items: center;
		min-height: 36px;
	}

	#aa-root .aa-close,
	#aa-root .aa-restart,
	#aa-root .aa-teaser-close {
		min-width: 36px;
		min-height: 36px;
		justify-content: center;
		align-items: center;
	}

	#aa-root .aa-close {
		display: flex;
	}
}

#aa-root .aa-panel:focus {
	outline: none;
}

@keyframes aa-pop {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes aa-fade {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes aa-dot {
	0%, 80%, 100% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	40% {
		opacity: 1;
		transform: scale(1);
	}
}

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