// 已完成的参考：
// https://codepen.io/232003894/pen/LYYgWyP?editors=1100
// 未完成的参考：
// https://projects.lukehaas.me/css-loaders/
// https://codepen.io/lbebber/pen/xrwja?editors=1100#0
// https://codepen.io/CrocoDillon/pen/Htycs?editors=1100

// 颜色值在 theme.scss 中修改
$color: rgb($wb-loading-r, $wb-loading-g, $wb-loading-b);

.default {
  display: block;
  margin: auto;
  width: 82rpx;
  height: 82rpx;
  border-radius: 50%;
  border-top: 4rpx solid $color;
  border-right: 4rpx solid #e8e8e8;
  border-left: 4rpx solid #e8e8e8;
  border-bottom: 4rpx solid #e8e8e8;
  transform: translateZ(0);
  animation: default 1.4s infinite linear;
}
@keyframes default {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- Loader0 -------------- */
.load {
  display: block;
  margin: auto;
  width: 82rpx;
  height: 82rpx;
  border-radius: 50%;
  border-top: 4rpx solid $color;
  border-right: 4rpx solid $color;
  border-left: 4rpx solid $color;
  border-bottom: 4rpx solid rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.03);
  transform: translateZ(0);
  animation: load 1.4s infinite linear;
}
@keyframes load {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- single1 -------------- */
.single1 {
  display: inline-block;
  width: 70rpx;
  height: 70rpx;
  position: relative;
}

.single1::before,
.single1::after {
  content: '';
  width: inherit;
  height: inherit;
  border-radius: 50%;
  background-color: rgb($wb-loading-r, $wb-loading-g, $wb-loading-b);
  opacity: 0.6;
  position: absolute;
  top: 0;
  left: 0;
  animation: ani-single1 2s infinite ease-in-out;
}

.single1::after {
  animation-delay: -1s;
}

@keyframes ani-single1 {
  0%,
  100% {
    transform: scale(0);
  }
  50% {
    transform: scale(1);
  }
}

/* -------------- single2 -------------- */
.single2 {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: $color;
  animation: ani-single2 1.4s 0s ease-in-out infinite;
}
// .single21 {
//   display: inline-block;
//   width: 72px;
//   height: 72px;
//   // margin: -18px auto 0px;
//   border-radius: 50%;
//   background-color: $color;
//   animation: ani-single2 1.4s 0s ease-in-out infinite;
// }
@keyframes ani-single2 {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* -------------- Clock -------------- */

.clock {
  display: block;
  border-radius: 60px;
  border: 3px solid $color;
  height: 80px;
  width: 80px;
  position: relative;

  top: 28%;
  top: calc(50% - 43px);
  left: 35%;
  left: calc(50% - 43px);

  margin: 0 auto 40px;
}
.clock:after {
  content: '';
  position: absolute;
  background-color: $color;
  top: 2px;
  left: 48%;
  height: 38px;
  width: 4px;
  border-radius: 5px;
  transform-origin: 50% 97%;
  animation: grdAiguille 2s linear infinite;
}

@keyframes grdAiguille {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.clock:before {
  content: '';
  position: absolute;
  background-color: $color;
  top: 6px;
  left: 48%;
  height: 35px;
  width: 4px;
  border-radius: 5px;
  transform-origin: 50% 94%;
  animation: ptAiguille 12s linear infinite;
}

@keyframes ptAiguille {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- hourglass -------------- */

.hourglass {
  display: block;
  position: relative;
  height: 80px;
  width: 80px;
  margin: -20px auto 10px;
  border: 3px solid $color;
  border-radius: 80px;
  transform-origin: 50% 50%;
  animation: hourglass 2s ease-in-out infinite;
}

.hourglass:before {
  content: '';
  position: absolute;
  top: 8px;
  left: 18px;
  width: 0px;
  height: 0px;
  border-style: solid;
  border-width: 37px 22px 0 22px;
  border-color: $color transparent transparent transparent;
}
.hourglass:after {
  content: '';
  position: absolute;
  top: 35px;
  left: 18px;
  width: 0px;
  height: 0px;
  border-style: solid;
  border-width: 0 22px 37px 22px;
  border-color: transparent transparent $color transparent;
}
@keyframes hourglass {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(180deg);
  }
}

/* -------------- Loader1 -------------- */

.surround1 {
  display: block;
  position: relative;
  height: 80px;
  width: 80px;
  border-radius: 80px;
  border: 3px solid rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.7);

  // top: 28%;
  // top: calc(50% - 43px);
  // left: 35%;
  // left: calc(50% - 43px);
  // margin: -40px auto 40px;

  margin: 0px auto;

  transform-origin: 50% 50%;
  animation: surround1 3s linear infinite;
}

.surround1:after {
  content: '';
  position: absolute;
  top: -5px;
  left: 20px;
  width: 11px;
  height: 11px;
  border-radius: 10px;
  background-color: $color;
}

@keyframes surround1 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- radar1 -------------- */

.radar1 {
  display: block;
  position: relative;
  width: 5px;
  height: 5px;

  // top: 49%;
  // top: calc(50% - 2.5px);
  // left: 49%;
  // left: calc(50% - 2.5px);
  margin: 50px auto;

  background-color: $color;
  border-radius: 50px;
}

.radar1:before {
  content: '';
  position: absolute;
  top: -38px;
  border-top: 3px solid $color;
  border-right: 3px solid $color;
  border-radius: 0 50px 0px 0;
  width: 40px;
  height: 40px;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.1);
  transform-origin: 0% 100%;
  animation: radar1 1.5s linear infinite;
}

.radar1:after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  border-bottom: 3px solid $color;
  border-left: 3px solid $color;
  border-radius: 0 0px 0px 50px;
  width: 40px;
  height: 40px;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.1);
  transform-origin: 100% 0%;
  animation: radar1 1.5s linear infinite;
}

