@import './../theme/vars.scss';

$progressPrefixCls: #{$vender-prefix}-progress;

.#{$progressPrefixCls} {
  display: inline-block;

  &-line {
    position: relative;
    width: 100%;
    font-size: $font-size-base;
  }

  &-sm.#{$progressPrefixCls}-line,
  &-sm.#{$progressPrefixCls}-line &-text i[class*='icon'] {
    font-size: $font-size-sm;
  }

  &-lg.#{$progressPrefixCls}-line,
  &-lg.#{$progressPrefixCls}-line &-text i[class*='icon'] {
    font-size: $font-size-lg;
  }

  i[class*='icon'] {
    display: inline-block;
    vertical-align: middle;
  }

  &-outer {
    display: inline-block;
    width: 100%;
    padding-right: 0;
    margin-right: 0;

    .#{$progressPrefixCls}-show-info & {
      padding-right: calc(2em + 8px);
      margin-right: calc(-2em - 8px);
    }
  }

  &-inner {
    position: relative;
    display: inline-block;
    width: 100%;
    vertical-align: middle;
    background-color: $progress-remaining-color;
    border-radius: 100px;
  }

  &-circle-trail {
    // stroke: $progress-remaining-color;
  }

  &-circle-path {
    // stroke: $progress-default-color;
    animation: #{$vender-prefix}-progress-appear 0.3s;
  }

  &-success-bg,
  &-bg {
    position: relative;
    background-color: $progress-default-color;
    border-radius: 100px;
    transition: all 0.4s $ease-out-circ 0s;
  }

  &-success-bg {
    position: absolute;
    top: 0;
    left: 0;
    background-color: $success-color;
  }

  &-text {
    display: inline-block;
    width: 2em;
    margin-left: 8px;
    font-size: 1em;
    line-height: 1;
    color: $text-color-secondary;
    text-align: left;
    word-break: normal;
    vertical-align: middle;

    i[class*='icon'] {
      font-size: $font-size-base;
    }
  }

  &-status-active {
    .#{$progressPrefixCls}-bg::before {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: $component-background;
      border-radius: 10px;
      content: '';
      opacity: 0;
      animation: #{$vender-prefix}-progress-active 2.4s $ease-out-quint infinite;
    }
  }

  &-status-exception {
    .#{$progressPrefixCls}-bg {
      background-color: $error-color;
    }

    .#{$progressPrefixCls}-text {
      color: $error-color;
    }

    .#{$progressPrefixCls}-circle-path {
      stroke: $error-color;
    }
  }

  &-status-success {
    .#{$progressPrefixCls}-bg {
      background-color: $success-color;
    }

    .#{$progressPrefixCls}-text {
      color: $success-color;
    }

    .#{$progressPrefixCls}-circle-path {
      stroke: $success-color;
    }
  }

  &-circle &-inner {
    position: relative;
    line-height: 1;
    background-color: transparent;
  }

  &-circle &-text {
    position: absolute;
    top: 50%;
    left: 0;
    display: block;
    width: 100%;
    margin: 0;
    line-height: 1;
    color: $text-color;
    text-align: center;
    transform: translateY(-50%);

    i[class*='icon'] {
      font-size: 14 / 12em;
    }
  }

  &-circle.#{$progressPrefixCls}-status-exception {
    .#{$progressPrefixCls}-text {
      color: $error-color;
    }
  }

  &-circle.#{$progressPrefixCls}-status-success {
    .#{$progressPrefixCls}-text {
      color: $success-color;
    }
  }
}

@keyframes #{$vender-prefix}-progress-active {
  0% {
    width: 0;
    opacity: 0.1;
  }

  20% {
    width: 0;
    opacity: 0.5;
  }

  100% {
    width: 100%;
    opacity: 0;
  }
}
