@keyframes candy-stripe {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 4px 0;
  }
}

$progress-bar--height: 3px;

.progress-bar {
  align-items: center;
  display: flex;
  width: 100%;
  z-index: 1;

  &__icon {
    flex: 0 0 auto;
    padding-right: 5px;

    .icon {
      color: $green;
      display: block;
      fill: currentColor;
      height: 12px;
      transition: opacity 0.15s;
      width: 12px;

      .torrent--is-seeding & {
        @include theme('color', 'progress-bar--fill--completed');
      }

      .torrent--is-stopped & {
        @include theme('color', 'progress-bar--fill--stopped');
      }

      .torrent--has-error & {
        @include theme('color', 'progress-bar--fill--error');
      }

      .torrent--is-checking & {
        @include theme('color', 'progress-bar--fill--checking');
      }

      .torrent--is-selected & {
        @include theme('color', 'progress-bar--fill--selected');
      }

      .torrent--is-selected.torrent--is-stopped & {
        @include theme('color', 'progress-bar--fill--selected--stopped');
      }

      .torrent--has-error.torrent--is-stopped & {
        @include theme('color', 'progress-bar--fill--error--stopped');
      }
    }
  }

  &__fill {
    @include theme('background', 'progress-bar--fill');
    display: block;
    height: $progress-bar--height;
    width: 100%;

    .torrent--is-seeding & {
      @include theme('background', 'progress-bar--fill--completed');
    }

    .torrent--is-stopped & {
      @include theme('background', 'progress-bar--fill--stopped');
    }

    .torrent--has-error & {
      @include theme('background', 'progress-bar--fill--error');
    }

    .torrent--is-checking & {
      @include theme('background', 'progress-bar--fill--checking');
    }

    .torrent--is-selected & {
      @include theme('background', 'progress-bar--fill--selected');
    }

    .torrent--is-selected.torrent--is-stopped & {
      @include theme('background', 'progress-bar--fill--selected--stopped');
    }

    .torrent--has-error.torrent--is-stopped & {
      @include theme('background', 'progress-bar--fill--error--stopped');
    }

    &__wrapper {
      @include theme('background', 'progress-bar--track--background');
      flex: 1 1 auto;
      position: relative;
      height: $progress-bar--height;

      .torrent--is-stopped & {
        @include theme('background', 'progress-bar--track--background--stopped');
      }

      .torrent--has-error & {
        @include theme('background', 'progress-bar--track--background--error');
      }

      .torrent--is-selected & {
        @include theme('background', 'progress-bar--track--background--selected');
      }

      .torrent--has-error.torrent--is-stopped & {
        @include theme('background', 'progress-bar--track--background--error--stopped');
      }

      .torrent--is-selected.torrent--is-stopped & {
        @include theme('background', 'progress-bar--track--background--selected--stopped');
        opacity: 1;
      }

      .torrent--is-checking & {
        animation: candy-stripe 0.25s linear infinite;
        background-color: transparent;
        @include theme('background-image', 'progress-bar--track--background--checking');
        background-size: 4px 4px;
        height: $progress-bar--height;
        top: 0;
      }

      .torrent--is-selected.torrent--is-checking & {
        background-image: linear-gradient(
          -45deg,
          rgba(#fff, 0) 0,
          rgba(#fff, 0) 25%,
          rgba(#fff, 0.5) 25%,
          rgba(#fff, 0.5) 50%,
          rgba(#fff, 0) 50%,
          rgba(#fff, 0) 75%,
          rgba(#fff, 0.5) 75%,
          rgba(#fff, 0.5) 100%
        );
      }
    }
  }
}
