/* Fansidea-style floating chat bot */

.fi-chat {
	--fi-chat-ink: #121212;
	--fi-chat-accent: #e10600;
	--fi-chat-bg: #f7f4ef;
	--fi-chat-panel: #ffffff;
	--fi-chat-bot: #1b1b1b;
	--fi-chat-user: #e10600;
	--fi-chat-muted: #6b6b6b;
	font-family: "Outfit", system-ui, sans-serif;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 2147483000;
	pointer-events: auto;
	line-height: 1.4;
}

.fi-chat *,
.fi-chat *::before,
.fi-chat *::after {
	box-sizing: border-box;
}

.fi-chat-launcher {
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(145deg, #ff2a1f 0%, #c40000 100%);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 12px 28px rgba(225, 6, 0, 0.35);
	display: grid;
	place-items: center;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.fi-chat-launcher:hover {
	transform: translateY(-3px) scale(1.04);
	box-shadow: 0 16px 32px rgba(225, 6, 0, 0.42);
}

.fi-chat-launcher svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
}

.fi-chat-launcher .fi-chat-close-icon {
	display: none;
}

.fi-chat.is-open .fi-chat-launcher .fi-chat-open-icon {
	display: none;
}

.fi-chat.is-open .fi-chat-launcher .fi-chat-close-icon {
	display: block;
}

.fi-chat-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: #111;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	display: grid;
	place-items: center;
}

.fi-chat.is-open .fi-chat-badge {
	display: none;
}

.fi-chat-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: min(380px, calc(100vw - 28px));
	height: min(560px, calc(100vh - 120px));
	background: var(--fi-chat-panel);
	border-radius: 18px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.96);
	transform-origin: bottom right;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.fi-chat.is-open .fi-chat-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.fi-chat-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 14px;
	background: linear-gradient(120deg, #161616 0%, #3a0d0d 55%, #e10600 160%);
	color: #fff;
}

.fi-chat-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: #fff;
	color: var(--fi-chat-accent);
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: 14px;
	flex-shrink: 0;
}

.fi-chat-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}

.fi-chat-header p {
	margin: 2px 0 0;
	font-size: 12px;
	opacity: 0.82;
}

.fi-chat-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.fi-chat-status::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #37d67a;
	box-shadow: 0 0 0 3px rgba(55, 214, 122, 0.25);
}

.fi-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background:
		radial-gradient(600px 200px at 100% 0%, rgba(225, 6, 0, 0.06), transparent 60%),
		var(--fi-chat-bg);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fi-chat-msg {
	max-width: 86%;
	padding: 10px 12px;
	border-radius: 14px;
	font-size: 14px;
	white-space: pre-wrap;
	word-break: break-word;
	animation: fiChatIn 0.28s ease;
}

@keyframes fiChatIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.fi-chat-msg.bot {
	align-self: flex-start;
	background: #fff;
	color: var(--fi-chat-ink);
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.fi-chat-msg.user {
	align-self: flex-end;
	background: var(--fi-chat-user);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.fi-chat-msg.typing {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	min-width: 52px;
}

.fi-chat-msg.typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #bbb;
	animation: fiChatDot 1.2s infinite ease-in-out;
}

.fi-chat-msg.typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.fi-chat-msg.typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes fiChatDot {
	0%,
	80%,
	100% {
		transform: translateY(0);
		opacity: 0.45;
	}
	40% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

.fi-chat-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 16px 12px;
	background: var(--fi-chat-bg);
}

.fi-chat-chip {
	border: 1px solid rgba(18, 18, 18, 0.12);
	background: #fff;
	color: var(--fi-chat-ink);
	border-radius: 999px;
	padding: 8px 12px;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.fi-chat-chip:hover {
	background: var(--fi-chat-ink);
	color: #fff;
	border-color: var(--fi-chat-ink);
}

.fi-chat-inputbar {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid rgba(18, 18, 18, 0.08);
	background: #fff;
}

.fi-chat-inputbar input {
	flex: 1;
	min-width: 0;
	height: 44px;
	border: 1px solid rgba(18, 18, 18, 0.12);
	border-radius: 12px;
	padding: 0 12px;
	font: inherit;
	font-size: 14px;
	outline: none;
}

.fi-chat-inputbar input:focus {
	border-color: rgba(225, 6, 0, 0.45);
	box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.12);
}

.fi-chat-send {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 12px;
	background: var(--fi-chat-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	flex-shrink: 0;
	transition: filter 0.2s ease;
}

.fi-chat-send:hover {
	filter: brightness(1.08);
}

.fi-chat-send svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.fi-chat-footer {
	padding: 0 12px 10px;
	font-size: 11px;
	color: var(--fi-chat-muted);
	text-align: center;
	background: #fff;
}

.fi-chat .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

@media (max-width: 480px) {
	.fi-chat {
		right: 12px;
		bottom: 12px;
	}

	.fi-chat-panel {
		bottom: 72px;
		height: min(70vh, 560px);
	}
}
