/**
 * 第三方聊天组件样式
 * 参考 chat-bubble.tsx 的设计，使用纯 CSS 实现
 */

/* 主容器 - Apple 风格字体与基准 */
.faq-chat-widget {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1000200;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 聊天窗口 - 更柔和的阴影与背景 */
.faq-chat-window {
  position: fixed !important; /* 强制使用固定定位，位置通过JavaScript动态设置 */
  width: 540px;
  min-width: 320px;
  max-width: 800px;
  height: min(750px, calc(100vh - 120px));
  background: #fafafa;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible !important;
  clip-path: none;
}

.faq-chat-widget-open .faq-chat-window {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 全屏模式 */
.faq-chat-widget-fullscreen .faq-chat-window {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  min-width: 100vw !important;
  border-radius: 0;
  bottom: 0;
  right: 0;
}

/* 全屏过渡动画 */
.faq-chat-window-transitioning {
  transition: transform 0.3s linear, 
              width 0.3s linear,
              height 0.3s linear,
              left 0.3s linear,
              top 0.3s linear,
              border-radius 0.3s linear !important;
}

/* Header - 更圆角与字重 */
.faq-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: none;
  background: #3b82f6;
  color: white;
  border-radius: 20px 20px 0 0;
}

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

.faq-chat-header-icon {
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.faq-chat-header-title {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.faq-chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.faq-chat-header-button {
  padding: 6px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s ease;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq-chat-header-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.faq-chat-header-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* SVG 图标按钮样式 */
.faq-chat-header-button-icon {
  width: 28px;
  height: 28px;
  padding: 6px;
  flex-shrink: 0;
  min-width: 28px;
}

.faq-chat-header-button-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 全屏模式下按钮间距调整 */
.faq-chat-widget-fullscreen .faq-chat-header-right {
  gap: 12px;
}

/* 全屏模式下输入区域和按钮位置固定 */
.faq-chat-widget-fullscreen .faq-chat-input-area {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.faq-chat-widget-fullscreen .faq-chat-input-wrapper {
  max-width: 100%;
  width: 100%;
}

.faq-chat-widget-fullscreen .faq-chat-send-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  font-size: 14px;
}

/* Messages area - 留白与滚动条 */
.faq-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 114, 128, 0.35) transparent;
}

/* 空状态时与输入区左右对齐，建议问题贴底 */
.faq-chat-messages:has(.faq-chat-empty) {
  padding: 20px 16px 0px;
  justify-content: flex-start;
}

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

.faq-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.faq-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.4);
  border-radius: 3px;
}

.faq-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(75, 85, 99, 0.6);
}

/* 常用问题界面 */
.faq-chat-quick-questions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #3b82f6 0%, #60a5fa 20%, #93c5fd 40%, #bfdbfe 60%, #dbeafe 80%, #eff6ff 100%);
  border-radius: 16px;
  overflow: hidden;
  z-index: 1;
}

/* 装饰元素 */
.faq-chat-quick-questions-decorations {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.faq-chat-quick-questions-decoration-circle {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: float 20s ease-in-out infinite;
}

.faq-chat-quick-questions-decoration-circle.decoration-1 {
  width: 120px;
  height: 120px;
  top: 10%;
  right: 5%;
  animation-delay: 0s;
}

.faq-chat-quick-questions-decoration-circle.decoration-2 {
  width: 80px;
  height: 80px;
  bottom: 20%;
  left: 8%;
  animation-delay: 5s;
}

.faq-chat-quick-questions-decoration-circle.decoration-3 {
  width: 60px;
  height: 60px;
  top: 50%;
  right: 15%;
  animation-delay: 10s;
}

.faq-chat-quick-questions-decoration-circle.decoration-4 {
  width: 100px;
  height: 100px;
  top: 30%;
  left: 5%;
  animation-delay: 3s;
}

.faq-chat-quick-questions-decoration-circle.decoration-5 {
  width: 70px;
  height: 70px;
  bottom: 30%;
  right: 8%;
  animation-delay: 7s;
}

.faq-chat-quick-questions-decoration-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 2px;
  animation: float 25s ease-in-out infinite;
}

.faq-chat-quick-questions-decoration-line.decoration-line-1 {
  width: 2px;
  height: 150px;
  top: 15%;
  left: 10%;
  animation-delay: 2s;
}

.faq-chat-quick-questions-decoration-line.decoration-line-2 {
  width: 2px;
  height: 100px;
  bottom: 25%;
  right: 12%;
  animation-delay: 8s;
}

.faq-chat-quick-questions-decoration-line.decoration-line-3 {
  width: 2px;
  height: 120px;
  top: 60%;
  left: 15%;
  animation-delay: 12s;
}

/* 装饰点元素 */
.faq-chat-quick-questions-decoration-dot {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: floatDot 15s ease-in-out infinite;
}

