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

@steps-prefix-cls: ~"@{ant-prefix}-steps";
@process-icon-color: @primary-color;
@process-title-color: @text-color;
@process-description-color: @process-title-color;
@process-tail-color: @border-color-split;
@process-icon-text-color: #fff;
@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: @process-icon-color;
@finish-title-color: @wait-title-color;
@finish-description-color: @finish-title-color;
@finish-tail-color: @process-icon-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: 26px;
@steps-small-icon-size: 18px;
@steps-dot-size: 5px;
@steps-current-dot-size: 7px;
@steps-desciption-max-width: 120px;

.@{steps-prefix-cls} {
  font-size: 0;
  line-height: @line-height-base;
  .@{steps-prefix-cls}-item {
    position: relative;
    display: inline-block;
    vertical-align: top;

    &.@{steps-prefix-cls}-status-wait {
      .@{steps-prefix-cls}-head-inner {
        border-color: @wait-icon-color;
        background-color: @steps-background;
        > .@{steps-prefix-cls}-icon {
          color: @wait-icon-color;
          .@{steps-prefix-cls}-icon-dot {
            background: @wait-icon-color;
          }
        }
      }
      .@{steps-prefix-cls}-title {
        color: @wait-title-color;
      }
      .@{steps-prefix-cls}-description {
        color: @wait-description-color;
      }
      .@{steps-prefix-cls}-tail > i {
        background-color: @wait-tail-color;
      }
    }
    &.@{steps-prefix-cls}-status-process {
      .@{steps-prefix-cls}-head-inner {
        border-color: @process-icon-color;
        background-color: @process-icon-color;
        > .@{steps-prefix-cls}-icon {
          color: @process-icon-text-color;
          .@{steps-prefix-cls}-icon-dot {
            background: @process-icon-color;
          }
        }
      }
      .@{steps-prefix-cls}-title {
        color: @process-title-color;
      }
      .@{steps-prefix-cls}-description {
        color: @process-description-color;
      }
      .@{steps-prefix-cls}-tail > i {
        background-color: @process-tail-color;
      }
    }
    &.@{steps-prefix-cls}-status-finish {
      .@{steps-prefix-cls}-head-inner {
        border-color: @finish-icon-color;
        background-color: @steps-background;
        > .@{steps-prefix-cls}-icon {
          color: @finish-icon-color;
          .@{steps-prefix-cls}-icon-dot {
            background: @finish-icon-color;
          }
        }
      }
      .@{steps-prefix-cls}-tail > i:after {
        width: 100%;
        background: @finish-tail-color;
        transition: all .6s;
        opacity: 1;
        box-shadow: 0 0 0 0 @primary-color;
        animation: tailEffect .4s;
      }
      .@{steps-prefix-cls}-title {
        color: @finish-title-color;
      }
      .@{steps-prefix-cls}-description {
        color: @finish-description-color;
      }
    }

    &.@{steps-prefix-cls}-status-error {
      .@{steps-prefix-cls}-head-inner {
        border-color: @error-icon-color;
        background-color: @steps-background;
        > .@{steps-prefix-cls}-icon {
          color: @error-icon-color;
          .@{steps-prefix-cls}-icon-dot {
            background: @error-icon-color;
          }
        }
      }
      .@{steps-prefix-cls}-title {
        color: @error-title-color;
      }
      .@{steps-prefix-cls}-description {
        color: @error-description-color;
      }
      .@{steps-prefix-cls}-tail > i {
        background-color: @process-tail-color;
      }
    }

    &.@{steps-prefix-cls}-next-error {
      .@{steps-prefix-cls}-tail > i,
      .@{steps-prefix-cls}-tail > i:after {
        background-color: @error-tail-color;
      }
    }

    &.@{steps-prefix-cls}-custom {
      .@{steps-prefix-cls}-head-inner {
        background: none;
        border: 0;
        width: auto;
        height: auto;
        > .@{steps-prefix-cls}-icon {
          font-size: @steps-icon-size;
          width: @steps-icon-size;
          height: @steps-icon-size;
        }
      }
      &.@{steps-prefix-cls}-status-process {
        .@{steps-prefix-cls}-head-inner > .@{steps-prefix-cls}-icon {
          color: @process-icon-color;
        }
      }
    }
  }

  .@{steps-prefix-cls}-head,
  .@{steps-prefix-cls}-main {
    position: relative;
    display: inline-block;
    vertical-align: top;
  }
  .@{steps-prefix-cls}-head {
    background: @steps-background;
  }

  .@{steps-prefix-cls}-head-inner {
    display: block;
    border: @border-width-base @border-style-base @wait-icon-color;
    width: @steps-icon-size;
    height: @steps-icon-size;
    line-height: 23px;
    text-align: center;
    border-radius: @steps-icon-size;
    font-size: @font-size-lg;
    margin-right: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    font-family: @font-family-no-number;

    > .@{steps-prefix-cls}-icon {
      line-height: 1;
      color: @primary-color;
      position: relative;
      &.@{iconfont-css-prefix} {
        font-size: @font-size-base;
        &-cross,
        &-check {
          font-weight: bold;
        }
      }
    }
  }
  .@{steps-prefix-cls}-title {
    font-size: @font-size-lg;
    line-height: @steps-icon-size;
    color: @text-color;
    font-weight: bold;
    background-color: @steps-background;
    display: inline-block;
    padding-right: 10px;
    > a:first-child:last-child {
      color: @text-color;
    }
  }
  .@{steps-prefix-cls}-item:last-child {
    .@{steps-prefix-cls}-title {
      padding-right: 0;
      width: 100%;
    }
    .@{steps-prefix-cls}-tail {
      display: none;
    }
  }
  .@{steps-prefix-cls}-description {
    font-size: @font-size-base;
    color: @text-color-secondary;
  }
  .@{steps-prefix-cls}-tail {
    position: absolute;
    left: 0;
    width: 100%;
    top: 13px;
    padding: 0 10px;
    > i {
      display: inline-block;
      vertical-align: top;
      background: @wait-tail-color;
      height: 1px;
      border-radius: 1px;
      width: 100%;
      position: relative;
      &:after {
        position: absolute;
        content: '';
        top: 0;
        width: 0;
        background: @border-color-split;
        height: 100%;
        opacity: 0;
      }
    }
  }

  &.@{steps-prefix-cls}-small {
    .@{steps-prefix-cls}-head-inner {
      border: @border-width-base @border-style-base @wait-icon-color;
      width: @steps-small-icon-size;
      height: @steps-small-icon-size;
      line-height: 15px;
      text-align: center;
      border-radius: @steps-small-icon-size;
      font-size: @font-size-base;
      margin-right: 10px;
      > .@{steps-prefix-cls}-icon.@{iconfont-css-prefix} {
        .iconfont-size-under-12px(9px);
        top: 0;
      }
    }
    .@{steps-prefix-cls}-main {
      margin-top: 0;
    }
    .@{steps-prefix-cls}-title {
      font-size: @font-size-base;
      line-height: @steps-small-icon-size;
      color: @text-color;
      font-weight: bold;
    }
    .@{steps-prefix-cls}-description {
      font-size: @font-size-base;
      color: @text-color-secondary;
    }
    .@{steps-prefix-cls}-tail {
      top: 8px;
      padding: 0 8px;
      > i {
        height: 1px;
        border-radius: 1px;
        width: 100%;
      }
    }
    .@{steps-prefix-cls}-custom .@{steps-prefix-cls}-head-inner > .@{steps-prefix-cls}-icon {
      font-size: @steps-small-icon-size;
      width: @steps-small-icon-size;
      height: @steps-small-icon-size;
    }
  }
}

