/* Go to Top Button - Global Component */

/* Main Button Container */
.go-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile positioning - avoid overlap with bottom navigation */
@media screen and (max-width: 1023px) {
  .go-to-top {
    bottom: 7rem !important; /* Position well above mobile navigation */
    right: 1rem !important; /* Adjust right margin for mobile */
    z-index: 1001 !important; /* Ensure it's above mobile nav */
  }
}

/* Small mobile devices - more aggressive positioning */
@media screen and (max-width: 767px) {
  .go-to-top {
    bottom: 8rem !important; /* Higher position for smaller screens */
    right: 1rem !important;
    z-index: 1001 !important;
  }
}

/* Very small mobile devices */
@media screen and (max-width: 480px) {
  .go-to-top {
    bottom: 8rem !important; /* Consistent high position */
    right: 0.75rem !important;
    z-index: 1001 !important;
  }
}

/* Show button when scrolled */
.go-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Button Styling */
.go-to-top-btn {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(138, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Hover Effects */
.go-to-top-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 30px rgba(138, 0, 0, 0.4);
}

.go-to-top-btn:active {
  transform: translateY(0) scale(0.95);
}

/* Shimmer Effect */
.go-to-top-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.go-to-top-btn:hover::before {
  left: 100%;
}

/* Icon Styling */
.go-to-top-btn i {
  color: white;
  font-size: 20px;
  transition: transform 0.3s ease;
}

.go-to-top-btn:hover i {
  transform: translateY(-2px);
}

/* Pulse Animation */
.go-to-top-btn.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 20px rgba(138, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(138, 0, 0, 0.3), 0 0 0 10px rgba(138, 0, 0, 0.1);
  }
  100% {
    box-shadow: 0 4px 20px rgba(138, 0, 0, 0.3);
  }
}

/* Scroll Progress Indicator */
.go-to-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--primary);
  z-index: 1001;
  transition: width 0.1s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .go-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .go-to-top-btn {
    width: 48px;
    height: 48px;
  }

  .go-to-top-btn i {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .go-to-top {
    bottom: 1rem;
    right: 1rem;
  }

  .go-to-top-btn {
    width: 44px;
    height: 44px;
  }

  .go-to-top-btn i {
    font-size: 16px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .go-to-top-btn {
    background: linear-gradient(
      135deg,
      var(--sqube-red-light),
      var(--sqube-orange-light)
    );
    box-shadow: 0 4px 20px rgba(138, 0, 0, 0.4);
  }

  .go-to-top-btn:hover {
    box-shadow: 0 8px 30px rgba(138, 0, 0, 0.5);
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .go-to-top-btn {
    background: #000000;
    border: 2px solid #ffffff;
  }

  .go-to-top-btn:hover {
    background: #ffffff;
    color: #000000;
  }

  .go-to-top-btn i {
    color: #ffffff;
  }

  .go-to-top-btn:hover i {
    color: #000000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .go-to-top {
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .go-to-top-btn {
    transition: transform 0.2s ease;
  }

  .go-to-top-btn::before {
    display: none;
  }

  .go-to-top-btn.pulse {
    animation: none;
  }
}

/* Print Styles */
@media print {
  .go-to-top,
  .go-to-top-progress {
    display: none;
  }
}

/* Focus States for Accessibility */
.go-to-top-btn:focus {
  outline: 2px solid var(--sqube-red);
  outline-offset: 2px;
}

.go-to-top-btn:focus:not(:focus-visible) {
  outline: none;
}

/* Loading State */
.go-to-top-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.go-to-top-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--sqube-cream);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    135deg,
    var(--sqube-red-dark),
    var(--sqube-orange-dark)
  );
}