.faq-chat-quick-questions-decoration-dot.decoration-dot-1 {
  width: 8px;
  height: 8px;
  top: 25%;
  left: 20%;
  animation-delay: 0s;
}

.faq-chat-quick-questions-decoration-dot.decoration-dot-2 {
  width: 6px;
  height: 6px;
  top: 45%;
  right: 25%;
  animation-delay: 4s;
}

.faq-chat-quick-questions-decoration-dot.decoration-dot-3 {
  width: 10px;
  height: 10px;
  bottom: 35%;
  left: 25%;
  animation-delay: 6s;
}

.faq-chat-quick-questions-decoration-dot.decoration-dot-4 {
  width: 7px;
  height: 7px;
  top: 70%;
  right: 20%;
  animation-delay: 9s;
}

@keyframes floatDot {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate(15px, -15px) scale(1.2);
    opacity: 0.7;
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0);
    opacity: 0.6;
  }
  33% {
    transform: translate(20px, -20px);
    opacity: 0.8;
  }
  66% {
    transform: translate(-15px, 15px);
    opacity: 0.7;
  }
}

@keyframes floatLine1 {
  0%, 100% {
    transform: translate(0, 0) rotate(45deg);
    opacity: 0.6;
  }
  33% {
    transform: translate(20px, -20px) rotate(45deg);
    opacity: 0.8;
  }
  66% {
    transform: translate(-15px, 15px) rotate(45deg);
    opacity: 0.7;
  }
}

@keyframes floatLine2 {
  0%, 100% {
    transform: translate(0, 0) rotate(-30deg);
    opacity: 0.6;
  }
  33% {
    transform: translate(20px, -20px) rotate(-30deg);
    opacity: 0.8;
  }
  66% {
    transform: translate(-15px, 15px) rotate(-30deg);
    opacity: 0.7;
  }
}

.faq-chat-quick-questions-decoration-line.decoration-line-1 {
  animation-name: floatLine1;
}

.faq-chat-quick-questions-decoration-line.decoration-line-2 {
  animation-name: floatLine2;
}

.faq-chat-quick-questions-decoration-line.decoration-line-3 {
  animation-name: floatLine3;
}

@keyframes floatLine3 {
  0%, 100% {
    transform: translate(0, 0) rotate(60deg);
    opacity: 0.5;
  }
  33% {
    transform: translate(15px, -15px) rotate(60deg);
    opacity: 0.7;
  }
  66% {
    transform: translate(-10px, 10px) rotate(60deg);
    opacity: 0.6;
  }
}

/* 标题区域（初始居中，滚动后sticky到顶部） */
.faq-chat-quick-questions-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  text-align: center;
  padding: 36px 24px 28px;
  background: transparent;
  transition: all 0.3s ease;
  margin: 0;
  overflow: hidden;
}

/* 使用伪元素创建全宽背景渐变，高度与弹窗一致 */
.faq-chat-quick-questions-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -24px;
  right: -24px;
  width: calc(100% + 48px);
  height: var(--quick-questions-height, 100vh);
  background: linear-gradient(180deg, #3b82f6 0%, #60a5fa 20%, #93c5fd 40%, #bfdbfe 60%);
  z-index: -1;
  transition: all 0.3s ease;
  pointer-events: none;
}

.faq-chat-quick-questions-header.sticky-active {
  padding: 14px 24px;
}

.faq-chat-quick-questions-header.sticky-active::before {
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.faq-chat-quick-questions-header.sticky-active .faq-chat-quick-questions-title {
  font-size: 20px;
  margin: 0 0 0 0;
}

.faq-chat-quick-questions-header.sticky-active .faq-chat-quick-questions-subtitle {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.faq-chat-quick-questions-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: white;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.faq-chat-quick-questions-subtitle {
  font-size: 14px;
  margin: 0;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 400;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
  position: relative;
  z-index: 1;
  max-height: 50px;
  opacity: 1;
}

/* Skip 按钮（固定在底部） */
.faq-chat-quick-questions-skip {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  font-size: 15px;
  font-weight: 500;
  color: white;
  text-shadow: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.faq-chat-quick-questions-skip:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.faq-chat-quick-questions-skip:active {
  transform: translateY(0);
}

/* 底部间距（为跳过按钮留出空间） */
.faq-chat-quick-questions-bottom-spacer {
  height: 80px;
  flex-shrink: 0;
}

/* 可滚动内容区域 */
.faq-chat-quick-questions-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  /* 自定义滚动条样式 */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.faq-chat-quick-questions-scrollable::-webkit-scrollbar {
  width: 6px;
}

.faq-chat-quick-questions-scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.faq-chat-quick-questions-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.faq-chat-quick-questions-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 常用问题列表：竖向列表 + 分隔线（参考第二张图） */
.faq-chat-quick-questions-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 480px;
  margin: 20px auto 0;
  padding: 0 24px;
  box-sizing: border-box;
}

.faq-chat-quick-question-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

.faq-chat-quick-question-item:last-child {
  border-bottom: none;
}

.faq-chat-quick-question-item::after {
  display: none;
}

.faq-chat-quick-question-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.faq-chat-quick-question-item:active {
  opacity: 0.9;
}

/* 箭头图标（与第二张图一致：斜上右箭头） */
.faq-chat-quick-question-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.9);
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}

