@import '../utils/theme/variables.scss';
$size: 1em;
$period: 1s;
$easing: linear;
$thickness: 0.1em;

.loading-spinner {
  .loading-spinner-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99;
    height: 100%;
    width: 100%;

    .spinner,
    .message {
      position: absolute;
      top: 50%;
      left: 50%;
    }

    .spinner {
      -ms-transform: translateZ(0);
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
      margin-top: -$size / 2;
      margin-left: -$size / 2;
      border-top-color: transparent;
      border-right-color: transparent;
      border-left-color: transparent;
      -webkit-animation: spin $period infinite $easing;
      animation: spin $period infinite $easing;
      box-sizing: border-box;

      &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        box-sizing: border-box;
        margin-top: -$size / 2;
        margin-left: -$size / 2;
        border-bottom-color: transparent;
        opacity: 0.2;
      }
    }

    .spinner,
    .spinner::after {
      border-width: $thickness;
      border-style: solid;
      border-radius: 50%;
      height: $size;
      width: $size;
    }

    .message {
      left: 0;
      padding-right: 2em;
      padding-left: 2em;
      width: 100%;
      font-weight: $brc-bold;
      text-align: center;
    }
  }
}

@mixin spin-frames() {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }

  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@-webkit-keyframes spin {
  @include spin-frames();
}

@keyframes spin {
  @include spin-frames();
}
