/* ===== 全局基础样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #eef1f5;
}

.hidden {
  display: none !important;
}

/* ==================== 登录 / 注册页面 ==================== */
#auth-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e3f2fd, #f5f7fa);
}

.auth-box {
  width: 340px;
  background: #fff;
  border-radius: 10px;
  padding: 32px 28px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.auth-box h1 {
  font-size: 22px;
  text-align: center;
  color: #333;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  margin-bottom: 16px;
  background: #f2f4f7;
  border-radius: 6px;
  padding: 4px;
}

.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  cursor: pointer;
  font-size: 15px;
  color: #666;
  border-radius: 4px;
}

.tabs button.active {
  background: #fff;
  color: #12b7f5;
  font-weight: bold;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.auth-box input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.auth-box input:focus {
  border-color: #12b7f5;
}

#auth-tip {
  min-height: 18px;
  font-size: 13px;
  color: #f56c6c;
  margin-bottom: 8px;
}

#auth-tip.ok {
  color: #67c23a;
}

#auth-submit {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #12b7f5;
  color: #fff;
  font-size: 16px;
}

#auth-submit:hover {
  background: #0fa8e0;
}

/* ==================== 聊天主页面 ==================== */
#chat-page {
  display: flex;
  height: 100vh;
}

/* ---------- 左侧边栏 ---------- */
.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #e4e7ed;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto; /* 群聊和用户多了可以滚动 */
}

.me {
  padding: 14px 16px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #ebeef2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

#logout-btn {
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #666;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

#logout-btn:hover {
  color: #f56c6c;
  border-color: #f56c6c;
}

.panel-title {
  padding: 12px 16px 6px;
  font-size: 12px;
  color: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* “＋ 创建群聊”按钮 */
#create-group-btn {
  border: none;
  background: #eaf6fe;
  color: #0b8fd6;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

#create-group-btn:hover {
  background: #d5edfc;
}

.contact {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
}

.contact:hover {
  background: #f2f6fa;
}

.contact.active {
  background: #e8f4fd;
  color: #0b8fd6;
  font-weight: bold;
}

.group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #12b7f5;
  color: #fff;
  font-size: 12px;
  margin-right: 8px;
  flex-shrink: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #67c23a;
  margin-right: 8px;
  flex-shrink: 0;
}

.dot-offline {
  background: #c0c4cc; /* 离线灰点 */
}

.contact-empty {
  padding: 11px 16px;
  color: #bbb;
  font-size: 13px;
}

/* ---------- 右侧聊天区 ---------- */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
  min-width: 0;
}

/* 顶部标题栏：标题 + “查看成员”按钮 */
.chat-head {
  height: 52px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e4e7ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-title {
  font-size: 16px;
  color: #333;
  font-weight: bold;
  line-height: 52px;
}

.members-btn {
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #666;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.members-btn:hover {
  color: #0b8fd6;
  border-color: #0b8fd6;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.msg-row {
  display: flex;
  margin-bottom: 14px;
}

.msg-row.mine {
  justify-content: flex-end;
}

.bubble {
  max-width: 60%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  background: #fff;
  color: #333;
  border: 1px solid #e6e6e6;
  border-top-left-radius: 2px;
}

.msg-row.mine .bubble {
  background: #12b7f5;
  color: #fff;
  border: none;
  border-radius: 8px;
  border-top-right-radius: 2px;
}

.msg-name {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}

.msg-time {
  font-size: 11px;
  color: #bbb;
  margin-top: 4px;
  text-align: right;
}

.msg-row.mine .msg-time {
  color: rgba(255, 255, 255, 0.75);
}

/* 图片缩略图气泡 */
.thumb {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 6px;
  cursor: zoom-in;
}

/* 文件卡片 */
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 12px;
  min-width: 220px;
}

.msg-row.mine .file-card {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.msg-row.mine .file-name {
  color: #fff;
}

.file-size {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.msg-row.mine .file-size {
  color: rgba(255, 255, 255, 0.8);
}

.file-download {
  flex-shrink: 0;
  background: #12b7f5;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 4px;
}

.file-download:hover {
  background: #0fa8e0;
}

/* ---------- 底部输入区 ---------- */
.input-bar {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  background: #fff;
  border-top: 1px solid #e4e7ed;
  align-items: center;
  flex-shrink: 0;
}

/* 图片 / 文件小按钮 */
.tool-btn {
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #666;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.tool-btn:hover {
  color: #0b8fd6;
  border-color: #0b8fd6;
}

#msg-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

#msg-input:focus {
  border-color: #12b7f5;
}

#send-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #12b7f5;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}

#send-btn:hover {
  background: #0fa8e0;
}

/* ==================== 弹窗 ==================== */
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  width: 380px;
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.modal-box h2 {
  font-size: 17px;
  color: #333;
  margin-bottom: 16px;
}

.modal-box input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}

.modal-box input[type="text"]:focus {
  border-color: #12b7f5;
}

.modal-subtitle {
  font-size: 13px;
  color: #999;
  margin-bottom: 8px;
}

/* 成员勾选 / 成员展示列表 */
.member-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ebeef2;
  border-radius: 6px;
  padding: 6px 0;
  margin-bottom: 16px;
  font-size: 14px;
  color: #333;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.member-item:hover {
  background: #f2f6fa;
}

.member-item input[type="checkbox"] {
  cursor: pointer;
}

.member-offline {
  color: #aaa;
}

/* ===== 群成员管理 ===== */
/* 弹窗顶部的群信息（群名、群主） */
.group-summary {
  font-size: 13px;
  color: #666;
  line-height: 1.9;
  margin-bottom: 12px;
}

/* 成员一行：左边是名字，右边是“移除”按钮 */
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
}

.member-row:hover {
  background: #f2f6fa;
}

.member-row .who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
}

/* “移除”按钮（仅群主可见） */
.remove-btn {
  border: 1px solid #f56c6c;
  background: #fff;
  color: #f56c6c;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.remove-btn:hover {
  background: #f56c6c;
  color: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-btn {
  background: #12b7f5;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.primary-btn:hover {
  background: #0fa8e0;
}

.plain-btn {
  background: #fff;
  color: #666;
  border: 1px solid #dcdfe6;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.plain-btn:hover {
  color: #333;
  border-color: #c0c4cc;
}

/* ==================== 未读消息角标 ==================== */
.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  border-radius: 9px;
  background: #f54c45;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}