.faq-chat-quick-question-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.faq-chat-quick-question-item:hover .faq-chat-quick-question-icon {
  transform: translate(2px, -2px);
  color: #fff;
}

.faq-chat-quick-question-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.45;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.faq-chat-quick-question-arrow {
  flex-shrink: 0;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  width: 18px;
  height: 18px;
}

.faq-chat-quick-question-arrow svg {
  width: 100%;
  height: 100%;
  display: block;
}

.faq-chat-quick-question-item:hover .faq-chat-quick-question-arrow {
  transform: translate(2px, -2px);
  color: #fff;
}

/* 暗色模式下的常用问题样式 */
.faq-chat-widget-dark .faq-chat-quick-questions {
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 20%, #2563eb 40%, #3b82f6 60%, #60a5fa 80%, #93c5fd 100%);
}

.faq-chat-widget-dark .faq-chat-quick-questions-header-sticky {
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.faq-chat-widget-dark .faq-chat-quick-questions-skip {
  background: rgba(255, 255, 255, 0.9);
  color: #1f2937;
}

.faq-chat-widget-dark .faq-chat-quick-questions-skip:hover {
  background: white;
}

.faq-chat-widget-dark .faq-chat-quick-question-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.faq-chat-widget-dark .faq-chat-quick-question-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.faq-chat-widget-dark .faq-chat-quick-question-text {
  color: rgba(255, 255, 255, 0.95);
}

.faq-chat-widget-dark .faq-chat-quick-question-arrow {
  color: #a78bfa;
}

.faq-chat-widget-dark .faq-chat-quick-question-item:hover .faq-chat-quick-question-arrow {
  color: #c4b5fd;
}

.faq-chat-widget-dark .faq-chat-quick-questions-decoration-circle {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

.faq-chat-widget-dark .faq-chat-quick-questions-decoration-line {
  background: rgba(255, 255, 255, 0.15);
}

/* Empty state - 问候区在上，建议问题贴底、宽度与输入框一致 */
.faq-chat-empty {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  text-align: center;
  color: #1d1d1f;
  padding: 100px 0 0;
  width: 100%;
  box-sizing: border-box;
}

.faq-chat-empty-icon {
  font-size: 44px;
  margin-bottom: 16px;
  opacity: 0.72;
  line-height: 1;
}

.faq-chat-empty-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: #1d1d1f;
  line-height: 1.3;
}

.faq-chat-empty-subtext {
  font-size: 13px;
  color: #86868b;
  font-weight: 400;
  line-height: 1.4;
}

/* 建议问题贴底部，宽度与输入框一致（同 16px 左右 padding） */
.faq-chat-empty-questions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: auto;
  padding: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  background: #fff;
  border-radius: 14px;
  /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); */
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  flex-shrink: 0;
}

.faq-chat-empty-question-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #1d1d1f;
  background: transparent;
  border: none;
  border-bottom: 1px solid #f0f0f2;
  border-radius: 0;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.22s ease, color 0.2s ease;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.42;
}

.faq-chat-empty-question-item:last-child {
  border-bottom: none;
}

.faq-chat-empty-question-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #86868b;
  transition: color 0.2s ease;
}

.faq-chat-empty-question-text {
  flex: 1;
  min-width: 0;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.faq-chat-empty-question-item:hover {
  background: #f5f5f7;
  color: #1d1d1f;
}

.faq-chat-empty-question-item:hover .faq-chat-empty-question-icon {
  color: #1d1d1f;
}

.faq-chat-empty-question-item:active {
  background: #ebebed;
}

/* Message */
.faq-chat-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

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

.faq-chat-message-assistant {
  justify-content: flex-start;
}

/* Avatar */
.faq-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  padding: 4px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.faq-chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center; /* 确保图片居中 */
  display: block;
}

/* SVG 头像样式 */
.faq-chat-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.faq-chat-avatar-bot {
  background: rgba(59, 130, 246, 0.1);
}

.faq-chat-avatar-user {
  background: #3b82f6;
  color: white;
}

/* Bubble */
.faq-chat-bubble {
  max-width: min(76%, 520px);
  border-radius: 16px;
  padding: 10px 16px;
}

.faq-chat-bubble-user {
  background: #3b82f6;
  color: white;
  border-bottom-right-radius: 4px;
}

