/**
 * LSKJ 在线客服 · 前台（右下角浮钮 + 聊天面板）。
 * 移动优先：面板窄屏全屏铺开。
 */

.lskj-chat-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: #09478c;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(9, 71, 140, .35);
	transition: transform .2s ease, box-shadow .2s ease;
}

.lskj-chat-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(9, 71, 140, .42);
}

.lskj-chat-launcher svg {
	display: block;
}

.lskj-chat-launcher__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid rgba(9, 71, 140, .45);
	animation: lskj-chat-pulse 2.4s ease-out infinite;
	pointer-events: none;
}

@keyframes lskj-chat-pulse {
	0%   { transform: scale(1);   opacity: .8; }
	70%  { transform: scale(1.55); opacity: 0; }
	100% { transform: scale(1.55); opacity: 0; }
}

/* ---------- 面板 ---------- */

.lskj-chat-panel {
	position: fixed;
	right: 20px;
	bottom: 88px;
	z-index: 99991;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	display: flex;
	flex-direction: column;
	background: #f5f6f7;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
	animation: lskj-chat-pop .18s ease;
}

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

@keyframes lskj-chat-pop {
	from { opacity: 0; transform: translateY(10px) scale(.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lskj-chat-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #09478c;
	color: #fff;
}

.lskj-chat-panel__title {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.lskj-chat-panel__brand {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
}

.lskj-chat-panel__status {
	font-size: 12px;
	opacity: .9;
	display: flex;
	align-items: center;
	gap: 5px;
}

.lskj-chat-panel__status i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #2ee06a;
	display: inline-block;
}

.lskj-chat-panel__close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
	opacity: .85;
}

.lskj-chat-panel__close:hover { opacity: 1; }

/* 访客称呼/联系方式（首次发送前展示） */

.lskj-chat-panel__meta {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-bottom: 1px solid #e5e6e7;
}

.lskj-chat-panel__meta[hidden] { display: none; }

.lskj-chat-panel__meta input {
	flex: 1;
	min-width: 0;
	border: 1px solid #d5d8db;
	border-radius: 6px;
	padding: 7px 9px;
	font-size: 13px;
}

/* 消息区（微信风：灰底，访客白气泡靠左，客服绿气泡靠右） */

.lskj-chat-panel__body {
	flex: 1;
	overflow-y: auto;
	background: #ededed;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.lskj-chat-panel__hint {
	text-align: center;
	font-size: 12px;
	color: #999;
}

.lskj-chat-panel__hint[hidden] { display: none; }

.lskj-chat {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* 时间分隔线（相邻消息间隔 > 5 分钟） */

.lskj-chat-time {
	text-align: center;
	font-size: 12px;
	color: #b0b3b7;
	margin: 2px 0;
}

/* 会话组：同发送者连续消息归组，头像只显示在组内最后一条 */

.lskj-chat-group {
	display: flex;
	flex-direction: column;
}

.lskj-chat-group--admin {
	align-items: flex-end;
}

.lskj-chat-group--visitor {
	align-items: flex-start;
}

.lskj-chat-row {
	display: flex;
	align-items: flex-end;
	max-width: 100%;
	margin-top: 2px;
}

.lskj-chat-row:first-child { margin-top: 0; }

.lskj-chat-row__avatar {
	width: 32px;
	height: 32px;
	border-radius: 6px;
	margin: 0 8px;
	flex: none;
	overflow: hidden;
	visibility: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lskj-chat-row:last-child .lskj-chat-row__avatar {
	visibility: visible;
}

.lskj-chat-row__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.lskj-chat-row__avatar--visitor {
	background: #c4c7cb;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
}

.lskj-chat-row--admin .lskj-chat-row__avatar {
	border-radius: 6px;
	background: #fff;
}

/* 气泡 + 小三角 */

.lskj-chat-row__bubble {
	position: relative;
	max-width: 78%;
	padding: 9px 12px;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.55;
	word-break: break-word;
	white-space: pre-wrap;
}

.lskj-chat-row--visitor .lskj-chat-row__bubble {
	background: #fff;
	color: #1b1b1b;
	border-top-left-radius: 2px;
}

.lskj-chat-row--visitor .lskj-chat-row__bubble::after {
	content: "";
	position: absolute;
	left: -7px;
	bottom: 0;
	border: 0 solid transparent;
	border-width: 0 7px 9px 0;
	border-right-color: inherit;
	border-bottom-color: #fff;
	transform: translateX(0);
}

.lskj-chat-row--admin .lskj-chat-row__bubble {
	background: #95ec69;
	color: #1b1b1b;
	border-top-right-radius: 2px;
}

.lskj-chat-row--admin .lskj-chat-row__bubble::after {
	content: "";
	position: absolute;
	right: -7px;
	bottom: 0;
	border: 0 solid transparent;
	border-width: 0 0 9px 7px;
	border-left-color: inherit;
	border-bottom-color: #95ec69;
}

/* 输入条 */

.lskj-chat-panel__input {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #e5e6e7;
}

.lskj-chat-panel__input textarea {
	flex: 1;
	min-height: 34px;
	max-height: 100px;
	border: 1px solid #d5d8db;
	border-radius: 6px;
	padding: 8px 10px;
	font-size: 14px;
	resize: none;
	line-height: 1.4;
}

.lskj-chat-panel__send {
	border: 0;
	border-radius: 6px;
	background: #09478c;
	color: #fff;
	font-size: 14px;
	padding: 9px 18px;
	cursor: pointer;
	transition: opacity .15s ease;
}

.lskj-chat-panel__send:disabled {
	opacity: .45;
	cursor: not-allowed;
}

/* 窄屏铺满 */

@media (max-width: 600px) {
	.lskj-chat-panel {
		inset: 0;
		width: 100%;
		height: 100%;
		max-width: 100%;
		max-height: 100%;
		border-radius: 0;
	}

	.lskj-chat-launcher {
		right: 16px;
		bottom: 16px;
	}
}