@use 'sass:map';
@use 'mixins/mixins' as *;
@use 'mixins/function' as *;
@use 'mixins/utils' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

@include b(contacts) {
  position: relative;

  @include set-component-css-var('contacts', $contacts);

  flex-wrap: nowrap;

  > .ant-col {
    position: relative;
    display: flex;
    flex-direction: column;
    height: getCssVar('contacts', 'height');
    overflow: hidden;
  }

  // @include e(left) {
  // }

  @include e(right-item) {
    cursor: pointer;
  }

  @include e(list-header) {
    padding: getCssVar('contacts', 'padding') getCssVar('contacts', 'padding') 0;

    .ant-tabs-nav {
      margin-bottom: 8px;
    }
  }

  @include e(list-main) {
    flex: 1;
    overflow: hidden;
  }

  @include e(right) {
    border-left: getCssVar('contacts', 'divider');
  }

  @include e(delete-icon) {
    cursor: pointer;
  }
}

@include b(contacts-item) {
  box-sizing: border-box;
  display: flex;
  justify-items: center;
  width: 100%;
  padding: 10px 16px;
  overflow: hidden;

  @include e(avatar) {
    margin-right: 8px;
  }

  @include e(content) {
    flex: 1;
    line-height: 28px;

    @include utils-ellipsis;
  }

  @include e(label) {
    font-weight: getCssVar('font-weight', 'bold');
    color: getCssVar('color', 'black');
  }

  @include e(tags) {
    margin-left: 8px;
    color: getCssVar('color', 'info');
  }

  @include e(suffix) {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 25px;
    color: getCssVar('color', 'info');
  }
}

@mixin item-hover() {
  .is-item-hover {
    cursor: pointer;

    &:hover {
      background-color: rgb(0 0 0 / 4%);
    }

    &.is-disabled {
      cursor: not-allowed;
    }
  }
}

@include b(contacts-list) {
  .is-list-header {
    padding-right: getCssVar('contacts', 'padding');
    padding-bottom: 8px;
    padding-left: getCssVar('contacts', 'padding');
  }

  &.is-tree-list .ant-tree-node-content-wrapper:hover,
  &.is-tree-list .ant-tree-checkbox + span:hover {
    background-color: rgb(0 0 0 / 4%);
  }

  .is-tree-list {
    .ant-tree-treenode {
      padding-right: getCssVar('contacts', 'padding');
      padding-left: getCssVar('contacts', 'padding');

      &:not(.is-card) {
        .ant-tree-node-content-wrapper {
          position: relative;
          // padding-right: 25px;

          @include utils-ellipsis;
        }
      }

      & > .ant-tree-checkbox {
        display: none;
      }
    }

    .ant-tree-title {
      .is-tree-selected-icon {
        position: absolute;
        top: 50%;
        right: 4px;
        color: getCssVar('color', 'info');
        transform: translateY(-50%);
      }
    }
  }

  @include item-hover;
}

@include b(contacts-group) {
  width: 100%;
  height: 100%;
  padding-top: getCssVar('contacts', 'padding');
  overflow: hidden;

  @include e('collapse') {
    width: 100%;
    background: transparent;

    .ant-collapse-item {
      border: none;
    }
  }

  @include e(main) {
    position: relative;
    overflow: hidden auto;
  }

  @include e(main-loading) {
    position: absolute;
    top: 50px;
    right: 0;
    left: 0;
    z-index: 10;
    padding-right: getCssVar('contacts', 'padding');
    padding-left: getCssVar('contacts', 'padding');
    font-size: 14px;
    text-align: center;
    pointer-events: none;
  }

  @include e(main-empty) {
    position: absolute;
    top: 100px;
    right: 0;
    left: 0;
    z-index: 9;
    padding-right: getCssVar('contacts', 'padding');
    padding-left: getCssVar('contacts', 'padding');
    font-size: 14px;
    color: #8c8c8c;
    text-align: center;
  }

  @include e(selected-title) {
    box-sizing: border-box;
    width: 100%;
    padding-right: getCssVar('contacts', 'padding');
    padding-left: getCssVar('contacts', 'padding');
    font-size: getCssVar('font-size', 'base');
    font-weight: getCssVar('font-weight', 'semi-bold');
    line-height: 30px;
  }

  .ant-collapse > .ant-collapse-item {
    & > .ant-collapse-header,
    & > .ant-collapse-content {
      padding: 0 getCssVar('contacts', 'padding');
    }

    .ant-collapse-content-box {
      padding: 0;
    }
  }

  @include item-hover;

  @include e('delete') {
    cursor: pointer;
  }
}
