/* ============================================================
 * 站内消息模块样式：铃铛 + 抽屉 + 网盘失效反馈按钮
 * ============================================================ */

/* 铃铛 */
.es-header-bell {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.es-header-bell__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: none;
	background: transparent;
	color: inherit;
	cursor: pointer;
	border-radius: 10px;
}

.es-header-bell__btn:hover {
	background: rgba(15, 23, 42, 0.08);
}

/* 页头为浅色（半透明白）——未滚动时也须用深色，否则白色铃铛在白底上不可见，
 * 这正是「铃铛有时候不显示」的根因（滚动后变深色才可见）。改为继承页头文字色。 */
.site-header:not(.is-scrolled) .es-header-bell__btn {
	color: inherit;
}

/* 头部「私信」入口（管理员 / 客服）：打开微信式双栏私信中心 */
.es-header-chat-open {
	display: inline-flex;
	align-items: center;
	height: 34px;
	padding: 0 12px;
	margin-right: 4px;
	border: 1px solid rgba(15, 23, 42, 0.16);
	border-radius: 18px;
	background: transparent;
	color: inherit;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
}
.es-header-chat-open:hover {
	background: rgba(15, 23, 42, 0.08);
}

.es-header-bell__dot {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 9px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	line-height: 16px;
	text-align: center;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

/* 新消息：铃铛闪烁 + 红点脉冲 */
.es-header-bell__btn.is-flash {
	animation: es-bell-flash 1s ease-in-out infinite;
}
.es-header-bell__btn.is-flash .es-header-bell__dot {
	animation: es-bell-dot-pulse 1s ease-in-out infinite;
}
@keyframes es-bell-flash {
	0%, 100% { transform: scale(1); }
	15% { transform: scale(1.18) rotate(-9deg); }
	30% { transform: scale(1.18) rotate(9deg); }
	45% { transform: scale(1.18) rotate(-9deg); }
	60% { transform: scale(1.18) rotate(9deg); }
	75% { transform: scale(1); }
}
@keyframes es-bell-dot-pulse {
	0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }
	50% { transform: scale(1.3); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
	.es-header-bell__btn.is-flash,
	.es-header-bell__btn.is-flash .es-header-bell__dot {
		animation: none;
	}
}

/* 抽屉 */
.es-msg-drawer {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 340px;
	max-width: calc(100vw - 24px);
	background: #fff;
	color: #0f172a;
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
	overflow: hidden;
	z-index: 200;
}

.es-msg-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid #eef2f7;
	font-size: 15px;
}

.es-msg-drawer__close {
	border: none;
	background: transparent;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #94a3b8;
}

.es-msg-drawer__close:hover {
	color: #0f172a;
}

.es-msg-drawer__tabs {
	display: flex;
	border-bottom: 1px solid #eef2f7;
}

.es-msg-drawer__tabs button {
	flex: 1;
	position: relative;
	padding: 10px 6px;
	border: none;
	background: transparent;
	font-size: 13px;
	color: #64748b;
	cursor: pointer;
	border-bottom: 2px solid transparent;
}

.es-msg-drawer__tabs button.is-active {
	color: #4338ca;
	border-bottom-color: #4338ca;
	font-weight: 600;
}

.es-msg-drawer__list {
	max-height: 320px;
	overflow-y: auto;
	padding: 6px;
}

.es-msg-empty {
	padding: 28px 12px;
	text-align: center;
	color: #94a3b8;
	font-size: 13px;
}

.es-msg-item {
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #f1f5f9;
	margin-bottom: 6px;
	background: #fff;
}

.es-msg-item.is-unread {
	background: #f5f3ff;
	border-color: #e0e7ff;
}

.es-msg-item__title {
	font-size: 13px;
	font-weight: 600;
	color: #1e293b;
	margin-bottom: 3px;
}

.es-msg-item__body {
	font-size: 12.5px;
	color: #475569;
	line-height: 1.6;
	word-break: break-word;
}

.es-msg-item__body a {
	color: #4338ca;
	text-decoration: underline;
}

.es-msg-item__time {
	margin-top: 6px;
	font-size: 11px;
	color: #aab4c2;
}

.es-msg-drawer__compose {
	border-top: 1px solid #eef2f7;
	padding: 10px;
}

.es-msg-drawer__compose textarea {
	width: 100%;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 8px;
	font-size: 13px;
	resize: vertical;
	box-sizing: border-box;
}

.es-msg-drawer__compose .es-btn {
	margin-top: 8px;
	width: 100%;
}

/* 网盘失效反馈按钮（下载源操作区） */
.es-pan-feedback {
	display: inline-flex;
	align-items: center;
	margin-left: 8px;
	padding: 4px 10px;
	font-size: 12px;
	line-height: 1.4;
	border: 1px solid #f59e0b;
	background: #fffbeb;
	color: #b45309;
	border-radius: 8px;
	cursor: pointer;
}

