@import '../style/theme/color';
@import '../style/theme/corner';
@import '../style/core/_font';
@import '../style/core/z-index';

.devui-loading-wrapper {
  display: flex;
  flex: 1 1 auto;
}

.devui-loading-wrapper.devui-loading-full {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0 !important;
  left: 0;
  z-index: $devui-z-index-full-page-overlay;
}

.devui-spinner-wrapper {
  position: absolute;
  z-index: $devui-z-index-full-page-overlay;
  width: max-content;
  max-width: 100%;
  display: flex;
}

.devui-message-wrapper {
  background: $devui-base-bg;
  border-radius: $devui-border-radius-card;
}

.devui-fix-loading-position {
  transform: translate(-50%, -50%);
}

.devui-busy-default-sign {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: $devui-z-index-full-page-overlay;
  padding: 12px 12px;
  color: $devui-text;
}

.devui-busy-default-text {
  display: inline-block;
  margin: auto 0 auto 8px;
  max-width: 400px;
  font-size: $devui-font-size;
  text-align: left;
}

.devui-busy-default-spinner {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  svg {
    position: absolute;
    z-index: 2;
    width: 28px;
    height: 28px;
    animation: animRotate 2s linear infinite;

    circle {
      animation: animDash 1.5s ease-in-out infinite;
      stroke-dasharray: 90, 150;
      stroke-dashoffset: 0;
      stroke-linecap: round;
      stroke-width: 4.5;
      stroke: $devui-primary;
    }
  }

  .devui-loading-dots {
    position: relative;
    width: 24px;
    height: 24px;
    animation: animRotate 12s linear infinite;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    span {
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      @for $i from 2 through 12 {
        &:nth-child(#{$i}) {
          transform: rotate(#{30 * ($i - 1)}deg);
        }
      }

      i {
        width: 2px;
        height: 2px;
        display: block;
        margin: 0 auto;
        border-radius: 50%;
        background-color: $devui-list-item-active-bg;
      }
    }
  }
}

$len: 170px;
$time: 1800ms;

#infinity-outline {
  stroke-dasharray: $len * 0.01, $len;
  stroke-dashoffset: 0;
  animation: anim $time linear infinite;
  opacity: 1;
}

#infinity-bg {
  stroke: $devui-zinc-20;
}

@keyframes anim {
  0% {
    stroke-dasharray: $len * 0, $len;
    stroke-dashoffset: -$len * 0;
  }

  55% {
    stroke-dasharray: $len * 0.24, $len;
    stroke-dashoffset: -$len * 0.36;
  }

  100% {
    stroke-dasharray: -$len * 0.93, $len;
    stroke-dashoffset: -$len * 0.93;
  }
}

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

  66% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -40px;
  }

  to {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -120px;
  }
}

@keyframes animRotate {
  to {
    transform: rotate(1turn);
  }
}
