@import "mixins/mixins";
@import "common/var";

@mixin genTheme($backgroundColorWeight, $borderColorWeight, $fontColorWeight, $hoverColorWeight) {
  background-color: mix($--tag-primary-color, $--color-white, $backgroundColorWeight);
  border-color: mix($--tag-primary-color, $--color-white, $borderColorWeight);
  color: mix($--tag-primary-color, $--color-white, $fontColorWeight);

  @include when(hit) {
    border-color: $--tag-primary-color;
  }
  .el-tag__close {
    color: mix($--tag-primary-color, $--color-white, $fontColorWeight);
  }
  &.el-tag-border-none{
    border-color: transparent !important;
  }

  &.el-tag--success {
    background-color: mix($--tag-success-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-success-color, $--color-white, $borderColorWeight);
    color: mix($--tag-success-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-success-color;
    }

    .el-tag__close {
      color: mix($--tag-success-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--warning {
    background-color: mix($--tag-warning-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-warning-color, $--color-white, $borderColorWeight);
    color: mix($--tag-warning-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-warning-color;
    }

    .el-tag__close {
      color: mix($--tag-warning-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--danger {
    background-color: mix($--tag-danger-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-danger-color, $--color-white, $borderColorWeight);
    color: mix($--tag-danger-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-danger-color;
    }

    .el-tag__close {
      color: mix($--tag-danger-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--text {
    background-color: transparent;
    border-color: transparent;
    .dot{
      width: 8px;
      height: 8px;
      border-radius: 50%;
      display: inline-block;
      margin-right: 6px;
    }
    @include when(hit) {
      border-color: transparent;
    }
  }

  &.el-tag--pink-green {
    background-color: mix($--tag-pink-green-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-pink-green-color, $--color-white, $borderColorWeight);
    color: mix($--tag-pink-green-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-pink-green-color;
    }

    .el-tag__close {
      color: mix($--tag-pink-green-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--purple {
    background-color: mix($--tag-purple-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-purple-color, $--color-white, $borderColorWeight);
    color: mix($--tag-purple-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-purple-color;
    }

    .el-tag__close {
      color: mix($--tag-purple-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--gray {
    background-color: mix($--tag-gray-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-gray-color, $--color-white, $borderColorWeight);
    color: mix($--tag-gray-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-gray-color;
    }

    .el-tag__close {
      color: mix($--tag-gray-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--orange {
    background-color: mix($--tag-orange-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-orange-color, $--color-white, $borderColorWeight);
    color: mix($--tag-orange-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-orange-color;
    }

    .el-tag__close {
      color: mix($--tag-orange-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--sky-blue {
    background-color: mix($--tag-sky-blue-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-sky-blue-color, $--color-white, $borderColorWeight);
    color: mix($--tag-sky-blue-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-sky-blue-color;
    }

    .el-tag__close {
      color: mix($--tag-sky-blue-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--blue {
    background-color: mix($--tag-blue-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-blue-color, $--color-white, $borderColorWeight);
    color: mix($--tag-blue-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-blue-color;
    }

    .el-tag__close {
      color: mix($--tag-blue-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--green {
    background-color: mix($--tag-green-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-green-color, $--color-white, $borderColorWeight);
    color: mix($--tag-green-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-green-color;
    }

    .el-tag__close {
      color: mix($--tag-green-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--pink {
    background-color: mix($--tag-pink-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-pink-color, $--color-white, $borderColorWeight);
    color: mix($--tag-pink-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-pink-color;
    }

    .el-tag__close {
      color: mix($--tag-pink-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--black {
    background-color: mix($--tag-black-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-black-color, $--color-white, $borderColorWeight);
    color: mix($--tag-black-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-black-color;
    }

    .el-tag__close {
      color: mix($--tag-black-color, $--color-white, $fontColorWeight);
    }
  }

  &.el-tag--gold {
    background-color: mix($--tag-gold-color, $--color-white, $backgroundColorWeight);
    border-color: mix($--tag-gold-color, $--color-white, $borderColorWeight);
    color: mix($--tag-gold-color, $--color-white, $fontColorWeight);

    @include when(hit) {
      border-color: $--tag-gold-color;
    }

    .el-tag__close {
      color: mix($--tag-gold-color, $--color-white, $fontColorWeight);
    }
  }
}

@include b(tag) {
  @include genTheme(10%, 20%, 100%, 100%);
  display: inline-block;
  height: 32px;
  padding: $--tag-padding;
  line-height: 30px;
  font-size: $--tag-font-size;
  color: $--tag-primary-color;
  border-width: 1px;
  border-style: solid;
  border-radius: $--tag-border-radius;
  box-sizing: border-box;
  white-space: nowrap;

  .el-icon-close {
    border-radius: 50%;
    text-align: center;
    position: relative;
    cursor: pointer;
    font-size: 12px;
    height: 16px;
    width: 16px;
    line-height: 16px;
    vertical-align: middle;
    top: -1px;
    right: -5px;

    &::before {
      display: block;
    }
  }

  @include m(dark) {
    @include genTheme(100%, 100%, 0, 80%);
  }

  @include m(plain) {
    @include genTheme(0, 40%, 100%, 100%);
  }

  @include m(medium) {
    height: 20px;
    line-height: 18px;

    .el-icon-close {
      transform: scale(.8);
    }
  }

  @include m(small) {
    height: 18px;
    padding: 0 4px;
    line-height: 16px;

    .el-icon-close {
      transform: scale(.8);
    }
  }

  @include m(mini) {
    height: 20px;
    padding: 0 5px;
    line-height: 19px;

    .el-icon-close {
      margin-left: -3px;
      transform: scale(.7);
    }
  }
}
