/**
 * 全站浮动：企业微信客服（PC + 移动端）
 * 配色参考企业微信绿 #24C362
 */
.kf-float-widget {
	position: fixed;
	right: 28px;
	bottom: 28px;
	z-index: 99999;
	width: 0;
	height: 0;
	font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
	-webkit-font-smoothing: antialiased;
}

.kf-float-inner {
	position: absolute;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	width: max-content;
	max-width: calc(100vw - 24px);
	pointer-events: none;
}

.kf-float-inner > * {
	pointer-events: auto;
}

/* ---------- 图1：气泡提示 ---------- */
.kf-teaser {
	display: none !important;
	position: relative;
	width: 268px;
	padding: 14px 36px 14px 16px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
	border: 1px solid rgba(0, 0, 0, 0.06);
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.28s ease, transform 0.28s ease;
}

.kf-float-widget.is-open .kf-teaser,
.kf-float-widget.teaser-dismissed .kf-teaser {
	opacity: 0;
	pointer-events: none;
	transform: translateY(6px);
	visibility: hidden;
	height: 0;
	padding: 0;
	margin: 0;
	overflow: hidden;
	border: none;
	box-shadow: none;
}

.kf-teaser-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 22px;
	height: 22px;
	border: none;
	padding: 0;
	margin: 0;
	background: transparent;
	color: #c4c9d4;
	font-size: 18px;
	line-height: 22px;
	cursor: pointer;
	border-radius: 4px;
}

.kf-teaser-close:hover {
	color: #8b97ab;
}

.kf-teaser-line1 {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	color: #1d2129;
	line-height: 1.45;
}

.kf-teaser-line2 {
	margin: 6px 0 0;
	font-size: 13px;
	font-weight: 400;
	color: #24c362;
	line-height: 1.45;
}

.kf-teaser-tail {
	position: absolute;
	right: 28px;
	left: auto;
	bottom: -7px;
	width: 14px;
	height: 7px;
	margin-left: 0;
	overflow: hidden;
}

.kf-teaser-tail::after {
	content: "";
	position: absolute;
	left: 2px;
	top: -6px;
	width: 10px;
	height: 10px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	transform: rotate(45deg);
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

/* ---------- 图2：展开面板 ---------- */
.kf-panel {
	width: 320px;
	max-width: calc(100vw - 32px);
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
	border: 1px solid rgba(0, 0, 0, 0.06);
	opacity: 0;
	transform: translateY(8px) scale(0.98);
	pointer-events: none;
	visibility: hidden;
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.kf-float-widget.is-open .kf-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	visibility: visible;
}

.kf-panel-hd {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 14px 14px 16px;
	background: #24c362;
	color: #fff;
}

.kf-panel-hd-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.kf-hd-icon-wrap {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.kf-hd-icon-wrap .kf-svg {
	width: 20px;
	height: 20px;
}

.kf-custom-icon {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.kf-custom-icon-chat {
	width: 20px;
	height: 20px;
}

.kf-custom-icon-service {
	width: 20px;
	height: 20px;
}

.kf-panel-title {
	font-size: 17px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0.02em;
}

.kf-panel-sub {
	margin-top: 2px;
	font-size: 12px;
	font-weight: 400;
	opacity: 0.95;
	line-height: 1.3;
}

.kf-panel-close {
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.kf-panel-close:hover {
	background: rgba(255, 255, 255, 0.15);
}

.kf-panel-bd {
	padding: 16px 16px 18px;
	background: #fff;
}

.kf-msg-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.kf-msg-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #e8f8ee;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.kf-msg-avatar .kf-svg {
	width: 20px;
	height: 20px;
}

.kf-msg-bubble {
	flex: 1;
	min-width: 0;
	padding: 12px 14px;
	background: #f3f4f6;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.55;
	color: #1d2129;
}

.kf-status {
	margin-top: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #8b97ab;
}

.kf-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #24c362;
	flex-shrink: 0;
}

.kf-cta-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
	width: 100%;
	height: 46px;
	border-radius: 10px;
	background: #24c362;
	color: #fff !important;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	box-shadow: 0 6px 16px rgba(36, 195, 98, 0.35);
	transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
	box-sizing: border-box;
}

.kf-cta-btn .kf-svg {
	width: 18px;
	height: 18px;
}

.kf-cta-btn .kf-cta-icon {
	width: 18px;
	height: 18px;
}

.kf-cta-btn:hover {
	background: #1fad55;
	box-shadow: 0 8px 20px rgba(36, 195, 98, 0.42);
}

.kf-cta-btn:active {
	transform: scale(0.99);
}

.kf-cta-note {
	margin: 10px 0 0;
	text-align: center;
	font-size: 12px;
	color: #8b97ab;
	line-height: 1.4;
}

/* ---------- 底部圆形按钮 ---------- */
.kf-fab {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: #24c362;
	box-shadow: 0 3px 10px rgba(20, 120, 58, 0.35);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
	flex-shrink: 0;
	position: relative;
	z-index: 2;
	isolation: isolate;
}

/* 发送信号动效：水波纹向外扩散，逐渐变浅消失后循环 */
.kf-fab::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	transform: translate(-50%, -50%) scale(1);
	border: none;
	box-shadow: 0 0 0 0 rgba(36, 195, 98, 0.26);
	background: transparent;
	pointer-events: none;
	z-index: -1;
	opacity: 0;
	animation: kfFabPulseSmooth 2.4s ease-out infinite;
}

