/* Assistant Immo IA — widget */
.wpb-aim {
	--aim-primary: #1d3557;
	--aim-bg: #ffffff;
	--aim-soft: #f3f5f8;
	--aim-text: #1f2328;
	--aim-muted: #6b7280;
	--aim-border: #e3e7ee;
	--aim-radius: 16px;
	position: fixed;
	bottom: 20px;
	z-index: 999990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--aim-text);
}
.wpb-aim--right { right: 20px; }
.wpb-aim--left { left: 20px; }
.wpb-aim *, .wpb-aim *::before, .wpb-aim *::after { box-sizing: border-box; }

.wpb-aim__launcher {
	width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--aim-primary); color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 8px 24px rgba(0,0,0,.22);
	transition: transform .15s ease;
	padding: 0;
}
.wpb-aim__launcher:hover { transform: scale(1.06); }
.wpb-aim__launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--aim-primary); }
.wpb-aim.is-open .wpb-aim__launcher { display: none; }

.wpb-aim__panel {
	display: none; flex-direction: column;
	width: 390px; height: min(640px, calc(100vh - 40px));
	background: var(--aim-bg); border-radius: var(--aim-radius);
	box-shadow: 0 18px 50px rgba(0,0,0,.25); overflow: hidden;
}
.wpb-aim.is-open .wpb-aim__panel { display: flex; }

.wpb-aim__head {
	display: flex; align-items: center; gap: 4px;
	padding: 14px 12px 14px 18px; background: var(--aim-primary); color: #fff;
}
.wpb-aim__title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wpb-aim__title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.wpb-aim__title span { font-size: 12px; opacity: .8; }
.wpb-aim__icon {
	background: transparent; border: 0; color: #fff; cursor: pointer;
	width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0;
}
.wpb-aim__icon:hover { background: rgba(255,255,255,.15); }

.wpb-aim__notice { font-size: 11.5px; color: var(--aim-muted); background: var(--aim-soft); padding: 6px 16px; border-bottom: 1px solid var(--aim-border); }

.wpb-aim__list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }

.wpb-aim__msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; word-wrap: break-word; }
.wpb-aim__msg p { margin: 0 0 6px; }
.wpb-aim__msg p:last-child { margin-bottom: 0; }
.wpb-aim__msg ul { margin: 4px 0 6px 18px; padding: 0; }
.wpb-aim__msg li { margin: 0 0 2px; }
.wpb-aim__msg a { color: inherit; text-decoration: underline; }
.wpb-aim__msg--assistant { align-self: flex-start; background: var(--aim-soft); border-bottom-left-radius: 4px; }
.wpb-aim__msg--user { align-self: flex-end; background: var(--aim-primary); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.wpb-aim__msg--error { align-self: center; background: #fdecec; color: #8a1f1f; font-size: 13px; }
.wpb-aim__msg--ok { align-self: stretch; max-width: 100%; background: #e9f7ef; color: #1e6b3b; font-size: 14px; }

.wpb-aim__typing { display: flex; gap: 4px; padding: 14px; }
.wpb-aim__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--aim-muted); animation: wpbAimDot 1.2s infinite ease-in-out; }
.wpb-aim__typing span:nth-child(2) { animation-delay: .15s; }
.wpb-aim__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes wpbAimDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.wpb-aim__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wpb-aim__chip {
	border: 1px solid var(--aim-primary); color: var(--aim-primary); background: #fff;
	border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; line-height: 1.3; text-align: left;
}
.wpb-aim__chip:hover { background: var(--aim-primary); color: #fff; }

.wpb-aim__cards { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; flex-shrink: 0; }
.wpb-aim__card {
	flex: 0 0 210px; scroll-snap-align: start; display: block; text-decoration: none !important; color: var(--aim-text) !important;
	border: 1px solid var(--aim-border); border-radius: 12px; overflow: hidden; background: #fff;
	transition: box-shadow .15s ease, transform .15s ease;
}
.wpb-aim__card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-1px); }
.wpb-aim__img { position: relative; height: 120px; background: var(--aim-soft) center / cover no-repeat; }
.wpb-aim__badge { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.92); color: var(--aim-primary); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.wpb-aim__cbody { padding: 9px 11px 11px; }
.wpb-aim__price { font-weight: 700; color: var(--aim-primary); font-size: 15px; }
.wpb-aim__ctitle { font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wpb-aim__cmeta { font-size: 12px; color: var(--aim-muted); margin-top: 4px; }
.wpb-aim__tags { font-size: 11.5px; color: var(--aim-primary); margin-top: 4px; }
.wpb-aim__more { flex: 0 0 150px; align-self: center; font-size: 12.5px; color: var(--aim-muted); padding: 8px; }

.wpb-aim__lead { display: flex; flex-direction: column; gap: 7px; background: #fff; border: 1px solid var(--aim-border); border-radius: 12px; padding: 12px; flex-shrink: 0; }
.wpb-aim__lead-title { font-weight: 600; font-size: 14px; }
.wpb-aim__lead input[type=text], .wpb-aim__lead input[type=email], .wpb-aim__lead input[type=tel], .wpb-aim__lead textarea {
	width: 100%; border: 1px solid var(--aim-border); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; background: #fff; color: var(--aim-text); margin: 0;
}
.wpb-aim__lead textarea { resize: vertical; }
.wpb-aim__consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--aim-muted); line-height: 1.35; }
.wpb-aim__consent input { margin-top: 2px; flex-shrink: 0; }
.wpb-aim__consent a { color: inherit; }
.wpb-aim__lead button { border: 0; border-radius: 8px; padding: 10px; background: var(--aim-primary); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px; }
.wpb-aim__lead button:disabled { opacity: .6; cursor: default; }
.wpb-aim__lead-err { color: #b42318; font-size: 12.5px; min-height: 0; }
.wpb-aim__lead-err:empty { display: none; }
.wpb-aim__hp { display: none !important; }

.wpb-aim__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--aim-border); background: #fff; margin: 0; }
.wpb-aim__input {
	flex: 1; resize: none; border: 1px solid var(--aim-border); border-radius: 12px; padding: 10px 12px;
	font: inherit; font-size: 15px; max-height: 110px; line-height: 1.35; background: #fff; color: var(--aim-text); margin: 0;
}
.wpb-aim__input:focus { outline: none; border-color: var(--aim-primary); }
.wpb-aim__send {
	width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--aim-primary); color: #fff;
	cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.wpb-aim__send:disabled { opacity: .5; cursor: default; }

