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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  background-color: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.chat-header {
  padding: 12px 16px;
  background-color: #fff;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #e8e8e8;
}

.header-left {
  display: flex;
  align-items: center;
}

.menu-icon {
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.menu-icon:hover {
  background-color: #f0f0f0;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  margin-left: 16px;
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.header-title {
  flex: 1;
  text-align: left;
}

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

.header-subtitle {
  font-size: 12px;
  color: #999;
  margin: 2px 0 0 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  background-color: #fafafa;
}

.message {
  display: flex;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content {
  max-width: 80%;
}

.bot-message .message-content {
  background-color: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background-color: #1890ff;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.message-text {
  word-wrap: break-word;
}

.chat-input-container {
  padding: 20px;
  background-color: #fff;
  border-top: 1px solid #e5e5e5;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.3s ease;
}

#messageInput:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

#sendButton {
  padding: 12px 24px;
  background-color: #1890ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

#sendButton:hover {
  background-color: #40a9ff;
}

#sendButton:active {
  background-color: #096dd9;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.loading-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #1890ff;
  animation: loading 1.4s ease-in-out infinite;
}

.loading-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading {
  0%,
  60%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  30% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 覆盖github-markdown-css的默认背景设置 */
.message-text .markdown-body {
  background-color: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* 确保表格在消息中正确显示 */
.message-text .markdown-body table {
  font-size: 14px !important;
  margin: 12px 0 !important;
  width: auto !important;
  min-width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
  word-break: break-word !important;
}

.message-text .markdown-body th,
.message-text .markdown-body td {
  border: 1px solid #e5e5e5 !important;
  padding: 10px 14px !important;
  text-align: left !important;
  word-wrap: break-word !important;
  white-space: normal !important;
  min-width: 100px !important;
  max-width: 300px !important;
}

.message-text .markdown-body th {
  background-color: #f5f5f5 !important;
  font-weight: 600 !important;
  color: #333 !important;
}

.message-text .markdown-body tr:nth-child(even) {
  background-color: #f9f9f9 !important;
}

/* 优化消息气泡样式 */
.message {
  margin-bottom: 12px !important;
}

.bot-message .message-content {
  border-radius: 12px !important;
  padding: 12px 16px !important;
}

.user-message .message-content {
  border-radius: 12px !important;
  padding: 12px 16px !important;
}

/* 优化整体布局 */
.chat-container {
  max-width: 900px !important;
}

.chat-messages {
  padding: 20px 10px 20px 10px !important;
}

.chat-input-container {
  padding: 24px !important;
}

/* 优化输入框和发送按钮 */
#messageInput {
  border-radius: 10px !important;
  padding: 14px 18px !important;
  font-size: 15px !important;
}

#sendButton {
  border-radius: 10px !important;
  padding: 14px 28px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

@media (max-width: 768px) {
  .chat-container {
    height: 100vh;
    max-width: 100%;
  }

  .message-content {
    max-width: 98%;
  }

  .chat-input-container {
    padding: 15px;
  }

  #messageInput {
    font-size: 16px;
  }
}
