* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f0f0f0;
  height: 100vh;
  overflow: hidden;
}

.qq-container {
  display: flex;
  height: 100vh;
  background: #f0f0f0;
}

/* 最左侧导航栏 */
.left-nav {
  width: 56px;
  background: #e6e6e6;
  border-right: 1px solid #d0d0d0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}

.nav-user {
  margin-bottom: 16px;
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #666;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(0,0,0,0.05);
}

.nav-item.active {
  background: #d4d4d4;
  color: #333;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: #ff6b6b;
  color: #fff;
  font-size: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-badge.red {
  background: #ff4757;
}

.nav-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 左侧会话列表 */
.session-sidebar {
  width: 240px;
  background: #f5f5f5;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.search-bar {
  padding: 12px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.search-bar input {
  flex: 1;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #ddd;
  border-radius: 16px;
  background: #fff;
  font-size: 13px;
  outline: none;
}

.search-bar input::placeholder {
  color: #999;
}

.search-add {
  width: 32px;
  height: 32px;
  border: none;
  background: #fff;
  border-radius: 50%;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.session-list {
  flex: 1;
  overflow-y: auto;
}

.session-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.session-item .session-avatar-wrap {
  position: relative;
}

.session-item .unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: #ff4757;
  color: #fff;
  font-size: 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  z-index: 1;
}

.session-item:hover {
  background: #e8e8e8;
}

.session-item.active {
  background: #e0e0e0;
}

.session-avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  flex-shrink: 0;
}

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

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

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

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

.session-preview {
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unread-badge {
  min-width: 16px;
  height: 16px;
  background: #ff4757;
  color: #fff;
  font-size: 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* 中间聊天区域 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  position: relative;
}

.chat-header {
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f5f5;
}

.chat-title h1 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.chat-actions {
  display: flex;
  gap: 4px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #e0e0e0;
}

.action-btn svg {
  width: 20px;
  height: 20px;
}

.start-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: bold;
  color: #999;
}

/* 消息区域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

.time-divider {
  text-align: center;
  margin: 20px 0;
}

.time-divider span {
  font-size: 12px;
  color: #999;
  background: #e8e8e8;
  padding: 4px 12px;
  border-radius: 12px;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  max-width: 70%;
}

.message .avatar {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex-shrink: 0;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message .nickname {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.message .level-badge {
  font-size: 11px;
  color: #1890ff;
  background: rgba(24, 144, 255, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

.message-body {
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  min-width: 60px;
  max-width: 100%;
}

.message-body.image {
  padding: 4px;
  background: transparent;
  box-shadow: none;
}

.message-body.image img,
.message-body.video {
  max-width: 280px;
  max-height: 380px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.message-body.reply {
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.reply-quote {
  background: #f0f0f0;
  font-size: 13px;
  color: #888;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 4px;
  line-height: 1.4;
}

.reply-quote-line {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

.reply-text {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.reply-quote {
  font-size: 13px;
  color: #888;
  border-left: 3px solid #ccc;
  padding-left: 8px;
  margin-bottom: 4px;
  line-height: 1.4;
  background: #f5f5f5;
}

.reply-quote {
  font-size: 13px;
  color: #888;
  border-left: 2px solid #ddd;
  padding-left: 8px;
  margin-bottom: 4px;
  line-height: 1.4;
}

.reply-quote-line {
  display: block;
  margin: 0;
  padding: 2px 4px;
  line-height: 1.4;
  background: #f5f5f5;
}



.reply-text {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  margin-top: 4px;
}

.reply-quote br {
  display: block;
  content: "";
  margin-bottom: 0;
  line-height: 0;
}

.reply-text {
  font-size: 14px;
  color: #333;
  line-height: 1.4;
  margin-top: 2px;
}

.message-body.card {
  background: #e6f7ff;
  border: 1px solid #91d5ff;
  max-width: 400px;
}

.message-body.voice {
  background: #fff;
  cursor: pointer;
  padding: 10px 14px;
  min-width: 200px;
}

.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.voice-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-duration {
  font-size: 13px;
  color: #999;
}

.voice-text {
  font-size: 13px;
  color: #666;
}

.message-body.voice.playing .voice-icon {
  animation: voicePlaying 1s ease-in-out infinite;
}

@keyframes voicePlaying {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.message-body.video {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-body.video::before {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
}

.message-body.video::after {
  content: '▶';
  position: absolute;
  color: #fff;
  font-size: 24px;
  padding-left: 4px;
}

.video-source {
  font-size: 11px;
  color: #999;
  margin-bottom: 6px;
}

/* 输入区域 */
.chat-input-area {
  border-top: 1px solid #e0e0e0;
  background: #f5f5f5;
  padding: 12px 20px;
}

.input-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.tool-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}

.tool-btn:hover {
  color: #333;
  background: #e0e0e0;
}

.tool-btn svg {
  width: 22px;
  height: 22px;
}

.toolbar-divider {
  flex: 1;
}

.history-btn svg {
  width: 18px;
  height: 18px;
}

.input-container {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.input-container textarea {
  flex: 1;
  min-height: 60px;
  max-height: 120px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.input-container textarea::placeholder {
  color: #bbb;
}

.send-btn {
  padding: 8px 24px;
  background: #07c160;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  height: 36px;
}

.send-btn:hover {
  background: #06ad56;
}

/* 表情面板 */
.emoji-panel {
  display: none;
  position: absolute;
  bottom: 140px;
  left: 20px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
}

.emoji-panel.show {
  display: block;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.emoji-item {
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.emoji-item:hover {
  background: #f0f0f0;
}

/* 右侧群成员列表 */
.member-sidebar {
  width: 200px;
  background: #f5f5f5;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}

.member-header {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.member-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.member-count {
  font-size: 14px;
  color: #999;
}

.member-close {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 16px;
}

.member-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.member-item {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

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

.member-item .avatar {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.member-item .name {
  flex: 1;
  font-size: 13px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-item .role {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.member-item .role.owner {
  background: #ffcc99;
  color: #d46b08;
}

.member-item .role.admin {
  background: #c6e4ff;
  color: #1890ff;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

/* 响应式 */
@media (max-width: 1200px) {
  .member-sidebar {
    display: none;
  }
}

/* 图片灯箱 */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.show {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
