@use '../../themes/index' as *;
@use '../../abstracts/index' as *;

/* 
  Loading indicator component styles
*/
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  // Size variations
  &.loading-small {
    .loading-spinner {
      @include spinner-size(20px);
    }

    .loading-dots {
      .dot {
        width: 8px;
        height: 8px;
      }
    }

    .loading-message {
      font-size: 0.8rem;
      margin-top: 0.5rem;
    }
  }

  &.loading-medium {
    .loading-spinner {
      @include spinner-size(30px);
    }

    .loading-dots {
      .dot {
        width: 10px;
        height: 10px;
      }
    }

    .loading-message {
      font-size: 0.9rem;
      margin-top: 0.75rem;
    }
  }

  &.loading-large {
    .loading-spinner {
      @include spinner-size(50px);
    }

    .loading-dots {
      .dot {
        width: 14px;
        height: 14px;
      }
    }

    .loading-message {
      font-size: 1.1rem;
      margin-top: 1rem;
    }
  }
}

// Windows/Fluent-style ring spinner - an SVG circle with an animated
// stroke-dasharray + rotation, rather than a CSS conic-gradient mask.
// Sizing is set per-context (see above); the ring geometry (viewBox +
// circle radius) is fixed, so the stroke scales with it automatically.
.spinner-ring {
  overflow: visible;
  color: var(--primary-color);

  circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5px;
    stroke-linecap: round;
    transform-origin: 50% 50%;
    animation: spinner-dash 2s linear infinite;
  }
}

@keyframes spinner-dash {
  0% {
    stroke-dasharray: 0.01px, 43.97px;
    transform: rotate(0deg);
  }

  50% {
    stroke-dasharray: 21.99px, 21.99px;
    transform: rotate(450deg);
  }

  100% {
    stroke-dasharray: 0.01px, 43.97px;
    transform: rotate(1080deg);
  }
}

// Loading dots animation
.loading-dots {
  display: flex;
  gap: 0.4rem;

  .dot {
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;

    &.dot-1 {
      animation-delay: -0.32s;
    }

    &.dot-2 {
      animation-delay: -0.16s;
    }
  }
}

.loading-message {
  color: var(--text-secondary);
  text-align: center;
}

// Animation
@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}
