// 已完成的参考：
// 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($red, $green, $blue);

.loader {
  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($red, $green, $blue, 0.03);
  transform: translateZ(0);
  animation: loader 1.1s infinite linear;
}
@keyframes loader {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

// .loader {
//   display: block;
//   color: #fff !important;
//   font-size: 11px;
//   text-indent: -99999em;
//   margin: auto;
//   width: 80px;
//   height: 80px;
//   box-shadow: inset 0 0 0 8px;
//   border-radius: 50%;
//   transform: translateZ(0);
// }
// .loader:after {
//   position: absolute;
//   content: '';
//   width: 40px;
//   height: 80px;
//   background: transparent;
//   border-radius: 0 80px 80px 0;
//   top: 0;
//   left: 40px;
//   transform-origin: 1px 40px;
//   animation: loadera 2s infinite ease;
// }

// .loader:before {
//   position: absolute;
//   content: '';
//   width: 40px;
//   height: 80px;
//   background: transparent;
//   border-radius: 80px 0 0 80px;
//   top: 0;
//   left: 0;
//   transform-origin: 40px 40px;
//   animation: loadera 2s infinite ease 1.5s;
// }

// @keyframes loadera {
//   0% {
//     transform: rotate(0deg);
//   }
//   100% {
//     transform: rotate(360deg);
//   }
// }

/* -------------- iview -------------- */
.iview {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: $color;
  animation: ani-spin-bounce 1s 0s ease-in-out infinite;
}
.iview-big {
  display: inline-block;
  width: 72px;
  height: 72px;
  margin: -18px auto 18px;
  border-radius: 50%;
  background-color: $color;
  animation: ani-spin-bounce 1s 0s ease-in-out infinite;
}
@keyframes ani-spin-bounce {
  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);
}
.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 20px;
  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 -------------- */

.loader1 {
  display: block;
  position: relative;
  height: 80px;
  width: 80px;
  border-radius: 80px;
  border: 3px solid rgba($red, $green, $blue, 0.7);

  // top: 28%;
  // top: calc(50% - 43px);
  // left: 35%;
  // left: calc(50% - 43px);
  // margin: -40px auto 40px;
  
  margin:  -20px auto;

  transform-origin: 50% 50%;
  animation: loader1 3s linear infinite;
}

.loader1:after {
  content: '';
  position: absolute;
  top: -5px;
  left: 20px;
  width: 11px;
  height: 11px;
  border-radius: 10px;
  background-color: $color;
}

@keyframes loader1 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- loader2 -------------- */

.loader2 {
  display: block;
  position: relative;
  width: 5px;
  height: 5px;

  // top: 49%;
  // top: calc(50% - 2.5px);
  // left: 49%;
  // left: calc(50% - 2.5px);
  margin: 20px auto;

  background-color: $color;
  border-radius: 50px;
}

.loader2: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($red, $green, $blue, 0.1);
  transform-origin: 0% 100%;
  animation: loader2 1.5s linear infinite;
}

.loader2: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($red, $green, $blue, 0.1);
  transform-origin: 100% 0%;
  animation: loader2 1.5s linear infinite;
}

@keyframes loader2 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- loader3 -------------- */

.loader3 {
  display: block;
  position: relative;
  width: 150px;
  height: 20px;
  margin: 10px auto;

  // top: 45%;
  // top: calc(50% - 10px);
  // left: 25%;
  // left: calc(50% - 75px);
}

.loader3: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);
}

.loader3: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: loader3 10s ease-in-out infinite;
}

@keyframes loader3 {
  0% {
    width: 0px;
  }
  70% {
    width: 100%;
    opacity: 1;
  }
  90% {
    opacity: 0;
    width: 100%;
  }
  100% {
    opacity: 0;
    width: 0px;
  }
}

/* -------------- loader4 -------------- */

.loader4 {
  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($red, $green, $blue, 0.2);
}

.loader4: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: loader4 10s ease-in-out infinite;
}

.loader4: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 loader4 {
  0% {
    width: 0px;
  }
  70% {
    width: 100%;
    opacity: 1;
  }
  90% {
    opacity: 0;
    width: 100%;
  }
  100% {
    opacity: 0;
    width: 0px;
  }
}

/* -------------- loader5 -------------- */
.loader5 {
  display: block;
  position: relative;
  width: 150px;
  height: 20px;

  // top: 45%;
  // top: calc(50% - 10px);
  // left: 25%;
  // left: calc(50% - 75px);
  margin: 10px auto;

  background-color: rgba($red, $green, $blue, 0.2);
}

.loader5: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;
}

.loader5:before {
  content: '';
  position: absolute;
  background-color: $color;
  top: 0px;
  height: 20px;
  width: 0px;
  z-index: 0;
  transform-origin: 100% 0%;
  animation: loader5 7s ease-in-out infinite;
}

@keyframes loader5 {
  0% {
    width: 0px;
    left: 0px;
  }
  48% {
    width: 100%;
    left: 0px;
  }
  50% {
    width: 100%;
    right: 0px;
  }
  52% {
    width: 100%;
    right: 0px;
  }
  100% {
    width: 0px;
    right: 0px;
  }
}

/* -------------- loader6 -------------- */

.loader6 {
  display: block;
  position: relative;
  width: 12px;
  height: 12px;
  margin: 12px 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: loader6 1s ease-in-out infinite;
}

.loader6:before {
  content: '';
  position: absolute;
  background-color: rgba($red, $green, $blue, 0.5);
  top: 0px;
  left: -25px;
  height: 12px;
  width: 12px;
  border-radius: 12px;
}

