/* 悬浮窗按钮样式 */
.chatbot-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
  border: 3px solid white;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: all 0.3s ease;
  z-index: 9998;
}

.chatbot-button:hover {
  transform: scale(1.12) rotate(5deg);
  box-shadow: 0 8px 30px rgba(76, 175, 80, 0.4);
  background: linear-gradient(135deg, var(--primary-orange-dark) 0%, var(--primary-orange) 100%);
}

/* 对话框容器样式 */
.chatbot-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 380px;
  max-height: 550px;
  background: linear-gradient(145deg, #FFFFFF 0%, var(--bg-light-orange) 100%);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(76, 175, 80, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
  border: 2px solid rgba(76, 175, 80, 0.2);
}

.chatbot-container.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 对话框头部样式 */
.chatbot-header {
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
  padding: 18px 22px;
  border-radius: 18px 18px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.chatbot-header h3 {
  margin: 0;
  font-size: 17px;
  color: white;
  font-weight: 700;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: white;
  padding: 6px 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.chatbot-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* 聊天内容区域样式 */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  max-height: 350px;
}

.chatbot-message {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
}

.chatbot-message.user {
  justify-content: flex-end;
}

.chatbot-message.ai {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.4;
  /* 允许HTML内容正确渲染 */
  white-space: pre-line;
}

/* 确保消息中的HTML标签正确显示 */
.chatbot-message .message-bubble br {
  display: block;
  margin-bottom: 5px;
}

.chatbot-message .message-bubble ul, 
.chatbot-message .message-bubble ol {
  padding-left: 20px;
  margin: 5px 0;
}

.chatbot-message .message-bubble li {
  margin-bottom: 3px;
}

.user .message-bubble {
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.ai .message-bubble {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--bg-light-orange) 100%);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(76, 175, 80, 0.1);
}

/* 输入区域样式 */
.chatbot-input-container {
  padding: 16px;
  border-top: 2px solid rgba(76, 175, 80, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(241, 248, 244, 0.5) 100%);
}

.chatbot-input {
  flex: 1;
  padding: 12px 18px;
  border: 2px solid rgba(76, 175, 80, 0.2);
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  background: white;
}

.chatbot-input:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.chatbot-send {
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.chatbot-send:hover {
  background: linear-gradient(135deg, var(--primary-orange-dark) 0%, var(--primary-orange) 100%);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* 响应式设计 */
@media (max-width: 480px) {
  .chatbot-container {
    width: calc(100% - 40px);
    max-height: 80vh;
  }
  
  .chatbot-button {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}

/* 滚动条样式 */
.chatbot-messages::-webkit-scrollbar {
  width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: var(--bg-light-orange);
  border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
  border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary-orange-dark) 0%, var(--primary-orange) 100%);
}