@use '../../sass/abstracts' as *;
@use '../../objects/checkbox/checkbox';

#{$object-prefix}select-list {
  @include body-medium;
  display: block;
  position: relative;
  color: $sodra-black-80;
  height: 3rem;

  // TODO: quick fix, test it
  #{$object-prefix}checkbox {
    display: flex;
  }

  input {
    pointer-events: none;
  }

  &[disabled='true'] {
    pointer-events: none;
    color: $sodra-black-40;

    #{$object-prefix}select-list__trigger {
      background-color: $sodra-black-20 !important;
    }
  }

  &:focus,
  &:focus-visible,
  &:focus-within {
    outline: none !important;
  }

  &:focus &__trigger,
  &:focus-visible &__trigger,
  &:focus-within &__trigger {
    outline: none !important;
    border-color: $sodra-black !important;
  }

  &__language-icon {
    background-color: $sodra-black-60;
    color: $white;
    font-size: 0.6rem;
    border-radius: 50%;
    line-height: 1.3rem;
    width: 1.3rem;
    text-align: center;
    display: inline-block;
    position: relative;
    top: -1px;
  }

  &__trigger {
    text-decoration: none;
    display: inline-block;
    padding-left: 1rem;
    padding-right: 3rem;
    box-sizing: border-box;
    background-color: $light-grey;
    width: 100%;
    line-height: 3rem;
    height: 3rem;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    padding-right: 2.5rem;
    border: 1px solid $sodra-black-25;
    @include no-select;

    &-arrow {
      padding: 0 1rem;
      position: absolute;
      right: 0;
      bottom: -1px;

      &::after {
        @include unity-symbols('keyboard-arrow-down', 0.75rem);
      }
    }
  }

  &__menu {
    display: none;
    background-color: $sodra-black-5;
    position: absolute;
    left: 0;
    top: 3rem;
    top: calc(3rem + 0px);
    min-width: 100%;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.05);
    max-height: 400px;
    overflow: auto;
    z-index: 3;
  }

  &__item,
  &__item-all {
    @include body-medium;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    float: left;
    width: 100%;
    cursor: pointer;
    min-height: 2rem;
    line-height: 1rem;
    padding: 0.75rem 1.25rem;

    box-sizing: border-box;
    &:hover {
      color: $black;
    }

    &--active {
      background-color: $sodra-black-10;
      color: $black;
    }
  }

  &__placeholder-text {
    font-weight: 600;
  }

  &__select-all-text {
    pointer-events: none;
  }

  &.is-open #{$object-prefix}select-list__menu {
    display: inline-block;
  }

  /*
  Overrides for grey modifier
*/
  &--light-grey &__trigger {
    background-color: $light-grey !important;
  }

  &--light-grey &__menu {
    background-color: $sodra-black-5 !important;
  }

  &--white &__trigger {
    background-color: $white !important;
  }

  &--white &__menu {
    background-color: $white !important;
  }
  /*
Overrides for small modifier
  */
  &--small {
    height: 2.5rem;
    line-height: 2.5rem;
  }

  &--small &__trigger {
    line-height: 2.5rem;
    height: 2.5rem;
  }

  &--small &__menu {
    top: 2.5rem;
  }

  /*
Overrides for small modifier
  */
  &--tiny {
    height: 1.75rem;
    line-height: 1.75rem;
  }

  &--tiny &__trigger {
    line-height: 1.75rem;
    height: 1.75rem;
  }

  &--tiny &__menu {
    top: 1.75rem;
  }
}
