/* ==========================================================================
   Rapid Legal Funding - AI Assistant widget
   Everything is scoped to .rlfai-wrap and prefixed rlfai-, so it cannot
   collide with the theme (rlf/rlfn) or the intake form (rlfi).
   ========================================================================== */

.rlfai-wrap {
	--rlfai-ink: #0E1B2A;
	--rlfai-ink-soft: #43536A;
	--rlfai-accent: #B8862B;
	--rlfai-accent-dk: #96691B;
	--rlfai-panel: #F5F6F8;
	--rlfai-line: #DCE0E7;

	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--rlfai-ink);
	line-height: 1.5;
}

.rlfai-wrap *,
.rlfai-wrap *::before,
.rlfai-wrap *::after { box-sizing: inherit; }

.rlfai-wrap :where(p, ul, li) { margin: 0; padding: 0; list-style: none; }
.rlfai-wrap :where(button) { font-family: inherit; margin: 0; }

/* ---------- Floating launcher ---------- */

.rlfai-float {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99998;
}

.rlfai-launcher {
	display: flex;
	align-items: center;
	gap: 9px;
	background: var(--rlfai-ink);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 13px 20px 13px 16px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 10px 26px -10px rgba(14, 27, 42, .7);
	transition: transform .15s ease, background .15s ease;
}

.rlfai-launcher:hover { background: #16283C; transform: translateY(-1px); }
.rlfai-launcher-icon { display: flex; color: var(--rlfai-accent); }

/* ---------- Panel ---------- */

.rlfai-panel {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--rlfai-line);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 20px 50px -20px rgba(14, 27, 42, .55);
}

.rlfai-panel[hidden] { display: none; }

.rlfai-float .rlfai-panel {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 40px);
}

.rlfai-inline .rlfai-panel {
	width: 100%;
	max-width: 640px;
	height: 520px;
	margin: 0 auto;
}

.rlfai-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--rlfai-ink);
	color: #fff;
	padding: 15px 18px;
}

.rlfai-brand { font-size: 15px; font-weight: 700; color: #fff; }

.rlfai-status {
	font-size: 11.5px;
	color: #A8B8CC;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
}

.rlfai-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #3FB27F;
	display: inline-block;
}

.rlfai-close {
	background: none;
	border: 0;
	color: #A8B8CC;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.rlfai-close:hover { color: #fff; }

/* ---------- Log ---------- */

.rlfai-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--rlfai-panel);
}

.rlfai-msg {
	max-width: 86%;
	padding: 12px 15px;
	border-radius: 14px;
	font-size: 14.5px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.rlfai-bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--rlfai-line);
	border-bottom-left-radius: 5px;
	color: var(--rlfai-ink);
}

.rlfai-user {
	align-self: flex-end;
	background: var(--rlfai-ink);
	color: #fff;
	border-bottom-right-radius: 5px;
}

.rlfai-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 14px 16px;
	background: #fff;
	border: 1px solid var(--rlfai-line);
	border-radius: 14px;
}

.rlfai-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9AA6B6;
	animation: rlfai-bounce 1.2s infinite;
}

.rlfai-typing span:nth-child(2) { animation-delay: .15s; }
.rlfai-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes rlfai-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Suggestions ---------- */

.rlfai-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 12px 18px 0;
	background: var(--rlfai-panel);
}

.rlfai-suggestions[hidden] { display: none; }

.rlfai-chip {
	background: #fff;
	border: 1px solid var(--rlfai-line);
	border-radius: 999px;
	padding: 8px 14px;
	font-size: 13px;
	color: var(--rlfai-ink-soft);
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease;
}

.rlfai-chip:hover { border-color: var(--rlfai-accent); color: var(--rlfai-ink); }

/* ---------- Compose ---------- */

.rlfai-compose {
	display: flex;
	align-items: flex-end;
	gap: 9px;
	padding: 14px 16px;
	background: var(--rlfai-panel);
	border-top: 1px solid var(--rlfai-line);
}

.rlfai-input {
	flex: 1 1 auto;
	resize: none;
	border: 1.5px solid var(--rlfai-line);
	border-radius: 10px;
	padding: 11px 13px;
	font-family: inherit;
	font-size: 16px; /* 16px keeps iOS from zooming */
	line-height: 1.4;
	max-height: 110px;
	background: #fff;
	color: var(--rlfai-ink);
}

.rlfai-input:focus {
	outline: none;
	border-color: var(--rlfai-accent);
	box-shadow: 0 0 0 3px rgba(184, 134, 43, .16);
}

.rlfai-send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 10px;
	background: var(--rlfai-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease;
}

.rlfai-send:hover { background: var(--rlfai-accent-dk); }
.rlfai-send[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Foot ---------- */

.rlfai-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 16px 12px;
	background: var(--rlfai-panel);
	font-size: 11px;
	color: var(--rlfai-ink-soft);
}

.rlfai-call {
	color: var(--rlfai-ink);
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.rlfai-call:hover { color: var(--rlfai-accent-dk); }
.rlfai-disclaimer { text-align: right; line-height: 1.35; }

@media (max-width: 480px) {
	.rlfai-float .rlfai-panel {
		right: 8px;
		left: 8px;
		bottom: 8px;
		width: auto;
		height: calc(100vh - 90px);
	}
	.rlfai-launcher-label { display: none; }
	.rlfai-launcher { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.rlfai-wrap * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