@keyframes radar1 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- loading1 -------------- */

.loading1 {
  display: block;
  position: relative;
  width: 150px;
  height: 20px;
  margin: 10px auto;

  // top: 45%;
  // top: calc(50% - 10px);
  // left: 25%;
  // left: calc(50% - 75px);
}

.loading1:after {
  content: 'LOADING ...';
  color: $color;
  font-family: Lato, 'Helvetica Neue';
  font-weight: 200;
  font-size: 16px;
  position: absolute;
  width: 100%;
  height: 20px;
  line-height: 20px;
  left: 0;
  top: 0;
  z-index: 1;
  background-color: rgba(255, 255, 255, 0.9);
}

.loading1:before {
  content: '';
  position: absolute;
  background-color: $color;
  top: -5px;
  left: 0px;
  height: 30px;
  width: 0px;
  z-index: 0;
  opacity: 1;
  transform-origin: 100% 0%;
  animation: loading1 10s ease-in-out infinite;
}

@keyframes loading1 {
  0% {
    width: 0px;
  }
  70% {
    width: 100%;
    opacity: 1;
  }
  90% {
    opacity: 0;
    width: 100%;
  }
  100% {
    opacity: 0;
    width: 0px;
  }
}

/* -------------- loading2 -------------- */

.loading2 {
  display: block;
  position: relative;
  width: 150px;
  height: 20px;

  // top: 45%;
  // top: calc(50% - 10px);
  // left: 25%;
  // left: calc(50% - 75px);
  margin: 10px auto 10px;

  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
}

.loading2:before {
  content: '';
  position: absolute;
  background-color: $color;
  top: 0px;
  left: 0px;
  height: 20px;
  width: 0px;
  z-index: 0;
  opacity: 1;
  transform-origin: 100% 0%;
  animation: loading2 10s ease-in-out infinite;
}

.loading2:after {
  content: 'LOADING ...';
  color: $color;
  font-family: Lato, 'Helvetica Neue';
  font-weight: 200;
  font-size: 16px;
  position: absolute;
  width: 100%;
  height: 20px;
  line-height: 20px;
  left: 0;
  top: 0;
}

