@use "@styles/mixins/bem" as *;
@use "@styles/mixins/function" as *;

@include b(layout-loading) {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100%;
  height: 100%;
  background-color: cssVar(layout-page-bg-color);

  @include is(route) {
    position: absolute;
  }

  @include e(wrap) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 43px;

    .dot {
      position: relative;
      box-sizing: border-box;
      display: inline-block;
      width: 56px;
      height: 56px;
      font-size: 32px;
      transform: rotate(45deg);
      animation: ant-rotate 1.2s infinite linear;
    }

    .dot i {
      position: absolute;
      display: block;
      width: 24px;
      height: 24px;
      background-color: cssVar(color-primary);
      border-radius: 100%;
      opacity: 0.3;
      transform: scale(0.75);
      transform-origin: 50% 50%;
      animation: ant-spin-move 1s infinite linear alternate;
    }

    .dot i:nth-child(1) {
      top: 0;
      left: 0;
    }

    .dot i:nth-child(2) {
      top: 0;
      right: 0;
      animation-delay: 0.4s;
    }

    .dot i:nth-child(3) {
      right: 0;
      bottom: 0;
      animation-delay: 0.8s;
    }

    .dot i:nth-child(4) {
      bottom: 0;
      left: 0;
      animation-delay: 1.2s;
    }

    @keyframes ant-rotate {
      to {
        transform: rotate(405deg);
      }
    }

    @keyframes ant-spin-move {
      to {
        opacity: 1;
      }
    }
  }

  @include e(text) {
    font-size: 26px;
    font-weight: 600;
    color: cssVarEl(text-color-regular);
  }
}

// 过渡动画样式
.loading-enter-active {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 1, 1);
}

.loading-leave-active {
  transition: opacity 0.5s cubic-bezier(0.4, 0, 1, 1);
}

.loading-enter-from,
.loading-leave-to {
  opacity: 0;
}
