* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font: 13px "微软雅黑", Helvetica, Arial;
  background: url("../image/bg3.jpg");
  background-size: cover;
}
.name {
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  background-color: rgba(238, 238, 238, 0.8);
  text-align: center;
  padding-top: 35vh;
}
.name input {
  width: 200px;
  border: none;
  border-bottom: 2px solid #bbb;
  background-color: #f3f3f3;
  font-size: 23px;
  color: #555;
  text-align: center;
}
.name button {
  display: block;
  width: 107px;
  height: 36px;
  margin: 0 auto;
  border: none;
  background-color: #805b6b;
  border-radius: 5px;
  color: #fff;
  font-size: 17px;
  margin-top: 20px;
  cursor: pointer;
}
.main {
  width: 1000px;
  margin: 7vh auto;
  border: 2px #eee solid;
  border-radius: 10px;
  box-shadow: 3px 5px 9px #ccc;
  background-color: rgba(255, 255, 255, 1);
  position: relative;
  left: 0;
}
.header {
  height: 85px;
  border-bottom: 2px solid #eee;
  font-size: 23px;
  padding-left: 10px;
  padding-top: 10px;
  color: #555;
  position: relative;
}
.header img {
  width: 50px;
  height: 50px;
  border-radius: 25px;
  vertical-align: middle;
}
#container {
  display: flex;
}
/* 会话列表面板 */
.chat-list {
  width: 200px;
  border-right: 2px #eee solid;
  display: flex;
  flex-direction: column;
}
.chat-list h1 {
  font-size: 16px;
  font-weight: 500;
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.chat-list ul {
  flex: 1;
  overflow-y: auto;
}
.chat-session {
  padding: 12px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-session:hover {
  background-color: #f5f5f5;
}
.chat-session.active {
  background-color: #e3f2fd;
  border-right: 3px solid #2196f3;
}

/* 新的会话列表样式 */
.chat-session {
  padding: 12px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background-color 0.2s ease;
}

.chat-session:hover {
  background-color: #f5f5f5;
}

.chat-session.active {
  background-color: #e3f2fd;
  border-right: 3px solid #2196f3;
}

.session-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.session-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.session-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.session-name {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-time {
  font-size: 11px;
  color: #999;
  flex-shrink: 0;
}

.session-last-message {
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.session-name {
  font-size: 14px;
  color: #333;
}
.session-count {
  font-size: 12px;
  color: #666;
}

/* 未读消息标记样式 */
.unread-count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 12px;
  color: white;
  background-color: #ff4444;
  border-radius: 9px;
  margin-left: 5px;
  padding: 0 5px;
}

.conversation {
  flex: 1;
  border-right: 2px #eee solid;
  position: relative;
}
#messages {
  height: 400px;
  padding: 20px 10px 0px 10px;
  overflow-y: auto;
}
/*滚动条样式*/
#messages::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 4px;
}
#messages::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  border-radius: 5px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
#messages::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}
p.system {
  color: #888;
  text-align: center;
  margin: 5px;
}
p.system span {
  background-color: #eee;
  border-radius: 9px;
  padding: 1px 5px;
  margin-bottom: 7px;
  display: inline-block;
}
#messages li {
  list-style: none;
  width: 100%;
  float: left;
  margin-bottom: 5px;
}
#messages li > img {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
}
#messages li p .sendImg {
  max-width: 300px;
  max-height: 188px;
  width: auto;
  height: auto;
  border-radius: 5px;
  cursor: pointer;
}
#messages li p span {
  padding-top: 7px;
}
.left img {
  margin-right: 8px;
}
.right img {
  margin-left: 8px;
}
.left img,
.left div {
  float: left;
}
.left span {
  text-align: left;
}
.right span {
  text-align: right;
}
.right p {
  float: right;
}
.right img,
.right div {
  float: right;
}
#messages li div > span {
  display: block;
  color: #555;
  padding-left: 2px;
}
#messages li div p {
  max-width: 300px;
  height: auto;
  padding: 10px;
  margin-top: 5px;
  word-wrap: break-word; /* 文本自动换行 */
  font-size: 15px;
  border-radius: 5px;
}

