#faa-ai-root {
	--faa-brand: #593D27;
	--faa-brand-2: #A5886C;
	--faa-dark: #382211;
	--faa-soft: #F6F1EB;
	--faa-text: #1f1a16;
	position: fixed;
	bottom: 24px;
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.6;
	color: var(--faa-text);
}
#faa-ai-root.faa-ai--right { right: 24px; }
#faa-ai-root.faa-ai--left { left: 24px; }
#faa-ai-root *, #faa-ai-root *::before, #faa-ai-root *::after { box-sizing: border-box; }

.faa-ai__fab {
	width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
	background: linear-gradient(135deg, var(--faa-brand-2), var(--faa-brand));
	color: #fff; display: flex; align-items: center; justify-content: center;
	box-shadow: 0 8px 24px rgba(56, 34, 17, .35);
	transition: transform .2s ease, box-shadow .2s ease;
	padding: 0;
}
.faa-ai__fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(56, 34, 17, .42); }
.faa-ai__fab:focus-visible { outline: 3px solid var(--faa-brand-2); outline-offset: 3px; }
#faa-ai-root.faa-ai--right .faa-ai__fab { margin-left: auto; }

.faa-ai__panel {
	position: absolute; bottom: 72px;
	width: 370px; max-width: calc(100vw - 32px);
	height: 540px; max-height: calc(100vh - 120px);
	background: #fff; border-radius: 18px; overflow: hidden;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
	display: flex; flex-direction: column;
	animation: faaIn .22s ease;
}
.faa-ai__panel[hidden] { display: none; }
.faa-ai--right .faa-ai__panel { right: 0; }
.faa-ai--left .faa-ai__panel { left: 0; }
@keyframes faaIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.faa-ai__head {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 14px; color: #fff;
	background: linear-gradient(135deg, var(--faa-dark), var(--faa-brand));
}
.faa-ai__avatar {
	width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
	background: rgba(255, 255, 255, .15); display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.faa-ai__ht { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.faa-ai__ht strong { font-size: 15px; }
.faa-ai__ht span { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faa-ai__wa {
	font-size: 12px; color: #fff !important; text-decoration: none !important;
	background: #25D366; border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.faa-ai__x {
	background: transparent; border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}

.faa-ai__body {
	flex: 1; overflow-y: auto; padding: 14px; background: var(--faa-soft);
	display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain;
}
.faa-ai__msg {
	max-width: 86%; padding: 9px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere;
	font-size: 14.5px;
}
.faa-ai__msg a { color: inherit; text-decoration: underline; }
.faa-ai__msg--bot { align-self: flex-start; background: #fff; border: 1px solid #ece3d9; border-start-start-radius: 4px; }
.faa-ai__msg--user { align-self: flex-end; background: var(--faa-brand); color: #fff; border-start-end-radius: 4px; }
.faa-ai__li { display: block; padding-inline-start: 14px; position: relative; }
.faa-ai__li::before { content: '•'; position: absolute; inset-inline-start: 2px; }

.faa-ai__typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.faa-ai__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faa-brand-2); animation: faaDot 1s infinite ease-in-out; }
.faa-ai__typing i:nth-child(2) { animation-delay: .15s; }
.faa-ai__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes faaDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.faa-ai__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--faa-soft); }
.faa-ai__chips[hidden] { display: none; }
.faa-ai__chip {
	border: 1px solid var(--faa-brand-2); background: #fff; color: var(--faa-brand);
	border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.faa-ai__chip:hover { background: var(--faa-brand); color: #fff; }

.faa-ai__form {
	display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; margin: 0;
	border-top: 1px solid #eee; background: #fff;
}
.faa-ai__form textarea {
	flex: 1; resize: none; border: 1px solid #ddd; border-radius: 12px; padding: 9px 12px;
	font: inherit; font-size: 14.5px; line-height: 1.5; max-height: 110px; min-height: 40px; outline: none; color: var(--faa-text); background: #fff;
}
.faa-ai__form textarea:focus { border-color: var(--faa-brand-2); }
.faa-ai__form button {
	width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--faa-brand); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0;
}
.faa-ai__form button:disabled { opacity: .5; cursor: default; }
[dir="rtl"] .faa-ai__form button svg { transform: scaleX(-1); }
.faa-ai__disc { font-size: 11px; color: #8a7d70; text-align: center; padding: 0 12px 8px; background: #fff; }

@media (max-width: 480px) {
	#faa-ai-root { bottom: 16px; }
	#faa-ai-root.faa-ai--right { right: 16px; }
	#faa-ai-root.faa-ai--left { left: 16px; }
	.faa-ai__fab { width: 54px; height: 54px; }
	#faa-ai-root.is-open .faa-ai__panel {
		position: fixed; inset: 0; width: 100vw; max-width: none; height: 100%; max-height: none; border-radius: 0; bottom: 0;
	}
	#faa-ai-root.is-open .faa-ai__fab { display: none; }
}

/* Keep the panel below the WordPress admin bar for logged-in users */
body.admin-bar #faa-ai-root .faa-ai__panel { max-height: calc(100vh - 152px); }
