@import '../styles/themes/themes.less';

@min-height: 32px;
@tag-input-disabled-bg-color: #fafbfd;

.@{bk-prefix}-tag-input {
  position: relative;
  min-height: @min-height;

  .@{bk-prefix}-tag-input-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: @min-height;
    padding: 0 0 0 5px;
    overflow: hidden;
    font-size: 12px;
    cursor: pointer;
    background: @white-color;
    border: 1px solid @light-gray;
    border-radius: 2px;

    &.active {
      border-color: @primary-color;
    }

    &.disabled {
      cursor: not-allowed;
      background: @tag-input-disabled-bg-color;
      border-color: @disable-color;
    }

    .tag-list {
      display: inline-flex;
      flex-wrap: wrap;
      align-items: center;
      max-height: 135px;
      padding: 0;
      margin: 0;
      overflow: auto;

      > li {
        position: relative;
        display: inline-flex;
        align-items: center;
        height: 22px;
        margin: 4px 5px 4px 0;
        overflow: hidden;
        font-size: 12px;
        border: solid 1px transparent;
        border-radius: 2px;

        &.tag-item {
          background: #f0f1f5;
          border-color: #f0f1f5;
        }
      }

      .remove-tag {
        flex-shrink: 0;
        margin-right: 5px;
        font-size: 14px;
        line-height: 0;
      }

      .tag {
        flex: 1;
        max-width: 190px;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
        white-space: nowrap;

        .dblclick-edit-input {
          position: absolute;
          top: 0px;
          width: 100%;
          max-width: 100%;
          height: 100%;
          padding: 0px 8px;
          resize: none;
          background-color: rgb(225, 236, 255);
          border: none;

          &:focus {
            border: none;
            outline: none;
          }
        }
      }

      .text {
        box-sizing: border-box;
        padding: 0 5px;
        line-height: 20px;
        color: @default-color;
        background-color: #f0f1f5;
        border-radius: 2px;

        &:hover {
          background-color: #dcdee5;;
        }
      }

      .tag-input {
        box-sizing: border-box;
        width: 10px;
        max-width: 295px;
        height: 22px;
        padding: 0;
        border: 0;
        outline: none;
      }
    }

    .placeholder {
      position: absolute;
      top: 0;
      right: 8px;
      left: 8px;
      height: 30px;
      padding: 0;
      margin: 0;
      overflow: hidden;
      line-height: 30px;
      color: @light-gray;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .icon-wrapper {
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .clear-icon {
      margin-right: 5px;
      font-size: 14px;
      line-height: 0;
      color: @light-gray;
      cursor: pointer;

      &:hover {
        color: @gray-color;
      }
    }

    .copy-icon {
      margin-right: 5px;
      font-size: 14px;
      line-height: 0;
      color: @light-gray;
      cursor: pointer;

      &:hover {
        color: @gray-color;
      }
    }
  }
}

.@{bk-prefix}-tag-input-popover-content {
  &.@{bk-prefix}-popover {
    padding: 0 !important;
  }

  .@{bk-prefix}-selector-list {
    min-width: 150px;

    .outside-ul {
      max-height: 160px;
      padding: 0;
      padding: 6px 0;
      margin: 0;
      overflow-y: auto;
      list-style: none;
      background-color: @white-color;
      border: 1px solid #dcdee5;
      border-radius: 2px;

      &::-webkit-scrollbar {
        width: 6px;
        height: 6px;
      }

      &::-webkit-scrollbar-thumb {
        min-height: 24px;
        background-color: #dcdee5;
        border-radius: 3px;
      }
    }

    .@{bk-prefix}-selector-group-item {
      list-style: none;

      .group-name {
        padding-left: 11px;
        font-size: 12px;
        line-height: 32px;
        color: #979ba5;
      }
    }

    .@{bk-prefix}-selector-group-list-item {
      padding: 0;
      margin: 0;
      list-style: none;
    }

    .@{bk-prefix}-selector-list-item {
      position: relative;
      width: 100%;
      cursor: pointer;
      background-color: @white-color;
      border-right: @light-gray;
      border-left: @light-gray;

      &:first-child {
        border-top: @light-gray;
      }

      &:last-child {
        border-bottom: @light-gray;
      }

      &.@{bk-prefix}-selector-selected {
        background-color: #f4f6fa;

        .selected-icon {
          display: inline-block;
        }
      }

      &.@{bk-prefix}-selector-actived {
        background-color: #f4f6fa;
      }

      &:hover {
        background-color: #eaf3ff;
      }

      &.disabled {
        cursor: not-allowed;
        background: @white-color;

        .text {
          color: @light-gray;
        }
      }

      &.loading {
        padding: 5px 0 3px;
        text-align: center;
      }

      .loading {
        position: relative;
        width: 100%;
        height: 40px;
        font-size: 14px;
        cursor: default;
      }

      .text {
        padding: 0 10px;
        overflow: hidden;
        font-size: 12px;
        line-height: 32px;
        color: @default-color;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .@{bk-prefix}-selector-tools {
        position: absolute;
        top: 10px;
        right: 0;
        display: none;
        font-size: 12px;

        .@{bk-prefix}-selector-list-icon {
          margin-right: 14px;
        }
      }

      .highlight-text {
        color: @primary-color;
      }
    }
  }
}

.@{bk-prefix}-tag-input-popover-reference{
  width: 100%;
}
