@import "../common/index.less";

.ph-audio-block {
  position: relative;
  width: 100%;
  height: 42px;
  padding-left: 30px;
  margin-left: 8px;
  color: #fff;
  background-color: #ffc21e;
  border-radius: 6px;

  &.is-pad {
    height: @r * 52px;
    padding-left: @r * 30px;
    margin-left: @r * 12px;
    border-radius: @r * 6px;

    &::before {
      width: @r * 15px;
      height: @r * 15px;
      border-radius: @r * 3px;
      transform: translate(-40%, -50%) rotate(45deg);
    }

    .duration-text {
      height: @r * 52px;
      margin-left: @r * 8px;
      font-size: @r * 20px;
      line-height: @r * 52px;
    }

    .animation-container {
      width: @r * 20px;
      height: @r * 22px;
      margin-left: @r * 12px;

      .animation-item {
        width: @r * 2px;
        height: @r * 14px;
        margin-top: @r * 2px;
        margin-left: @r * 2px;
        border-radius: @r * 2px;
      }
    }
  }

  &.on-play {
    .animation-item {
      animation: .5s audio-item-animation infinite;

      &:nth-child(1) {
        animation-delay: .1s;
      }

      &:nth-child(2) {
        animation-delay: .2s;
      }

      &:nth-child(3) {
        animation-delay: .3s;
      }

      &:nth-child(4) {
        animation-delay: .4s;
      }
    }
  }

  &::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 0;
    width: 10px;
    height: 10px;
    background-color: #ffc21e;
    border-radius: 3px;
    transform: translate(-40%, -50%) rotate(45deg);
  }

  .animation-container {
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 1;
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 12px;
    transform: translateY(-50%);

    .animation-item {
      display: inline-block;
      width: 2px;
      height: 14px;
      margin-top: 2px;
      margin-left: 2px;
      vertical-align: top;
      background-color: #fff;
      border-radius: 2px;

      &:nth-child(1) {
        transform: scale(1, .4);
      }

      &:nth-child(2) {
        transform: scale(1, .8);
      }

      &:nth-child(3) {
        transform: scale(1, 1);
      }

      &:nth-child(4) {
        transform: scale(1, .6);
      }
    }
  }

  .duration-text {
    display: inline-block;
    height: 42px;
    margin-left: 8px;
    font-size: 20px;
    line-height: 42px;
    vertical-align: top;
  }
}

@keyframes audio-item-animation {
  0% {
    transform: scale(1, 1);
  }

  25% {
    transform: scale(1, .75);
  }

  50% {
    transform: scale(1, .5);
  }

  75% {
    transform: scale(1, .25);
  }
}
