// == when hoverd
.hover(@color: @input-hover-border-color) {
  border-color: @color;
  border-right-width: @border-width-base  !important;
}

// input status
// == when focus or actived
.active(@color: @outline-color) {
  border-color:~`colorPalette('@{color}', 5) `;
  border-right-width: @border-width-base  !important;
  outline: 0;
  box-shadow: @input-outline-offset @outline-blur-size @outline-width fade(@color, 20%);
}
// tooltip挂载到body上
.uniq-aggregateSearch-tooltip{
  white-space: nowrap;
  background: #FFF1F0;
  border: @border-width-base @border-style-base @red-5;
  border-radius: 0 0 2px 2px;
  font-size: 12px;
  color: @red-5;
  padding: 0 10px;
  min-width: 100px;
  height: 20px;
  line-height: 20px;
}
.aggregate-search-wrapper {
  background: #FFFFFF;
  border-radius: 2px;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  white-space: pre-wrap;
  position: relative;
  border: @border-width-base @border-style-base @input-border-color;
  border-radius: @border-radius-base;
  width: 100%;
  // 聚焦样式修改
  &:focus-within {
    .active();
  }

  &:hover {
    .hover();
  }

  // 取消默认聚焦样式
  &:focus-visible {
    outline: none;
  }

  .aggregate-search-input {
    position: relative;
    padding: 0 10px;
    padding-right: 30px;
    flex: 1;
    height: 100%;
    min-height: 26px;
    line-height: 26px;
    // border-radius: @border-radius-base 0 0 @border-radius-base;
    outline: none;

    &:empty:before {
      content: attr(data-placeholder);
      font-size: 12px;
      color: rgba(0, 0, 0, 0.45);
      line-height: 20px;
    }

    &:empty+.close-all-icon {
      display: none;
    }

    &:not(.syntax-error):focus:before {
      // 需要排除掉syntax-error的样式不然报错内容丢失
      content: ""; // 不能为none，否则placeholder不显示
    }

    .tag-box {
      position: relative;
      background: #FFFFFF;
      border: @border-width-base @border-style-base #E3E3E3;
      border-radius: 2px;
      min-height: 20px;
      line-height: 18px;
      display: inline-block;
      margin-right: 2px;
      padding-right: 5px;
      word-break: break-word;
      .tag-box-item-close {
        position: absolute;
        height: 20px;
        line-height: 20px;
        display: none;
        top: -1px;
        right: -12px;
        width: 12px;
        border: @border-width-base @border-style-base #E3E3E3;
        border-left: none;
        z-index: 10;
        background: #fff;
        border-radius: 0 @border-radius-base @border-radius-base 0;

        &::before,
        &::after {
          content: ''; // content为x时，样式突兀
          width: 0.5px;
          height: 8px;
          background: @text-color-show;
          position: absolute;
          top: 5.5px;
          right: 6px;
          left: auto;
        }

        &::before {
          transform: rotate(45deg);
        }

        &::after {
          transform: rotate(-45deg);
        }
      }
      &:hover {
        border-color: @primary-5;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        .tag-box-item-close {
          display: inline-block;
          border-color: @primary-5;
          &:hover {
            cursor: pointer;
            &::before,
            &::after {
              background: @primary-5;
            }
          }

        }
      }
      &:not(.syntax-error):not(&:hover):has(.tag-con-keyword_AND_OR:nth-child(1)):has(.tag-box-item-close:nth-child(2)) {
        border-color: transparent;
      }

      .tag-con {
        display: inline-block;
        min-height: 18px;
        line-height: 18px;

        &:first-child {
          padding-left: 5px;
        }
      }

      .tag-con-key {
        background: rgba(0, 0, 0, 0.06);
      }

      .tag-con-key-last {
        padding-right: 2px;
      }

      .tag-con-keyword {
        color: #FA8C16;
      }

      .tag-con-identifier {
        color: #FA8C16;
      }

      .tag-con-match {
        color: #FA8C16;
        padding-left: 2px;
      }
    }
  }

  &.aggregate-search-text-wrapper {
    .aggregate-search-input {
      line-height: 20px;
      padding-top: 3px;
      padding-bottom: 3px;
    }
  }
}


.syntax-error {
  // 语法错误，高亮样式
  border: @border-width-base @border-style-base @red-5  !important;
  box-shadow: none !important;

  &:hover {

    // 伪类展示属性值
    // &:before {
    //   content: attr(data-error);
    //   position: absolute;
    //   white-space: nowrap;
    //   top: -28px;
    //   left: -1px;
    //   height: 20px;
    //   line-height: 20px;
    //   background: #FFF1F0;
    //   border: @border-width-base @border-style-base @red-5;
    //   border-radius: 0 0 2px 2px;
    //   font-size: 12px;
    //   color: @red-5;
    //   padding: 0 10px;
    //   min-width: 100px;
    // }
  }
  &:hover {
    .tag-box-item-close {
      border-color: @red-5 !important;
      &:hover {
        &::before,
        &::after {
          background: @red-5 !important;
        }
      }
    }
  }
}