.es-pan-feedback:hover {
	background: #fef3c7;
}

.es-pan-feedback:disabled,
.es-pan-feedback.is-done {
	background: #eef2f7;
	border-color: #e2e8f0;
	color: #94a3b8;
	cursor: default;
}

/* 私信回复按钮（消息抽屉内，仅管理员 / 客服可见） */
.es-msg-item__reply {
	margin-top: 8px;
	display: inline-block;
}

/* 回复对话框（弹窗，前端 / 后台共用样式） */
.es-reply-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
}
.es-reply-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0,0, .45);
}
.es-reply-modal__dialog {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(560px, 92vw);
	max-height: 88vh;
	overflow: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
	padding: 22px 26px 24px;
}
.es-reply-modal__title {
	margin: 0 0 12px;
	font-size: 16px;
}
.es-reply-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 30px;
	height: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	color: #646970;
	font-size: 22px;
	line-height: 1;
	border-radius: 8px;
	cursor: pointer;
}
.es-reply-modal__close:hover {
	background: #f0f0f1;
	color: #1d2327;
}
.es-reply-modal__status {
	margin: 0 0 12px;
	font-size: 13px;
	min-height: 1em;
}
.es-reply-modal__status--ok {
	color: #1a7f37;
}
.es-reply-modal__status--error {
	color: #b32d2e;
}
.es-reply-modal__actions {
	margin: 16px 0 0;
	display: flex;
	gap: 10px;
}

/* @用户 提及下拉 */
.es-mention-pop {
	position: absolute;
	z-index: 10;
	min-width: 200px;
	max-height: 220px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
	margin-top: 4px;
}
.es-mention-pop__item {
	padding: 8px 12px;
	font-size: 13px;
	cursor: pointer;
	border-bottom: 1px solid #f1f5f9;
}
.es-mention-pop__item:last-child {
	border-bottom: none;
}
.es-mention-pop__item:hover,
.es-mention-pop__item.is-active {
	background: #eef2ff;
}

/* 消息正文中的 @提及 高亮 */
.es-mention {
	color: #4338ca;
	font-weight: 600;
}

/* 对话式聊天弹窗（前端复用，与后台样式一致） */
.es-reply-modal__dialog.es-chat {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 0;
	width: min(560px, 94vw);
	height: min(80vh, 660px);
}
.es-chat__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 44px 14px 16px;
	border-bottom: 1px solid #f0f0f1;
	background: #f7f7f8;
}
.es-chat__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #cfe3ff center/cover no-repeat;
	color: #2271b1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	flex: 0 0 auto;
}
.es-chat__headinfo {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.es-chat__select {
	max-width: 100%;
	font-size: 14px;
	font-weight: 600;
	border: none;
	background: transparent;
	box-shadow: none;
	padding: 2px 4px;
	color: #1d2327;
	cursor: pointer;
}
.es-chat__select:focus {
	box-shadow: 0 0 0 1px #2271b1;
	border-radius: 4px;
}
.es-chat__sub {
	font-size: 11px;
	color: #646970;
}
.es-chat__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: #f0f0f1;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.es-chat__placeholder {
	margin: auto;
	color: #8c8f94;
	font-size: 13px;
	text-align: center;
}
.es-chat__row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}
.es-chat__row--mine {
	justify-content: flex-end;
}
.es-chat__row--peer {
	justify-content: flex-start;
}
.es-chat__bubble-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #d8e8ff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex: 0 0 auto;
}
.es-chat__bubble {
	max-width: 72%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.5;
	word-break: break-word;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}
.es-chat__row--peer .es-chat__bubble {
	background: #fff;
	color: #1d2327;
	border-bottom-left-radius: 4px;
}
.es-chat__row--mine .es-chat__bubble {
	background: #2271b1;
	color: #fff;
	border-bottom-right-radius: 4px;
}
.es-chat__bubble-text {
	white-space: pre-wrap;
}
.es-chat__bubble-time {
	margin-top: 4px;
	font-size: 10px;
	opacity: 0.7;
	text-align: right;
}
.es-chat__composer {
	display: flex;
	gap: 10px;
	padding: 12px 16px;
	border-top: 1px solid #f0f0f1;
	background: #fff;
	align-items: flex-end;
	position: relative;
}
.es-chat__composer textarea {
	flex: 1 1 auto;
	resize: none;
	font-size: 13px;
	line-height: 1.5;
	padding: 8px 10px;
}
.es-chat__composer .button {
	flex: 0 0 auto;
	height: 36px;
}
/* @提及下拉在输入区内定位（浮于文本框上方） */
.es-chat__composer .es-mention-pop {
	left: 12px;
	right: 12px;
	bottom: 100%;
	margin-top: 0;
	max-height: 180px;
}

