/* ==========================================================================
   轻语机场 (qingyujc.lol) - Crisp 在线客服与右下角 LOGO 悬浮组件样式
   1:1 精准还原用户截图 Crisp 聊天交互界面
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 右下角品牌 LOGO 悬浮触发按钮
   -------------------------------------------------------------------------- */
.floating-service-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.service-float-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 50%, #0f766e 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 25px rgba(13, 148, 136, 0.38), 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, background 0.28s;
  outline: none;
}

.service-float-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 32px rgba(13, 148, 136, 0.5), 0 0 20px rgba(45, 212, 191, 0.4);
}

.service-float-btn:active {
  transform: scale(0.96);
}

/* 按钮内 LOGO 图标 */
.service-logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.service-close-icon {
  position: absolute;
  width: 24px;
  height: 24px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 打开状态下切换为关闭按钮 */
.floating-service-widget.is-open .service-logo-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.floating-service-widget.is-open .service-close-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.floating-service-widget.is-open .service-float-btn {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.6);
}

/* 在线绿点指示灯 */
.service-online-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
  animation: onlinePulse 2.5s infinite;
}

@keyframes onlinePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

/* 提示气泡 */
.service-float-tooltip {
  position: absolute;
  right: 70px;
  background: #ffffff;
  color: #0f2922;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.15);
  border: 1px solid rgba(13, 148, 136, 0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.floating-service-widget:hover .service-float-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   2. Crisp 风格客服会话弹窗 (1:1 还原图二)
   -------------------------------------------------------------------------- */
.crisp-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.15), 0 0 25px rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.15);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.95);
  transform-origin: bottom right;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}

.crisp-chat-widget.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* 顶部操作工具栏 */
.crisp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.crisp-home-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1e293b;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.crisp-home-btn:hover {
  background: #0f172a;
}

.crisp-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1d72f2;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(29, 114, 242, 0.3);
}

.crisp-menu-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.25rem;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}

.crisp-menu-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* 问候欢迎区 (带经典菱形几何底纹水印) */
.crisp-hero-card {
  padding: 18px 20px 14px 20px;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  background-image: 
    radial-gradient(rgba(13, 148, 136, 0.06) 1px, transparent 1px),
    radial-gradient(rgba(29, 114, 242, 0.04) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.crisp-avatar-combo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.crisp-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #64748b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crisp-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1d72f2;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(29, 114, 242, 0.35);
}

.crisp-hero-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.crisp-hero-status {
  font-size: 0.76rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.crisp-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

/* 消息对话列表区 */
.crisp-messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
}

.crisp-message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.crisp-message-row.is-agent .crisp-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1d72f2;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crisp-message-row.is-agent .crisp-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 4px 16px 16px 16px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 80%;
  word-break: break-word;
}

.crisp-message-row.is-user {
  flex-direction: row-reverse;
}

.crisp-message-row.is-user .crisp-bubble {
  background: #1d72f2;
  color: #ffffff;
  border-radius: 16px 4px 16px 16px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 82%;
  word-break: break-word;
  white-space: pre-wrap;
}

.crisp-msg-time {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 4px;
  text-align: right;
}

/* 底部消息输入区域 */
.crisp-input-box {
  padding: 12px 14px 8px 14px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.crisp-input-card {
  border: 1.5px solid #3b82f6;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.crisp-textarea {
  width: 100%;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  min-height: 48px;
  max-height: 90px;
  color: #0f172a;
}

.crisp-textarea::placeholder {
  color: #94a3b8;
}

.crisp-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crisp-tools-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crisp-tool-icon {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.crisp-tool-icon:hover {
  color: #1d72f2;
}

.crisp-send-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
}

.crisp-send-btn.can-send {
  color: #1d72f2;
}

.crisp-send-btn.can-send:hover {
  transform: translateX(2px);
}

/* 底部 Crisp 版权标 */
.crisp-footer-tag {
  text-align: center;
  padding: 4px 0 8px 0;
  font-size: 0.72rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.crisp-footer-tag svg {
  color: #1d72f2;
}

/* --------------------------------------------------------------------------
   3. 移动端自适应适配
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .floating-service-widget {
    right: 16px;
    bottom: 16px;
  }

  .service-float-btn {
    width: 52px;
    height: 52px;
  }

  .service-logo-icon {
    width: 28px;
    height: 28px;
  }

  .crisp-chat-widget {
    right: 12px;
    bottom: 78px;
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    border-radius: 18px;
  }
}
