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

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

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

  margin: 0;
  padding: 0;
  list-style: none;

  &-item {
    position: relative;
    margin: 0;
    padding: 0 0 20px;
    font-size: @yee-font-size-base;
    list-style: none;

    &-tail {
      position: absolute;
      top: 10px;
      left: 4px;
      height: calc(100% - 10px);
      border-left: @yee-timeline-width solid @yee-timeline-color;
    }

    &-pending &-head {
      font-size: @yee-font-size-sm;
      background-color: transparent;
    }

    &-pending &-tail {
      display: none;
    }

    &-head {
      position: absolute;
      width: 10px;
      height: 10px;
      background-color: @yee-timeline-dot-bg;
      border: @yee-timeline-dot-border-width solid transparent;
      border-radius: 100px;

      &-blue {
        color: @yee-primary-color;
        border-color: @yee-primary-color;
      }

      &-red {
        color: @yee-error-color;
        border-color: @yee-error-color;
      }

      &-green {
        color: @yee-success-color;
        border-color: @yee-success-color;
      }

      &-gray {
        color: @yee-disabled-color;
        border-color: @yee-disabled-color;
      }
    }

    &-head-custom {
      position: absolute;
      top: 5.5px;
      left: 5px;
      width: auto;
      height: auto;
      margin-top: 0;
      padding: 3px 1px;
      line-height: 1;
      text-align: center;
      border: 0;
      border-radius: 0;
      transform: translate(-50%, -50%);
    }

    &-content {
      position: relative;
      top: -(@yee-font-size-base * @yee-line-height-base - @yee-font-size-base) + 1px;
      margin: 0 0 0 18px;
      word-break: break-word;
    }

    &-last {
      > .@{yee-timeline-prefix-cls}-item-tail {
        display: none;
      }
      > .@{yee-timeline-prefix-cls}-item-content {
        min-height: 48px;
      }
    }
  }

  &.@{yee-timeline-prefix-cls}-alternate,
  &.@{yee-timeline-prefix-cls}-right {
    .@{yee-timeline-prefix-cls}-item {
      &-tail,
      &-head,
      &-head-custom {
        left: 50%;
      }

      &-head {
        margin-left: -4px;
        &-custom {
          margin-left: 1px;
        }
      }

      &-left {
        .@{yee-timeline-prefix-cls}-item-content {
          left: calc(50% - 4px);
          width: calc(50% - 14px);
          text-align: left;
        }
      }

      &-right {
        .@{yee-timeline-prefix-cls}-item-content {
          width: calc(50% - 12px);
          margin: 0;
          text-align: right;
        }
      }
    }
  }

  &.@{yee-timeline-prefix-cls}-right {
    .@{yee-timeline-prefix-cls}-item-right {
      .@{yee-timeline-prefix-cls}-item-tail,
      .@{yee-timeline-prefix-cls}-item-head,
      .@{yee-timeline-prefix-cls}-item-head-custom {
        // stylelint-disable-next-line function-calc-no-invalid
        left: calc(100% - 4px - @yee-timeline-width);
      }
      .@{yee-timeline-prefix-cls}-item-content {
        width: calc(100% - 18px);
      }
    }
  }

  &&-pending &-item-last &-item-tail {
    display: block;
    height: calc(100% - 14px);
    border-left: 2px dotted @yee-timeline-color;
  }

  &&-reverse &-item-last &-item-tail {
    display: none;
  }

  &&-reverse &-item-pending {
    .@{yee-timeline-prefix-cls}-item-tail {
      top: 15px;
      display: block;
      height: calc(100% - 15px);
      border-left: 2px dotted @yee-timeline-color;
    }
    .@{yee-timeline-prefix-cls}-item-content {
      min-height: 48px;
    }
  }
}