.faq-chat-bubble-assistant {
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

/* Content */
.faq-chat-content {
  font-size: 13px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.faq-chat-content strong {
  font-weight: 600;
}

.faq-chat-content em {
  font-style: italic;
}

.faq-chat-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.faq-chat-bubble-user .faq-chat-content code {
  background: rgba(255, 255, 255, 0.2);
}

/* Loading */
.faq-chat-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.faq-chat-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: faq-chat-spin 0.6s linear infinite;
}

@keyframes faq-chat-spin {
  to { transform: rotate(360deg); }
}

/* 跟踪整块（提示文案 + 结果卡片）统一入场 */
.faq-chat-tracking {
  animation: faq-chat-tracking-enter 0.32s ease-out forwards;
}

/* Tracking form */
.faq-chat-tracking-form {
  margin-top: 12px;
}

/* 表单 loading：输入框禁用，按钮显示 spinner + 文案 */
.faq-chat-tracking-form-loading .faq-chat-tracking-input {
  opacity: 0.7;
  cursor: not-allowed;
}

.faq-chat-tracking-form-loading .faq-chat-tracking-button {
  cursor: not-allowed;
  min-width: auto;
  padding: 8px 12px;
  gap: 6px;
}

.faq-chat-tracking-button-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: faq-chat-spin 0.6s linear infinite;
  flex-shrink: 0;
}

.faq-chat-tracking-button-text {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.faq-chat-tracking-message {
  font-size: 13px;
  margin-bottom: 8px;
}

.faq-chat-tracking-form-inner {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.faq-chat-tracking-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: white;
  outline: none;
}

.faq-chat-tracking-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.faq-chat-tracking-button {
  padding: 8px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.faq-chat-tracking-button:hover {
  background: #2563eb;
}

.faq-chat-tracking-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* 跟踪块入场：整体淡入 + 轻微上移 */
@keyframes faq-chat-tracking-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* AI 分析结果块入场：延迟淡入，与卡片形成顺畅衔接 */
@keyframes faq-chat-tracking-summary-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tracking result */
.faq-chat-tracking-result {
  /* margin-top: 12px; */
  padding: 12px;
  border-radius: 12px;
  min-width: 220px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.faq-chat-tracking-loading {
  background: #f9fafb;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
}

.faq-chat-tracking-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: faq-chat-spin 0.6s linear infinite;
}

.faq-chat-tracking-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 12px;
}

.faq-chat-tracking-error-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-chat-tracking-error-message {
  flex: 1;
  margin: 0;
  font-size: 14px;
  color: #dc2626;
  line-height: 1.5;
  min-width: 0;
}

.faq-chat-tracking-retry-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: white;
  background: #dc2626;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.faq-chat-tracking-retry-button:hover {
  background: #b91c1c;
}

.faq-chat-tracking-retry-button:active {
  background: #991b1b;
}

.faq-chat-tracking-retry-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.faq-chat-tracking-retry-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.faq-chat-tracking-success {
  background: #f9fafb;
}

/* 跟踪卡片头部：窄宽度时左侧承运商+运单号可横向滚动，右侧状态不压缩 */
.faq-chat-tracking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0;
  min-width: 0; /* 允许 flex 子项在窄宽度下收缩 */
}

/* 承运商+运单号区域：内容过长时横向滚动显示，不被截断 */
.faq-chat-tracking-carrier {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  min-width: 0; /* 允许在 flex 中收缩，让出空间给右侧状态 */
  overflow-x: auto; /* 宽度不足时出现横向滚动 */
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
/* 子元素不收缩，保证整行完整宽度，多出的部分通过横向滚动查看 */
.faq-chat-tracking-carrier > * {
  flex-shrink: 0;
}

/* 运单号不换行，与 carrier 一起参与横向滚动 */
.faq-chat-tracking-number {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
}

.faq-chat-tracking-separator {
  color: #9ca3af;
  flex-shrink: 0;
}

.faq-chat-tracking-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #dbeafe;
  color: #1e40af;
  opacity: 0;
  transition: opacity 0.5s ease-in;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0; /* 头部窄宽度时不被压缩，左侧承运商+运单号区域负责滚动 */
}

.faq-chat-tracking-status-fade-in {
  opacity: 1;
}

.faq-chat-tracking-status-loading {
  background: #f3f4f6;
  color: #6b7280;
  opacity: 1;
  white-space: nowrap;
}

.faq-chat-tracking-status-spinner {
  animation: faq-chat-spin 1s linear infinite;
  flex-shrink: 0;
}

@keyframes faq-chat-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.faq-chat-tracking-status-delivered {
  background: #dcfce7;
  color: #166534;
}

.faq-chat-tracking-status-exception {
  background: #fee2e2;
  color: #991b1b;
}

