@loadingCls: ~'@{comps-prefix}-loading';

.@{loadingCls}{
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1888;
  background-color: @loading-mask-bg;
  &__container{
      position: absolute;
      left: 50%;
      top: 35%;
      z-index: 1889;
      transform: translateX(-50%);
      text-align: center;
      width: 120px;
      height: 120px;
      background-color: @loading-container-bg;
      border-radius: 6px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
  }
  &__icon {
    display: inline-block;
    width: @loading-icon-size;
    height: @loading-icon-size;
    color: @loading-icon-color;
    &--spinner {
      animation: ~'r-rotate @{loading-icon-animation-duration} linear infinite';
      animation-timing-function: steps(12);
      i {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        &::before {
          content: ' ';
          width: 2px;
          height: 25%;
          border-radius: 40%;
          background-color: currentColor;
          margin: 0 auto;
          display: block;
        }
      }
    }
    &--circular {
      animation: ~'r-rotate @{loading-icon-animation-duration} linear infinite';
      animation-duration: 2s;
    }
  }
  &__text {
    font-size: @loading-text-font-size;
    color: @loading-text-color;
    margin-top: 5px;
  }
  &__circular {
    display: block;
    width: 100%;
    height: 100%;
    circle {
      animation: r-circular 1.5s ease-in-out infinite;
      stroke: currentColor;
      stroke-width: 3;
      stroke-linecap: round;
    }
  }
}


@keyframes r-circular {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 90, 200;
    stroke-dashoffset: -40;
  }

  100% {
    stroke-dasharray: 90, 300;
    stroke-dashoffset: -120;
  }
}

.generate-spinner(@n, @i: 1) when (@i =< @n) {
  .@{loadingCls}__icon--spinner i:nth-of-type(@{i}) {
    transform: rotate(@i * 30deg);
    opacity: 1 - (0.75 / 12) * (@i - 1);
  }
  .generate-spinner(@n, (@i + 1));
}
.generate-spinner(12);
