/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';
@import './vars.less';

@milestone-prefix-cls: ~'@{css-prefix}milestone';
@svg-prefix-cls: ~'@{css-prefix}svg';

.@{milestone-prefix-cls} {
  .inject-Milestone-vars();

  overflow: hidden;
  padding-top: 38px;

  /* 节点本身 */
  & &__node {
    float: left;
    display: block;

    &::before {
      position: relative;
      display: block;
      left: ~'calc(50% - 14px)';
      top: 28px;
      z-index: 15;
      content: '';
      width: 28px;
      height: 28px;
    }

    &.is-solid {

      &::before {
        background: var(--tv-Milestone-bg-color);
      }

      .@{svg-prefix-cls} {
        fill: #fff;
      }
    }

    .iconfix {
      font-size: 20px;
    }
  }

  /* 图标节点 */
  & &__icon {
    position: relative;
    left: calc(50% - 16px);
    top: 0px;
    width: var(--tv-Milestone-node-size);
    height: var(--tv-Milestone-node-size);
    line-height: var(--tv-Milestone-node-size);
    font-size: var(--tv-Milestone-font-size);
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    border: var(--tv-Milestone-icon-border-width) solid;
    display: flex;
    align-items: center;
    justify-content: center;

    .@{svg-prefix-cls} {
      font-size: var(--tv-Milestone-icon-size);
      fill: currentColor;
      vertical-align: baseline;
    }

    .custom-milestone {
      fill: var(--tv-Milestone-status-completed-border-color);
    }

    &.status-doing {
      background-color: var(--tv-Milestone-icon-color);
      color: var(--tv-Milestone-doing-text-color);
    }

    &.is-completed,
    &.status-cancel,
    &.status-back,
    &.status-end {
      border: var(--tv-Milestone-icon-border-width-completed) solid var(--tv-Milestone-status-completed-border-color);
      background-color: var(--tv-Milestone-status-completed-bg-color);
      color: var(--tv-Milestone-icon-color);
    }
  }

  /* 节点线 */
  & &__node.node-status-completed {
    .@{milestone-prefix-cls}__line {
      background-color: var(--tv-Milestone-line-bg-color-completed);
    }
  }

  & &__line {
    position: relative; // 里程碑线条不区分状态
    left: calc(50% + 24px);
    top: -16px;
    height: var(--tv-Milestone-line-height);
    width: calc(100% - 48px);
    background-color: var(--tv-Milestone-line-bg-color);

    &-end {
      width: 0;
    }
  }

  /* 横向节点下方部分 */
  & &__description {
    position: relative;
    line-height: 14px;
    margin-top: 8px;
    overflow: hidden;
    text-align: center;

    // 标题
    &-name {
      float: left;
      width: 100%;
      font-size: var(--tv-Milestone-font-size);
    }

    // 日期
    &-status {
      float: left;
      margin-top: 4px;
      width: 100%;
      color: var(--tv-Milestone-status-text-color);
      font-size: var(--tv-Milestone-status-font-size);
    }
  }

  /* 旗子部分 */
  & &__flag {
    position: absolute;
    left: ~'calc(50% - 29px)';
    bottom: 5px;
    width: 58px;
    z-index: 1;

    &:hover {
      z-index: 2;
    }

    &-content {
      display: table-cell;
      vertical-align: middle;
      width: var(--tv-Milestone-flag-width);
      height: var(--tv-Milestone-flag-height);
      padding: var(--tv-Milestone-flag-padding);
      line-height: var(--tv-Milestone-flag-line-height);
      font-size: var(--tv-Milestone-flag-font-size);
      border-radius: var(--tv-Milestone-flag-border-radius);
      color: var(--tv-Milestone-text-color);
      background-color: var(--tv-Milestone-flag-bg-color);
      cursor: pointer;

      p {
        color: var(--tv-Milestone-text-color);
        width: var(--tv-Milestone-flag-width);
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        margin: 0;
        box-sizing: border-box;
      }

      .@{milestone-prefix-cls}__flag-name {
        font-weight: var(--tv-Milestone-flag-name-font-weight);
      }

      .@{milestone-prefix-cls}__flag-desc {
        color: var(--tv-Milestone-flag-desc-text-color);
        font-size: var(--tv-Milestone-flag-desc-font-size);
      }
    }
  }

  /* 旗子线部分 */
  & &__flag-line {
    height: 30px;
    width: 1px;
    margin-left: 0px;
    background: var(--tv-Milestone-flag-line-bg-color);
  }

  & &__dot {
    position: relative;
    bottom: -29px;
    right: 2px;
    display: none;
    width: 5px;
    height: 5px;
    border: solid 1px;
    border-radius: 50%;
  }
}