/* =============================================================================
   Recherche par IA (/recherche-ia - chat.php)

   Écran conversation type messagerie : hauteur verrouillée au viewport
   (pattern .conversation-screen de middle/user/common.css, dupliqué ici sous .chat-screen -
   middle/user/common.css est la feuille de l'espace internaute, elle ne se charge pas sur
   une page marketing). Le fil (.chat-thread) est la seule zone scrollable,
   le composer reste collé en bas.

   Les bulles sont créées par chat.js → classes sémantiques définies ici
   (aucune classe Tailwind arbitraire côté JS : elles n'existeraient pas dans
   le CSS compilé). Texte assistant inséré en nœuds texte : `white-space:
   pre-wrap` restitue les retours à la ligne sans aucun HTML.

   Clavier virtuel : la page pose `interactive-widget=resizes-content` (les
   dvh rétrécissent avec le clavier - Android) ; iOS l'ignore → fallback
   visualViewport dans chat.js (height inline posée sur .chat-screen,
   prioritaire sur ces règles). Cf. .claude/documentation/CHATBOT.md.
   ========================================================================== */

.chat-screen {
	height: calc(100vh - 85px); /* fallback sans dvh */
	height: calc(100dvh - 85px); /* 85px = header sticky du site */
}
.chat-screen > .container-x {
	height: 100%;
}
/* Zones scrollables internes (fil + listes d'historique sidebar/tiroir) : le
   scroll ne se propage jamais à la page (chaining) et tirer vers le bas depuis
   le haut ne déclenche plus le pull-to-refresh de Chrome Android - un
   rechargement brutal en pleine conversation (le fil est restauré, mais la
   coupure est réelle). Même pattern que les modales/popovers de styles.css. */
.chat-thread,
[data-chat-list] {
	overscroll-behavior: contain;
}

/* Desktop : hauteur UNIQUE et explicite des deux en-têtes de la coquille
   (sidebar « Historique » en .filters-modal-header + header du panneau) -
   leurs contenus naturels divergent d'un pixel ou deux (titre 2 lignes 37px
   côté panneau vs bouton 36px côté sidebar), la hauteur fixe garantit des
   bordures horizontales alignées au pixel. 76px = hauteur du header de la
   modal filtres en desktop (20 + 36 + 20). */
@media (min-width: 768px) {
	.chat-shell .filters-modal-header,
	.chat-panel > header {
		height: 76px;
		padding-top: 0;
		padding-bottom: 0;
	}
}

/* --------------------------------------------------------------------------
   Bulles du fil
   -------------------------------------------------------------------------- */
.chat-msg {
	max-width: 85%;
	padding: 10px 14px;
	font-size: 15px;
	line-height: 22px;
	overflow-wrap: anywhere; /* une URL ou un mot interminable ne déborde pas */
}
.chat-msg-user {
	align-self: flex-end;
	background: rgb(var(--brand));
	color: #fff;
	border-radius: 14px 14px 4px 14px;
	white-space: pre-wrap;
}
.chat-msg-assistant {
	align-self: flex-start;
	background: #f2f3f5; /* surface-field */
	color: #0a0a0a; /* ink-900 */
	border-radius: 14px 14px 14px 4px;
	white-space: pre-wrap;
}
/* Écran d'accueil (aucun message) : héros centré dans l'espace du fil +
   suggestions collées en bas. Markup PHP (chat.php), restauré par
   « Nouvelle recherche ». */
.chat-welcome {
	flex: 1;
	/* min-height auto (jamais 0) : quand la hauteur manque, l'accueil garde sa
	   taille de contenu et c'est .chat-thread qui scrolle - min-height: 0
	   écraserait le héros et les cards de suggestions. */
	display: flex;
	flex-direction: column;
}
.chat-welcome-hero {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 8px;
	padding: 20px 15px;
}
.chat-welcome-icon {
	width: 48px;
	height: auto;
	margin-bottom: 8px;
}
.chat-welcome-title {
	font-size: 24px;
	line-height: 30px;
	font-weight: 700;
	color: #0a0a0a; /* ink-900 */
	max-width: 320px;
}
.chat-welcome-sub {
	font-size: 14px;
	line-height: 20px;
	color: #757575; /* ink-500 */
	max-width: 340px;
}
/* Erreur : bulle assistant en livrée d'alerte (quota, service coupé, réseau). */
/* Avertissement : bulle informative douce (conversation bientôt pleine -
   seuil WARN_MESSAGES_LEFT de chat.js sur messages_left). */