.@{steps-prefix-cls}-vertical {
  > .@{steps-prefix-cls}-item {
    display: block;
  }

  > .@{steps-prefix-cls}-item > .@{steps-prefix-cls}-tail {
    position: absolute;
    left: 13px;
    top: 0;
    height: 100%;
    width: 1px;
    padding: 30px 0 4px;
    > i {
      height: 100%;
      width: 1px;
      &:after {
        height: 0;
        width: 100%;
      }
    }
  }

  .@{steps-prefix-cls}-status-finish {
    .@{steps-prefix-cls}-tail > i:after {
      height: 100%;
    }
  }

  .@{steps-prefix-cls}-head {
    float: left;
    &-inner {
      margin-right: 16px;
    }
  }

  .@{steps-prefix-cls}-main {
    min-height: 47px;
    overflow: hidden;
    display: block;
    .@{steps-prefix-cls}-title {
      line-height: @steps-icon-size;
    }
    .@{steps-prefix-cls}-description {
      padding-bottom: 12px;
    }
  }
}

.@{steps-prefix-cls}-vertical.@{steps-prefix-cls}-small {
  .@{steps-prefix-cls}-tail {
    position: absolute;
    left: 9px;
    top: 0;
    padding: 22px 0 4px;
    > i {
      height: 100%;
    }
  }

  .@{steps-prefix-cls}-title {
    line-height: @steps-small-icon-size;
  }
}

