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

@steps-prefix-cls: ~'@{yg-prefix}-steps';
@process-icon-color: @primary-color;
@process-title-color: @heading-color;
@process-description-color: @text-color;
@process-tail-color: #cccccc;
@process-icon-text-color: @text-color-inverse;
@wait-icon-color: @disabled-color;
@wait-title-color: @text-color-secondary;
@wait-description-color: @wait-title-color;
@wait-tail-color: @process-tail-color;
@finish-icon-color: @primary-color;// @success-color;
@finish-title-color: @primary-color;// @success-color;
@finish-description-color: @primary-color;// @success-color;
@finish-tail-color: @primary-color;// @success-color;
@error-icon-color: @error-color;
@error-title-color: @error-color;
@error-description-color: @error-color;
@error-tail-color: @error-color;
@steps-background: @component-background;

@steps-icon-size: 28px;
@steps-small-icon-size: 24px;
@steps-dot-size: 14px;
@steps-current-dot-size: 14px;
@steps-desciption-max-width: 140px;

.@{steps-prefix-cls} {
  .reset-component;
  display: flex;
  width: 100%;
  box-sizing: content-box;
  font-size: 0;
}

.@{steps-prefix-cls}-item {
  position: relative;
  display: inline-block;
  flex: 1;
  overflow: hidden;
  vertical-align: top;

  &:last-child {
    flex: none;
  }

  &:last-child &-tail,
  &:last-child &-title::after {
    display: none;
  }

  &-icon,
  &-content {
    display: inline-block;
    vertical-align: top;
  }

  &-icon {
    width: @steps-icon-size - 2px;
    height: @steps-icon-size - 2px;
    margin-right: 0;
    font-size: @heading-2-size;
    font-family: @font-family;
    line-height: @steps-icon-size;
    text-align: center;
    border: 2px @border-style-base @wait-icon-color;
    border-radius: 50%;
    transition: background-color 0.3s, border-color 0.3s;

    > .@{steps-prefix-cls}-icon {
      position: relative;
      top: 0px;
      color: @primary-color;
      line-height: 1;
    }
  }
  &-tail {
    position: absolute;
    top: 12px;
    left: 0;
    width: 100%;
    padding: 0 10px;
    &::after {
      display: inline-block;
      width: 50%;// 100%

      height: 2px;
      margin-left: -1px;
      background: #ccc;
      border-radius: 0;
      transition: background 0.3s;
      content: '';
    }
    &::before {
      display: inline-block;
      width: 50%;// 100%

      height: 2px;
      background: @primary-color;
      // @border-color-split;
      border-radius: 0;
      transition: background 0.3s;
      content: '';
    }
  }
  &-title {
    position: relative;
    display: inline-block;
    padding-right: 16px;
    color: @primary-color;
    font-size: @heading-2-size;
    line-height: @steps-icon-size;
    &::after {
      position: absolute;
      top: @steps-icon-size / 2;
      left: 100%;
      display: block;
      width: 9999px;
      height: 2px;
      background: @wait-tail-color;
      content: '';
    }
  }

  &-description {
    color: @text-color-secondary;
    font-size: @font-size-base;
  }
  .step-item-status(wait);
  .step-item-status(process);
  &-process &-icon {
    background: @process-icon-color;
    > .@{steps-prefix-cls}-icon {
      color: @process-icon-text-color;
    }
  }
  &-process &-title {
    font-weight: 500;
  }
  .step-item-status(finish);
  .step-item-status(error);

  &.@{steps-prefix-cls}-item-error .@{steps-prefix-cls}-item-tail::after{
    background-color :@process-tail-color;
  }

  &.@{steps-prefix-cls}-next-error .@{steps-prefix-cls}-item-title::after {
    background: @error-icon-color;
  }
}

.@{steps-prefix-cls}-horizontal:not(.@{steps-prefix-cls}-label-vertical) {
  .@{steps-prefix-cls}-item {
    margin-right: 16px;
    white-space: nowrap;
    &:last-child {
      margin-right: 0;
    }
    &:last-child .@{steps-prefix-cls}-item-title {
      padding-right: 0;
    }
    &-tail {
      display: none;
    }
    &-description {
      max-width: @steps-desciption-max-width;
      white-space: normal;
    }
  }
}

.step-item-status(@status) {
  @icon-color: '@{status}-icon-color';
  @title-color: '@{status}-title-color';
  @description-color: '@{status}-description-color';
  @tail-color: '@{status}-tail-color';
  &-@{status} &-icon {
    background-color: @steps-background;
    border-color: @@icon-color;
    > .@{steps-prefix-cls}-icon {
      color: @@icon-color;
      .@{steps-prefix-cls}-icon-dot {
        background: @@icon-color;
      }
    }
  }
  &-wait &-icon {
    > .@{steps-prefix-cls}-icon {
      .@{steps-prefix-cls}-icon-dot {
        background: @wait-tail-color;
      }
    }
  }

  &-finish &-icon {
    background-color: @white;
    border-color: @primary-color;
    > .@{steps-prefix-cls}-icon {
      color: @primary-color;
    }

  }
  &-finish &-tail::after {
    background: @primary-color;
  }

  &-process &-tail::after {
    background: @wait-tail-color;
  }

  &-wait &-tail::before {
    background: @wait-tail-color;
  }
  &-wait &-title {
    color: @wait-tail-color;
  }
  &-wait &-icon-dot {
    background: @wait-tail-color;
  }
  &-active &-title {
    color: #333;
  }
  &-@{status} > &-content > &-title {
    color: @@title-color;
    &::after {
      background-color: @@tail-color;
    }
  }
  &-@{status} > &-content > &-description {
    color: @@description-color;
  }
  &-@{status} > &-tail::after {
    background-color: @@tail-color;
  }
  &-@{status} > &-tail::before {
    background-color: @@tail-color;
  }
  &-process > &-tail::before {
    background-color: @primary-color;
  }
  &-process {
    color: #f00;
  }

}

@import 'custom-icon';
@import 'small';
@import 'vertical';
@import 'label-placement';
@import 'progress-dot';
@import 'compatibility';
