@import 'mixins/mixins';
@import 'common/var';

@include b(step) {
  position: relative;
  flex-shrink: 1;

  @include pseudo(last-of-type) {
    @include e(line) {
      display: none;
    }

    // 只有未设置 space 的情况下才自适应宽度
    @include when(flex) {
      flex-basis: auto !important;
      flex-shrink: 0;
      flex-grow: 0;
    }

    @include e((main, description)) {
      padding-right: 0;
    }
  }

  @include e(head) {
    position: relative;
    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    align-items: center;
    width: 100%;

    @include when(process) {
      color: $--color-text-primary;
      // border-color: $--color-text-primary;
    }

    @include when(wait) {
      color: $--color-text-placeholder;
      // border-color: $--color-text-placeholder;
    }

    // @include when(success) {
    //   color: $--color-success;
    //   // border-color: $--color-success;
    // }

    @include when(error) {
      color: $--color-danger;
      // border-color: $--color-danger;
    }

    @include when(finish) {
      color: $--color-primary;
      // border-color: $--color-primary;
    }
    @include when(loading) {
      color: $--color-text-primary;
    }
  }
  @include e(icon) {
    @include when(text) {
      @include when(full) {
        @include when(wait) {
          color: $--color-white;
          background-color: $--color-text-placeholder;
        }
        @include when(process) {
          color: $--color-white;
          background-color: $--color-primary;
        }
        @include when(loading) {
          color: $--color-white;
          background-color: $--color-text-regular;
        }

        @include when(error) {
          color: $--color-white;
          background-color: $--color-danger;
        }

        @include when(finish) {
          color: $--color-white;
          background-color: rgba($color: $--color-primary, $alpha: 0.32);
        }
      }
    }
  }

  @include e(icon) {
    position: relative;
    z-index: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    background: $--color-white;
    transition: 0.15s ease-out;

    font-size: 12px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    line-height: 18px;

    @include when(text) {
      border-radius: 50%;
      border: 1px solid;
      border-color: inherit;
    }

    @include when(icon) {
      width: 40px;
    }
  }

  @include e(icon-inner) {
    display: inline-block;
    user-select: none;
    text-align: center;
    font-weight: bold;
    line-height: 1;
    color: inherit;

    &[class*='el-icon']:not(.is-status) {
      font-size: 25px;
      font-weight: normal;
    }

    // 组件自身表示状态的图标
    @include when(status) {
      transform: translateY(1px);
    }

    @include when(loading) {
      font-size: 12px !important;
    }
  }

  @include e(line) {
    // position: absolute;
    flex-grow: 2;

    border-color: inherit;
    background-color: rgba($color: $--color-text-placeholder, $alpha: 0.08);
  }

  @include e(line-inner) {
    display: block;
    // border-width: 1px;
    // border-style: solid;
    // border-color: inherit;
    transition: 0.15s ease-out;
    box-sizing: border-box;
    width: 0;
    height: 0;
    background-repeat: repeat;
    // @include when(process) {
    //   background-color: rgba($color: $--color-text-placeholder, $alpha: 0.08);
    // }

    // @include when(wait) {
    //   background-color: rgba($color: $--color-text-placeholder, $alpha: 0.08);
    // }

    // @include when(loading) {
    //   background-color: rgba($color: $--color-text-placeholder, $alpha: 0.08);
    // }

    // @include when(error) {
    //   background-color: rgba($color: $--color-text-placeholder, $alpha: 0.08);
    // }

    @include when(finish) {
      background-color: $--color-primary;
    }
  }

  @include e(main) {
    white-space: normal;
    text-align: left;
  }

  @include e(title) {
    font-size: 12px;
    line-height: 38px;
  }

  @include e(description) {
    padding-right: 10%;
    margin-top: -5px;
    font-size: 12px;
    line-height: 20px;

    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba($color: $--color-text-regular, $alpha: 0.56);
  }

  @include when(horizontal) {
    display: inline-block;

    @include e(line) {
      height: 1px;
      margin: 0 8px;
    }

    @include e(title) {
      width: 72px;
      height: 20px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      line-height: 20px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      margin-left: -26px;
      text-align: center;
      
      @include when(error) {
        color: $--color-danger;
      }

      @include when(finish) {
        color: $--color-primary;
      }
    }

    @include e(line-inner) {
      background-size: 10px 1px;
    }

    @include e(line-dashed) {
      background-size: 10px 1px;
      background-repeat: repeat;
      background-image: linear-gradient(
        to right,
        $--color-text-placeholder 0%,
        $--color-text-placeholder 50%,
        transparent 50%
      );
      background-color: transparent;
      @include e(line-inner-dashed) {
        background-color: transparent;
        @include when(process) {
          background-image: linear-gradient(
            to right,
            $--color-text-primary 0%,
            $--color-text-primary 50%,
            transparent 50%
          );
        }

        @include when(wait) {
          background-image: linear-gradient(
            to right,
            $--color-text-placeholder 0%,
            $--color-text-placeholder 50%,
            transparent 50%
          );
        }

        @include when(success) {
          background-image: linear-gradient(
            to right,
            $--color-success 0%,
            $--color-success 50%,
            transparent 50%
          );
        }

        @include when(error) {
          background-image: linear-gradient(
            to right,
            $--color-danger 0%,
            $--color-danger 50%,
            transparent 50%
          );
        }

        @include when(finish) {
          background-image: linear-gradient(
            to right,
            $--color-primary 0%,
            $--color-primary 50%,
            transparent 50%
          );
        }
      }
    }
  }

  @include when(vertical) {
    display: flex;

    @include e(head) {
      flex-grow: 0;
      width: 24px;
      flex-direction: column;
    }

    @include e(main) {
      padding-left: 10px;
      flex-grow: 1;
    }

    @include e(title) {
      padding-bottom: 8px;
      font-size: 13px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: $--color-text-regular;
      line-height: 20px;
    }

    @include e(line) {
      width: 1px;
      margin: 8px 0;
      // top: 0;
      // bottom: 0;
      // left: 11px;
    }

    @include e(icon) {
      @include when(icon) {
        width: 24px;
      }
    }
    @include e(line-inner) {
      background-size: 1px 10px;
    }
    @include e(line-dashed) {
      background-size: 1px 10px;
      background-repeat: repeat;
      background-image: linear-gradient(
        to bottom,
        $--color-text-placeholder 0%,
        $--color-text-placeholder 50%,
        transparent 50%
      );
      background-color: transparent;
      @include e(line-inner-dashed) {
        background-color: transparent;
        @include when(process) {
          background-image: linear-gradient(
            to bottom,
            $--color-text-primary 0%,
            $--color-text-primary 50%,
            transparent 50%
          );
        }

        @include when(wait) {
          background-image: linear-gradient(
            to bottom,
            $--color-text-placeholder 0%,
            $--color-text-placeholder 50%,
            transparent 50%
          );
        }

        @include when(success) {
          background-image: linear-gradient(
            to bottom,
            $--color-success 0%,
            $--color-success 50%,
            transparent 50%
          );
        }

        @include when(error) {
          background-image: linear-gradient(
            to bottom,
            $--color-danger 0%,
            $--color-danger 50%,
            transparent 50%
          );
        }

        @include when(finish) {
          background-image: linear-gradient(
            to bottom,
            $--color-primary 0%,
            $--color-primary 50%,
            transparent 50%
          );
        }
      }
    }
  }

  @include when(center) {
    @include e(head) {
      text-align: center;
    }

    @include e(main) {
      text-align: center;
    }

    @include e(description) {
      padding-left: 20%;
      padding-right: 20%;
    }

    @include e(line) {
      left: 50%;
      right: -50%;
    }
  }

  @include when(simple) {
    display: flex;
    align-items: center;

    @include e(head) {
      width: auto;
      font-size: 0;
      padding-right: 10px;
    }

    @include e(icon) {
      background: transparent;
      width: 16px;
      height: 16px;
      font-size: 12px;
    }

    @include e(icon-inner) {
      &[class*='el-icon']:not(.is-status) {
        font-size: 18px;
      }

      &.is-status {
        transform: scale(0.8) translateY(1px);
      }
    }

    @include e(main) {
      position: relative;
      display: flex;
      align-items: stretch;
      flex-grow: 1;
    }

    @include e(title) {
      font-size: 16px;
      line-height: 20px;
    }

    @include pseudo('not(:last-of-type)') {
      @include e(title) {
        max-width: 50%;
        word-break: break-all;
      }
    }

    @include e(arrow) {
      flex-grow: 1;
      display: flex;
      align-items: center;
      justify-content: center;

      &::before,
      &::after {
        content: '';
        display: inline-block;
        position: absolute;
        height: 15px;
        width: 1px;
        background: $--color-text-placeholder;
      }

      &::before {
        transform: rotate(-45deg) translateY(-4px);
        transform-origin: 0 0;
      }

      &::after {
        transform: rotate(45deg) translateY(4px);
        transform-origin: 100% 100%;
      }
    }

    @include pseudo(last-of-type) {
      @include e(arrow) {
        display: none;
      }
    }
  }

  .popover {
    font-size: 13px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #2c2836;
    line-height: 20px;
    position: absolute;
    padding: 8px 12px;
    background: #ffffff;
    box-shadow: 4px 4px 8px 0px rgba(111, 144, 194, 0.04),
      -4px -4px 8px 0px rgba(111, 144, 194, 0.04),
      4px 4px 8px 0px rgba(60, 102, 165, 0.04),
      -4px -4px 8px 0px rgba(60, 102, 165, 0.04);
    top: -40px;
    position: absolute;
  }
}
