/* Paticozy chat widget (work) — 复用主题 --pati-* 变量，视觉与站内一致 */

/* 隐藏主题自带的静态咨询面板，由本插件的聊天窗接管入口 */
.pati-consult:not(.pcz-chat) {
	display: none !important;
}

/* 主题全局样式会把组件内 svg 当可伸缩项压扁，这里统一锁死尺寸 */
.pcz-chat svg {
	flex: none;
}

.pcz-chat-toggle svg {
	width: 23px;
	height: 23px;
	display: block;
}

.pcz-chat-avatar svg {
	width: 19px;
	height: 19px;
	display: block;
}

.pcz-chat .pati-consult-toggle {
	position: relative;
}

.pcz-chat-dot {
	position: absolute;
	top: 1px;
	right: 1px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #e8703a;
	border: 2px solid #fff;
	box-sizing: content-box;
}

.pcz-chat .pati-consult-panel {
	width: 344px;
	max-width: calc(100vw - 32px);
	height: 486px;
	max-height: calc(100vh - 130px);
	padding: 0;
	gap: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	border-radius: 14px;
}

.pcz-chat .pati-consult-panel[hidden] {
	display: none !important;
}

/* ---------- 头部 ---------- */
.pcz-chat-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--pati-primary, #2f4a3c);
	color: #fff;
	flex: none;
}

.pcz-chat-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	color: #fff;
}

.pcz-chat-head-txt {
	min-width: 0;
	line-height: 1.25;
}

.pcz-chat-head-txt strong {
	display: block;
	font-family: var(--pati-font-heading, inherit);
	font-size: 14px;
	font-weight: 700;
	color: #fff;
}

.pcz-chat-presence {
	display: block;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.78);
	margin-top: 2px;
}

.pcz-chat-presence i {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #7fd39b;
	margin-right: 5px;
	vertical-align: middle;
}

.pcz-chat-min {
	margin-left: auto;
	background: none;
	border: 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 18px;
	line-height: 1;
	padding: 4px 6px;
	cursor: pointer;
	border-radius: 6px;
	flex: none;
}

.pcz-chat-min:hover {
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
}

/* ---------- 消息区 ---------- */
.pcz-chat-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px;
	background: #faf9f6;
	display: flex;
	flex-direction: column;
}

.pcz-chat-body > * + * {
	margin-top: 8px;
}

.pcz-m {
	max-width: 84%;
	font-size: 13.5px;
	line-height: 1.5;
}

.pcz-m-body {
	padding: 9px 12px;
	border-radius: 12px;
	word-break: break-word;
	white-space: pre-wrap;
}

.pcz-m-time {
	font-size: 10.5px;
	color: #9a9a92;
	margin-top: 3px;
}

.pcz-m-bot .pcz-m-body {
	background: #eeece4;
	color: #45453f;
	border-bottom-left-radius: 4px;
}

.pcz-m-admin .pcz-m-body {
	background: #fff;
	border: 1px solid var(--pati-border, #e5e1d8);
	color: var(--pati-text, #2b2b2b);
	border-bottom-left-radius: 4px;
}

.pcz-m-admin .pcz-m-time {
	padding-left: 2px;
}

.pcz-m-user {
	margin-left: auto;
	text-align: right;
}

.pcz-m-user .pcz-m-body {
	background: var(--pati-primary, #2f4a3c);
	color: #fff;
	border-bottom-right-radius: 4px;
	text-align: left;
}

/* ---------- 输入 ---------- */
.pcz-chat-form {
	flex: none;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--pati-border, #e5e1d8);
	background: #fff;
}

.pcz-chat-form input {
	flex: 1;
	min-width: 0;
	border: 1px solid #e2e2dc;
	background: #f7f6f2;
	border-radius: 999px;
	padding: 9px 14px;
	font-size: 13px;
	color: var(--pati-text, #2b2b2b);
}

.pcz-chat-form input:focus {
	outline: none;
	border-color: var(--pati-primary, #2f4a3c);
	background: #fff;
}

.pcz-chat-form button {
	width: 34px;
	height: 34px;
	flex: none;
	padding: 0;
	box-sizing: border-box;
	border: 0;
	border-radius: 50%;
	background: var(--pati-primary, #2f4a3c);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

/* 主题全局样式会把按钮内 svg 压成 0 宽，这里锁死尺寸 */
.pcz-chat-form button svg {
	width: 17px;
	height: 17px;
	flex: 0 0 17px;
	display: block;
}

.pcz-chat-form button:hover {
	background: var(--pati-primary-dark, #24382d);
}

.pcz-chat-form button:disabled {
	opacity: 0.5;
	cursor: default;
}

/* ---------- 底部备用入口 ---------- */
.pcz-chat-alt {
	flex: none;
	text-align: center;
	font-size: 11.5px;
	color: #9a9a92;
	padding: 0 12px 10px;
	background: #fff;
}

.pcz-chat-alt a {
	color: #7d7d74;
	text-decoration: underline;
}

.pcz-chat-alt a:hover {
	color: var(--pati-primary, #2f4a3c);
}

.pcz-chat-alt span {
	margin: 0 6px;
}

@media (max-width: 480px) {
	.pcz-chat .pati-consult-panel {
		width: calc(100vw - 24px);
		height: min(470px, calc(100vh - 150px));
	}
	.pcz-chat-body {
		padding: 12px;
	}
}

/* 移动端：底部吸底加购条出现时抬高气泡，避免遮挡 */
@media (max-width: 860px) {
	body.pcz-atc-visible .pati-consult.pcz-chat {
		bottom: calc(20px + 76px);
	}
	body.pcz-atc-visible.pati-cookie-visible .pati-consult.pcz-chat {
		bottom: calc(20px + 76px + var(--pati-cookie-offset, 108px));
	}
	body.pcz-atc-visible .pcz-chat .pati-consult-panel {
		max-height: calc(100vh - 220px);
	}
}
