/* ======================================
   客服悬浮按钮（基于 uView 设计规范）
   BOX3 数字工坊 - 2026-08-23 重新设计版

   设计参考：ui-library/components/feedback/uView-b02342a2
   规范来源：uView 官方设计系统

   核心规范：
   - 悬浮按钮尺寸: 48×48px (移动端) / 56×56px (桌面端)
   - 圆角: 50% (圆形)
   - 阴影: 0 4px 12px rgba(14,165,233,0.4)
   - 位置: 右下角 24px (移动端 20px)
   - z-index: 9999 (低于用户入口 10001)
   ====================================== */

/* 客服按钮容器 */
.customer-service-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999; /* 低于用户入口，避免层级冲突 */
  width: 48px;
  height: 48px;
  background: var(--accent, #0ea5e9);
  border: none;
  border-radius: 50%; /* uView 规范：圆形 */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.customer-service-btn:hover {
  background: #0284c7;
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.6);
  transform: translateY(-2px) scale(1.05);
}

.customer-service-btn:active {
  transform: translateY(0) scale(0.95);
}

/* 图标 */
.customer-service-btn__icon {
  color: white;
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.customer-service-btn:hover .customer-service-btn__icon {
  transform: scale(1.1);
}

/* 在线状态指示器 */
.customer-service-btn__status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--accent, #0ea5e9);
}

.customer-service-btn--offline .customer-service-btn__status {
  background: #64748b;
}

/* 提示文字（hover 显示） */
.customer-service-btn__tooltip {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-1, #161b22);
  color: var(--text-primary, #e6edf3);
  border: 1px solid var(--border-default, #30363d);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.customer-service-btn__tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent var(--border-default, #30363d);
}

.customer-service-btn:hover .customer-service-btn__tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-4px);
}

/* 桌面端适配 */
@media (min-width: 769px) {
  .customer-service-btn {
    width: 56px;
    height: 56px;
  }

  .customer-service-btn__icon {
    width: 28px;
    height: 28px;
  }

  .customer-service-btn__status {
    width: 14px;
    height: 14px;
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .customer-service-btn {
    bottom: 20px;
    right: 20px;
  }

  /* 移动端隐藏提示文字 */
  .customer-service-btn__tooltip {
    display: none;
  }
}

/* 移动端安全区适配 */
@media (max-width: 768px) {
  .customer-service-btn {
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(20px, env(safe-area-inset-right));
  }
}

/* 触控区优化（移动端最小 44×44px） */
@media (pointer: coarse) {
  .customer-service-btn {
    min-width: 48px;
    min-height: 48px;
  }
}

/* 避免与滚动条重叠（Windows/Linux） */
@media (min-width: 769px) {
  .customer-service-btn {
    right: 32px; /* 多 8px 避开滚动条 */
  }
}

/* 动画：入场效果 */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.customer-service-btn {
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.5s both;
}

/* 无障碍支持 */
.customer-service-btn:focus {
  outline: 2px solid var(--accent, #0ea5e9);
  outline-offset: 2px;
}

.customer-service-btn:focus:not(:focus-visible) {
  outline: none;
}

/* 深色主题优化 */
@media (prefers-color-scheme: dark) {
  .customer-service-btn {
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.5);
  }
}
