/* ============================================
   Neumorphism 客服悬浮组件样式
   Version: 1.0.0
   ============================================ */

/* 核心变量 */
.neu-service-widget {
  --neu-bg: #e8e8e8;
  --neu-bg-light: #f0f0f0;
  --neu-shadow-dark: rgba(163, 163, 163, 0.5);
  --neu-shadow-light: rgba(255, 255, 255, 0.8);
  --neu-primary: #E89513;
  --neu-primary-light: #f59e0b;
  --neu-primary-dark: #d17e0a;
  --neu-text: #333333;
  --neu-text-light: #666666;
  --neu-radius: 20px;
  --neu-radius-sm: 12px;
  --neu-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

/* ============================================
   主悬浮按钮 (FAB)
   ============================================ */
.neu-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--neu-primary-light), var(--neu-primary-dark));
  box-shadow:
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light),
    0 4px 15px rgba(232, 149, 19, 0.4);
  transition: var(--neu-transition);
  position: relative;
  z-index: 10;
}

.neu-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light),
    0 8px 25px rgba(232, 149, 19, 0.5);
}

.neu-fab:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    inset 3px 3px 6px rgba(0, 0, 0, 0.2),
    inset -3px -3px 6px rgba(255, 255, 255, 0.1);
}

.neu-fab-icon {
  width: 28px;
  height: 28px;
  stroke: white;
  stroke-width: 2;
  fill: none;
  transition: var(--neu-transition);
  position: absolute;
}

.neu-fab-icon-open {
  opacity: 1;
  transform: rotate(0deg);
}

.neu-fab-icon-close {
  opacity: 0;
  transform: rotate(-90deg);
}

.neu-service-widget.active .neu-fab-icon-open {
  opacity: 0;
  transform: rotate(90deg);
}

.neu-service-widget.active .neu-fab-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* 脉冲动画 */
.neu-fab::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--neu-primary);
  opacity: 0;
  animation: neuPulse 2s infinite;
}

@keyframes neuPulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

.neu-service-widget.active .neu-fab::before {
  animation: none;
  opacity: 0;
}

/* ============================================
   客服卡片
   ============================================ */
.neu-card {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 320px;
  background: var(--neu-bg-light);
  border-radius: var(--neu-radius);
  box-shadow:
    12px 12px 24px var(--neu-shadow-dark),
    -12px -12px 24px var(--neu-shadow-light);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.9);
  transform-origin: bottom right;
  transition: var(--neu-transition);
}

.neu-service-widget.active .neu-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* 卡片头部 */
.neu-card-header {
  background: linear-gradient(135deg, var(--neu-primary), var(--neu-primary-dark));
  padding: 20px;
  color: white;
}

.neu-card-header h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 600;
}

.neu-card-header .neu-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.neu-card-header .neu-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: statusBlink 1.5s infinite;
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 卡片内容 */
.neu-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 列表项 */
.neu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--neu-bg);
  border-radius: var(--neu-radius-sm);
  text-decoration: none;
  color: var(--neu-text);
  box-shadow:
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  transition: var(--neu-transition);
}

.neu-item:hover {
  transform: translateX(4px);
  box-shadow:
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light);
}

.neu-item:active {
  box-shadow:
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light);
}

/* 主要项（在线咨询） */
.neu-item-primary {
  background: linear-gradient(135deg, var(--neu-primary-light), var(--neu-primary));
  color: white;
  box-shadow:
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light),
    0 4px 12px rgba(232, 149, 19, 0.3);
}

.neu-item-primary:hover {
  box-shadow:
    6px 6px 12px var(--neu-shadow-dark),
    -6px -6px 12px var(--neu-shadow-light),
    0 6px 18px rgba(232, 149, 19, 0.4);
}

.neu-item-primary .neu-item-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.neu-item-primary .neu-item-icon svg {
  stroke: white;
}

/* 图标容器 */
.neu-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--neu-bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -2px -2px 4px var(--neu-shadow-light);
}

.neu-item-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--neu-primary);
  stroke-width: 2;
  fill: none;
}

/* 内容区 */
.neu-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.neu-item-title {
  font-size: 14px;
  font-weight: 600;
}

.neu-item-desc {
  font-size: 12px;
  color: var(--neu-text-light);
}

.neu-item-primary .neu-item-desc {
  color: rgba(255, 255, 255, 0.85);
}

/* ============================================
   返回顶部按钮
   ============================================ */
.neu-back-top {
  --neu-bg-light: #f0f0f0;
  --neu-shadow-dark: rgba(163, 163, 163, 0.5);
  --neu-shadow-light: rgba(255, 255, 255, 0.8);
  --neu-primary: #E89513;
  --neu-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  position: fixed;
  right: 24px;
  bottom: 100px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neu-bg-light);
  box-shadow:
    5px 5px 10px var(--neu-shadow-dark),
    -5px -5px 10px var(--neu-shadow-light);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--neu-transition);
  z-index: 9998;
}

.neu-back-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.neu-back-top:hover {
  transform: translateY(-3px);
  box-shadow:
    7px 7px 14px var(--neu-shadow-dark),
    -7px -7px 14px var(--neu-shadow-light);
}

.neu-back-top:active {
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

.neu-back-top svg {
  width: 22px;
  height: 22px;
  stroke: var(--neu-primary);
  stroke-width: 2.5;
  fill: none;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 480px) {
  .neu-service-widget {
    right: 16px;
    bottom: 16px;
  }

  .neu-fab {
    width: 56px;
    height: 56px;
  }

  .neu-card {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 70px;
  }

  .neu-back-top {
    right: 16px;
    bottom: 90px;
    width: 44px;
    height: 44px;
  }

  .neu-item {
    padding: 12px 14px;
  }

  .neu-item-icon {
    width: 40px;
    height: 40px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .neu-service-widget,
  .neu-back-top {
    --neu-bg: #2a2a2a;
    --neu-bg-light: #333333;
    --neu-shadow-dark: rgba(0, 0, 0, 0.5);
    --neu-shadow-light: rgba(60, 60, 60, 0.5);
    --neu-text: #e0e0e0;
    --neu-text-light: #a0a0a0;
  }
}
