* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: 'Microsoft YaHei', sans-serif;
}

/* body {
	background: #121212;
	height: 100vh;
	overflow: hidden;
	color: #e0e0e0;
	position: relative;
} */
body {
    background: #121212;
    height: 100%; /* 改为100%，避免100vh受导航栏影响 */
    min-height: 100vh; /* 保底最小高度 */
    overflow: hidden;
    color: #e0e0e0;
    position: relative;
    padding: 0;
    margin: 0;
}

/* 侧边栏（默认显示，占满屏幕） */
.sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	background: #1e1e2e;
	z-index: 100;
	transform: translateX(0);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.sidebar.hidden {
	transform: translateX(-100%);
}

.sidebar-header {
	padding: 15px;
	display: flex;
	align-items: center;
	border-bottom: 1px solid #303040;
}

.sidebar-header img {
	display: block;
	width: 70%;
	margin-left: auto;
	margin-right: auto;
}

.contact-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	margin-right: 10px;
	background-color: #303040;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: bold;
	font-size: 18px;
}

.user-info {
	flex: 1;
}

.user-name {
	font-weight: 600;
	color: #fff;
	font-size: 18px;
}

.user-role {
	font-size: 14px;
	color: #aaa;
}

.sidebar-actions {
	display: flex;
	gap: 10px;
}

.action-btn {
	background: transparent;
	border: none;
	color: #aaa;
	cursor: pointer;
	font-size: 20px;
}

.action-btn:hover {
	color: #fff;
}

.contacts-list {
	flex: 1;
	overflow-y: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.contacts-list::-webkit-scrollbar {
	display: none;
}

.contact-item {
	display: flex;
	align-items: center;
	padding: 12px 15px;
	cursor: pointer;
	transition: background 0.2s;
	border-bottom: 1px solid #2a2a3a;
}

.contact-item:hover {
	background: #2a2a3a;
}

/* 新增：工作人员列表项的头像图片样式 */
.contact-item .contact-avatar {
	overflow: hidden;
	/* 确保图片不超出圆形 */
	position: relative;
}

/* 列表项头像图片适配 */
.contact-item .contact-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* 保持图片比例，填满容器 */
	display: block;
}

/* 图片加载失败时显示原有的首字母兜底 */
.contact-item .contact-avatar img[src=""]+.avatar-placeholder,
.contact-item .contact-avatar img:not([src])+.avatar-placeholder,
.contact-item .contact-avatar img.onerror+.avatar-placeholder {
	display: flex;
}

/* 首字母兜底容器（保持原有文字样式） */
.contact-item .contact-avatar .avatar-placeholder {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: none;
	/* 默认隐藏，图片加载失败时显示 */
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: bold;
	font-size: 18px;
}

.contact-info {
	flex: 1;
	overflow: hidden;
	padding-right: 10px;
}

.contact-name {
	color: #fff;
	font-weight: 500;
	font-size: 16px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.contact-last-msg {
	font-size: 13px;
	color: #aaa;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-top: 2px;
}

.contact-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}

.unread-count {
	background: #F56C6C;
	color: white;
	font-size: 12px;
	padding: 1px 6px;
	border-radius: 12px;
	min-width: 20px;
	text-align: center;
}

.active-chat {
	background: #303040;
}

/* 聊天区域（默认隐藏，占满屏幕） */
/* .chat-area {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s ease;
	z-index: 90;
} */
.chat-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* 占满可视区域 */
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 90;
    box-sizing: border-box;
}
.chat-area.show {
	transform: translateX(0);
}

.chat-header {
	padding: 15px;
	background: #1e1e2e;
	border-bottom: 1px solid #303040;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.chat-title {
	font-weight: 600;
	color: #fff;
	font-size: 18px;
}

.switch-contacts-btn {
	background: transparent;
	border: none;
	color: #e0e0e0;
	cursor: pointer;
	font-size: 22px;
}

/* .chat-messages {
	flex: 1;
	padding: 15px;
	overflow-y: auto;
	background: #121212;
	gap: 12px;
	display: flex;
	flex-direction: column;
	scrollbar-width: none;
	-ms-overflow-style: none;
} */
.chat-messages {
    flex: 1; /* 占满中间剩余高度 */
    padding: 15px;
    padding-bottom: 80px; /* 预留输入框位置（后续JS动态调整） */
    overflow-y: auto;
    background: #121212;
    gap: 12px;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
}