@keyframes loading2 {
  0% {
    width: 0px;
  }
  70% {
    width: 100%;
    opacity: 1;
  }
  90% {
    opacity: 0;
    width: 100%;
  }
  100% {
    opacity: 0;
    width: 0px;
  }
}

/* -------------- points3 -------------- */

.points3 {
  display: block;
  position: relative;
  width: 12px;
  height: 12px;
  margin: 25px auto;
  // margin: -40px auto 40px;
  // top: 46%;
  // top: calc(50% - 6px);
  // left: 46%;
  // left: calc(50% - 6px);

  border-radius: 12px;
  background-color: $color;
  transform-origin: 50% 50%;
  animation: points3 1s ease-in-out infinite;
}

.points3:before {
  content: '';
  position: absolute;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.5);
  top: 0px;
  left: -25px;
  height: 12px;
  width: 12px;
  border-radius: 12px;
}

.points3:after {
  content: '';
  position: absolute;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.5);
  top: 0px;
  left: 25px;
  height: 12px;
  width: 12px;
  border-radius: 12px;
}

@keyframes points3 {
  0% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(180deg);
  }
}

/* -------------- surround2 -------------- */

.surround2 {
  display: block;
  position: relative;
  width: 40px;
  height: 40px;

  // top: 40%;
  // top: calc(50% - 20px);
  // left: 43%;
  // left: calc(50% - 20px);
  margin: 15px auto;

  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
}

.surround2:before {
  content: '';
  position: absolute;
  background-color: $color;
  height: 10px;
  width: 10px;
  border-radius: 10px;
  animation: surround2 2s ease-in-out infinite;
}

.surround2:after {
  content: '';
  position: absolute;
  background-color: $color;
  top: 0px;
  left: 0px;
  height: 40px;
  width: 0px;
  z-index: 0;
  opacity: 1;
  animation: loader72 10s ease-in-out infinite;
}

@keyframes surround2 {
  0% {
    left: -12px;
    top: -12px;
  }
  25% {
    left: 42px;
    top: -12px;
  }
  50% {
    left: 42px;
    top: 42px;
  }
  75% {
    left: -12px;
    top: 42px;
  }
  100% {
    left: -12px;
    top: -12px;
  }
}

@keyframes loader72 {
  0% {
    width: 0px;
  }
  70% {
    width: 40px;
    opacity: 1;
  }
  90% {
    opacity: 0;
    width: 40px;
  }
  100% {
    opacity: 0;
    width: 0px;
  }
}

/* -------------- radar2 -------------- */

.radar2 {
  display: block;
  position: relative;
  width: 80px;
  height: 80px;

  // top: 28%;
  // top: calc(50% - 43px);
  // left: 35%;
  // left: calc(50% - 43px);
  margin: 5px auto;

  border-radius: 50px;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  border-width: 40px;
  border-style: double;
  border-color: transparent $color;

  box-sizing: border-box;

  transform-origin: 50% 50%;
  animation: radar2 2s linear infinite;
}

@keyframes radar2 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- points2 -------------- */

.points2 {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  margin: 20px auto;
  border-radius: 20px;
  background-color: $color;
}

.points2:before {
  content: '';
  position: absolute;
  top: 0px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader9g 1.4s ease-in-out infinite;
}

.points2:after {
  content: '';
  position: absolute;
  top: 0px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader9d 1.4s ease-in-out infinite;
}

@keyframes loader9g {
  0% {
    left: -40px;
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.8);
  }
  50% {
    left: 0px;
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.1);
  }
  100% {
    left: -40px;
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.8);
  }
}

@keyframes loader9d {
  0% {
    left: 40px;
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.8);
  }
  50% {
    left: 0px;
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.1);
  }
  100% {
    left: 40px;
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.8);
  }
}

/* -------------- points1 -------------- */

.points1 {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  margin: 20px auto;
  border-radius: 20px;
  animation: loader10m 3s ease-in-out infinite;
}

.points1:before {
  content: '';
  position: absolute;
  top: 0px;
  left: -40px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader10g 3s ease-in-out infinite;
}

