/* 单版本聊天窗口样式 - V2.0 智能版（蓝色主题） */

/* 容器 - 固定右下角 */
.chatbot-container {
  position: fixed !important;
  bottom: 0 !important;
  right: 20px !important;
  z-index: 9999;
}

/* 聊天窗口 */
.chatbot {
  width: 380px;
  height: 500px;
  min-height: 200px;
  max-height: 85vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: height 0.3s ease;
  text-align: left !important;
}

/* Header - 蓝色主题 */
.chatbot header {
  background: linear-gradient(135deg, #005CAB, #0088CC);
  padding: 14px 16px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.chatbot header:hover {
  background: linear-gradient(135deg, #004A8C, #0077B3);
}

.chatbot header h2 {
  font-size: 14px;
  margin: 0;
  font-family: "Microsoft YaHei", sans-serif;
  font-weight: 500;
}

.version-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 8px;
  background: rgba(255,255,255,0.25);
  color: white;
}

.minimize-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.minimize-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.1);
}

/* 聊天消息区域 */
.chatbot .chatbox {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left !important;
}

.chatbot .chatbox::-webkit-scrollbar {
  width: 5px;
}

.chatbot .chatbox::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.chatbot .chatbox .chat {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}

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

/* 机器人消息 */
.chatbot .chatbox .incoming {
  justify-content: flex-start;
  gap: 10px;
}

.chatbot .chatbox .incoming p {
  background: #fff;
  color: #333;
  border-radius: 0 14px 14px 14px;
  padding: 12px 16px;
  max-width: 300px;
  margin: 0;
  line-height: 1.7;
  font-size: 13px;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: left !important;
}

.chatbot .chatbox .incoming lottie-player {
  border-radius: 50%;
  background: #E6F3FF;
  padding: 3px;
  flex-shrink: 0;
  width: 34px !important;
  height: 34px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* 用户消息 */
.chatbot .chatbox .outgoing {
  justify-content: flex-end;
}

.chatbot .chatbox .outgoing p {
  background: linear-gradient(135deg, #005CAB, #0088CC);
  color: white;
  border-radius: 14px 0 14px 14px;
  padding: 12px 16px;
  max-width: 280px;
  margin: 0;
  line-height: 1.7;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 来源标签 */
.source-tag {
  font-size: 10px;
  color: #888;
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #eee;
}

/* 输入区域 */
.chatbot .chat-input {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid #eee;
  align-items: flex-end;
  flex-shrink: 0;
}

.chatbot .chat-input textarea {
  flex: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 22px;
  outline: none;
  resize: none;
  padding: 10px 16px;
  font-size: 13px;
  font-family: "Microsoft YaHei", sans-serif;
  max-height: 100px;
  min-height: 40px;
  background: #f8f8f8;
  transition: all 0.2s ease;
  line-height: 1.5;
}

.chatbot .chat-input textarea:focus {
  border-color: #005CAB;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,92,171,0.1);
}

.chatbot .chat-input span {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #005CAB, #0088CC);
  color: white;
  cursor: pointer;
  border-radius: 50%;
  font-size: 18px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot .chat-input span:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(0, 92, 171, 0.5);
}

/* 最小化状态 */
.chatbot.minimized {
  height: 52px !important;
}

.chatbot.minimized .chatbox,
.chatbot.minimized .chat-input {
  display: none;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .chatbot-container {
    right: 0 !important;
    left: 0 !important;
    padding: 0;
  }
  
  .chatbot {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    height: 60vh;
    max-height: 70vh;
  }
  
  .chatbot header {
    padding: 16px 20px;
    min-height: 56px;
  }
  
  .chatbot header h2 {
    font-size: 16px;
  }
  
  .minimize-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .chatbot .chatbox .incoming p,
  .chatbot .chatbox .outgoing p {
    max-width: 85%;
    font-size: 14px;
    padding: 14px 16px;
  }
  
  .chatbot .chat-input {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  
  .chatbot .chat-input textarea {
    font-size: 16px;
    min-height: 44px;
  }
  
  .chatbot .chat-input span {
    width: 44px;
    height: 44px;
  }
  
  .chatbot.minimized {
    height: 56px !important;
  }
}

/* ========== Markdown 样式 ========== */
.chatbox .incoming p .md-h2,
.chatbox .incoming p .md-h3 {
  display: block;
  margin: 8px 0 4px 0;
  font-weight: 600;
}

.chatbox .incoming p .md-li {
  display: block;
  margin: 4px 0;
}

.chatbox .incoming p strong {
  font-weight: 600;
  color: #0d6efd;
}

.chatbox .incoming p a {
  color: #1976d2;
  text-decoration: none;
  border-bottom: 1px dashed #1976d2;
}

/* ========== 思考状态 ========== */
.thinking-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.thinking-step {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 12px;
  width: fit-content;
}

.thinking-step.active {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  color: #1565c0;
  font-weight: 500;
  animation: pulse 1.5s infinite;
}

.thinking-step.done {
  background: #f0f0f0;
  color: #666;
  font-size: 11px;
  padding: 3px 10px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.thinking-dots::after {
  content: '...';
  animation: dots 1.2s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ========== 常见问题 ========== */
.faq-container {
  justify-content: flex-end !important;
  padding: 4px 10px !important;
}

.faq-vertical {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.faq-hint {
  color: #bbb;
  font-size: 9px;
}

.faq-item {
  background: #f8f9fa;
  color: #666;
  padding: 3px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid #e8e8e8;
  transition: all 0.2s;
  font-size: 10px;
}

.faq-item:hover {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #90caf9;
}

/* ========== 反馈按钮 ========== */
.feedback-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.feedback-btn {
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 12px;
  opacity: 0.5;
  transition: all 0.2s;
}

.feedback-btn:hover {
  opacity: 1;
  background: #f0f0f0;
}

.feedback-btn.active {
  opacity: 1;
}

.feedback-btn.active[data-type="up"] {
  background: #e8f5e9;
}

.feedback-btn.active[data-type="down"] {
  background: #ffebee;
}
