@import '../variables/default.scss';
@import '../mixins/index.scss';

$ink-progress-height: 16px !default;
$ink-progress-text-size: $ink-font-size-sm !default;
$ink-progress-icon-size: $ink-font-size-xl !default;
$ink-progress-inner-bg-color: $ink-color-grey-6 !default;
$ink-progress-bar-bg-color: $ink-color-brand-light !default;
$ink-progress-bar-bg-color-active: $ink-color-white !default;

@keyframes progress-active {
  from {
    opacity: 0.5;
    transform: translate(-100%);
  }

  to {
    opacity: 0.1;
    transform: translate(0);
  }
}

.ink-progress {
  display: flex;
  align-items: center;

  /* elements */

  &__inner {
    flex: 1;
    background-color: $ink-progress-inner-bg-color;
    border-radius: $ink-progress-height / 2;
    vertical-align: middle;

    &-background {
      position: relative;
      height: $ink-progress-height;
      border-radius: $ink-progress-height / 2;
      background-color: $ink-progress-bar-bg-color;
      transition: all 0.3s $ink-ease-in-out-quad;
      overflow: hidden;
    }
  }

  &__privot {
    margin-left: 16px;
    font-size: $ink-progress-text-size;
    text-align: center;

    .ink-icon {
      font-size: $ink-progress-icon-size;
    }
  }

  /* modifiers */
  &--progress {
    .ink-progress__inner-background::before {
      content: '';
      opacity: 0;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: $ink-progress-bar-bg-color-active;
      border-radius: $ink-progress-height / 2;
      animation: progress-active 2s $ink-ease-out-quad infinite;
    }
  }

  &--error {
    .ink-progress__inner-background {
      background: $ink-color-error;
    }

    .ink-icon {
      color: $ink-color-error;
    }
  }

  &--success {
    .ink-progress__inner-background {
      background: $ink-color-success;
    }

    .ink-icon {
      color: $ink-color-success;
    }
  }
}