.kf-fab::after {
	content: none !important;
	animation: none !important;
}

.kf-float-widget.is-open .kf-fab::before {
	animation-play-state: paused;
	opacity: 0;
}

.kf-fab:hover {
	background: #1fad55;
	box-shadow: 0 8px 24px rgba(36, 195, 98, 0.5);
}

.kf-fab:active {
	transform: scale(0.96);
}

.kf-fab-icon-open {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
}

.kf-fab-icon-open img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	/* 尽量减少浏览器缩放插值导致的发糊 */
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	transform: translateZ(0);
	backface-visibility: hidden;
	filter: brightness(1.05) contrast(1.08);
}

.kf-fab-icon-close {
	display: none;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	font-weight: 300;
}

.kf-float-widget.is-open .kf-fab-icon-open {
	display: none;
}

.kf-float-widget.is-open .kf-fab-icon-close {
	display: block;
}

@keyframes kfFabPulseSmooth {
	0% {
		opacity: 0;
		transform: translate(-50%, -50%) scale(1);
		border-color: rgba(36, 195, 98, 0);
		box-shadow: 0 0 0 0 rgba(36, 195, 98, 0);
		background: transparent;
	}
	10% {
		opacity: 0.48;
		transform: translate(-50%, -50%) scale(1.1);
		box-shadow: 0 0 0 2px rgba(36, 195, 98, 0.36);
		background: transparent;
	}
	65% {
		opacity: 0.16;
		transform: translate(-50%, -50%) scale(2.05);
		box-shadow: 0 0 0 12px rgba(57, 208, 117, 0.14);
		background: transparent;
	}
	100% {
		opacity: 0;
		transform: translate(-50%, -50%) scale(2.45);
		box-shadow: 0 0 0 18px rgba(104, 230, 155, 0);
		background: transparent;
	}
}

@media (max-width: 768px) {
	.kf-float-widget {
		right: 18px;
		bottom: calc(88px + env(safe-area-inset-bottom, 0px));
	}

	.kf-teaser {
		width: 252px;
		padding: 12px 34px 12px 14px;
	}

	.kf-panel {
		width: min(320px, calc(100vw - 24px));
		border-radius: 14px;
	}

	.kf-fab {
		width: 46px;
		height: 46px;
	}
}
