/*
 * 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-border); /* séparation visible quand l'en-tête est translucide */
}
#aicb-root .aicb-messages,
#aicb-root .aicb-contact,
#aicb-root .aicb-composer { background: transparent; }

/* 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;
}
#aicb-root .aicb-ai-notice,
#aicb-root .aicb-powered {
	align-self: center;
	width: fit-content;
	max-width: calc(100% - 24px);
	box-sizing: border-box;
	margin: 0 auto 6px;
	padding: 2px 10px;
	background: #fff;
	border: 1px solid var(--aicb-border);
	border-radius: 999px;
}
#aicb-root .aicb-ai-notice + .aicb-powered { margin-top: -2px; }
#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) {
	/* 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 .aicb-panel { background-image: none; isolation: isolate; }
	#aicb-root .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.aicb-has-powered .aicb-powered,
	#aicb-root.aicb-has-powered .aicb-ai-notice:last-child,
	#aicb-root .aicb-has-powered .aicb-powered,
	#aicb-root .aicb-has-powered .aicb-ai-notice:last-child {
		padding-bottom: 2px;
		margin-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
	}
}
