

/* Enhanced Scroll-to-Top Button */
#scroll-to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25), 0 0 10px var(--shadow-color, rgba(0, 0, 0, 0.2));
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 999;
  overflow: hidden;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Mobile responsiveness for scroll-to-top button */
@media screen and (max-width: 768px) {
  #scroll-to-top {
    width: 30px;
    height: 30px;
    bottom: 15px;
    right: 15px;
    font-size: 12px;
  }
}

@media screen and (max-width: 480px) {
  #scroll-to-top {
    width: 28px;
    height: 28px;
    bottom: 12px;
    right: 12px;
    font-size: 10px;
  }
}

#scroll-to-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 25%, rgba(255, 255, 255, 0.1) 50%, transparent 75%);
  background-size: 200% 200%;
  animation: shimmer 3s infinite linear;
  border-radius: 50%;
}

@keyframes shimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 200%; }
}

#scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  animation: pulse 2s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 0 15px var(--shadow-color, rgba(0, 0, 0, 0.2)); }
  100% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 20px var(--shadow-color, rgba(0, 0, 0, 0.3)); }
}

#scroll-to-top:hover {
  background-color: var(--accent-color, var(--primary-color));
  transform: translateY(-8px) scale(1.1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 25px var(--shadow-color, rgba(0, 0, 0, 0.3));
  animation: none;
}

/* Add a subtle glow effect when hovered */
#scroll-to-top:hover::after {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: radial-gradient(circle, var(--shadow-color, rgba(0, 0, 0, 0.2)) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  opacity: 0.6;
  animation: glow 1.5s infinite alternate;
}

@keyframes glow {
  0% { opacity: 0.2; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(1.05); }
}

/* For RTL layouts */
html[dir="rtl"] #scroll-to-top {
  right: auto;
  left: 25px;
}

/* Enhanced animation for the arrow */
#scroll-to-top i {
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.3));
}

#scroll-to-top:hover i {
  transform: translateY(-5px);
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(-3px); }
  50% { transform: translateY(-8px); }
}

/* Improved visibility in different modes */
body.terminal-mode #scroll-to-top, 
body.hacker-mode #scroll-to-top,
body.darknet-mode #scroll-to-top {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 15px var(--shadow-color, rgba(0, 255, 0, 0.3));
}

/* Add a tooltip to indicate function on hover */
#scroll-to-top::after {
  content: 'Back to top';
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

#scroll-to-top:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  bottom: -35px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #scroll-to-top {
    width: 30px;
    height: 30px;
    bottom: 15px;
    right: 15px;
    font-size: 12px;
  }
  
  html[dir="rtl"] #scroll-to-top {
    right: auto;
    left: 15px;
  }
}

/* For users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  #scroll-to-top {
    transition: opacity 0.3s, visibility 0.3s;
  }
  
  #scroll-to-top.visible {
    animation: none;
  }
  
  #scroll-to-top:hover {
    transform: translateY(-5px);
  }
  
  #scroll-to-top:hover i {
    transform: translateY(-3px);
    animation: none;
  }
  
  #scroll-to-top::before {
    animation: none;
  }
}