.faq-chat-tracking-status-out-for-delivery {
  background: #e9d5ff;
  color: #6b21a8;
}

.faq-chat-tracking-status-pickup {
  background: #dbeafe;
  color: #1e40af;
}

.faq-chat-tracking-status-in-transit {
  background: #dbeafe;
  color: #1e40af;
}

/* 内容区域：标题下方，包裹 summary / 事件列表 / 暂无跟踪记录 */
.faq-chat-tracking-content {
  margin-top: 12px;
  padding: 12px 0 0;
  border-top: 1px solid #e5e7eb;
  /* min-height: 32px; */
}

.faq-chat-tracking-summary {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  animation: faq-chat-tracking-summary-enter 0.28s ease-out 0.12s forwards;
  opacity: 0;
}
.faq-chat-tracking-content .faq-chat-tracking-summary:not(:first-child) {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.faq-chat-tracking-summary-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  background: #dbeafe;
  border-radius: 8px;
}

.faq-chat-tracking-summary-icon {
  width: 16px;
  height: 16px;
  color: #2563eb;
  flex-shrink: 0;
  margin-top: 2px;
}

.faq-chat-tracking-summary-text {
  flex: 1;
  margin: 0;
  font-size: 12px;
  color: #1e40af;
  line-height: 1.6;
  word-wrap: break-word;
}