.chat-messages::-webkit-scrollbar {
	display: none;
}

.message {
	max-width: 80%;
	display: inline-flex;
	flex-direction: column;
	gap: 4px;
	align-items: flex-start;
}

.message.self {
	align-self: flex-end;
	align-items: flex-end;
}

.message.other {
	align-self: flex-start;
}

.message-content {
	padding: 10px 15px;
	border-radius: 12px;
	word-wrap: break-word;
	white-space: pre-wrap;
	max-width: 100%;
	font-size: 16px;
	line-height: 1.4;
}

.self .message-content {
	background: #7a43b6;
	color: white;
	border-top-right-radius: 4px;
}

.other .message-content {
	background: #1e1e2e;
	color: #e0e0e0;
	border-top-left-radius: 4px;
}

/* 图片消息容器：上下左右间距一致，消除额外间隙 */
.message-content.img-container {
	padding: 6px;
	/* 上下左右统一内边距，可按需调整大小 */
	display: flex;
	/* 让图片垂直水平居中 */
	align-items: center;
	justify-content: center;
	line-height: 0;
	/* 消除 inline 元素默认行高间隙（关键） */
}

/* 图片自适应容器，保持比例 */
.message-content.img-container .message-image {
	display: block;
	/* 消除 inline 元素默认间隙 */
	max-width: 100%;
	max-height: 250px;
	border-radius: 6px;
	/* 与内边距配合，圆角一致 */
}

.message-time {
	font-size: 11px;
	color: #aaa;
	white-space: nowrap;
}

.message-image {
	max-width: 100%;
	max-height: 250px;
	border-radius: 8px;
	cursor: pointer;
	object-fit: cover;
	/* 新增：确保图片可点击区域完整 */
	pointer-events: auto;
}

/* 输入区域 */
/* .chat-input {
	padding: 12px 15px;
	border-top: 1px solid #303040;
	background: #1e1e2e;
	display: flex;
	align-items: center;
	gap: 10px;
} */
.chat-input {
    padding: 12px 15px;
    padding-bottom: 12px; /* 初始值，JS会覆盖 */
    border-top: 1px solid #303040;
    background: #1e1e2e;
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute; /* 固定在底部 */
    bottom: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    z-index: 20;
}
.input-container {
	flex: 1;
	display: flex;
	align-items: center;
	border: 1px solid #303040;
	border-radius: 25px;
	padding: 0 15px;
	background: #2a2a3a;
	min-height: 40px;
}

#messageInput {
	flex: 1;
	padding: 0;
	padding-top: 10px;
	padding-bottom: 10px;
	border: none;
	outline: none;
	font-size: 16px;
	resize: none;
	min-height: 28px;
	max-height: 150px;
	background: transparent;
	color: #e0e0e0;
	line-height: 28px;
	overflow: auto;
	scrollbar-width: none;
}

#messageInput::-webkit-scrollbar {
	display: none;
}

.tool-buttons {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tool-btn {
	width: 42px;
	height: 42px;
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 22px;
	color: #aaa;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tool-btn:hover {
	color: #fff;
}

#sendBtn {
	background: #7a43b6;
	color: white;
	border-radius: 50%;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: none;
}

#sendBtn:hover {
	background: #8a53c6;
}

/* 未连接提示和图片预览样式 */
.no-connection {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	color: #999;
	gap: 15px;
}

.no-connection i {
	font-size: 60px;
}

.no-connection p {
	font-size: 16px;
}

.image-preview {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 999;
	display: none;
	/* 新增：确保弹窗层级最高，点击区域完整 */
	pointer-events: auto;
}

.preview-image {
	max-width: 90%;
	max-height: 90vh;
	border-radius: 8px;
	/* 新增：确保图片清晰，避免拉伸 */
	object-fit: contain;
}

/* 加载提示样式 */
.loading-tip {
	padding: 15px;
	text-align: center;
	color: #aaa;
	font-size: 14px;
}