.loader6:after {
  content: '';
  position: absolute;
  background-color: rgba($red, $green, $blue, 0.5);
  top: 0px;
  left: 25px;
  height: 12px;
  width: 12px;
  border-radius: 12px;
}

@keyframes loader6 {
  0% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(180deg);
  }
}

/* -------------- loader7 -------------- */

.loader7 {
  display: block;
  position: relative;
  width: 40px;
  height: 40px;

  // top: 40%;
  // top: calc(50% - 20px);
  // left: 43%;
  // left: calc(50% - 20px);
  margin: 10px auto;

  background-color: rgba($red, $green, $blue, 0.2);
}

.loader7:before {
  content: '';
  position: absolute;
  background-color: $color;
  height: 10px;
  width: 10px;
  border-radius: 10px;
  animation: loader7 2s ease-in-out infinite;
}

.loader7: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 loader7 {
  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;
  }
}

/* -------------- loader8 -------------- */

.loader8 {
  display: block;
  position: relative;
  width: 80px;
  height: 80px;

  // top: 28%;
  // top: calc(50% - 43px);
  // left: 35%;
  // left: calc(50% - 43px);
  margin: -20px auto ;

  border-radius: 50px;
  background-color: rgba($red, $green, $blue, 0.2);
  border-width: 40px;
  border-style: double;
  border-color: transparent $color;

  box-sizing: border-box;

  transform-origin: 50% 50%;
  animation: loader8 2s linear infinite;
}

@keyframes loader8 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* -------------- loader9 -------------- */

.loader9 {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  margin: 20px auto;
  border-radius: 20px;
  background-color: $color;
}

.loader9:before {
  content: '';
  position: absolute;
  top: 0px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader9g 3s ease-in-out infinite;
}

.loader9:after {
  content: '';
  position: absolute;
  top: 0px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader9d 3s ease-in-out infinite;
}

@keyframes loader9g {
  0% {
    left: -40px;
    background-color: rgba($red, $green, $blue, 0.8);
  }
  50% {
    left: 0px;
    background-color: rgba($red, $green, $blue, 0.1);
  }
  100% {
    left: -40px;
    background-color: rgba($red, $green, $blue, 0.8);
  }
}

@keyframes loader9d {
  0% {
    left: 40px;
    background-color: rgba($red, $green, $blue, 0.8);
  }
  50% {
    left: 0px;
    background-color: rgba($red, $green, $blue, 0.1);
  }
  100% {
    left: 40px;
    background-color: rgba($red, $green, $blue, 0.8);
  }
}

/* -------------- loader10 -------------- */

.loader10 {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  margin: 20px auto;
  border-radius: 20px;
  animation: loader10m 3s ease-in-out infinite;
}

.loader10:before {
  content: '';
  position: absolute;
  top: 0px;
  left: -40px;
  height: 20px;
  width: 20px;
  border-radius: 20px;
  animation: loader10g 3s ease-in-out infinite;
}

.loader10: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($red, $green, $blue, 0.2);
  }
  25% {
    background-color: rgba($red, $green, $blue, 1);
  }
  50% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  75% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  100% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
}

@keyframes loader10m {
  0% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  25% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  50% {
    background-color: rgba($red, $green, $blue, 1);
  }
  75% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  100% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
}

@keyframes loader10d {
  0% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  25% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  50% {
    background-color: rgba($red, $green, $blue, 0.2);
  }
  75% {
    background-color: rgba($red, $green, $blue, 1);
  }
  100% {
    background-color: rgba($red, $green, $blue, 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;
  }
}

/*magnifier*/
.magnifier {
  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;
}
.magnifier:after,
.magnifier:before {
  position: absolute;
  content: '';
}
.magnifier:before {
  content: 'me';
  font-size: 24px;
  color: $color;
  left: 4px;
  text-align: center;
  top: 4px;
}
.magnifier: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($red, $green, $blue, 0.8);
  border-radius: 50%;
  box-shadow: 60px 0px 0px 0px rgba($red, $green, $blue, 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 .8s linear infinite alternate;
}
@keyframes eyeball {
  0% {
    left: 18px;
  }
  100% {
    left: 2px;
  }
}

/*coffee cup*/
.coffee_cup {
  display: block;
  width: 40px;
  height: 48px;
  border: 2px rgba($red, $green, $blue, 1) solid;
  border-radius: 0px 0px 10px 10px;
  position: relative;
  margin: 10px auto;
}
.coffee_cup:after,
.coffee_cup:before {
  position: absolute;
  content: '';
}
.coffee_cup:after {
  width: 10px;
  height: 24px;
  border: 2px $color solid;
  border-left: none;
  border-radius: 0px 40px 40px 0px;
  left: 40px;
}
.coffee_cup:before {
  width: 2px;
  height: 12px;
  background-color: rgba($red, $green, $blue, 1);
  top: -20px;
  left: 8px;
  box-shadow: 10px 0px 0px 0px rgba($red, $green, $blue, 1), 10px -10px 0px 0px rgba($red, $green, $blue, 1), 20px 0px 0px 0px rgba($red, $green, $blue, 1);
  animation: steam 1s linear infinite alternate;
}

@keyframes steam {
  0% {
    height: 0px;
  }
  100% {
    height: 6px;
  }
}

/*circle classick*/
.circle {
  display: block;
  margin: 10px auto;
  position: relative;
  width: 12px;
  height: 12px;
  background-color: rgba($red, $green, $blue, 0.5);
  box-shadow: -21px 0px 0px rgba($red, $green, $blue, 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);
  }
}
