/* ============================================
   悬浮客服组件 Floating Customer Service
   BEM 命名规范
   ============================================ */

/* 悬浮按钮容器 */
.floating-service {
  position: fixed;
  right: 20px;
  bottom: 40px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

/* 单个按钮 */
.floating-service__btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--color-bg-white);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.floating-service__btn:hover {
  background-color: var(--color-primary);
  transform: scale(1.08);
}

.floating-service__btn:hover .floating-service__btn-icon {
  fill: #fff;
}

.floating-service__btn.is-active {
  background-color: var(--color-primary);
}

.floating-service__btn.is-active .floating-service__btn-icon {
  fill: #fff;
}

.floating-service__btn-icon {
  width: 26px;
  height: 26px;
  fill: var(--color-text-primary);
  transition: fill 0.3s ease;
}

/* AI 客服弹窗 */
.floating-service__ai-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 16px);
  width: 440px;
  background-color: var(--color-bg-white);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-service__ai-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* AI 弹窗头部 */
.floating-service__ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border-light);
}

.floating-service__ai-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.floating-service__ai-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4ab8a8 0%, #2b8c7c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.floating-service__ai-avatar svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.floating-service__ai-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.floating-service__ai-subtitle {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.floating-service__ai-collapse {
  font-size: 13px;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.floating-service__ai-collapse:hover {
  color: var(--color-primary);
}

.floating-service__ai-collapse svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

/* AI 对话区 */
.floating-service__ai-body {
  padding: 24px;
  max-height: 360px;
  overflow-y: auto;
  background-color: var(--color-bg-light);
}

.floating-service__message {
  display: flex;
  margin-bottom: 16px;
}

.floating-service__message--ai {
  justify-content: flex-start;
}

.floating-service__message--user {
  justify-content: flex-end;
}

.floating-service__message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.floating-service__message--ai .floating-service__message-bubble {
  background-color: var(--color-bg-white);
  color: var(--color-text-primary);
  border-top-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.floating-service__message--user .floating-service__message-bubble {
  background-color: var(--color-primary);
  color: var(--color-text-white);
  border-top-right-radius: 4px;
}

/* 快捷提问区 */
.floating-service__quick-questions {
  padding: 16px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--color-bg-white);
  border-top: 1px solid var(--color-border-light);
}

.floating-service__quick-btn {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  width: 100%;
}

.floating-service__quick-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* 底部输入区 */
.floating-service__ai-input-area {
  padding: 16px 24px 20px;
  background-color: var(--color-bg-white);
  border-top: 1px solid var(--color-border-light);
}

.floating-service__ai-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.floating-service__ai-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  font-size: 14px;
  color: var(--color-text-primary);
  background-color: var(--color-bg-light);
  border: 1px solid transparent;
  border-radius: 22px;
  transition: all 0.3s ease;
}

.floating-service__ai-input:focus {
  border-color: var(--color-primary);
  background-color: var(--color-bg-white);
}

.floating-service__ai-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.floating-service__ai-send:hover {
  background-color: var(--color-primary-hover);
  transform: scale(1.05);
}

.floating-service__ai-send svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.floating-service__ai-tip {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 10px;
}

/* WhatsApp 气泡 */
.floating-service__whatsapp {
  position: absolute;
  right: 0;
  bottom: calc(100% + 16px);
  background-color: var(--color-bg-white);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  padding: 18px 22px;
  min-width: 240px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-service__whatsapp.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.floating-service__whatsapp::after {
  content: '';
  position: absolute;
  right: 26px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background-color: var(--color-bg-white);
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.06);
}

.floating-service__whatsapp-tag {
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 4px 12px;
  background-color: #1a1a1a;
  color: #fff;
  font-size: 12px;
  border-radius: 12px;
}

.floating-service__whatsapp-title {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-bottom: 8px;
}

.floating-service__whatsapp-number {
  font-size: 22px;
  font-weight: bold;
  color: var(--color-text-primary);
  letter-spacing: 0.5px;
}

.floating-service__whatsapp-number span {
  color: var(--color-primary);
}

/* 微信二维码卡片 */
.floating-service__wechat {
  position: absolute;
  right: 0;
  bottom: calc(100% + 16px);
  background-color: var(--color-bg-white);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  padding: 20px;
  width: 200px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-service__wechat.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.floating-service__wechat::after {
  content: '';
  position: absolute;
  right: 26px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background-color: var(--color-bg-white);
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.06);
}

.floating-service__wechat-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--color-text-primary);
  margin-bottom: 14px;
}

.floating-service__wechat-qr {
  width: 160px;
  height: 160px;
  margin: 0 auto 14px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.floating-service__wechat-qr svg {
  width: 140px;
  height: 140px;
}

.floating-service__wechat-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
  .floating-service {
    right: 14px;
    bottom: 30px;
    gap: 10px;
  }

  .floating-service__btn {
    width: 54px;
    height: 54px;
  }

  .floating-service__btn-icon {
    width: 22px;
    height: 22px;
  }

  .floating-service__ai-panel {
    width: 90vw;
    right: 0;
  }

  .floating-service__whatsapp {
    min-width: auto;
    width: 70vw;
    padding: 14px 18px;
  }

  .floating-service__whatsapp-number {
    font-size: 18px;
  }

  .floating-service__wechat {
    width: 70vw;
    padding: 16px;
  }

  .floating-service__wechat-qr {
    width: 140px;
    height: 140px;
  }

  .floating-service__wechat-qr svg {
    width: 120px;
    height: 120px;
  }
}
