/*!
 * JCM AI Assistant — Styles
 * V8.4.30
 *
 * Zone de réponse IA dans le hero GoMedine.
 * Cohérent avec l'identité visuelle orange du hero (.jcm-v81-hero).
 */

/* ─── Zone réponse (cachée par défaut) ─── */

.jcm-v81-hero__ai-zone {
	position: relative;
	max-width: 720px;
	margin: 16px auto 0;
	background: rgba(255, 255, 255, 0.98);
	border-radius: 16px;
	padding: 22px 26px 18px;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #2b2b2b;
	animation: jcm-ai-fade-in 0.25s ease-out;
}

.jcm-v81-hero__ai-zone[hidden] {
	display: none;
}

@keyframes jcm-ai-fade-in {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ─── Bouton fermer ─── */

.jcm-v81-hero__ai-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 28px;
	height: 28px;
	background: transparent;
	border: none;
	font-size: 22px;
	line-height: 1;
	color: #999;
	cursor: pointer;
	border-radius: 50%;
	transition: background 0.15s, color 0.15s;
}

.jcm-v81-hero__ai-close:hover,
.jcm-v81-hero__ai-close:focus {
	background: rgba(0, 0, 0, 0.06);
	color: #333;
	outline: none;
}

/* ─── Loading state ─── */

.jcm-v81-hero__ai-loading {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 4px 0;
	color: #555;
	font-size: 14px;
}

.jcm-v81-hero__ai-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid #ddd;
	border-top-color: #d6603a;
	border-radius: 50%;
	animation: jcm-ai-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@keyframes jcm-ai-spin {
	to { transform: rotate(360deg); }
}

.jcm-v81-hero__ai-loading-text {
	font-style: italic;
}

/* ─── Intro "Réponse de GoMedine :" ─── */

.jcm-v81-hero__ai-intro {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #d6603a;
	margin-bottom: 8px;
}

/* ─── Corps de la réponse ─── */

.jcm-v81-hero__ai-text {
	font-size: 15px;
	line-height: 1.55;
	color: #2b2b2b;
}

.jcm-v81-hero__ai-text p {
	margin: 0 0 10px;
}

.jcm-v81-hero__ai-text p:last-child {
	margin-bottom: 0;
}

.jcm-v81-hero__ai-text strong {
	color: #1a1a1a;
	font-weight: 700;
}

.jcm-v81-hero__ai-text ul {
	margin: 8px 0;
	padding-left: 22px;
}

.jcm-v81-hero__ai-text li {
	margin: 4px 0;
}

.jcm-v81-hero__ai-text.is-error {
	color: #9a3324;
	background: #fdf3f0;
	border-left: 3px solid #d6603a;
	padding: 10px 14px;
	border-radius: 6px;
}

/* ─── Disclaimer ─── */

.jcm-v81-hero__ai-disclaimer {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid #f0e8e4;
	font-size: 12px;
	color: #888;
	line-height: 1.4;
}

/* ─── Badge cache ─── */

.jcm-v81-hero__ai-cached {
	margin-top: 6px;
	font-size: 11px;
	color: #999;
	text-align: right;
	font-style: italic;
}

/* ─── Hidden state ARIA ─── */

.jcm-v81-hero__ai-state[data-state="idle"] .jcm-v81-hero__ai-loading,
.jcm-v81-hero__ai-state[data-state="answer"] .jcm-v81-hero__ai-loading,
.jcm-v81-hero__ai-state[data-state="error"] .jcm-v81-hero__ai-loading {
	/* le JS gère display:none directement, on garde une règle de secours */
}

/* ─── Mobile ─── */

@media (max-width: 600px) {
	.jcm-v81-hero__ai-zone {
		margin: 14px 8px 0;
		padding: 18px 20px 16px;
		border-radius: 12px;
	}
	.jcm-v81-hero__ai-text {
		font-size: 14px;
	}
}

/* ─── Support RTL (arabe) ─── */

body.is-rtl .jcm-v81-hero__ai-zone,
[dir="rtl"] .jcm-v81-hero__ai-zone {
	direction: rtl;
	text-align: right;
}

body.is-rtl .jcm-v81-hero__ai-close,
[dir="rtl"] .jcm-v81-hero__ai-close {
	right: auto;
	left: 10px;
}

body.is-rtl .jcm-v81-hero__ai-text ul,
[dir="rtl"] .jcm-v81-hero__ai-text ul {
	padding-left: 0;
	padding-right: 22px;
}