/* 事件列表：收起时只显示前 3 条（由 JS 控制），每条描述完整显示不截断；展开时显示全部，用 max-height 做过渡动画 */
.faq-chat-tracking-content .faq-chat-tracking-events {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  max-height: 520px;
  transition: max-height 0.4s ease-out;
}
.faq-chat-tracking-content .faq-chat-tracking-events:not(:first-child) {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.faq-chat-tracking-events-expanded {
  max-height: 2000px;
}

/* 成功但无轨迹时在内容区域显示「暂无跟踪记录」 */
.faq-chat-tracking-content .faq-chat-tracking-no-events {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.faq-chat-tracking-no-events-text {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.faq-chat-tracking-event {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.faq-chat-tracking-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
  margin-top: 6px;
  align-self: flex-start;
}

.faq-chat-tracking-event-dot-active {
  background: #1f2937;
  width: 8px;
  height: 8px;
}

.faq-chat-tracking-event-content {
  flex: 1;
  min-width: 0;
}

.faq-chat-tracking-event-desc {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  word-wrap: break-word;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.faq-chat-tracking-event-time {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.4;
  margin-bottom: 0;
  padding: 0;
  font-weight: normal;
}

.faq-chat-tracking-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.faq-chat-tracking-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #3b82f6;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.faq-chat-tracking-toggle:hover {
  color: #2563eb;
}

.faq-chat-tracking-toggle-text {
  color: inherit;
}

.faq-chat-tracking-toggle-icon {
  width: 12px;
  height: 12px;
  color: inherit;
  flex-shrink: 0;
}

.faq-chat-tracking-toggle-count {
  color: #9ca3af;
  font-weight: normal;
}

.faq-chat-tracking-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s;
}

.faq-chat-tracking-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.faq-chat-tracking-link-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Relevant FAQs */
.faq-chat-relevant-faqs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.faq-chat-relevant-faqs-title {
  padding-top: 0px !important;
  margin-block-start: 0px !important;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.faq-chat-relevant-faqs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.faq-chat-relevant-faq-item {
  font-size: 12px;
  padding: 4px 8px;
  background: #e5e7eb;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #1f2937;
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faq-chat-relevant-faq-item:hover {
  background: #d1d5db;
}

/* Input area - 与窗口圆角一致 */
.faq-chat-input-area {
  padding: 14px 16px;
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: 0 0 20px 20px;
  background: #fafafa;
}

/* 输入框容器 - 更柔和的边框与聚焦态 */
.faq-chat-input-wrapper {
  position: relative;
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

.faq-chat-input-wrapper:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.faq-chat-input-wrapper:focus-within {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
  background: #fff;
}

.faq-chat-input-wrapper:focus-within .faq-chat-input {
  background: #fff;
}

/* 输入框 */
.faq-chat-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  max-height: 132px;
  padding: 14px 48px 14px 18px;
  font-size: 15px;
  border: none;
  border-radius: 14px;
  background: transparent;
  outline: none;
  resize: none;
  overflow-y: auto;
  box-sizing: border-box;
  color: #1d1d1f;
  line-height: 1.4;
}

.faq-chat-input::placeholder {
  color: #86868b;
}

/* 发送按钮 */
.faq-chat-send-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.faq-chat-send-button:hover {
  background: #2563eb;
  transform: scale(1.02);
}

.faq-chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toggle button - 柔和阴影与动效 */
.faq-chat-toggle-button {
  position: fixed;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000100;
}

.faq-chat-toggle-button:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4), 0 4px 10px rgba(0, 0, 0, 0.1);
  transform: scale(1.06);
}

/* 当窗口打开时，按钮位置由JavaScript动态控制，避免遮挡输入框和发送按钮 */
.faq-chat-widget-open .faq-chat-toggle-button {
  transform: none; /* 移除旋转，因为按钮在窗口左侧时显示关闭图标 */
}

.faq-chat-widget-open .faq-chat-toggle-button:hover {
  transform: scale(1.05); /* 悬停时保持缩放效果 */
}

/* Dark mode support */
.faq-chat-widget-dark .faq-chat-window {
  background: #1f2937;
  border-color: #374151;
}

.faq-chat-widget-dark .faq-chat-header {
  background: #1e40af;
  border-bottom-color: #374151;
}

.faq-chat-widget-dark .faq-chat-bubble-assistant {
  background: #374151;
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-messages {
  background: #1f2937;
}

.faq-chat-widget-dark .faq-chat-input-area {
  background: #1f2937;
}

.faq-chat-widget-dark .faq-chat-input-wrapper {
  border-color: #4b5563;
  background: #374151;
}

.faq-chat-widget-dark .faq-chat-input-wrapper:hover {
  border-color: #6b7280;
}

.faq-chat-widget-dark .faq-chat-input-wrapper:focus-within {
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: #4b5563;
}

.faq-chat-widget-dark .faq-chat-input-wrapper:focus-within .faq-chat-input {
  background: #4b5563;
}

.faq-chat-widget-dark .faq-chat-input {
  background: transparent;
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-input::placeholder {
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-tracking-result {
  background: #374151;
  border-color: #4b5563;
}

.faq-chat-widget-dark .faq-chat-tracking-number {
  color: #d1d5db;
}

.faq-chat-widget-dark .faq-chat-empty-text {
  color: #f5f5f7;
}

.faq-chat-widget-dark .faq-chat-empty-subtext {
  color: #a1a1a6;
}

.faq-chat-widget-dark .faq-chat-empty-questions {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.faq-chat-widget-dark .faq-chat-empty-question-item {
  color: #e8e8ed;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.faq-chat-widget-dark .faq-chat-empty-question-icon {
  color: #a1a1a6;
}

.faq-chat-widget-dark .faq-chat-empty-question-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f5f5f7;
}

.faq-chat-widget-dark .faq-chat-empty-question-item:hover .faq-chat-empty-question-icon {
  color: #e8e8ed;
}

.faq-chat-widget-dark .faq-chat-empty-question-item:active {
  background: rgba(255, 255, 255, 0.14);
}

.faq-chat-widget-dark .faq-chat-tracking-message {
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-tracking-carrier {
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-tracking-event-desc {
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-tracking-event-time {
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-tracking-loading {
  background: #374151;
  color: #d1d5db;
}

.faq-chat-widget-dark .faq-chat-tracking-success {
  background: #374151;
}

.faq-chat-widget-dark .faq-chat-tracking-content {
  border-top-color: #4b5563;
}

.faq-chat-widget-dark .faq-chat-tracking-content .faq-chat-tracking-events {
  border-top-color: #4b5563;
}

.faq-chat-widget-dark .faq-chat-tracking-no-events {
  border-top-color: #4b5563;
}
.faq-chat-widget-dark .faq-chat-tracking-no-events-text {
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-tracking-footer {
  border-top-color: #4b5563;
}

.faq-chat-widget-dark .faq-chat-relevant-faqs {
  border-top-color: #4b5563;
}

.faq-chat-widget-dark .faq-chat-relevant-faqs-title {
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-relevant-faq-item {
  background: #4b5563;
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-relevant-faq-item:hover {
  background: #6b7280;
}

.faq-chat-widget-dark .faq-chat-content code {
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

/* Tracking form in dark mode */
.faq-chat-widget-dark .faq-chat-tracking-form {
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-tracking-input {
  background: #4b5563;
  border-color: #6b7280;
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-tracking-input::placeholder {
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-tracking-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: #52525b;
}

/* Loading spinner in dark mode */
.faq-chat-widget-dark .faq-chat-loading-spinner {
  border-color: #4b5563;
  border-top-color: #60a5fa;
}

.faq-chat-widget-dark .faq-chat-tracking-loading-spinner {
  border-color: #4b5563;
  border-top-color: #60a5fa;
}

/* Avatar in dark mode */
.faq-chat-widget-dark .faq-chat-avatar-bot {
  color: white;
  background: rgba(59, 130, 246, 0.2);
}

/* Tracking status badge in dark mode */
.faq-chat-widget-dark .faq-chat-tracking-status {
  background: #1e40af;
  color: #dbeafe;
}

.faq-chat-widget-dark .faq-chat-tracking-status-delivered {
  background: #166534;
  color: #dcfce7;
}

.faq-chat-widget-dark .faq-chat-tracking-status-exception {
  background: #991b1b;
  color: #fee2e2;
}

.faq-chat-widget-dark .faq-chat-tracking-status-out-for-delivery {
  background: #6b21a8;
  color: #e9d5ff;
}

.faq-chat-widget-dark .faq-chat-tracking-status-pickup {
  background: #1e40af;
  color: #dbeafe;
}

.faq-chat-widget-dark .faq-chat-tracking-status-in-transit {
  background: #1e40af;
  color: #dbeafe;
}

.faq-chat-widget-dark .faq-chat-tracking-status-loading {
  background: #374151;
  color: #9ca3af;
}

.faq-chat-widget-dark .faq-chat-tracking-event-dot-active {
  background: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-tracking-toggle {
  color: #60a5fa;
}

.faq-chat-widget-dark .faq-chat-tracking-toggle:hover {
  color: #93c5fd;
}

.faq-chat-widget-dark .faq-chat-tracking-link {
  color: #60a5fa;
}

.faq-chat-widget-dark .faq-chat-tracking-link:hover {
  color: #93c5fd;
}

.faq-chat-widget-dark .faq-chat-tracking-summary {
  border-top-color: #4b5563;
}

.faq-chat-widget-dark .faq-chat-tracking-summary-content {
  background: rgba(30, 64, 175, 0.2);
}

.faq-chat-widget-dark .faq-chat-tracking-summary-icon {
  color: #60a5fa;
}

.faq-chat-widget-dark .faq-chat-tracking-summary-text {
  color: #dbeafe;
}

.faq-chat-widget-dark .faq-chat-tracking-error {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
}

.faq-chat-widget-dark .faq-chat-tracking-error-message {
  color: #fca5a5;
}

.faq-chat-widget-dark .faq-chat-tracking-retry-button {
  background: #dc2626;
  color: white;
}

.faq-chat-widget-dark .faq-chat-tracking-retry-button:hover {
  background: #b91c1c;
}

.faq-chat-widget-dark .faq-chat-tracking-retry-button:active {
  background: #991b1b;
}

/* System dark mode support (fallback) */
@media (prefers-color-scheme: dark) {
  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-window {
    background: #1f2937;
    border-color: #374151;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-header {
    background: #1e40af;
    border-bottom-color: #374151;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-bubble-assistant {
    background: #374151;
    color: #f3f4f6;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-messages {
    background: #1f2937;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-input-area {
    background: #1f2937;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-input-wrapper {
    border-color: #4b5563;
    background: #374151;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-input-wrapper:hover {
    border-color: #6b7280;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-input {
    background: transparent;
    color: #f3f4f6;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-input::placeholder {
    color: #9ca3af;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-tracking-result {
    background: #374151;
    border-color: #4b5563;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-tracking-number {
    color: #d1d5db;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-relevant-faq-item {
    background: #4b5563;
    color: #f3f4f6;
  }

  .faq-chat-widget:not(.faq-chat-widget-dark):not(.faq-chat-widget-light) .faq-chat-tracking-input {
    background: #4b5563;
    border-color: #6b7280;
    color: #f3f4f6;
  }
}

/* 拖动调整宽度的手柄 - 在左侧，实体长条设计 */
.faq-chat-resize-handle {
  position: absolute;
  top: 16px; /* 从圆角下方开始 */
  bottom: 16px; /* 到圆角上方结束 */
  left: -4px;
  width: 4px;
  cursor: ew-resize;
  background: transparent; /* 默认不显示背景色 */
  z-index: 10000;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto !important;
  border-radius: 0 2px 2px 0;
}

/* 实体长条指示器 - 默认隐藏，完全填充高度 */
.faq-chat-resize-handle::before {
  content: '';
  position: absolute;
  top: 0; /* 从顶部开始 */
  bottom: 0; /* 到底部结束 */
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: rgba(156, 163, 175, 0.6); /* 更深的实体颜色 */
  border-radius: 1px;
  opacity: 0; /* 默认隐藏 */
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 悬停状态 - 优雅的展开效果 */
.faq-chat-resize-handle:hover {
  left: -6px;
  width: 6px;
  background: rgba(59, 130, 246, 0.2); /* 更深的背景色 */
  border-radius: 0 3px 3px 0;
}

.faq-chat-resize-handle:hover::before {
  opacity: 1;
  width: 3px;
  top: 0; /* 保持从顶部开始 */
  bottom: 0; /* 保持到底部结束 */
  background: rgba(59, 130, 246, 0.8); /* 更深的蓝色 */
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.4);
}

/* 激活状态 - 更明显的反馈 */
.faq-chat-resize-handle:active {
  left: -7px;
  width: 7px;
  background: rgba(59, 130, 246, 0.3); /* 激活时更深的背景 */
  border-radius: 0 4px 4px 0;
}

.faq-chat-resize-handle:active::before {
  opacity: 1;
  width: 4px;
  top: 0; /* 保持从顶部开始 */
  bottom: 0; /* 保持到底部结束 */
  background: rgba(59, 130, 246, 1); /* 最深的蓝色 */
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

/* 全屏模式下隐藏拖动条 */
.faq-chat-widget-fullscreen .faq-chat-resize-handle {
  display: none;
}

/* 聊天按钮图标图片 */
.faq-chat-toggle-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* Responsive */
@media (max-width: 640px) {
  .faq-chat-window {
    width: calc(100vw - 32px) !important;
    min-width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    right: 16px;
    bottom: 80px;
    height: calc(100vh - 100px);
  }
  
  .faq-chat-resize-handle {
    display: none;
  }
  
  /* 移动端确保发送按钮位置固定 */
  .faq-chat-input-area {
    padding: 10px;
    min-height: 84px;
  }
  
  .faq-chat-send-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    flex-shrink: 0;
  }
}

/* 确认弹窗样式 - 相对于聊天窗口定位 */
.faq-chat-window {
  position: relative; /* 确保确认弹窗相对于窗口定位 */
  z-index: 1000101;
}

.faq-chat-confirm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
  border-radius: 16px; /* 与窗口圆角保持一致 */
}

.faq-chat-confirm-overlay-visible {
  opacity: 1;
}

.faq-chat-confirm-dialog {
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  width: calc(100% - 48px); /* 与聊天窗口内容区域保持一致的内边距 */
  max-width: 320px;
  margin: 0 auto;
  overflow: hidden;
  transform: scale(0.9) translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  opacity: 0;
}

.faq-chat-confirm-overlay-visible .faq-chat-confirm-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.faq-chat-confirm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  background: transparent; /* 去掉顶部背景色 */
  border-bottom: none; /* 移除中间边框 */
}

.faq-chat-confirm-icon {
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 193, 7, 0.1); /* 图标背景改为淡黄色 */
  border-radius: 8px;
  box-shadow: none; /* 去掉阴影，更简洁 */
}

.faq-chat-confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  letter-spacing: -0.02em;
}

.faq-chat-confirm-content {
  padding: 0px 20px 10px 20px;
  flex: 1;
  overflow-y: auto;
  background: transparent; /* 去掉背景色，与整体保持一致 */
}

.faq-chat-confirm-message {
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  margin: 0;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.faq-chat-confirm-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  background: transparent; /* 去掉背景色 */
  border-top: none; /* 去掉底部边框 */
  justify-content: flex-end;
}

.faq-chat-confirm-button {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  min-width: 70px;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.faq-chat-confirm-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.faq-chat-confirm-button:hover::before {
  width: 300px;
  height: 300px;
}

.faq-chat-confirm-button-cancel {
  background: #f3f4f6;
  color: #374151;
}

.faq-chat-confirm-button-cancel:hover {
  background: #e5e7eb;
  color: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.faq-chat-confirm-button-confirm {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.faq-chat-confirm-button-confirm:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.faq-chat-confirm-button:active {
  transform: translateY(0) scale(0.98);
}

.faq-chat-confirm-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 暗色模式支持 */
.faq-chat-widget-dark .faq-chat-confirm-dialog {
  background: #1f2937;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.faq-chat-widget-dark .faq-chat-confirm-header {
  background: transparent; /* 去掉顶部背景色 */
  border-bottom: none; /* 移除中间边框 */
}

.faq-chat-widget-dark .faq-chat-confirm-icon {
  background: rgba(255, 193, 7, 0.15); /* 图标背景改为淡黄色 */
  box-shadow: none; /* 去掉阴影 */
}

.faq-chat-widget-dark .faq-chat-confirm-title {
  color: #f9fafb;
}

.faq-chat-widget-dark .faq-chat-confirm-content {
  background: transparent; /* 去掉背景色 */
}

.faq-chat-widget-dark .faq-chat-confirm-message {
  color: #d1d5db;
}

.faq-chat-widget-dark .faq-chat-confirm-actions {
  background: transparent; /* 去掉背景色 */
  border-top: none; /* 去掉底部边框 */
}

.faq-chat-widget-dark .faq-chat-confirm-button-cancel {
  background: #374151;
  color: #f3f4f6;
}

.faq-chat-widget-dark .faq-chat-confirm-button-cancel:hover {
  background: #4b5563;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 响应式设计 */
@media (max-width: 640px) {
  .faq-chat-confirm-dialog {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    margin: 16px;
  }
  
  .faq-chat-confirm-header,
  .faq-chat-confirm-content,
  .faq-chat-confirm-actions {
    padding-left: 20px;
    padding-right: 20px;
  }
}
