.yc-input-tag {
  cursor: text;
  position: relative;
  width: 100%;
  background-color: var(--color-fill-2);
  border: 1px solid transparent;
  border-radius: var(--border-radius-small);
  transition:
    color 0.1s cubic-bezier(0, 0, 1, 1),
    border-color 0.1s cubic-bezier(0, 0, 1, 1),
    background-color 0.1s cubic-bezier(0, 0, 1, 1);
  color: var(--color-text-1);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  &:not(.yc-input-tag-disabled) {
    &:hover .yc-input-tag-clear-button {
      visibility: visible;
    }
    &:hover {
      border-color: transparent;
      background-color: var(--color-fill-3);
    }
    &:focus-within {
      background-color: var(--color-bg-2);
      border-color: rgb(var(--primary-6));
      box-shadow: 0 0 0 0 var(--color-primary-light-2);
      .yc-input-tag-inner {
        .yc-tag {
          border-color: var(--color-fill-2);
          background-color: var(--color-fill-2);
        }
      }
    }
  }
  .yc-input-tag-prefix,
  .yc-input-tag-suffix {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: inherit;
    color: var(--color-text-2);

    &.yc-input-tag-prefix {
      padding-right: 12px;
    }
    &.yc-input-tag-suffix {
      padding-left: 12px;
    }
  }
  .yc-input-tag-clear-button {
    visibility: hidden;
  }
  .yc-input-tag-mirror {
    min-width: 12px;
    position: absolute;
    top: 0;
    left: 0;
    visibility: hidden;
    font-variant: normal;
    letter-spacing: normal;
    text-indent: 0;
    text-rendering: auto;
    text-transform: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
  }
  .yc-input-tag-inner {
    overflow: hidden;
    flex: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 4px;
    .yc-tag {
      max-width: 100%;
      &:hover {
        background-color: var(--color-bg-2);
      }
    }
    .yc-input-tag-input {
      max-width: 100%;
      cursor: inherit;
      outline: none;
      border: none;
      border-radius: var(--border-radius-none);
      background-color: transparent;
      color: inherit;
      &::placeholder {
        color: var(--color-text-3);
      }
    }
  }
}
// error
.yc-input-tag-error {
  background-color: var(--color-danger-light-1);
  &:not(.yc-input-tag-disabled) {
    &:hover {
      border-color: transparent;
      background-color: var(--color-danger-light-2);
    }
    &:focus-within {
      background-color: var(--color-bg-2);
      border-color: rgb(var(--danger-6));
      box-shadow: 0 0 0 0 var(--color-danger-light-2);
    }
  }
}
//no-value has suffix
.yc-input-tag {
  // novalue
  &.yc-input-tag-no-value {
    padding: 0 12px;
  }
  // has-suffix
  &.yc-input-tag-has-suffix {
    padding-right: 12px;
  }
}
// disabled
.yc-input-tag-disabled {
  cursor: not-allowed;
  border-color: transparent;
  background-color: var(--color-fill-2);
  color: var(--color-text-4);
  .yc-input-tag-prefix,
  .yc-input-tag-suffix {
    color: inherit;
  }
  .yc-input-tag-inner {
    .yc-tag {
      cursor: not-allowed;
      color: var(--color-text-4);
      background-color: var(--color-fill-2);
      border-color: var(--color-fill-3);
      &:hover {
        color: var(--color-text-4);
        background-color: var(--color-fill-2);
        border-color: var(--color-fill-3);
      }
    }
  }
}
// size
@size: {
  @mini: {
    height: 24px;
    padding-x: 4px;
    inner-padding: 1px;
  };
  @small: {
    height: 28px;
    padding-x: 4px;
    inner-padding: 2px;
  };
  @medium: {
    height: 32px;
    padding-x: 4px;
    inner-padding: 2px;
  };
  @large: {
    height: 36px;
    padding-x: 6px;
    inner-padding: 2px;
  };
};
each(@size, .(@value,@name){
  @key:replace(~"@{name}", "@", "");
  @font-size:if(@key=mini,12px,14px);
  .yc-input-tag-size-@{key} {
    min-height: @value[height];
    font-size: @font-size;
    padding: 0 @value[padding-x];
    .yc-input-tag-inner {
      padding: @value[inner-padding] 0;
      & when  (@key = large) {
        .yc-tag-size-large {
          min-height: 28px;
          line-height: 26px
        }
      }
    }
  }
});