/* 微信式双栏布局（前端私信回复弹窗） */
.es-reply-modal__dialog.es-chat.es-chat--panes {
	display: flex;
	flex-direction: row;
	width: min(860px, 94vw);
	height: min(82vh, 680px);
	max-height: 88vh;
}

/* 左侧：会话列表 / 通讯录 */
.es-chat__sidebar {
	flex: 0 0 280px;
	width: 280px;
	background: #fafafa;
	border-right: 1px solid #eee;
	display: flex;
	flex-direction: column;
	min-height: 0;
}
.es-chat__sidebar-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	padding: 14px 16px 10px;
	border-bottom: 1px solid #f0f0f1;
}
.es-chat__sidebar-head strong {
	font-size: 15px;
	color: #1d2327;
}
.es-chat__sidebar-tip {
	font-size: 11px;
	color: #aab4c2;
}
.es-chat__search {
	padding: 10px 12px;
}
.es-chat__search input {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #e2e8f0;
	border-radius: 18px;
	padding: 7px 12px;
	font-size: 13px;
	background: #fff;
}
.es-chat__search input:focus {
	outline: none;
	border-color: #4338ca;
}
.es-chat__conv-list {
	list-style: none;
	margin: 0;
	padding: 4px 0;
	flex: 1 1 auto;
	overflow-y: auto;
	min-height: 0;
}
.es-chat__conv {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	cursor: pointer;
	border-bottom: 1px solid #f4f4f5;
}
.es-chat__conv:hover {
	background: #f0f0f3;
}
.es-chat__conv.is-active {
	background: #e6e9ff;
}
.es-chat__conv-avatar {
	width: 42px;
	height: 42px;
	flex: 0 0 auto;
	border-radius: 8px;
	background: #cfe3ff center/cover no-repeat;
	color: #2271b1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	overflow: hidden;
}
.es-chat__conv-info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}
.es-chat__conv-name {
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.es-chat__conv-preview {
	font-size: 12px;
	color: #8c8f94;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.es-chat__conv-right {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}
.es-chat__conv-time {
	font-size: 11px;
	color: #aab4c2;
}
.es-chat__conv-badge {
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
}
.es-chat__conv-empty {
	padding: 24px 14px;
	text-align: center;
	color: #94a3b8;
	font-size: 13px;
}

/* 右侧：会话聊天主区 */
.es-chat__main {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
	background: #fff;
}
.es-chat__peer {
	font-size: 15px;
	font-weight: 600;
	color: #1d2327;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* 移动端适配 */
@media (max-width: 600px) {
	.es-reply-modal__dialog.es-chat:not(.es-chat--panes) {
		width: 96vw;
		height: 86vh;
	}
	.es-reply-modal__dialog.es-chat.es-chat--panes {
		flex-direction: column;
		width: 96vw;
		height: 88vh;
	}
	.es-chat__sidebar {
		flex: 0 0 auto;
		width: 100%;
		max-height: 208px;
		border-right: none;
		border-bottom: 1px solid #eee;
	}
	.es-chat__conv-list {
		max-height: 168px;
	}
	.es-chat__bubble {
		max-width: 82%;
	}
}

/* 公告弹窗：前台登录后展示，关闭即标记已读 */
.es-ann-popup { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.es-ann-popup[hidden] { display: none; }
.es-ann-popup__mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.es-ann-popup__box {
	position: relative; z-index: 1; width: 100%; max-width: 520px; max-height: 82vh; overflow: auto;
	background: #fff; border-radius: 14px; padding: 26px 24px 20px; box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
}
.es-ann-popup__close { position: absolute; top: 8px; right: 12px; border: 0; background: transparent; font-size: 24px; line-height: 1; color: #94a3b8; cursor: pointer; }
.es-ann-popup__close:hover { color: #334155; }
.es-ann-popup__title { margin: 0 0 14px; font-size: 18px; font-weight: 800; color: #0f172a; padding-right: 24px; }
.es-ann-popup__body { font-size: 14px; line-height: 1.75; color: #334155; }
.es-ann-popup__body p { margin: 0 0 10px; }
.es-ann-popup__body img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px 0; }
.es-ann-popup__body a { color: #2563eb; }
.es-ann-popup__ok { display: block; width: 100%; margin-top: 18px; padding: 10px 0; border: 0; border-radius: 10px; background: #2563eb; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.es-ann-popup__ok:hover { background: #1d4ed8; }
@media (max-width: 560px) {
	.es-ann-popup { padding: 12px; }
	.es-ann-popup__box { padding: 20px 16px 16px; max-height: 88vh; }
}

/* 移动端：私信弹窗内的搜索框 16px，避免 iOS 聚焦时缩放整页 */
@media (max-width: 640px) {
	.es-chat__search input { font-size: 16px; }
	/* 关闭图标触控区域 */
	.es-ann-popup__close,
	.es-msg-drawer__close,
	.es-reply-modal__close { min-width: 32px; min-height: 32px; }
}