@media (max-width: 640px) {
	.wpb-aim { bottom: 16px; }
	.wpb-aim--right { right: 16px; }
	.wpb-aim--left { left: 16px; }
	.wpb-aim.is-open { inset: 0; }
	.wpb-aim.is-open .wpb-aim__panel { width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
	.wpb-aim__input { font-size: 16px; } /* évite le zoom iOS */
}
@media (prefers-reduced-motion: reduce) {
	.wpb-aim__launcher, .wpb-aim__card { transition: none; }
	.wpb-aim__typing span { animation: none; opacity: .6; }
}

/* Debug admin */
.wpb-aim__debug { align-self: stretch; font-size: 11px; color: var(--aim-muted); border: 1px dashed var(--aim-border); border-radius: 8px; padding: 4px 8px; flex-shrink: 0; }
.wpb-aim__debug summary { cursor: pointer; }
.wpb-aim__debug pre { white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; margin: 6px 0 0; font-size: 10.5px; }

/* Bulle avec libellé */
.wpb-aim__launcher--label { width: auto; border-radius: 999px; padding: 0 20px 0 16px; gap: 8px; }
.wpb-aim__launcher-text { font-size: 15px; font-weight: 600; white-space: nowrap; }
@media (max-width: 640px) { .wpb-aim__launcher-text { display: none; } .wpb-aim__launcher--label { width: 60px; padding: 0; } }

/* Barre inline [assistant_immo] (hors du conteneur .wpb-aim) */
.wpb-aim-bar { display: flex; gap: 8px; align-items: stretch; max-width: 760px; margin: 0 auto; background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.wpb-aim-bar__icon { display: flex; align-items: center; padding-left: 12px; color: var(--aim-primary, #1d3557); }
.wpb-aim-bar input { flex: 1; min-width: 0; border: 0 !important; outline: none; background: transparent !important; font: inherit; font-size: 16px; padding: 10px 6px !important; color: #1f2328; box-shadow: none !important; margin: 0 !important; }
.wpb-aim-bar button { border: 0; border-radius: 999px; padding: 0 22px; background: var(--aim-primary, #1d3557); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.wpb-aim-bar__hint { text-align: center; font-size: 12px; opacity: .75; margin-top: 8px; }
@media (max-width: 640px) { .wpb-aim-bar { border-radius: 14px; } .wpb-aim-bar button { padding: 0 14px; } }

/* Biens proches */
.wpb-aim__proche { position: absolute; left: 8px; bottom: 8px; right: 8px; background: rgba(255, 244, 214, .96); color: #7a5300; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wpb-aim__card--proche { border-style: dashed; }
