/* ==================== WhatsApp 风格私信样式 ==================== */

/* 私信弹窗特殊样式 */
.messages-modal-content {
  max-height: 85vh;
  height: 600px;
  display: flex;
  flex-direction: column;
}

.messages-modal-body {
  padding: 0;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.messages-view {
  display: none;
  flex-direction: column;
  height: 100%;
}

.messages-view.active {
  display: flex;
}

/* 会话列表样式 */
#conversations-container {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#conversations-container::-webkit-scrollbar {
  width: 8px;
}

#conversations-container::-webkit-scrollbar-track {
  background: transparent;
}

#conversations-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.conversation-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.conversation-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.conversation-item.unread {
  background: rgba(96, 165, 250, 0.08);
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-right: 12px;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.conversation-name {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.conversation-name .blue-v {
  width: 16px;
  height: 16px;
}

.conversation-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.conversation-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conversation-preview {
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.conversation-preview.unread {
  color: var(--text);
  font-weight: 500;
}

.conversation-badge {
  background: #60a5fa;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  margin-left: 8px;
  flex-shrink: 0;
}

/* 聊天界面样式 */
.chat-contact-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.chat-contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-contact-info {
  flex: 1;
}

.chat-contact-name {
  font-weight: 600;
  color: var(--text);
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-contact-name .blue-v {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.chat-messages-container::-webkit-scrollbar {
  width: 8px;
}

.chat-messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.message-item {
  display: flex;
  gap: 8px;
  max-width: 80%;
  animation: messageSlideIn 0.2s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-item.from-me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.message-content {
  display: flex;
  flex-direction: column;
}

.message-bubble {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}

.message-item.from-me .message-bubble {
  background: #60a5fa;
  color: #fff;
}

.message-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-item.from-me .message-time {
  justify-content: flex-end;
  color: rgba(255, 255, 255, 0.7);
}

.message-status {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.checkmark {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.checkmark.read {
  color: #34d399;
}

/* 聊天输入区域 */
.chat-input-area {
  padding: 12px 16px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 40px;
  font-family: inherit;
  line-height: 1.4;
}

.chat-input::placeholder {
  color: var(--muted);
}

.chat-send-btn {
  background: #60a5fa;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #3b82f6;
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  background: rgba(96, 165, 250, 0.3);
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

/* 空状态 */
.messages-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.messages-empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.messages-empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
}

.messages-empty-state p {
  font-size: 14px;
  margin: 0;
}

/* 返回按钮 */
#messages-back-btn {
  font-size: 20px;
  padding: 0 8px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .messages-modal-content {
    max-width: 100vw;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  
  .message-item {
    max-width: 85%;
  }
}