.@{steps-prefix-cls}-horizontal {
   &.@{steps-prefix-cls}-hidden {
     visibility: hidden;
  }
  .@{steps-prefix-cls}-description {
    max-width: @steps-desciption-max-width;
  }
  .@{steps-prefix-cls}-item:not(:first-child) .@{steps-prefix-cls}-head {
    padding-left: 10px;
    margin-left: -10px;
  }
}

.@{steps-prefix-cls}-dot {
  .@{steps-prefix-cls}-item {
    .@{steps-prefix-cls}-step {
      display: inline-block;
      text-align: center;
      width: @steps-desciption-max-width;
    }
    &:not(:first-child) .@{steps-prefix-cls}-head {
      margin-left: 0;
      padding-left: 0;
    }
  }
  .@{steps-prefix-cls}-tail {
    margin: 0 0 0 @steps-desciption-max-width / 2;
    padding: 0;
    width: 100%;
    top: 1px;

    & > i {
      height: 3px;
    }
  }
  .@{steps-prefix-cls}-head {
    display: inline-block;
    padding-right: 0;
    &-inner {
      margin: 0 auto;
      width: @steps-dot-size;
      height: @steps-dot-size;
      line-height: @steps-dot-size;
      border: 0;

      .@{steps-prefix-cls}-icon-dot {
        float: left;
        width: 100%;
        height: 100%;
        border-radius: @steps-dot-size / 2;
        position: relative;
        &:after {
          content: '';
          background: rgba(255, 255, 255, 0.001);
          width: 40px;
          height: 24px;
          position: absolute;
          top: -8px;
          left: -16px;
        }
        &:hover {
          transform: scale(1.3);
        }
      }
    }
  }
  .@{steps-prefix-cls}-main {
    display: block;
    margin-top: 10px;
    .@{steps-prefix-cls}-title {
      padding-right: 0;
      background-color: transparent;
    }
  }
  .@{steps-prefix-cls}-status-process {
    .@{steps-prefix-cls}-head {
      top: -1px;
      &-inner {
        width: @steps-current-dot-size;
        height: @steps-current-dot-size;
        line-height: @steps-current-dot-size;

        .@{steps-prefix-cls}-icon-dot {
          border-radius: @steps-current-dot-size / 2;
        }
      }
    }
  }
  &.@{steps-prefix-cls}-vertical {
    .@{steps-prefix-cls}-tail {
      left: 2px;
      height: 100%;
      padding: 0;
      top: 15px;
      > i {
        height: 100%;
        width: 3px;
      }
    }
    .@{steps-prefix-cls}-head {
      top: 12px;
      left: 1px;
    }
    .@{steps-prefix-cls}-status-process {
      .@{steps-prefix-cls}-head {
        left: 0;
      }
    }
  }
}

@keyframes tailEffect {
  to {
    box-shadow: 0 0 3px 3px transparent;
  }
}
