@import '../../style/variables';

.#{$prefix}progress-bar {
  font-family: $font-family;
  display: flex;
  align-items: center;
  font-size: 13px;

  &__inner {
    flex: 1;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    background-color: #e4e8f1;
  }

  &__bg {
    position: relative;
    text-align: right;
    height: 100%;
    transition: all 0.6s;
    &_primary {
      background-color: $primary-color;
    }

    &_yellow {
      background-color: $yellow-color;
    }

    &_blue {
      background-color: $blue-color;
    }

    &_red {
      background-color: $red-color;
    }

    &_green {
      background-color: $green-color;
    }
  }

  &__text {
    color: #48576a;
    margin-left: 10px;
    min-width: 40px;
    text-align: right;
  }

  &__inner-text {
    color: #fff;
    font-size: 10px;
    margin: 0 5px;
  }

  &__effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    &_striped {
      background-size: 20px 20px;
      background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
      );
      animation: ty-progress-striped 2s linear infinite;
    }

    &_impulse {
      border-radius: inherit;
      opacity: 0;
      background: #fff;
      animation: ty-progress-impulse 2.4s cubic-bezier(0.23, 1, 0.32, 1) infinite;
    }
  }

  &_round {
    .#{$prefix}progress-bar {
      &__inner,
      &__bg {
        border-radius: 100px;
      }
    }
  }

  &_square {
    .#{$prefix}progress-bar {
      &__inner,
      &__bg {
        border-radius: 0;
      }
    }
  }
}

.#{$prefix}progress-circle {
  font-family: $font-family;
  display: inline-block;
  position: relative;

  &__bg {
    stroke: #e5e9f2;
    fill: none;
  }

  &__path {
    fill: none;
    transition: stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease;
    &_primary {
      stroke: $primary-color;
    }

    &_yellow {
      stroke: $yellow-color;
    }

    &_blue {
      stroke: $blue-color;
    }

    &_red {
      stroke: $red-color;
    }

    &_green {
      stroke: $green-color;
    }
  }

  &__text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
  }
}

@keyframes ty-progress-striped {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 20px 0;
  }
}

@keyframes ty-progress-impulse {
  0% {
    opacity: 0.1;
    width: 0;
  }
  20% {
    opacity: 0.5;
    width: 0;
  }
  100% {
    opacity: 0;
    width: 100%;
  }
}
