/* Loading Spinner Component */

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-4);
  padding: var(--space-layout-md);
}

.spinner {
  position: relative;
  display: inline-block;
}

/* Size variants */
.spinner.sm {
  width: 24px;
  height: 24px;
}

.spinner.md {
  width: 40px;
  height: 40px;
}

.spinner.lg {
  width: 64px;
  height: 64px;
}

.ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--color-primary-500);
  border-radius: var(--radius-circle);
  animation: spin var(--duration-slowest) cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.ring:nth-child(1) {
  animation-delay: calc(var(--duration-slowest) * -0.45);
  border-top-color: var(--color-primary-500);
}

.ring:nth-child(2) {
  animation-delay: calc(var(--duration-slowest) * -0.3);
  border-top-color: var(--color-secondary-500);
}

.ring:nth-child(3) {
  animation-delay: calc(var(--duration-slowest) * -0.15);
  border-top-color: var(--color-tertiary-500);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.message {
  font-size: var(--font-size-body-sm);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  margin: 0;
  text-align: center;
}

/* Screen reader only class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .ring {
    animation: none;
    border: 3px solid var(--color-primary-500);
    opacity: 0.7;
  }
}
