@import '../../style/themes/index';
@import '../../style/mixins/index';

@yee-progress-prefix-cls: ~'@{yee-prefix}-progress';

.@{yee-progress-prefix-cls} {
  .yee-reset-component;

  display: inline-block;

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

  &-small&-line,
  &-small&-line &-text .@{yee-iconfont-css-prefix} {
    font-size: @yee-font-size-sm;
  }

  &-outer {
    display: inline-block;
    width: 100%;
    margin-right: 0;
    padding-right: 0;
    .@{yee-progress-prefix-cls}-show-info & {
      margin-right: ~'calc(-2em - 8px)';
      padding-right: ~'calc(2em + 8px)';
    }
  }

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

  &-circle-trail {
    stroke: @yee-progress-remaining-color;
  }

  &-circle-path {
    animation: ~'@{yee-prefix}-progress-appear' 0.3s;
  }

  &-inner:not(.@{yee-prefix}-progress-circle-gradient) {
    .@{yee-prefix}-progress-circle-path {
      stroke: @yee-progress-default-color;
    }
  }

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

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

  &-text {
    display: inline-block;
    width: 2em;
    margin-left: 8px;
    color: @yee-text-color-secondary;
    font-size: 1em;
    line-height: 1;
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
    word-break: normal;
    .@{yee-iconfont-css-prefix} {
      font-size: @yee-font-size-base;
    }
  }

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

  &-status-exception {
    .@{yee-progress-prefix-cls}-bg {
      background-color: @yee-error-color;
    }
    .@{yee-progress-prefix-cls}-text {
      color: @yee-error-color;
    }
  }

  &-status-exception &-inner:not(.@{yee-progress-prefix-cls}-circle-gradient) {
    .@{yee-progress-prefix-cls}-circle-path {
      stroke: @yee-error-color;
    }
  }

  &-status-success {
    .@{yee-progress-prefix-cls}-bg {
      background-color: @yee-success-color;
    }
    .@{yee-progress-prefix-cls}-text {
      color: @yee-success-color;
    }
  }

  &-status-success &-inner:not(.@{yee-progress-prefix-cls}-circle-gradient) {
    .@{yee-progress-prefix-cls}-circle-path {
      stroke: @yee-success-color;
    }
  }

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

  &-circle &-text {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    margin: 0;
    padding: 0;
    color: @yee-progress-text-color;
    line-height: 1;
    white-space: normal;
    text-align: center;
    transform: translate(-50%, -50%);

    .@{yee-iconfont-css-prefix} {
      font-size: 14 / 12em;
    }
  }

  &-circle&-status-exception {
    .@{yee-progress-prefix-cls}-text {
      color: @yee-error-color;
    }
  }
  &-circle&-status-success {
    .@{yee-progress-prefix-cls}-text {
      color: @yee-success-color;
    }
  }
}

@keyframes ~"@{yee-prefix}-progress-active" {
  0% {
    width: 0;
    opacity: 0.1;
  }
  20% {
    width: 0;
    opacity: 0.5;
  }
  100% {
    width: 100%;
    opacity: 0;
  }
}
