@import 'variables';
@import 'theme-colors';

.overlay-preloader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--overlay-loader-bg);
}

.preloader {
  position: relative;
  width: 50px;
  height: 45px;
  display: inline-block;
  transform-origin: center;
  animation: animatePreloader 1.5s linear infinite;

  .loading-items {
    display: flex;
    justify-content: center;

    span {
      position: absolute;
      width: 8px;
      height: 8px;
      background: $brand-color;
      border-radius: 50%;
      transform-origin: center 22px;

      &:first-child {
        opacity: 0.1;
      }

      &:nth-child(2) {
        transform: rotate(36deg);
        opacity: 0.2;
      }

      &:nth-child(3) {
        transform: rotate(72deg);
        opacity: 0.3;
      }

      &:nth-child(4) {
        transform: rotate(108deg);
        opacity: 0.4;
      }

      &:nth-child(5) {
        transform: rotate(144deg);
        opacity: 0.5;
      }

      &:nth-child(6) {
        transform: rotate(180deg);
        opacity: 0.6;
      }

      &:nth-child(7) {
        transform: rotate(216deg);
        opacity: 0.7;
      }

      &:nth-child(8) {
        transform: rotate(252deg);
        opacity: 0.8;
      }

      &:nth-child(9) {
        transform: rotate(288deg);
        opacity: 0.9;
      }

      &:nth-child(10) {
        transform: rotate(324deg);
        opacity: 1;
      }
    }
  }
}

@keyframes animatePreloader {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}