$auto-complete-option-height: 32px;

@include b(auto-complete) {
  position: fixed;
  background-color: var(--#{$rd-prefix}background-color);
  border-radius: var(--#{$rd-prefix}border-radius);
  box-shadow: var(--#{$rd-prefix}shadow-popup);

  @include e(list) {
    position: relative;
    max-height: 264px;
    padding: 4px 0;
    margin: 0;
    overflow: hidden auto;
    list-style: none;
  }

  @include e(option) {
    @include polyfill-column-gap(8px);

    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: $auto-complete-option-height;
    padding: 0 12px;
    cursor: pointer;
    transition: background-color var(--#{$rd-prefix}animation-duration-base) linear;

    &:not(.is-selected):hover {
      background-color: var(--#{$rd-prefix}background-color-hover);
    }

    @include when(disabled) {
      color: var(--#{$rd-prefix}color-disabled);
      pointer-events: none;
    }

    @include when(selected) {
      background-color: var(--#{$rd-prefix}background-color-primary);
    }
  }

  @include e(option-group) {
    padding: 0;
    margin: 0;
    list-style: none;
  }

  @include e(option-group-label) {
    display: flex;
    align-items: center;
    height: $auto-complete-option-height;
    padding: 0 12px;
    font-size: 0.9em;
    color: var(--#{$rd-prefix}text-color-sub);
  }

  @include e(option-content) {
    @include utils-ellipsis;

    flex: 1 0 0;
  }

  @include e(empty) {
    display: flex;
    align-items: center;
    height: $auto-complete-option-height;
    padding: 0 12px;
    color: var(--#{$rd-prefix}color-disabled);
  }

  @include e(loading) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: var(--#{$rd-prefix}color-primary);
    background-color: rgb(var(--#{$rd-prefix}background-color-rgb) / 80%);

    @include m(empty) {
      justify-content: flex-start;
      background-color: var(--#{$rd-prefix}background-color);
    }
  }
}
