/* ============ BACK TO TOP BUTTON ============ */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #7C5CFC, #00D4FF);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 25px rgba(124, 92, 252, 0.4);
  overflow: visible;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 35px rgba(124, 92, 252, 0.6);
}

.back-to-top:active {
  transform: scale(0.95);
}

.back-to-top i {
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.back-to-top:hover i {
  transform: translateY(-2px);
}

/* Progress Ring */
.back-to-top .progress-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border-radius: 50%;
  pointer-events: none;
}

.back-to-top .progress-ring::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(124, 92, 252, 0.15);
  box-sizing: border-box;
}

.back-to-top .progress-ring svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.back-to-top .progress-ring svg circle {
  fill: none;
  stroke: #00D4FF;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 157.08;
  stroke-dashoffset: 157.08;
  transition: stroke-dashoffset 0.3s ease;
}

/* Progress ring color changes based on scroll percentage */
.back-to-top .progress-ring svg circle.partial {
  stroke: #7C5CFC;
}

.back-to-top .progress-ring svg circle.complete {
  stroke: #00D68F;
}

/* Pulse animation when visible */
.back-to-top.visible::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  border-radius: 50%;
  border: 2px solid rgba(124, 92, 252, 0.2);
  animation: backToTopPulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes backToTopPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.2);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}