/*
 * Fond personnalisé de la fenêtre de discussion (module « Fond »).
 * Chargé seulement quand un fond est activé ; les variables --aicb-bg-color, --aicb-bg-image et
 * --aicb-header-bg sont définies juste après ce fichier.
 */

/* Le fond couvre toute la fenêtre, en-tête compris (visible à travers un en-tête translucide). */
#aicb-root .aicb-panel {
	background-color: var(--aicb-bg-color, #fff);
	background-image: var(--aicb-bg-image, none);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
#aicb-root .aicb-header {
	background: var(--aicb-header-bg, var(--aicb-primary));
	border-bottom: 1px solid var(--aicb-header-line, #d1d5db); /* séparation visible quand l'en-tête est translucide */
}
/* Icônes de l'en-tête (enveloppe, corbeille, croix) : couleur lisible sur la couleur réelle de l'en-tête. */
#aicb-root .aicb-header .aicb-icon-btn { color: var(--aicb-header-on, var(--aicb-on-primary)); }
#aicb-root .aicb-header .aicb-icon-btn svg { fill: var(--aicb-header-on, var(--aicb-on-primary)) !important; }
#aicb-root .aicb-header .aicb-icon-btn:focus-visible { outline-color: var(--aicb-header-on, var(--aicb-on-primary)); }
#aicb-root .aicb-header .aicb-icon-btn[data-aicb="close"] { border-color: var(--aicb-header-on, var(--aicb-on-primary)); }
#aicb-root .aicb-messages,
#aicb-root .aicb-contact { background: transparent; }
/* Barre du bas : couleur du bot, même opacité que l'en-tête (contour des boutons d'envoi : Habillage → Boutons d'envoi). */
#aicb-root .aicb-composer {
	background: var(--aicb-header-bg, var(--aicb-primary));
	border-top-color: var(--aicb-header-line, #d1d5db);
}

/* Textes en pastilles blanches : lisibles sur n'importe quel fond. */
#aicb-root .aicb-contact-title {
	align-self: center;
	width: fit-content;
	max-width: 100%;
	box-sizing: border-box;
	padding: 4px 12px;
	background: #fff;
	border: 1px solid var(--aicb-border);
	border-radius: 10px;
}
#aicb-root .aicb-contact-intro,
#aicb-root .aicb-contact-consent,
#aicb-root .aicb-contact-error,
#aicb-root .aicb-contact-status {
	background: #fff;
	border: 1px solid var(--aicb-border);
	border-radius: 10px;
	padding: 6px 10px;
}
#aicb-root .aicb-contact-row label,
#aicb-root .aicb-contact-privacy {
	align-self: flex-start;
	width: fit-content;
	max-width: 100%;
	box-sizing: border-box;
	padding: 3px 10px;
	background: #fff;
	border: 1px solid var(--aicb-border);
	border-radius: 10px;
}
#aicb-root .aicb-msg-note {
	padding: 3px 12px;
	background: #fff;
	border: 1px solid var(--aicb-border);
	border-radius: 999px;
}
/* Mention IA et signature : dans la continuité de la barre du bas (même couleur et opacité),
   la couleur du chatbot va ainsi jusqu'en bas de la fenêtre. */
#aicb-root .aicb-ai-notice,
#aicb-root .aicb-powered {
	align-self: stretch;
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0 10px 6px;
	background: var(--aicb-header-bg, var(--aicb-primary));
	color: var(--aicb-header-on, var(--aicb-on-primary));
	border: 0;
	border-radius: 0;
}
#aicb-root .aicb-ai-notice + .aicb-powered { margin-top: 0; }
#aicb-root .aicb-ai-notice a,
#aicb-root .aicb-ai-notice a:hover,
#aicb-root .aicb-powered a { color: inherit; }
#aicb-root .aicb-feedback {
	margin: 0 10px 6px;
	border: 1px solid var(--aicb-border);
	border-radius: 10px;
	background: #fff;
}

@media (max-width: 480px), (max-width: 1024px) and (pointer: coarse) {
	/* Sauf l'aperçu en direct d'Habillage (.aicb-try) : fenêtre d'ordinateur, image comme sur ordinateur. */
	/* Plein écran mobile : la barre d'adresse qui apparaît/disparaît change la hauteur de la fenêtre.
	   L'image est posée sur un calque de hauteur fixe (écran maximal) : elle ne se redimensionne plus,
	   seul son bas est masqué quand la barre est visible. */
	#aicb-root:where(:not(.aicb-try)) .aicb-panel { background-image: none; isolation: isolate; }
	#aicb-root:where(:not(.aicb-try)) .aicb-panel::before {
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 100vh;
		height: 100lvh;
		background-image: var(--aicb-bg-image, none);
		background-size: cover;
		background-position: var(--aicb-bg-pos-mobile, 50%) center; /* cadrage choisi dans l'administration */
		background-repeat: no-repeat;
		z-index: -1;
		pointer-events: none;
	}
	#aicb-root:where(:not(.aicb-try)).aicb-has-powered .aicb-powered,
	#aicb-root:where(:not(.aicb-try)).aicb-has-powered .aicb-ai-notice:last-child,
	#aicb-root:where(:not(.aicb-try)) .aicb-has-powered .aicb-powered,
	#aicb-root:where(:not(.aicb-try)) .aicb-has-powered .aicb-ai-notice:last-child {
		margin-bottom: 0;
		padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); /* la couleur descend jusqu'au bord de l'écran */
	}
}
