/* AI Live Chat Support – widget styles. Scoped under .ailc to avoid theme clashes. */
.ailc, .ailc * { box-sizing: border-box; }
.ailc {
	--ailc-accent: #2563eb;
	--ailc-accent-text: #fff;
	--ailc-bg: #fff;
	--ailc-fg: #1f2937;
	--ailc-muted: #6b7280;
	--ailc-soft: #f1f5f9;
	--ailc-line: #e5e7eb;
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
	color: var(--ailc-fg);
}
.ailc[data-pos="left"] { right: auto; left: 20px; }
:where(.ailc) button, :where(.ailc) input, :where(.ailc) textarea { font: inherit; color: inherit; margin: 0; }
:where(.ailc) button { cursor: pointer; }
.ailc [hidden] { display: none !important; }

/* Launcher */
.ailc-launcher {
	width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 0;
	display: flex; align-items: center; justify-content: center;
	background: var(--ailc-accent); color: var(--ailc-accent-text);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
	transition: transform .15s ease, box-shadow .15s ease;
}
.ailc-launcher:hover { transform: scale(1.06); }
.ailc-launcher:focus-visible, .ailc button:focus-visible, .ailc input:focus-visible, .ailc textarea:focus-visible {
	outline: 2px solid var(--ailc-accent); outline-offset: 2px;
}

/* Panel */
.ailc-panel {
	position: absolute; bottom: 74px; right: 0;
	width: 380px; max-width: calc(100vw - 24px);
	height: 580px; max-height: calc(100vh - 110px);
	display: flex; flex-direction: column;
	background: var(--ailc-bg); border-radius: 16px; overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
	animation: ailc-in .18s ease-out;
}
.ailc[data-pos="left"] .ailc-panel { right: auto; left: 0; }
@keyframes ailc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.ailc-head {
	display: flex; align-items: center; gap: 8px;
	padding: 14px 14px 14px 18px;
	background: var(--ailc-accent); color: var(--ailc-accent-text);
}
.ailc-title { flex: 1; font-weight: 600; font-size: 16px; }
.ailc-head-btn {
	background: transparent; border: 0; color: inherit; padding: 6px; border-radius: 8px;
	display: inline-flex; align-items: center; justify-content: center; opacity: .92;
}
.ailc-head-btn:hover { background: rgba(255, 255, 255, .18); opacity: 1; }
.ailc-head-human { font-size: 12px; padding: 6px 10px; border: 1px solid currentColor; }

/* Messages */
.ailc-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fff; overscroll-behavior: contain; }
.ailc-row { display: flex; flex-direction: column; max-width: 88%; gap: 6px; }
.ailc-bot { align-self: flex-start; align-items: flex-start; }
.ailc-user { align-self: flex-end; align-items: flex-end; }
.ailc-bubble { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.ailc-bot .ailc-bubble { background: var(--ailc-soft); border-bottom-left-radius: 4px; }
.ailc-user .ailc-bubble { background: var(--ailc-accent); color: var(--ailc-accent-text); border-bottom-right-radius: 4px; }

.ailc-typing .ailc-bubble { display: flex; gap: 4px; padding: 13px 14px; }
.ailc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ailc-muted); animation: ailc-bounce 1.2s infinite ease-in-out; }
.ailc-dot:nth-child(2) { animation-delay: .15s; }
.ailc-dot:nth-child(3) { animation-delay: .3s; }
@keyframes ailc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Result cards */
.ailc-cards { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.ailc-card {
	display: flex; gap: 10px; align-items: stretch; text-decoration: none; color: inherit;
	border: 1px solid var(--ailc-line); border-radius: 12px; padding: 8px; background: #fff;
	transition: border-color .15s, box-shadow .15s;
}
.ailc-card:hover { border-color: var(--ailc-accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.ailc-card-img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }
.ailc-card-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ailc-card-type { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ailc-muted); }
.ailc-card-title { font-weight: 600; color: var(--ailc-accent); overflow-wrap: anywhere; }
.ailc-card-price { font-weight: 600; }
.ailc-card-excerpt { font-size: 12px; color: var(--ailc-muted); }

/* Buttons & chips */
.ailc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ailc-btn {
	border: 1px solid var(--ailc-accent); background: #fff; color: var(--ailc-accent);
	border-radius: 999px; padding: 7px 14px; font-weight: 600;
}
.ailc-btn:hover { background: var(--ailc-accent); color: var(--ailc-accent-text); }
.ailc-btn-primary { background: var(--ailc-accent); color: var(--ailc-accent-text); border-radius: 10px; }
.ailc-btn-primary:hover { filter: brightness(1.08); }
.ailc-btn-primary[disabled] { opacity: .6; cursor: default; }
.ailc-btn-ghost { border-color: var(--ailc-line); color: var(--ailc-fg); border-radius: 10px; }
.ailc-btn-ghost:hover { background: var(--ailc-soft); color: var(--ailc-fg); }

.ailc-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; background: #fff; }
.ailc-chip { border: 1px solid var(--ailc-line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; }
.ailc-chip:hover { border-color: var(--ailc-accent); color: var(--ailc-accent); }

/* Composer */
.ailc-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ailc-line); background: #fff; }
.ailc-input { flex: 1; min-width: 0; border: 1px solid var(--ailc-line); border-radius: 999px; padding: 10px 14px; background: #fff; font-size: 16px; }
.ailc-send {
	flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; padding: 0;
	display: flex; align-items: center; justify-content: center;
	background: var(--ailc-accent); color: var(--ailc-accent-text);
}
.ailc-send[disabled] { opacity: .55; cursor: default; }

/* Lead form pane */
.ailc-form-pane { position: absolute; inset: 0; background: #fff; overflow-y: auto; animation: ailc-in .18s ease-out; }
.ailc-form { padding: 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.ailc-form h3 { margin: 0 0 2px; font-size: 18px; color: var(--ailc-fg); }
.ailc-field { display: flex; flex-direction: column; gap: 4px; }
.ailc-field label { font-size: 12px; font-weight: 600; color: var(--ailc-muted); }
.ailc-field input, .ailc-field textarea {
	width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 16px; resize: vertical;
}
.ailc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ailc-error { color: #b91c1c; font-size: 13px; min-height: 18px; }
.ailc-form-actions { display: flex; gap: 8px; }
.ailc-form-actions .ailc-btn-primary { flex: 1; }

/* Mobile: full-screen sheet */
@media (max-width: 480px) {
	.ailc { bottom: 14px; right: 14px; }
	.ailc[data-pos="left"] { left: 14px; }
	.ailc.ailc-open .ailc-launcher { display: none; }
	.ailc-panel {
		position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; bottom: 0;
	}
	.ailc-panel { height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
	.ailc-panel, .ailc-form-pane, .ailc-dot, .ailc-launcher { animation: none; transition: none; }
}
