/* === 返回顶部按钮样式 === */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8) translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  user-select: none;
}

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

.back-to-top:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: var(--shadow-xl);
  background: linear-gradient(135deg, #6ed905 0%, #57b401 100%);
}

.back-to-top:active {
  transform: scale(0.95) translateY(0);
  transition-duration: 0.1s;
}

.back-to-top i {
  font-size: 20px;
  color: white;
  transition: transform 0.3s ease;
}

.back-to-top:hover i {
  transform: translateY(-2px);
}

/* 毛玻璃效果增强 */
.back-to-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: -1;
}

/* 深色模式适配 */
[data-theme="dark"] .back-to-top {
  background: var(--gradient-primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .back-to-top::before {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .back-to-top:hover {
  background: linear-gradient(135deg, #6ed905 0%, #57b401 100%);
  box-shadow: 0 12px 40px rgba(87, 180, 1, 0.3);
}

/* 脉冲动画效果 */
@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.back-to-top::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary-green);
  opacity: 0;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  z-index: -2;
}

.back-to-top.show::after {
  animation-play-state: running;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .back-to-top {
    width: 48px;
    height: 48px;
    right: 16px;
    bottom: 20px;
  }
  
  .back-to-top i {
    font-size: 18px;
  }
}

/* 小屏幕适配 */
@media (max-width: 480px) {
  .back-to-top {
    width: 44px;
    height: 44px;
    right: 12px;
    bottom: 16px;
  }
  
  .back-to-top i {
    font-size: 16px;
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .back-to-top {
    right: 16px;
    bottom: 12px;
    width: 40px;
    height: 40px;
  }
  
  .back-to-top i {
    font-size: 14px;
  }
}

/* 无障碍性优化 */
@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  
  .back-to-top::after {
    animation: none !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .back-to-top {
    background: #0f5132;
    border: 2px solid #ffffff;
  }
  
  [data-theme="dark"] .back-to-top {
    background: #198754;
    border: 2px solid #ffffff;
  }
}

/* 打印时隐藏 */
@media print {
  .back-to-top {
    display: none !important;
  }
}