.left p {
  background-color: #d5d3d3;
}
.right p {
  background-color: #86bdf8;
}
.right .audio-message {
  background-color: #86bdf8;
}
form {
  height: 121px;
  border-top: 1px #ddd solid;
  position: relative;
}
.edit {
  width: 100%;
  height: 33px;
  color: #7f8393;
  font-size: 19px;
  line-height: 33px;
  padding-left: 10px;
  position: relative;
}
.edit i {
  padding: 5px 6px;
  cursor: pointer;
}
.edit i:hover {
  background-color: #e2e2e2 !important;
}
.edit .selectBox {
  display: none;
  position: absolute;
  bottom: 34px;
  left: 0px;
  z-index: 3;
  background-color: #fff;
}
.shaking {
  animation: run 0.2s infinite;
}
@keyframes run {
  0% {
    left: 0;
  }
  25% {
    left: -7px;
  }
  50% {
    left: 7px;
  }
  100% {
    left: 0;
  }
}
.edit #file {
  width: 32.36px;
  height: 29px;
  opacity: 0;
  z-index: 5;
}
.edit #img {
  z-index: 0;
  margin-left: -43px;
}
#color {
  width: 25px;
  border: none;
  cursor: pointer;
  background: none;
  opacity: 0;
  position: relative;
  z-index: 5;
}
#color:focus {
  outline: none;
}
.edit #font {
  position: absolute;
  left: 9px;
  top: 3px;
  z-index: 0;
}
.smile {
  width: 460px;
  height: auto;
  border: 1px #eee solid;
  box-shadow: 1px 1px 1px #ccc;
  padding-top: 5px;
  box-sizing: border-box;
}
.smile p {
  height: 35px;
  font-size: 15px;
  color: #555;
  line-height: 35px;
  padding-left: 20px;
  box-sizing: border-box;
}
.emoji {
  width: 100%;
  height: 210px;
  overflow-y: scroll;
  padding: 0 17px;
}
.emoji li {
  list-style: none;
  width: 35px;
  height: 35px;
  line-height: 35px;
  box-sizing: border-box;
  overflow: hidden;
  text-align: center;
  font-size: 24px;
  display: inline-block;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.emoji li:hover {
  background-color: #f3f3f4;
  transform: scale(1.2);
}

.emoji::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 4px;
}
.emoji::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  border-radius: 5px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
.emoji::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}

textarea {
  display: block;
  width: 100%;
  height: 55px;
  padding-left: 5px;
  padding-top: 5px;
  resize: none;
  font-size: 16px;
  background: none;
  border: none;
  font-family: "微软雅黑";
}
textarea:focus,
.btn:focus,
.name input:focus,
.name button:focus {
  outline: none;
}
/*滚动条样式*/
textarea::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 4px;
}
textarea::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  border-radius: 5px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
textarea::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}
button.btn {
  width: 72px;
  height: 25px;
  float: right;
  margin-right: 5px;
  background-color: #805b6b;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

/* 退出按钮样式 */
.logout-btn {
  position: absolute;
  top: 30px;
  right: 20px;
  width: 60px;
  height: 28px;
  margin: 0;
  background-color: #ff4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  z-index: 1;
}

.logout-btn:hover {
  background-color: #cc0000;
}
button.btn.rBtn {
  margin-right: 10px;
}
.btn:hover {
  background-color: #b495a1;
}

/* 语音录制样式 */
#recordBtn {
  height: 30px;
  border: none;
  padding: 2px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  position: relative;
  background-color: transparent;
}

#recordBtn:hover {
  background-color: rgb(226, 226, 226);
}

#recordBtn.recording {
  background-color: #3498db;
}

#recordBtn:after {
  content: "🎤";
  font-size: 16px;
}

#recordBtn.recording:after {
  content: "🎤";
}

#recordingIndicator {
  position: absolute;
  bottom: 125px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.recording-animation {
  width: 15px;
  height: 15px;
  background-color: #e74c3c;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#recordingTimer {
  font-size: 16px;
  font-weight: bold;
}

/* 引用消息样式 */
.quote-container {
  margin: 3px 0;
  border-radius: 0 4px 4px 0;
  position: relative;
}

/* 正常引用样式 */
.quote-ref {
  background-color: #f5f5f5;
  border-left: 3px solid #d9d9d9;
  padding: 6px 8px;
  cursor: pointer;
  clear: both;
}

.quote-ref:hover {
  background-color: #eeeeee;
}

/* 已删除引用样式 */
.quote-deleted {
  background-color: #f8f8f8;
  border-left: 3px solid #ff9999;
  padding: 6px 8px;
  clear: both;
}

.quote-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.quote-ref .quote-line {
  background-color: #d9d9d9;
}

.quote-deleted .quote-line {
  background-color: #ff9999;
}

