@use "../theme.scss" as *;

.select-list {
  user-select: none;
  box-sizing: border-box;
  margin: 0;
  margin-bottom: $form-control-vertical-gap;
  padding: 0;
  list-style: none;
  text-align: left;
  border-color: $select-list-border-color;
  border-width: $select-list-border-width;
  border-style: solid;
  background-color: $select-list-bg-color;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
  width: 100%;

  & .select-list-item {
    outline: 0;
    line-height: 1.6;
    padding-top: 0.38em;
    padding-bottom: 0.38em;
    cursor: pointer;
    color: $select-list-item-color;

    & > .select-list-item-label,
    & > .select-list-item-sub-label {
      padding-left: 0.9rem;
      padding-right: 0.9rem;
      padding-bottom: 0.1em;
      white-space: nowrap;
      text-decoration: none;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    &:hover,
    &:focus-visible {
      background-color: $select-list-item-bg-hover-color;

      & > .select-list-item-label {
        color: $select-list-item-hover-color;
      }

      & > .select-list-item-sub-label {
        color: $select-list-item-sub-label-hover-color;
      }
    }

    & > .select-list-item-sub-label {
      font-size: 0.95em;
      padding-top: 0;
      color: $select-list-item-sub-label-color;
    }

    &.selected,
    &.selected:hover,
    &.selected:focus-visible {
      background-color: $select-list-selected-item-bg-color;

      & > .select-list-item-label,
      & > .select-list-item-sub-label {
        color: $select-list-selected-item-color;
      }
    }

    &.highlighted,
    &.highlighted:hover,
    &.highlighted:focus-visible {
      background-color: $select-list-highlighted-item-bg-color;

      & > .select-list-item-label {
        color: $select-list-highlighted-item-color;
      }
      & > .select-list-item-sub-label {
        color: $select-list-highlighted-item-sub-label-color;
      }
    }

    &.disabled,
    &.disabled:hover,
    &.disabled:focus-visible {
      background-color: $select-list-disabled-item-bg-color;
      cursor: default;

      & > .select-list-item-label,
      & > .select-list-item-sub-label {
        color: $select-list-disabled-item-color;
      }
    }
  }

  & .separator {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    border-bottom-color: $select-list-separator-item-border-color;
    border-bottom-width: 1px;
    border-bottom-style: solid;

    &:hover,
    &:focus-visible {
      background-color: transparent;
    }
  }

  & .select-list-item-group-header {
    line-height: 1.4;
    padding-top: 0.1em;
    padding-bottom: 0.1em;

    & > .select-list-item-group-header-label {
      line-height: 1.6;
      padding-top: 0.2em;
      padding-bottom: 0.2em;
      padding-left: 0.5em;
      font-weight: 600;
      cursor: default;
    }
  }

}

.form-control-group .select-list {
  margin-bottom: 0;
}
