@use '../../_styles/variables' as *;
@use "pkg:@ohu-mobile/styles" as *;
@use '../../_styles/mixins' as *;
$selectPrefixClass: #{$prefix}select;

.#{$selectPrefixClass} {
  display: inline-flex;
  position: relative;
  &__popup {
    width: 100%;
    background: $selectPopupBackground;
    box-sizing: border-box;
    @include safe-bottom;
    &__content {
      overflow-y: scroll;
      -webkit-overflow-scrolling: touch;
      // Don't support minorText property of Header
      max-height: calc(100% - 90px);
    }
    .#{$prefix}popup-header {
      background: $selectPopupHeaderBackground;
      &__text {
        color: $selectPopupHeaderColor;
      }
    }
  }
  &.is-disabled {
    .#{$selectPrefixClass}__input, select {
      opacity: .5;
      cursor: not-allowed;
    }
  }
  &__input {
    width: 100%;
    box-sizing: border-box;
    font-size: $selectFontSize;
    font-weight: normal;
    line-height: 1.375em;
    border: 0;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    &.is-normal {
      padding: $selectInputPadding;
    }
    &.is-outline {
      padding: $selectInputOutlinePadding;
    }
    &.has-border.is-normal {
      @include hair-border($selectBorderColor, all, $selectBorderRadius);
    }
    &.has-border.is-outline {
      border-style: solid;
      @include hair-border($inputBorderColor, bottom);
    }
    &__control {
      color: $selectColor;
      min-height: 1.375em;
      flex-grow: 1;
    }
    &__placeholder {
      color: $selectPlaceholderColor;
      flex-grow: 1;
    }
    &__icon {
      margin-left: $selectIconMargin;
      width: 1.5em;
      height: 1.5em;
      color: $selectIconColor;
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      justify-content: center;
      .#{$prefix}icon {
        font-size: 1.3em;
      }
      &.is-close {
        .#{$prefix}icon {
          font-size: 1.125em;
        }
      }
    }
    select {
      position: absolute;
      font-size: $selectFontSize;
      top: 0;
      left: 0;
      outline: 0;
      width: 100%;
      height: 100%;
      opacity: 0;
      user-select: none;
      background: none;
      -webkit-appearance: none;
    }
  }
}
