#fchat-root {
	--fchat-primary: #14171f;
	--fchat-accent: #b08d57;
	position: fixed;
	bottom: 22px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#fchat-root.fchat-right { right: 22px; }
#fchat-root.fchat-left  { left: 22px; }

#fchat-bubble {
	width: var(--fchat-bubble-size, 60px);
	height: var(--fchat-bubble-size, 60px);
	border-radius: 50%;
	background: var(--fchat-primary);
	border: none;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform .15s ease;
	overflow: hidden;
	padding: 0;
}
#fchat-bubble:hover { transform: scale(1.06); }
.fchat-bubble-icon { font-size: calc(var(--fchat-bubble-size, 60px) * 0.42); line-height: 1; }
.fchat-bubble-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}
.fchat-bubble-ping {
	position: absolute;
	top: -3px;
	right: -3px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--fchat-accent);
	box-shadow: 0 0 0 0 rgba(176,141,87,.7);
	animation: fchat-pulse 2s infinite;
}
.fchat-bubble-ping.fchat-hide { display: none; }
@keyframes fchat-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(176,141,87,.6); }
	70%  { box-shadow: 0 0 0 10px rgba(176,141,87,0); }
	100% { box-shadow: 0 0 0 0 rgba(176,141,87,0); }
}

.fchat-panel {
	position: absolute;
	bottom: 74px;
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 480px;
	max-height: 70vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0,0,0,0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: fchat-rise .18s ease;
}
#fchat-root.fchat-right .fchat-panel { right: 0; }
#fchat-root.fchat-left  .fchat-panel { left: 0; }

@keyframes fchat-rise {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

.fchat-header {
	background: var(--fchat-primary);
	color: #fff;
	padding: 14px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}
.fchat-header-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255,255,255,0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 17px;
	overflow: hidden;
	flex-shrink: 0;
}
.fchat-header-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.fchat-header-text { flex: 1; }
.fchat-header-name { font-weight: 600; font-size: 14px; }
.fchat-header-status { font-size: 11px; opacity: .75; }
.fchat-header-status:before {
	content: "";
	display: inline-block;
	width: 6px; height: 6px;
	border-radius: 50%;
	background: #4caf7d;
	margin-right: 5px;
}
#fchat-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: .8;
	padding: 0 4px;
}
#fchat-close:hover { opacity: 1; }

.fchat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f7f5f0;
}

.fchat-msg {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.45;
	word-wrap: break-word;
}
.fchat-msg p { margin: 0 0 6px; }
.fchat-msg p:last-child { margin-bottom: 0; }
.fchat-msg.bot {
	background: #fff;
	border: 1px solid rgba(0,0,0,0.08);
	align-self: flex-start;
	border-bottom-left-radius: 3px;
}
.fchat-source-link {
	color: var(--fchat-accent);
	font-weight: 600;
	text-decoration: none;
}
.fchat-source-link:hover { text-decoration: underline; }
.fchat-msg.user {
	background: var(--fchat-primary);
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 3px;
}

.fchat-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid rgba(0,0,0,0.08);
	border-radius: 12px;
	border-bottom-left-radius: 3px;
}
.fchat-typing span {
	width: 6px; height: 6px;
	border-radius: 50%;
	background: #bbb;
	animation: fchat-blink 1.2s infinite;
}
.fchat-typing span:nth-child(2) { animation-delay: .2s; }
.fchat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes fchat-blink {
	0%, 80%, 100% { opacity: .25; }
	40% { opacity: 1; }
}

.fchat-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 10px;
	flex-shrink: 0;
	background: #f7f5f0;
}
.fchat-chip {
	background: #fff;
	border: 1px solid rgba(0,0,0,0.12);
	border-radius: 20px;
	padding: 6px 12px;
	font-size: 12px;
	cursor: pointer;
	color: var(--fchat-primary);
	transition: background .15s ease;
}
.fchat-chip:hover { background: var(--fchat-accent); color: #fff; border-color: var(--fchat-accent); }

.fchat-input-row {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid rgba(0,0,0,0.08);
	flex-shrink: 0;
	background: #fff;
}
#fchat-input {
	flex: 1;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 20px;
	padding: 9px 14px;
	font-size: 13.5px;
	outline: none;
}
#fchat-input:focus { border-color: var(--fchat-accent); }
#fchat-send {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: var(--fchat-accent);
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
	font-size: 14px;
}
#fchat-send:hover { opacity: .9; }

@media (max-width: 480px) {
	.fchat-panel { width: calc(100vw - 24px); height: 65vh; }
	#fchat-root.fchat-right, #fchat-root.fchat-left { right: 12px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.fchat-panel, .fchat-bubble-ping, .fchat-typing span { animation: none !important; }
}
