@use 'sass:map';
@use 'mixins/mixins' as *;
@use 'mixins/function' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

@include b(contacts-select) {
  display: inline-block;
  width: 100%;

  @include set-component-css-var('contacts', $contacts);
  @include set-component-css-var('contacts-select', $contacts-select);

  $padding: getCssVar('contacts-select', 'padding');
  $footer-height: getCssVar('contacts-select', 'footer-height');
  $divider: getCssVar('contacts-select', 'divider');

  @include e(modal) {
    width: min(875px, 100%);
    max-height: 90vh;

    .ant-modal-content {
      padding: 0;
    }

    .ant-modal-header {
      display: flex;
      align-items: center;
      height: getCssVar('contacts-select', 'header-height');
      padding: 0 $padding;
      margin-bottom: 0;
      border-bottom: $divider;
    }

    .ant-modal-footer {
      display: flex;
      align-items: center;
      justify-content: end;
      height: $footer-height;
      padding: 0 $padding;
      margin-top: 0;
      border-top: $divider;
    }

    .ant-modal-title {
      font-size: getCssVar('font-size', 'medium');
      font-weight: getCssVar('font-weight', 'semi-bold');
    }

    .ant-modal-body {
      position: relative;
      min-height: 100px;

      @include e(all-select) {
        position: absolute;
        bottom: calc($footer-height / 2 * -1);
        left: $padding;
        z-index: 10;
        line-height: 1;
        transform: translate(0, 50%);
      }
    }
  }

  @include e(input-wrap) {
    position: relative;
    width: 100%;
    cursor: pointer;

    &.is-input {
      min-height: 32px;
      overflow: hidden;
      line-height: 32px;
      background: #fff;
      border: 1px solid getCssVar('border-color', '');
      border-radius: 6px;

      &:hover {
        border-color: getCssVar('color', 'primary');
      }

      .ant-input {
        pointer-events: none;
        user-select: none;
        border: none;
      }

      .is-select-wrap {
        position: relative;
        max-height: 90px;
        padding: 4px 32px 4px 11px;
        overflow: hidden auto;
        font-size: 12px;

        .ant-flex {
          flex-wrap: wrap;
        }
      }

      .is-select-tag {
        max-width: 250px;
        height: 24px;
        margin: 0;
        overflow: hidden;
        font-size: 12px;
        line-height: 24px;
        color: rgb(0 0 0 / 65%);
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: default;
        background-color: #fafafa;

        &.is-no-multiple {
          padding: 0;
          margin: 0;
          background: transparent;
        }

        img.is-select-tag-primary-icon {
          width: 16px;
          height: 16px;
        }
      }

      .is-select-close {
        position: absolute;
        top: 50%;
        right: 11px;
        z-index: 1;
        display: inline-block;
        width: 12px;
        height: 12px;
        margin-top: -6px;
        font-size: 12px;
        font-style: normal;
        line-height: 12px;
        color: rgb(0 0 0 / 25%);
        text-align: center;
        text-transform: none;
        cursor: pointer;
        background: #fff;
        opacity: 0;
        transition:
          color 0.3s ease,
          opacity 0.15s ease;
        text-rendering: auto;
      }

      &:hover .is-select-close {
        opacity: 1;

        &:hover {
          color: rgb(0 0 0 / 75%);
        }
      }
    }
  }
}