.points1:after {
  content: '';
  position: absolute;
  top: 0px;
  left: 40px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader10d 3s ease-in-out infinite;
}

@keyframes loader10g {
  0% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  25% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1);
  }
  50% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  75% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  100% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
}

@keyframes loader10m {
  0% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  25% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  50% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1);
  }
  75% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  100% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
}

@keyframes loader10d {
  0% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  25% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  50% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
  75% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1);
  }
  100% {
    background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.2);
  }
}

/*Battery*/
.battery {
  display: block;
  width: 84px;
  height: 42px;
  border: 1px $color solid;
  border-radius: 2px;
  position: relative;
  animation: charge 2s linear infinite;
  top: -8px;
  margin: 10px auto;
}
.battery:after {
  width: 6px;
  height: 20px;
  background-color: $color;
  border-radius: 0px 1px 1px 0px;
  position: absolute;
  content: '';
  top: 11px;
  right: -6px;
}
@keyframes charge {
  0% {
    box-shadow: inset 0px 0px 0px $color;
  }
  100% {
    box-shadow: inset 84px 0px 0px $color;
  }
}

/*lookup*/
.lookup {
  display: block;
  width: 40px;
  height: 40px;
  box-shadow: 0px 0px 0px 1px $color;
  border-radius: 50%;
  position: relative;
  margin: 34px auto;
  animation: magnify 1s linear infinite alternate;
}
.lookup:after,
.lookup:before {
  position: absolute;
  content: '';
}
.lookup:before {
  content: 'me';
  font-size: 24px;
  color: $color;
  left: 4px;
  text-align: center;
  top: 4px;
}
.lookup:after {
  width: 4px;
  height: 16px;
  background-color: $color;
  bottom: -12px;
  left: 40px;
  border-radius: 4px;
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
@keyframes magnify {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.5);
  }
}

/*eye ball*/
.eye {
  display: block;
  width: 40px;
  height: 40px;
  left: -30px;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.8);
  border-radius: 50%;
  box-shadow: 60px 0px 0px 0px rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.8);
  position: relative;
  margin: 10px auto;
}

.eye:after {
  background-color: #59488b;
  width: 20px;
  height: 20px;
  box-shadow: 60px 0px 0px 0px #59488b;
  border-radius: 50%;
  left: 18px;
  top: 16px;
  position: absolute;
  content: '';
  animation: eyeball 0.8s linear infinite alternate;
}
@keyframes eyeball {
  0% {
    left: 18px;
  }
  100% {
    left: 2px;
  }
}

/*coffee cup*/
.cup {
  display: block;
  width: 40px;
  height: 48px;
  border: 2px rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1) solid;
  border-radius: 0px 0px 10px 10px;
  position: relative;
  margin: 10px auto;
}
.cup:after,
.cup:before {
  position: absolute;
  content: '';
}
.cup:after {
  width: 10px;
  height: 24px;
  border: 2px $color solid;
  border-left: none;
  border-radius: 0px 40px 40px 0px;
  left: 40px;
}
.cup:before {
  width: 2px;
  height: 12px;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1);
  top: -20px;
  left: 8px;
  box-shadow: 10px 0px 0px 0px rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1), 10px -10px 0px 0px rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1),
    20px 0px 0px 0px rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1);
  animation: steam 1s linear infinite alternate;
}

@keyframes steam {
  0% {
    height: 0px;
  }
  100% {
    height: 6px;
  }
}

/*pendule classick*/
.pendule {
  display: block;
  margin: 25px auto;
  position: relative;
  width: 12px;
  height: 12px;
  background-color: rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 0.5);
  box-shadow: -21px 0px 0px rgba($wb-loading-r, $wb-loading-g, $wb-loading-b, 1);
  border-radius: 50%;
  animation: circle_classic 1s ease-in-out infinite alternate;
}
@keyframes circle_classic {
  0% {
    opacity: 0.1;
    transform: rotate(0deg) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: rotate(360deg) scale(1.2);
  }
}
