/* ===== AI 智能客服 ===== */
.ai-chat-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 360px;
  z-index: 9999;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

/* 悬浮按钮 */
.ai-chat-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06220A 0%, #0A4B2A 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(6, 34, 10, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.ai-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(6, 34, 10, 0.4);
}

.ai-chat-btn i {
  font-size: 26px;
}

.ai-chat-btn .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #C8611E;
  color: #FFFFFF;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* 聊天窗口 */
.ai-chat-window {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 360px;
  max-width: 360px;
  height: 500px;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.ai-chat-window.active {
  display: flex;
}

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

/* 聊天窗口头部 */
.ai-chat-header {
  background: linear-gradient(135deg, #06220A 0%, #0A4B2A 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-chat-header .header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-chat-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.ai-chat-header .title {
  font-size: 16px;
  font-weight: 600;
}

.ai-chat-header .status {
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chat-header .status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  display: inline-block;
}

.ai-chat-header .close-btn {
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  font-size: 18px;
}

.ai-chat-header .close-btn:hover {
  opacity: 1;
}

/* 消息列表 */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F5F6FA;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #D0D7E0;
  border-radius: 3px;
}

.message {
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  max-width: 85%;
}

.message.bot {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message .msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message.bot .msg-avatar {
  background: #E8F5E9;
  color: #06220A;
}

.message.user .msg-avatar {
  background: #FFF3E0;
  color: #C8611E;
}

.message .msg-content {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.message.bot .msg-content {
  background: #FFFFFF;
  color: #333333;
  border-top-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message.user .msg-content {
  background: #06220A;
  color: #FFFFFF;
  border-top-right-radius: 4px;
}

/* 快捷问题 */
.quick-questions {
  padding: 10px 16px;
  background: #FFFFFF;
  border-top: 1px solid #E4E8EE;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-question {
  padding: 6px 12px;
  background: #F0F4F1;
  color: #06220A;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid #D4E2D8;
}

.quick-question:hover {
  background: #E0EBE3;
}

/* 输入区域 */
.ai-chat-input {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid #E4E8EE;
  display: flex;
  gap: 10px;
  align-items: center;
}

.ai-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #D9DEE7;
  border-radius: 20px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.ai-chat-input input:focus {
  border-color: #06220A;
}

.ai-chat-input .send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #C8611E;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  flex-shrink: 0;
}

.ai-chat-input .send-btn:hover {
  background: #A84E14;
}

.ai-chat-input .send-btn i {
  font-size: 14px;
}

/* 正在输入提示 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #B0BEC5;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* 移动端适配 */
@media (max-width: 480px) {
  .ai-chat-widget {
    bottom: 20px;
    right: 20px;
    width: calc(100vw - 40px);
  }
  .ai-chat-window {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    height: 70vh;
    right: 0;
  }
}
