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

@tag-prefix-cls: ~"@{ant-prefix}-tag";

.@{tag-prefix-cls} {
  display: inline-block;
  line-height: 20px;
  height: 22px;
  padding: 0 8px;
  border-radius: @border-radius-base;
  border: @border-width-base @border-style-base @border-color-split;
  background: @tag-default-bg;
  font-size: @font-size-base;
  transition: all 0.3s @ease-in-out-circ;
  opacity: 1;
  margin-right: 8px;
  cursor: pointer;
  white-space: nowrap;

  &:hover {
    opacity: 0.85;
  }

  &,
  a,
  a:hover {
    color: @tag-default-color;
  }

  &-text {
    a:first-child:last-child {
      display: inline-block;
      margin: 0 -8px;
      padding: 0 8px;
    }
  }

  .@{iconfont-css-prefix}-cross {
    .iconfont-size-under-12px(10px);
    cursor: pointer;
    font-weight: bold;
    margin-left: 3px;
    transition: all 0.3s ease;
    opacity: 0.66;

    &:hover {
      opacity: 1;
    }
  }

  &-has-color {
    border-color: transparent;
    &,
    a,
    a:hover,
    .@{iconfont-css-prefix}-cross,
    .@{iconfont-css-prefix}-cross:hover {
      color: #fff;
    }
  }

  &-checkable {
    background-color: transparent;
    border-color: transparent;
    &:hover,
    &:active,
    &-checked {
      color: #fff;
    }
    &:hover {
      background-color: @primary-5;
    }
    &-checked {
      background-color: @primary-6;
    }
    &:active {
      background-color: @primary-7;
    }
  }

  &-close {
    width: 0 !important;
    padding: 0;
    margin: 0;
  }

  &-zoom-enter,
  &-zoom-appear {
    animation: antFadeIn .2s @ease-in-out-circ;
    animation-fill-mode: both;
  }

  &-zoom-leave {
    animation: antZoomOut .3s @ease-in-out-circ;
    animation-fill-mode: both;
  }

  @colors: pink, red, orange, yellow, cyan, green, blue, purple;

  // mixin to iterate over colors and create CSS class for each one
  .make-color-classes(@i: length(@colors)) when (@i > 0) {
    .make-color-classes(@i - 1);
    @color: extract(@colors, @i);
    @lightColor: "@{color}-2";
    @darkColor: "@{color}-6";
    &-@{color} {
      color: @@darkColor;
      background: @@lightColor;
      border-color: @@lightColor;
    }
    &-@{color}-inverse {
      background: @@darkColor;
      border-color: @@darkColor;
      color: #fff;
    }
  }

  .make-color-classes();
}
