@tag-prefix-cls: ~"@{css-prefix}tag";
@tag-close-prefix-cls: haloe-icon-close;
.@{tag-prefix-cls} {
    box-sizing: content-box;
    display: inline-block;
    height: 20px;
    // line-height: 20px;
    margin: 2px 4px 2px 0;
    padding: 0 8px;
    border-radius: @border-radius-small;
    background: @tag-default-bg-color;
    font-size: @tag-font-size;
    vertical-align: middle;
    opacity: 1;
    overflow: hidden;
    //transition: all @transition-time @ease-in-out;
    
    .@{tag-prefix-cls}-content-box {
      display: flex;
      align-items: center;
      .haloe-icon {
        line-height: normal;
      }
    }

    &-disabled{
      cursor: not-allowed;
      background: @color-bg-disable;
    }

    // 大标签
    &-size-large {
      height: 28px;
      line-height: 28px;
      padding: 0 12px;
    }
    &-size-large&-border {
      height: 26px;
      line-height: 26px;
      padding: 0 11px;
    }

    // 中标签
    &-size-medium {
      height: 24px;
      line-height: 24px;
    }
    &-size-medium&-border {
      height: 22px;
      line-height: 22px;
    }

    // for color and unchecked
    // &:not(&-border):not(&-dot):not(&-checked){
    //     background: transparent;
    //     border-color: transparent;
    //     color: @text-color;
    //     .@{tag-close-prefix-cls} {
    //         color: @text-color !important;
    //     }
    // }

    &-checkable {
      cursor: pointer;
      background: @color-bg-select-tag !important;
      border-color: @color-bg-pause-tag !important;
      .@{tag-prefix-cls}-text {
        color: @text-color !important;
      }
      &.@{tag-prefix-cls}-checked {
        background: @color-brand-primary !important;
        border-color: @color-brand-primary !important;
        .@{tag-prefix-cls}-text {
          color: @color-functional-white !important;
        }
      }
    }
    
    &-checkable&-disabled{
      cursor: not-allowed;
      background: @tag-checkable-disabled-bg-color !important;
      border-color: @tag-checkable-disabled-border-color !important;
      .@{tag-prefix-cls}-text {
        color: @color-brand-disabled1 !important;
      }
    }


    &-color{
        &-error{
            color: @error-color !important;
            border-color: @error-color;
        }
        &-success{
            color: @success-color !important;
            border-color: @success-color;
        }
        &-primary{
            color: @link-color !important;
            border-color: @link-color;
        }
        &-warning{
            color: @warning-color !important;
            border-color: @warning-color;
        }
    }
    & &-color-white{
      color: @color-functional-white;
    }

    &-dot{
        height: 32px;
        line-height: 32px;
        height: 28px;
        line-height: 28px;
        // border: 1px solid @border-color-split !important;
        color: @text-color !important;
        background: @color-functional-white !important;
        padding: 0 12px;

        &-inner{
            display: inline-block;
            width: 12px;
            height: 12px;
            margin-right: 8px;
            border-radius: 50%;
            background: @border-color-split;
            position: relative;
            top: 1px;
        }
        .@{tag-close-prefix-cls} {
            color: #666 !important; // ★待定
            margin-left: 12px !important;
        }
    }

    &-border{
        height: 18px;
        line-height: 18px;
        padding: 0 7px;

        border: 1px solid @tag-default-border-color;
        color: @border-color-split;
        background: @color-functional-white; ;
        position: relative;

        .@{tag-close-prefix-cls} {
            color: #666; // ★待定
            margin-left: 12px !important;
        }

        &:after{
            content: "";
            display: none;
            width: 1px;
            background: currentColor;
            position: absolute;
            top: 0;
            bottom: 0;
            right: 22px;
        }

        &.@{tag-prefix-cls}-closable {
            &:after{
                display: block;
            }
            .@{tag-close-prefix-cls} {
                margin-left: 18px !important;
                left: 4px;
                top: -1px;
            }
        }

        &.@{tag-prefix-cls}-primary {
            color: @link-color !important;
            border: 1px solid @link-color !important;

            &:after{
                background: @link-color;
            }
            .@{tag-close-prefix-cls}{
                color: @link-color !important;
            }
        }
        &.@{tag-prefix-cls}-success {
            color: @success-color !important;
            border: 1px solid @success-color !important;

            &:after{
                background: @success-color;
            }
            .@{tag-close-prefix-cls}{
                color: @success-color !important;
            }
        }
        &.@{tag-prefix-cls}-warning {
            color: @warning-color !important;
            border: 1px solid @warning-color !important;

            &:after{
                background: @warning-color;
            }
            .@{tag-close-prefix-cls}{
                color: @warning-color !important;
            }
        }
        &.@{tag-prefix-cls}-error {
            color: @error-color !important;
            border: 1px solid @error-color !important;

            &:after{
                background: @error-color;
            }
            .@{tag-close-prefix-cls}{
                color: @error-color !important;
            }
        }
    }

    &-text {
      color: @text-color;
      a:first-child:last-child {
        display: inline-block;
        margin: 0 -8px;
        padding: 0 8px;
      }
      &.@{tag-prefix-cls}-has-max-width {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }

    .@{tag-close-prefix-cls} {
        .iconfont-size-under-12px(14);
        cursor: pointer;
        vertical-align: 0;
        margin-left: 4px;
        color: @tag-default-text-color;
        position: relative;

        &:hover {
          opacity: 1;
        }
    }


    &-primary,
    &-success,
    &-warning,
    &-error {
        border: 0;
        &,
        a,
        a:hover,
        .@{tag-close-prefix-cls},
        .@{tag-close-prefix-cls}:hover {
            color: @color-functional-white;;
        }
    }

    &-primary,
    &-primary&-dot &-dot-inner
    {
        background: @link-color;
    }
    &-primary&-dot &-aniamation{
        .tag-aniamation( @link-color,@color-bg-page);
        &:before {
          .tag-aniamation-before(@link-color)
        }
    }
    &-primary&-dark &-text{
        color: @link-color;
    }
    &-success&-border,&-warning&-border,&-error&-border,&-primary&-border{
      background: @color-functional-white;;
    }
    &-primary&-dark{
      background: @color-bg-normal;
    }
    &-success&-dark{
      background: @color-bg-success;
    }
    &-success&-dark &-text{
        color: @success-color;
    }
    &-success,
    &-success&-dot &-dot-inner
    {
        background: @success-color;
    }
    &-success&-dot &-aniamation{
        .tag-aniamation( @color-functional-success,@color-bg-page);
        &:before {
          .tag-aniamation-before(@color-functional-success)
        }
    }

    &-warning,
    &-warning&-dot &-dot-inner
    {
        background: @warning-color;
    }

    &-warning&-dot &-aniamation{
      .tag-aniamation( @color-functional-warning,@color-bg-page);
        &:before {
          .tag-aniamation-before(@color-functional-warning)
        }
    }
    &-warning&-dark{
      background: @color-bg-warning;
    }
    &-warning&-dark &-text{
        color: @warning-color;
    }

    &-error,
    &-error&-dot &-dot-inner
    {
        background: @error-color;
    }
    &-error&-dot &-aniamation{
      .tag-aniamation( @color-functional-fail,@color-bg-page);
        &:before {
          .tag-aniamation-before(@color-functional-fail)
        }
    }
    &-error&-dark{
      background: @color-bg-fail;
    }
    &-error&-dark &-text{
        color: @error-color;
    }

    &-default&-dark {
      background: @tag-default-bg-dark-color;
      .@{tag-close-prefix-cls} {
        &:hover {
          color: @tag-default-close-hover-color;
        }
      }
    }

    &-default &-text{
      color: @color-functional-white;
    }
    &-default&-border{

    }
    &-default&-dark &-text,
    &-default&-border &-text,
    &-default&-dot &-text{
      color: @tag-default-text-color;
    }

    &-default&-dot &-aniamation{
              .tag-aniamation(@color-functional-pause,@color-bg-page);
        &:before {
          .tag-aniamation-before(@color-functional-pause)
        }
    }

    @colors: pink, magenta, red, volcano, orange, yellow, gold, cyan, lime, green, blue, geekblue, purple;

    .make-color-classes(@i: length(@colors)) when (@i > 0) {
        .make-color-classes(@i - 1);
        @color: extract(@colors, @i);
        @lightColor: "@{color}-1";
        @lightBorderColor: "@{color}-3";
        @darkColor: "@{color}-6";
        &-@{color} {
            // line-height: 20px;
            background: @@lightColor;
            border-color: @@lightBorderColor;
            .@{tag-prefix-cls}-text{
                color: @@darkColor !important;
            }
            &.@{tag-prefix-cls}-dot{
                line-height: 32px;
            }
        }
        .haloe-tag-size-large&-@{color} {
            // line-height: 30px;
        }
        .haloe-tag-size-medium&-@{color} {
            // line-height: 26px;
        }
    }

    .make-color-classes();

    // 渐变色标签基础样式
    &-gradient {
        border: 0;
        background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
        &,
        a,
        a:hover,
        .@{tag-close-prefix-cls},
        .@{tag-close-prefix-cls}:hover {
            color: @color-functional-white;
        }
    }

    // 预设渐变色
    &-gradient-blue-purple {
        background: linear-gradient(to right, #667eea, #764ba2); // ★待定
        border: 0;
        &,
        a,
        a:hover,
        .@{tag-close-prefix-cls},
        .@{tag-close-prefix-cls}:hover {
            color: @color-functional-white;
        }
    }

    &-gradient-orange-red {
        background: linear-gradient(to right, #f093fb, #f5576c); // ★待定
        border: 0;
        &,
        a,
        a:hover,
        .@{tag-close-prefix-cls},
        .@{tag-close-prefix-cls}:hover {
            color: @color-functional-white;
        }
    }

    &-gradient-green-cyan {
        background: linear-gradient(to right, #11998e, #38ef7d); // ★待定
        border: 0;
        &,
        a,
        a:hover,
        .@{tag-close-prefix-cls},
        .@{tag-close-prefix-cls}:hover {
            color: @color-functional-white;
        }
    }

    &-gradient-pink-magenta {
        background: linear-gradient(to right, #ee9ca7, #ffdde1); // ★待定
        border: 0;
        &,
        a,
        a:hover,
        .@{tag-close-prefix-cls},
        .@{tag-close-prefix-cls}:hover {
            color: @color-functional-white;
        }
    }
}


@keyframes loading-beat {
  /* 0%{
    transform: translateY(0) scale(1);
  }
  25% {
     transform: translateY(0px) scale(1.8);
  }
  50%, 75%, 100% {
    transform: translateY(0px) scale(1);
  } */
  0% {
    transform: translateY(0) scale(1);
  }

  25% {
    transform: translateY(0px) scale(1.5);
  }

  50%,
  75%,
  100% {
    transform: translateY(0px) scale(1);
  }

  /* 50% {
    transform: translateY(0px) scale(1.8);
  }
  75%{
    transform: scale(1);
  }
  100%{
    transform: scale(0.5);
  } */
}

.tag-aniamation(@color-border,@background) {
  /* margin-right: 5px; */
  animation-name: loading-beat;
  /* 动画完成一个周期所需要的时间 */
  animation-duration: 1.2s;
  /* 定义动画从何时开始（延迟） */
  animation-delay: 0s;
  /* 动画播放次数（无限） */
  animation-iteration-count: infinite;
  border: 1px solid @color-border;
  background-color: @background;
}

.tag-aniamation-before(@backgroud) {
  //  background: #E6804A;
  position: absolute;
  height: 8px;
  width: 8px;
  border-radius: 50%;
  content: '';
  margin: 0 auto;
  top: 1px;
  left: 1px;
  background-color: @backgroud;
  animation-name: loading-beat;
  /* 动画完成一个周期所需要的时间 */
  /* 定义动画从何时开始（延迟） */
  /* 动画播放次数（无限） */
  animation-iteration-count: infinite;
}