.chat-msg-notice {
	align-self: flex-start;
	background: #fffbeb;
	color: #92400e;
	border: 1px solid #fde68a;
	border-radius: 14px 14px 14px 4px;
}
.chat-msg-error {
	align-self: flex-start;
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
	border-radius: 14px 14px 14px 4px;
	white-space: pre-wrap;
}

/* Suggestions de premières demandes : cards horizontales en bas de l'accueil,
   centrées quand elles tiennent (`safe center`, comme les pistes .scroll-snap),
   scroll horizontal discret sinon. */
.chat-suggestions {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	justify-content: safe center;
	padding: 4px 2px;
	scrollbar-width: none;
}
.chat-suggestions::-webkit-scrollbar {
	display: none;
}
.chat-suggestion {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 250px;
	text-align: left;
	font-size: 13px;
	line-height: 18px;
	color: #0a0a0a;
	background: #f5f5f5; /* surface-light */
	border-radius: 12px;
	padding: 12px 14px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.chat-suggestion:hover {
	background: #eceef0;
}
.chat-suggestion > i {
	flex-shrink: 0;
	font-size: 14px;
	color: #757575; /* ink-500 */
}

/* --------------------------------------------------------------------------
   Cards prestataires injectées dans le fil (render_venue_card, event `cards`)
   Carrousel horizontal monté par chat.js : pattern standard des pages fiche -
   flèches .nav-btn [data-scroll] + piste .scroll-snap (main.js §2/§4b,
   window.initCarousels). Cards au rendu du MODE GRILLE de list.php
   (empilement vertical, photo pleine largeur) : mêmes annulations des
   utilitaires md:* de la vue liste que #list-cards[data-view="grid"]
   (styles.css), scopées ici à .chat-cards - la spécificité (0,2,0) bat les
   utilitaires (0,1,0), pas besoin de !important.
   -------------------------------------------------------------------------- */
.chat-cards {
	align-self: stretch;
	position: relative; /* ancrage des flèches .nav-btn */
}
.chat-cards .list-card {
	flex: 0 0 280px; /* slide à largeur fixe dans la piste */
	width: 280px;
	scroll-snap-align: start;
	flex-direction: column; /* annule le md:flex-row (vue liste) du markup */
	border-radius: 15px; /* annule le md:rounded-r-none */
	box-shadow: none; /* pas d'ombre dans le chat (contrairement au mode grille de list.php) */
	border: 1px solid #e5e7eb; /* gray-200 - léger relief sans ombre, aligné sur .chat-cta */
}
@media (min-width: 768px) {
	.chat-cards .list-card {
		flex-basis: 310px;
		width: 310px;
	}
	.chat-cards .list-card-media {
		width: 100%;
		height: 230px;
		padding: 0;
	}
	.chat-cards .list-card-media-frame {
		border-radius: 12px 12px 0 0;
	}
	.chat-cards .list-card-content {
		padding: 15px;
	}
}

/* Tuiles photo du tool get_provider_photos (render_chat_photos, functions.php) :
   slides de la même piste carrousel que les cards - largeurs alignées sur
   .list-card, hauteur sur sa zone média (230px en md+). */
.chat-cards .chat-photo {
	position: relative; /* requis par initImageLoading (main.js §1) : parent positionné = fond gris + spinner + placeholder d'erreur */
	flex: 0 0 280px;
	width: 280px;
	height: 210px;
	margin: 0; /* neutralise la marge UA des <figure> */
	scroll-snap-align: start;
	border-radius: 15px;
	overflow: hidden;
	background: #f5f5f5; /* surface-light - fond d'attente avant le boot JS */
}
.chat-cards .chat-photo picture {
	display: block;
	width: 100%;
	height: 100%;
}
.chat-cards .chat-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
/* Bouton-overlay d'ouverture du photo viewer mutualisé (render_chat_photos -
   trigger [data-modal-trigger="photo-viewer"], délégation provider.js §6). */
.chat-cards .chat-photo .chat-photo-zoom {
	position: absolute;
	inset: 0;
	z-index: 2; /* au-dessus du spinner/placeholder d'initImageLoading */
	cursor: zoom-in;
}
.chat-cards .chat-photo .chat-photo-zoom:focus-visible {
	outline: 2px solid rgb(var(--brand));
	outline-offset: -2px;
	border-radius: 15px; /* suit l'arrondi de la tuile */
}
@media (min-width: 768px) {
	.chat-cards .chat-photo {
		flex-basis: 310px;
		width: 310px;
		height: 230px;
	}
}

/* Cards d'avis du tool get_provider_reviews (render_chat_reviews,
   functions.php) : slides de la même piste carrousel que les cards -
   largeurs alignées sur .list-card, bordure légère sans ombre (même relief
   que les cards de recherche du chat). Hauteur libre : la piste (flex,
   align-items stretch) aligne les cards du lot sur la plus haute, le clamp
   du texte (line-clamp-6, markup) borne l'ensemble. Aucune image dedans :
   pas d'initImageLoading, pas de photo viewer. */
.chat-cards .chat-review {
	flex: 0 0 280px;
	width: 280px;
	scroll-snap-align: start;
	margin: 0;
	padding: 16px;
	border-radius: 15px;
	border: 1px solid #e5e7eb; /* gray-200 - aligné sur .chat-cards .list-card */
	background: #fff;
	display: flex;
	flex-direction: column;
}
@media (min-width: 768px) {
	.chat-cards .chat-review {
		flex-basis: 310px;
		width: 310px;
	}
}

/* Entrée en douceur des blocs injectés dans le fil (cards/photos/CTA) :
   fondu + léger glissement - supprime l'apparition « d'un coup sec ». */
.chat-cards,
.chat-cta {
	animation: chat-block-in 0.25s ease-out;
}
@keyframes chat-block-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
@media (prefers-reduced-motion: reduce) {
	.chat-cards,
	.chat-cta {
		animation: none;
	}
}

/* Bouton « reprendre le fil » (scroll intelligent, chat.js) : flotte au-dessus
   du composer via son ancre à hauteur nulle, révélé quand l'internaute est
   remonté lire et que du contenu vit plus bas. */
.chat-jump-anchor {
	position: relative;
	height: 0;
	z-index: 5;
}
.chat-jump {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	width: 36px;
	height: 36px;
	border-radius: 9999px;
	background: #fff;
	border: 1px solid #e5e7eb;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
	color: #757575; /* ink-500 */
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s, box-shadow 0.15s;
}
.chat-jump:hover {
	color: rgb(var(--brand));
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}
.chat-jump[hidden] {
	display: none; /* le display:flex de la classe battrait l'attribut hidden */
}
/* Tactile : seule reprise du fil depuis le scroll figé → cible élargie aux
   44px recommandés (Apple HIG / Material), 36px desktop où la souris suffit. */
@media (hover: none) {
	.chat-jump {
		width: 44px;
		height: 44px;
	}
	.chat-jump i {
		font-size: 15px; /* bat le text-[13px] du markup - équilibre la pastille élargie */
	}
}

/* --------------------------------------------------------------------------
   Indicateur d'attente (3 points animés + libellé d'étape optionnel poussé
   par les events SSE `status` : réflexion, recherche, préparation de devis)
   -------------------------------------------------------------------------- */
.chat-typing {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: #f2f3f5;
	border-radius: 14px 14px 14px 4px;
	padding: 14px 16px;
}
.chat-typing i {
	width: 7px;
	height: 7px;
	border-radius: 9999px;
	background: #757575; /* ink-500 */
	animation: chat-typing-bounce 1.2s infinite ease-in-out;
}
.chat-typing i:nth-child(2) {
	animation-delay: 0.15s;
}
.chat-typing i:nth-child(3) {
	animation-delay: 0.3s;
}
.chat-typing-label {
	margin-left: 3px;
	font-size: 13px;
	color: #757575; /* ink-500 */
}
.chat-typing-label:empty {
	display: none;
}
/* Chargement d'une conversation (restauration reload / sélection historique) :
   points animés centrés dans le fil, posés par chat.js à la place de l'accueil
   le temps du fetch chat-history (mêmes keyframes que l'indicateur d'attente). */
.chat-loading {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}
.chat-loading i {
	width: 9px;
	height: 9px;
	border-radius: 9999px;
	background: #757575; /* ink-500 */
	animation: chat-typing-bounce 1.2s infinite ease-in-out;
}
.chat-loading i:nth-child(2) {
	animation-delay: 0.15s;
}
.chat-loading i:nth-child(3) {
	animation-delay: 0.3s;
}
@keyframes chat-typing-bounce {
	0%,
	60%,
	100% {
		transform: translateY(0);
		opacity: 0.5;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}
@media (prefers-reduced-motion: reduce) {
	.chat-typing i,
	.chat-loading i {
		animation: none;
	}
}

/* --------------------------------------------------------------------------
   Composer : markup 100 % Tailwind dans chat.php, copie conforme du composer
   de la messagerie privée (user-booking.php) ; toute évolution de style se
   fait en miroir. L'autosize (max 120px) vit dans chat.js. Seule exception
   ci-dessous : le bouton micro (dictée vocale), propre au chat.
   -------------------------------------------------------------------------- */

/* Bouton micro [data-chat-voice] (dictée vocale - Web Speech API, chat.js).
   Caché tant que l'API SpeechRecognition n'est pas détectée (Firefox) : le
   display:flex des utilitaires du markup battrait l'attribut hidden →
   override explicite, même pattern que .chat-icon-btn[hidden]. */
.chat-voice-btn[hidden] {
	display: none;
}
/* Écoute en cours : livrée « enregistrement » (rouge universel, PAS la couleur
   de marque : l'état doit se lire comme un micro OUVERT) + halo pulsé. */
.chat-voice-btn.is-listening {
	background: #dc2626;
	color: #fff;
	animation: chat-voice-pulse 1.6s infinite ease-out;
}
.chat-voice-btn.is-listening:hover {
	background: #b91c1c;
	color: #fff;
}
@keyframes chat-voice-pulse {
	0% {
		box-shadow: 0 0 0 0 rgb(220 38 38 / 0.4);
	}
	70% {
		box-shadow: 0 0 0 9px rgb(220 38 38 / 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgb(220 38 38 / 0);
	}
}
@media (prefers-reduced-motion: reduce) {
	.chat-voice-btn.is-listening {
		animation: none;
	}
}

/* Bouton d'envoi ↔ Stop : pendant un tour (busy), chat.js pose is-stop sur
   [data-chat-send] - l'icône avion laisse place au carré « stop », le clic
   interrompt la réponse (abort du fetch, tour partiel persisté serveur).
   Les deux icônes vivent dans le markup (chat.php), une seule est visible. */
[data-chat-send] .chat-stop-icon {
	display: none;
}
[data-chat-send].is-stop .chat-send-icon {
	display: none;
}
[data-chat-send].is-stop .chat-stop-icon {
	display: inline;
}

/* --------------------------------------------------------------------------
   Feedback d'un tour (👍/👎 sous la dernière bulle d'une réponse aboutie -
   chat.js, ajax/chat-feedback.php). Un vote par tour, re-votable et annulable
   au re-clic ; restauré au rechargement avec l'état du vote (items feedback
   de chat-history.php).
   -------------------------------------------------------------------------- */
.chat-feedback {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	margin-top: -8px; /* colle la barre à la bulle qui précède (gap 14px du fil) */
}
.chat-feedback-btn {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	font-size: 13px;
	color: #757575; /* ink-500 */
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.chat-feedback-btn:hover {
	background: #f5f5f5; /* surface-light */
	color: #0a0a0a; /* ink-900 */
}
.chat-feedback-btn.is-selected {
	background: rgb(var(--brand-tint));
	color: rgb(var(--brand));
}
/* Tactile : cible élargie (28px = trop fin au pouce), même pattern que la
   poubelle de l'historique. Le -8px de la barre absorbe le surcroît de haut. */
@media (hover: none) {
	.chat-feedback-btn {
		width: 36px;
		height: 36px;
		font-size: 15px;
	}
}

/* --------------------------------------------------------------------------
   Blocs d'action contextuels (event SSE `cta` - render_chat_sos_cta /
   render_chat_booking_recap, HTML serveur inséré brut par chat.js)
   -------------------------------------------------------------------------- */
.chat-cta {
	align-self: flex-start;
	max-width: 85%;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.chat-cta-text {
	font-size: 14px;
	line-height: 20px;
	color: #0a0a0a;
}
.chat-cta-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.chat-cta-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #0a0a0a;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 9px 14px;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.chat-cta-btn:hover {
	border-color: rgb(var(--brand) / 0.5);
	color: rgb(var(--brand));
}
.chat-cta-btn.is-primary {
	background: rgb(var(--brand));
	border-color: rgb(var(--brand));
	color: #fff;
}
.chat-cta-btn.is-primary:hover {
	opacity: 0.9;
	color: #fff;
}
.chat-cta-btn:disabled {
	opacity: 0.55;
	cursor: default;
}
.chat-cta-btn.is-sent {
	background: #16a34a;
	border-color: #16a34a;
	opacity: 1;
}

/* Bloc « SOS Recherche » (render_chat_sos_cta - variante riche du .chat-cta,
   défini APRÈS lui pour gagner la cascade) : card titre + accroche à gauche,
   bouton à droite - il passe dessous quand la place manque (wrap). */
.chat-sos {
	width: 100%;
	max-width: 100%; /* annule le plafond 85% du .chat-cta racine */
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	padding: 18px 20px;
	border-radius: 15px;
}
.chat-sos-text {
	flex: 1 1 240px;
	min-width: 0;
}
.chat-sos-title {
	font-size: 17px;
	line-height: 22px;
	font-weight: 700;
	color: #0a0a0a;
	margin-bottom: 4px;
}
.chat-sos-sub {
	font-size: 14px;
	line-height: 20px;
	color: #757575; /* ink-500 */
}
.chat-sos-btn {
	flex-shrink: 0;
	padding: 11px 18px;
	border-radius: 12px;
}

/* Pills de suggestions de réponse (event SSE `suggestions` - chat.js) : une
   rangée sous le dernier message, remplacée à chaque tour, purgée à l'envoi.
   Mobile : ligne unique swipable (scroll horizontal, scrollbar masquée -
   même mécanique que .chat-suggestions) ; desktop (≥ 768px) : wrap. */
.chat-pills {
	align-self: flex-start;
	/* Le fil est un flex column scrollable : overflow-x != visible ramène la
	   taille minimale automatique de l'item à 0 et le fil PLEIN l'écrase à
	   0 px de haut - flex-shrink: 0 préserve la hauteur de contenu. */
	flex-shrink: 0;
	max-width: 100%;
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
}
.chat-pills::-webkit-scrollbar {
	display: none;
}
@media (min-width: 768px) {
	.chat-pills {
		flex-wrap: wrap;
		overflow-x: visible;
	}
}
.chat-pill {
	flex: 0 0 auto;
	white-space: nowrap;
	font-size: 13px;
	line-height: 18px;
	font-weight: 500;
	color: #0a0a0a;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 9999px;
	padding: 7px 13px;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease;
}
.chat-pill:hover {
	border-color: rgb(var(--brand) / 0.5);
	color: rgb(var(--brand));
}

/* Récapitulatif de demande de devis (tool create_booking_request). */
.chat-recap {
	align-self: stretch;
	max-width: none;
}
.chat-recap-rows {
	display: flex;
	flex-direction: column;
	gap: 4px;
	border-top: 1px solid #f0f1f3;
	border-bottom: 1px solid #f0f1f3;
	padding: 8px 0;
}
.chat-recap-row {
	display: flex;
	gap: 10px;
	font-size: 14px;
	line-height: 20px;
}
.chat-recap-row dt {
	flex: 0 0 92px;
	color: #757575; /* ink-500 */
}
.chat-recap-row dd {
	color: #0a0a0a;
	overflow-wrap: anywhere;
}
.chat-cta-note {
	font-size: 11px;
	line-height: 15px;
	color: #757575;
}
.chat-cta-feedback {
	font-size: 13px;
	line-height: 18px;
	font-weight: 600;
	color: #b91c1c;
}
.chat-cta-feedback.is-ok {
	color: #15803d;
}

/* Tableau comparatif de fiches (tool compare_providers - event `cta`,
   render_chat_compare_table) : fiches en colonnes, critères en première
   colonne STICKY, scroll horizontal contenu DANS le bloc (le fil ne déborde
   jamais - règle projet) ; pleine largeur comme le récap de devis.
   border-collapse: separate obligatoire : en mode collapse, les bordures d'une
   cellule sticky ne suivent pas l'élément pendant le scroll (comportement
   navigateur connu). */
.chat-compare {
	align-self: stretch;
	max-width: none;
	padding: 6px 4px;
}
.chat-compare-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.chat-compare-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 13px;
	line-height: 18px;
}
.chat-compare-table th,
.chat-compare-table td {
	padding: 8px 10px;
	text-align: left;
	vertical-align: top;
	min-width: 116px;
}
.chat-compare-table thead th {
	font-weight: 700;
	color: #0a0a0a;
	max-width: 170px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.chat-compare-table tbody th,
.chat-compare-table tbody td {
	border-top: 1px solid #f0f1f3;
}
.chat-compare-table tbody th {
	font-weight: 500;
	color: #757575; /* ink-500 - colonne des critères */
}
.chat-compare-table td {
	color: #0a0a0a;
	overflow-wrap: anywhere;
}
/* Première colonne figée pendant le scroll horizontal (critères toujours
   lisibles) : fond opaque + voile de séparation quand les colonnes défilent
   dessous. */
.chat-compare-table th:first-child {
	position: sticky;
	left: 0;
	z-index: 1;
	background: #fff;
	min-width: 96px;
	max-width: 110px;
	box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.1);
}

/* Boutons d'action à icône seule (en-tête mobile : historique / nouvelle
   recherche / fermer ; crayon sidebar ; croix du tiroir) : pastille RONDE à
   fond gris permanent (maquette). Tooltip maison via title (main.js §28). */
.chat-icon-btn {
	/* Copie conforme du bouton fermer de la modal filtres : w-[36px] h-[36px]
	   rounded-full bg-surface-light flex items-center justify-center
	   text-ink-900 hover:bg-surface-border transition-colors (+ icône 14px). */
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: #f5f5f5; /* surface-light */
	color: #0a0a0a; /* ink-900 */
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.chat-icon-btn:hover {
	background: #d9d9d9; /* surface-border */
}
/* Visibilités des boutons d'en-tête : le display:flex ci-dessus (chargé après
   tailwind.css) écraserait aussi bien l'UA [hidden] que lg:hidden de Tailwind
   à spécificité égale - on les rétablit ici. [hidden] est piloté par chat.js
   (refreshActions : Historique si conversations à lister, « Nouvelle
   recherche » si conversation entamée) ; .chat-icon-btn-mobile = actions
   mobile-only (historique → tiroir, fermer), en lg+ l'historique vit dans la
   sidebar. */
.chat-icon-btn[hidden] {
	display: none;
}
@media (min-width: 1024px) {
	.chat-icon-btn-mobile {
		display: none;
	}
}

/* --------------------------------------------------------------------------
   Historique des conversations (sidebar lg+ / tiroir mobile - chat.js,
   ajax/chat-list.php). Items créés par renderList() en nœuds texte.
   -------------------------------------------------------------------------- */
.chat-hist-item {
	display: flex;
	align-items: stretch;
	border-radius: 10px;
	transition: background 0.15s ease;
}
.chat-hist-item:hover {
	background: #f5f5f5; /* surface-light */
}
.chat-hist-item.is-active {
	background: rgb(var(--brand-tint)); /* rose/bleu très pâle selon le site */
}
.chat-hist-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	text-align: left;
	padding: 9px 4px 9px 10px;
	cursor: pointer;
}
/* Poubelle : révélée au survol de l'item (desktop), toujours visible au
   tactile (pas de hover). Confirmation appConfirm avant toute suppression. */
.chat-hist-delete {
	flex-shrink: 0;
	width: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	color: #757575; /* ink-500 */
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s ease, color 0.15s ease;
}
.chat-hist-item:hover .chat-hist-delete,
.chat-hist-delete:focus-visible {
	opacity: 1;
}
.chat-hist-delete:hover {
	color: #b91c1c;
}
@media (hover: none) {
	.chat-hist-delete {
		opacity: 1;
	}
}
.chat-hist-title {
	font-size: 13px;
	line-height: 17px;
	font-weight: 600;
	color: #0a0a0a;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.chat-hist-date {
	font-size: 11px;
	line-height: 14px;
	color: #757575;
}
/* Placeholder « aucune session » (sidebar + tiroir) : occupe l'espace de la
   liste, centré. Le display:flex battrait l'attribut hidden posé par
   renderList() → override [hidden] explicite. */
.chat-list-empty {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 6px;
	padding: 20px 24px;
	color: #757575; /* ink-500 */
	font-size: 13px;
	line-height: 18px;
}
.chat-list-empty[hidden] {
	display: none;
}
.chat-list-empty > i {
	font-size: 26px;
	color: rgb(var(--brand) / 0.45);
	margin-bottom: 6px;
}
.chat-list-empty-title {
	font-weight: 600;
	color: #0a0a0a; /* ink-900 */
}

/* Tiroir mobile : panneau latéral gauche au-dessus de tout le chrome de la
   page chat (l'échelle du site s'arrête au drawer menu z-[76]). Ouverture par
   la classe is-open (chat.js) - JAMAIS l'attribut hidden ni display:none :
   l'ANIMATION (fondu du fond + glissement du panneau) exige que l'élément
   reste rendu ; l'état fermé est neutralisé par visibility + pointer-events,
   la visibility ne basculant qu'APRÈS la transition de fermeture (delay). */
.chat-drawer-overlay {
	position: fixed;
	inset: 0;
	z-index: 80;
	visibility: hidden;
	pointer-events: none;
	transition: visibility 0s linear 0.25s;
}
.chat-drawer-overlay.is-open {
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}
.chat-drawer-backdrop {
	position: absolute;
	inset: 0;
	background: rgb(0 0 0 / 0.4);
	opacity: 0;
	transition: opacity 0.25s ease;
}
.chat-drawer-overlay.is-open .chat-drawer-backdrop {
	opacity: 1;
}
.chat-drawer {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 300px;
	max-width: 85vw;
	background: #fff;
	display: flex;
	flex-direction: column;
	box-shadow: 0 10px 30px rgb(0 0 0 / 0.2);
	transform: translateX(-100%);
	transition: transform 0.25s ease;
}
.chat-drawer-overlay.is-open .chat-drawer {
	transform: translateX(0);
}
@media (prefers-reduced-motion: reduce) {
	.chat-drawer-overlay,
	.chat-drawer-backdrop,
	.chat-drawer {
		transition: none;
	}
}

/* Bouton « Nouvelle recherche » (sidebar Historique + tiroir mobile). */
.chat-reset {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	font-weight: 600;
	color: #0a0a0a;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 8px 12px;
	cursor: pointer;
	white-space: nowrap;
	transition: border-color 0.15s ease, color 0.15s ease;
}
.chat-reset:hover {
	border-color: rgb(var(--brand) / 0.5);
	color: rgb(var(--brand));
}

/* --------------------------------------------------------------------------
   Mobile (< 640) : écran « focus » plein viewport façon app - chrome du site
   masqué (header sticky ET footer), panneau bord à bord. Même pattern que
   middle/user/common.css .conversation-screen ; body:has() ne cible que la page portant
   .chat-screen (chat.php), `> footer` ne vise que le footer du SITE (enfant
   direct du body).
   -------------------------------------------------------------------------- */
@media (max-width: 639.98px) {
	body:has(.chat-screen) #site-header,
	body:has(.chat-screen) > footer {
		display: none;
	}
	.chat-screen {
		height: 100vh;
		height: 100dvh;
	}
	.chat-shell {
		/* Plein bord : compense le padding 15px du .container-x (pattern
		   .scroll-snap). width en calc OBLIGATOIRE : la coquille porte w-full
		   (100 % du parent) - les marges négatives seules la décaleraient à
		   gauche en laissant 30px de vide à droite. */
		margin-left: -15px;
		margin-right: -15px;
		width: calc(100% + 30px);
		max-width: none;
	}
	.chat-msg {
		max-width: 92%;
	}
}