body.is-rtl .jcm-v81-hero__ai-text.is-error,
[dir="rtl"] .jcm-v81-hero__ai-text.is-error {
	border-left: none;
	border-right: 3px solid #d6603a;
}

/* ─── V8.4.29 — Liens markdown dans la réponse (annuaire local) ─── */

.jcm-v81-hero__ai-link {
	color: #d6603a;
	text-decoration: none;
	font-weight: 600;
	border-bottom: 1px solid rgba(214, 96, 58, 0.3);
	transition: border-color 0.15s, color 0.15s;
}

.jcm-v81-hero__ai-link:hover,
.jcm-v81-hero__ai-link:focus {
	color: #b3502d;
	border-bottom-color: #d6603a;
	outline: none;
}

.jcm-v81-hero__ai-text ul .jcm-v81-hero__ai-link {
	font-weight: 700;
}

/* Badge source plus distinct */
.jcm-v81-hero__ai-cached {
	display: inline-block;
	padding: 3px 9px;
	background: rgba(214, 96, 58, 0.08);
	border-radius: 10px;
	color: #b3502d;
	font-weight: 500;
	margin-top: 8px;
}

/* ─── V8.5.0 — Cards riches dans la zone réponse (réutilise listing-card.php) ─── */

.jcm-ai-local-response {
	width: 100%;
}

.jcm-ai-local-intro {
	font-size: 14px;
	color: #333;
	margin: 0 0 14px;
	line-height: 1.5;
}

.jcm-ai-local-intro strong {
	color: #d6603a;
	font-weight: 700;
}

/* Grille compacte de cards dans la zone IA (max 3 par ligne sur desktop) */
.jcm-ai-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px;
	margin: 0 0 14px;
}

/* Force la card listing à s'adapter au container étroit du bot */
.jcm-ai-cards-grid .listing-card {
	margin: 0;
	font-size: 13px;
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: transform 0.15s, box-shadow 0.15s;
}

.jcm-ai-cards-grid .listing-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.jcm-ai-cards-grid .card-image {
	height: 120px;
}

.jcm-ai-cards-grid .card-body {
	padding: 10px 12px;
}

.jcm-ai-cards-grid .card-category {
	font-size: 10px;
	letter-spacing: 0.04em;
}

.jcm-ai-cards-grid .card-title {
	font-size: 14px;
	margin: 4px 0;
	line-height: 1.3;
}

.jcm-ai-cards-grid .card-title a {
	color: #1a1a1a;
	text-decoration: none;
}

.jcm-ai-cards-grid .card-location {
	font-size: 11px;
	color: #777;
	margin: 4px 0;
}

.jcm-ai-cards-grid .card-actions {
	gap: 4px;
	margin-top: 8px;
}

.jcm-ai-cards-grid .card-actions .btn {
	font-size: 11px;
	padding: 6px 10px;
}

/* CTA "Voir toutes les adresses" */
.jcm-ai-local-cta {
	text-align: center;
	margin: 10px 0 0;
}

.jcm-ai-local-cta a {
	color: #d6603a;
	font-weight: 600;
	text-decoration: none;
	font-size: 14px;
	border-bottom: 1px solid rgba(214, 96, 58, 0.3);
	transition: border-color 0.15s;
}

.jcm-ai-local-cta a:hover {
	border-bottom-color: #d6603a;
}

/* État "aucun résultat" */
.jcm-ai-no-result {
	padding: 4px 0;
}

.jcm-ai-no-result .jcm-ai-local-intro strong {
	color: #333;
}

.jcm-ai-local-sub {
	font-size: 13px;
	color: #666;
	margin: 0 0 12px;
}

/* Chips catégories (suggestions quand aucun résultat) */
.jcm-ai-cat-chips {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.jcm-ai-cat-chips li {
	margin: 0;
}

.jcm-ai-cat-chip {
	display: inline-block;
	padding: 6px 12px;
	background: #fdf3f0;
	color: #b3502d;
	border-radius: 14px;
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	transition: background 0.15s, color 0.15s;
}

.jcm-ai-cat-chip:hover,
.jcm-ai-cat-chip:focus {
	background: #d6603a;
	color: #fff;
	outline: none;
}

/* Responsive : 1 colonne mobile, 2 sur tablette */
@media (max-width: 480px) {
	.jcm-ai-cards-grid {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 481px) and (max-width: 768px) {
	.jcm-ai-cards-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