.quote-content {
  padding-left: 5px;
}

.quote-user {
  color: #999;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
}

.right .quote-text{
  text-align: left !important;
}

.quote-text {
  color: #666;
  font-size: 12px;
  word-break: break-all;
  line-height: 1.3;
  display: -webkit-box !important;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-deleted .quote-text {
  color: #999;
}

/* 引用预览区域样式 */
#quotePreview {
  display: none;
  background-color: #f5f5f5;
  border-left: 3px solid #d9d9d9;
  padding: 6px 8px;
  margin: 3px 0;
  border-radius: 0 4px 4px 0;
  position: relative;
  min-height: 30px;
  max-height: 100px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* 图片预览区域样式 */
.image-preview-area {
  display: none;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin: 3px 0;
  padding: 8px;
  box-sizing: border-box;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #666;
}

.clear-all-btn {
  background: none;
  border: none;
  color: #999;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}

.clear-all-btn:hover {
  background-color: #e0e0e0;
  color: #666;
}

.preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background-color: white;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.delete-image-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid #ddd;
  border-radius: 50%;
  font-size: 14px;
  line-height: 14px;
  text-align: center;
  cursor: pointer;
  color: #666;
}

.delete-image-btn:hover {
  background-color: #ff4444;
  color: white;
  border-color: #ff4444;
}

#quotePreview .quote-content {
  padding-left: 5px;
}

#quotePreview .quote-user {
  color: #999;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
}

#quotePreview .quote-text {
  color: #666;
  font-size: 12px;
  word-break: break-all;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 清除引用按钮样式 */
#clearQuote {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 12px;
  padding: 1px;
  line-height: 1;
}

#clearQuote:hover {
  color: #666;
}

/* 音频消息样式 */
.audio-message {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-message button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

.audio-progress {
  flex: 1;
  height: 4px;
  background-color: #dee2e6;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.audio-progress-bar {
  height: 100%;
  background-color: #3498db;
  width: 0;
  transition: width 0.1s linear;
}

.audio-duration {
  font-size: 12px;
  color: #6c757d;
  min-width: 40px;
  text-align: right;
}
.contacts {
  width: 160px;
  height: 100%;
  padding: 6px;
}
.contacts h1 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 10px;
}
.contacts ul {
  width: 100%;
}
.contacts li {
  display: inline-block;
  width: 23%;
  margin-right: 2%;
  height: 65px;
  text-align: center;
  margin-bottom: 5px;
  cursor: pointer;
}
.contacts li img {
  width: 100%;
  height: 45.5px;
}
.contacts li > span {
  display: inline-block;
  width: 100%;
  font-size: 13px;
  line-height: 20px;
  vertical-align: middle;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.contacts p {
  text-align: center;
  margin-top: 70px;
  color: #555;
}

/* 图片上传loading样式 */
#imageUploading {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.uploading-animation {
  width: 15px;
  height: 15px;
  background-color: #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 用户卡片样式 */
#userCard {
  position: fixed;
  z-index: 1000;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  width: 200px;
  padding: 15px;
  display: none;
}

#userCard .card-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

#cardUserImg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

#cardUserName {
  font-weight: bold;
}

#startPrivateChat {
  width: 100%;
  background-color: #0b93f6;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#startPrivateChat:hover {
  background-color: #0978d4;
}

/* 私聊会话时隐藏在线列表 */
.private-chat .contacts {
  display: none;
}

.private-chat .conversation {
  width: 100%;
  margin-right: 0;
}

/* 分页加载loading指示器样式 */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  color: #6c757d;
  font-size: 14px;
  gap: 10px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e9ecef;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-indicator span {
  font-weight: 500;
}

/* 时间消息样式 */
.time-message {
  text-align: center;
  margin: 10px 0;
  list-style: none;
}

.time-divider {
  display: inline-block;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.time-text {
  color: #999;
  font-size: 11px;
}

/* 消息发送失败样式 - 红色感叹号 */
.message-failed {
  position: relative;
}

.message-failed::before {
  content: '!';
  position: absolute;
  left: -25px;
  top: 50%;
  width: 20px;
  height: 20px;
  background-color: #ff4444;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  z-index: 10;
}

/* 系统消息发送失败样式 */
.system-failed {
  position: relative;
  padding-left: 20px;
}

.system-failed::before {
  content: '!';
  position: absolute;
  left: 30%;
  width: 20px;
  height: 20px;
  background-color: #ff4444;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  z-index: 10;
}
