@import '../../style/themes';
@import '../../style/mixins';

@import '../../input/style/mixin';

.x-select {
  @include reset-component();
  position: relative;
  display: inline-block;
  width: 100%;

  &_selector {
    display: flex;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    padding: 0 $padding-sm;
    border: $select-selector-border;
  }

  &-focus &_selector {
    @include hover();
  }


  &-single &_selector {
    height: 32px;
  }

  &-multiple &_selector {
    min-height: 32px;
    // padding: 2px 4px;
  }

  &-clear {
    position: absolute;
    top: 50%;
    right: $padding-sm;
    padding: $padding-xs;
    margin-right: - $padding-xs;
    transform: translateY(-50%);
    cursor: pointer;
  }

  &-arrow {
    position: absolute;
    top: 50%;
    right: $padding-sm;
    width: 10px;
    text-align: center;
    transform: translateY(-50%);
    pointer-events: none;
  }

  &-filterable {
    cursor: text;
  }

  &-dropdown {
    border: $select-dropdown-border;
    padding: $margin-xss 2px;
    box-sizing: border-box;
    background-color: $select-dropdown-bg;
    // box-shadow: $box-shadow-base;
  }

  &-option {
    display: flex;
    align-items: center;
    padding: 0 $padding-sm;
    margin-top: 2px;
    min-height: 32px;
    cursor: default;
    &:hover {
      background-color: $select-option-hover-bg;
    }
    &-selected {
      background-color: rgba($select-option-selected-bg, .6);
      &:hover {
        background-color: rgba($select-option-selected-bg, .8);
      }
    }
    &-disabled {
      opacity: .4;
      filter: grayscale(40%);
      pointer-events: none;
    }
  }

  &-disabled {
    pointer-events: none;
  }

  &-disabled &_selector {
    color: rgba($text-color, .4);
    background: $input-disabled-bg;
    border-color: transparent;
  }

  &-placeholder {
    color: $text-color-secondary;
  }

  &_tag {
    margin-right: 4px;
  }

  &_text {
    //display: flex;
    align-items: center;
    &::after {
      content: '\a0';
    }
  }
  
  &_search {
    flex: 1 0 30px;
    &_input {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      border: none;
      outline: none;
      background: transparent;
      cursor: auto;
    }
  }

  &-multiple &_search {
    flex-basis: 4px;
  }
  &-single &_search {
    position: absolute;
    top: 0;
    bottom: 0;
    left: $padding-sm;
    right: $padding-sm;
  }

}