/* ============================================
   Utilities: Back to Top, Loading, Animations
   ============================================ */

/* Back to Top */
.cg-back-to-top {
  position: fixed;
  bottom: var(--cg-spacing-xl);
  right: var(--cg-spacing-xl);
  width: 40px;
  height: 40px;
  border-radius: var(--cg-radius-md);
  background: var(--cg-bg-card);
  border: 1px solid var(--cg-border);
  color: var(--cg-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--cg-transition-base);
  z-index: 999;
}

.cg-back-to-top:hover {
  background: var(--cg-primary);
  border-color: var(--cg-primary);
  color: #ffffff;
}

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

/* Loading Overlay */
.cg-loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--cg-bg-primary);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.cg-loader {
  width: 36px;
  height: 36px;
  border: 2px solid var(--cg-border);
  border-top-color: var(--cg-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============================================
   Keyframe Animations
   ============================================ */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
