/**
 * 思维工具箱 — LiveChat 风格预对话表单（中文版）
 */
.siwei-chat-root {
	position: relative;
	z-index: 999999;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
	font-size: 14px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	color: #1f2937;
}

/* —— 右下角浮动按钮 —— */
.siwei-chat-fab {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1000001;
	width: 60px;
	height: 60px;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(145deg, #ff8a34 0%, #ff6b00 45%, #ea580c 100%);
	color: #fff;
	box-shadow:
		0 4px 20px rgba(234, 88, 12, 0.42),
		0 2px 6px rgba(15, 23, 42, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	padding: 0;
}

.siwei-chat-fab:hover {
	transform: scale(1.06);
	box-shadow:
		0 8px 28px rgba(234, 88, 12, 0.48),
		0 4px 10px rgba(15, 23, 42, 0.1);
}

.siwei-chat-fab svg {
	width: 28px;
	height: 28px;
	pointer-events: none;
}

.siwei-chat-fab .siwei-chat-fab__icon-close {
	display: none;
	width: 24px;
	height: 24px;
}

.siwei-chat-root.is-open .siwei-chat-fab {
	background: linear-gradient(145deg, #64748b 0%, #475569 100%);
	box-shadow: 0 4px 16px rgba(71, 85, 105, 0.35);
}

.siwei-chat-root.is-open .siwei-chat-fab .siwei-chat-fab__icon-chat {
	display: none;
}

.siwei-chat-root.is-open .siwei-chat-fab .siwei-chat-fab__icon-close {
	display: block;
}

/* —— 主窗口外壳 —— */
.siwei-chat-window {
	position: fixed;
	right: 20px;
	bottom: 96px;
	z-index: 1000000;
	width: min(380px, calc(100vw - 24px));
	max-height: min(620px, calc(100vh - 110px));
	display: flex;
	flex-direction: column;
	background: #eceff4;
	border-radius: 12px;
	overflow: hidden;
	box-shadow:
		0 20px 50px rgba(15, 23, 42, 0.2),
		0 0 0 1px rgba(15, 23, 42, 0.06);
	opacity: 0;
	visibility: hidden;
	transform: translate3d(0, 16px, 0);
	transition:
		opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
		transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
		visibility 0.28s;
	pointer-events: none;
}

.siwei-chat-root.is-open .siwei-chat-window {
	opacity: 1;
	visibility: visible;
	transform: translate3d(0, 0, 0);
	pointer-events: auto;
}

/* 顶栏：返回 · 菜单 · 收起 */
.siwei-lc-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	background: #fff;
	border-bottom: 1px solid #e8eaef;
	flex-shrink: 0;
}

.siwei-lc-toolbar__btn {
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 10px;
	background: transparent;
	color: #6b7280;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s, color 0.15s;
}

.siwei-lc-toolbar__btn:hover {
	background: #f3f4f6;
	color: #374151;
}

.siwei-lc-toolbar__btn svg {
	width: 22px;
	height: 22px;
	pointer-events: none;
}

.siwei-lc-toolbar__dots {
	letter-spacing: 2px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	color: #9ca3af;
	cursor: default;
	user-select: none;
	padding: 6px 10px;
}

/* 客服信息条 */
.siwei-lc-agent {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 18px 14px;
	background: linear-gradient(180deg, #fafbfc 0%, #f3f5f9 100%);
	border-bottom: 1px solid #e5e7eb;
	flex-shrink: 0;
}

.siwei-lc-agent__avatar {
	position: relative;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	flex-shrink: 0;
	background: linear-gradient(145deg, #e0e7ff 0%, #c7d2fe 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.siwei-lc-agent__avatar svg {
	width: 28px;
	height: 28px;
	color: #4f46e5;
	opacity: 0.9;
}

.siwei-lc-agent__online {
	position: absolute;
	right: 2px;
	bottom: 2px;
	width: 12px;
	height: 12px;
	background: #22c55e;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.siwei-lc-agent__meta {
	min-width: 0;
}

.siwei-lc-agent__meta strong {
	display: block;
	font-size: 17px;
	font-weight: 700;
	color: #111827;
	letter-spacing: 0.02em;
	line-height: 1.25;
}

.siwei-lc-agent__meta span {
	display: block;
	font-size: 13px;
	color: #6b7280;
	margin-top: 3px;
}

/* 表单白卡片 */
.siwei-lc-card {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 14px 16px 12px;
}

.siwei-lc-welcome {
	margin: 0 0 18px;
	font-size: 14px;
	line-height: 1.65;
	color: #4b5563;
}

.siwei-lc-form .siwei-chat-honeypot {
	position: absolute !important;
	left: -9999px !important;
	width: 0 !important;
	height: 0 !important;
	opacity: 0 !important;
	overflow: hidden !important;
	pointer-events: none !important;
}

.siwei-lc-field {
	margin-bottom: 14px;
}

.siwei-lc-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 6px;
}

.siwei-lc-field label .siwei-lc-req {
	color: #ef4444;
	font-weight: 700;
	margin-left: 2px;
}

.siwei-lc-field input,
.siwei-lc-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 11px 13px;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 14px;
	background: #f3f4f6;
	color: #111827;
	transition: background 0.15s, box-shadow 0.15s;
}

.siwei-lc-field input::placeholder,
.siwei-lc-field textarea::placeholder {
	color: #9ca3af;
}

.siwei-lc-field input:focus,
.siwei-lc-field textarea:focus {
	outline: none;
	background: #fff;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 107, 0, 0.35);
}

.siwei-lc-field textarea {
	min-height: 88px;
	resize: vertical;
	line-height: 1.5;
}

.siwei-lc-submit {
	width: 100%;
	margin-top: 6px;
	padding: 14px 18px;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	color: #111827;
	background: linear-gradient(180deg, #ffb040 0%, #ff8c00 35%, #ff6b00 100%);
	box-shadow: 0 2px 10px rgba(255, 107, 0, 0.38);
	transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}

.siwei-lc-submit:hover:not(:disabled) {
	box-shadow: 0 4px 14px rgba(255, 107, 0, 0.45);
	transform: translateY(-1px);
}

.siwei-lc-submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}

/* 发送成功后的简短对话区（可选） */
.siwei-lc-stream {
	min-height: 0;
	padding: 0 16px 8px;
	display: none;
}

.siwei-lc-stream.has-msg {
	display: block;
}

.siwei-lc-bubble-user {
	max-width: 92%;
	margin-left: auto;
	padding: 10px 13px;
	border-radius: 12px 12px 4px 12px;
	background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
	color: #fff;
	font-size: 13px;
	line-height: 1.5;
	margin-bottom: 8px;
	word-break: break-word;
}

.siwei-lc-bubble-agent {
	max-width: 92%;
	margin-right: auto;
	padding: 10px 13px;
	border-radius: 12px 12px 12px 4px;
	background: #fff;
	color: #374151;
	font-size: 13px;
	line-height: 1.5;
	margin-bottom: 8px;
	word-break: break-word;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
	border: 1px solid #e5e7eb;
}

.siwei-hidden {
	display: none !important;
}

.siwei-lc-verified-email {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 10px;
	margin-bottom: 14px;
	padding: 10px 12px;
	border-radius: 8px;
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	font-size: 13px;
	line-height: 1.45;
	color: #3730a3;
}

.siwei-lc-verified-email__label {
	font-weight: 600;
	color: #4338ca;
}

.siwei-lc-verified-email__addr {
	font-weight: 500;
	word-break: break-all;
}

.siwei-lc-verify-panel {
	margin-bottom: 4px;
}

.siwei-lc-submit--secondary {
	margin-top: 10px;
	background: #fff;
	color: #374151;
	border: 1px solid #d1d5db;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
	font-weight: 600;
}

.siwei-lc-submit--secondary:hover:not(:disabled) {
	background: #f9fafb;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
	transform: translateY(-1px);
}

/* 状态提示 */
.siwei-chat-status {
	font-size: 13px;
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	display: none;
	line-height: 1.45;
}

.siwei-chat-status.is-visible.is-error {
	display: block;
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
}

.siwei-chat-status.is-visible.is-success {
	display: block;
	background: #ecfdf5;
	color: #047857;
	border: 1px solid #a7f3d0;
}

/* 底部 Powered by */
.siwei-lc-powered {
	flex-shrink: 0;
	padding: 10px 14px 12px;
	text-align: center;
	font-size: 11px;
	color: #9ca3af;
	background: #eceff4;
	border-top: 1px solid #e2e5ea;
}

.siwei-lc-powered span {
	color: #ff6b00;
	font-weight: 600;
}

@media (max-width: 480px) {
	.siwei-chat-fab {
		right: 14px;
		bottom: 14px;
		width: 56px;
		height: 56px;
	}

	.siwei-chat-window {
		right: 10px;
		left: 10px;
		bottom: 84px;
		width: auto;
		max-height: min(78vh, 600px);
	}
}
