/**Variable**/
@import './helpers/mixin.scss';
@import './base/loading.scss';

.vhb-select {
  position: relative;
  display: inline-block;
  width: 180px;
  color: $vhb-font-color;
  text-align: left;
  & > .vhb-input {
    .vhb-input--inner {
      cursor: pointer;
    }
  }
  &.is--disabled {
    & > .vhb-input {
      .vhb-input--inner {
        cursor: no-drop;
      }
    }
  }
  &.is--loading {
    & > .vhb-input {
      .vhb-input--inner {
        cursor: progress;
      }
    }
  }
  & > .vhb-input {
    width: 100%;
    .vhb-input--suffix-icon {
      @include animatTransition(transform, .2s);
    }
  }
  &.is--active {
    & > .vhb-input {
      .vhb-input--inner {
        border: 1px solid $vhb-primary-color;
      }
    }
  }
}

.vhb-select-slots {
  display: none;
}

.vhb-select--panel {
  display: none;
  position: absolute;
  left: 0;
  padding: 4px 0;
  color: $vhb-font-color;
  text-align: left;
  &:not(.is--transfer) {
    min-width: 100%;
  }
  &.is--transfer {
    position: fixed;
  }
  &.animat--leave {
    display: block;
    opacity: 0;
    transform: scaleY(0.5);
    transition: transform .3s cubic-bezier(.23,1,.32,1), opacity .3s cubic-bezier(.23,1,.32,1);
    transform-origin: center top;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    &[placement="top"] {
      transform-origin: center bottom;
    }
  }
  &.animat--enter {
    opacity: 1;
    transform: scaleY(1);
  }
}

.vhb-select-option--wrapper {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 0;
  max-height: 200px;
  border-radius: $vhb-border-radius;
  border: 1px solid $vhb-table-popup-border-color;
  box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
  background-color: $vhb-select-panel-background-color;
}

.vhb-optgroup {
  .vhb-optgroup--title {
    padding: 0 6px;
    color: $vhb-optgroup-title-color;
    font-size: 12px;
  }
}

.vhb-optgroup--wrapper {
  .vhb-select-option {
    padding: 0 20px;
  }
}

.vhb-select-option {
  padding: 0 10px;
  max-width: 600px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
  &.is--selected {
    font-weight: 700;
    color: $vhb-primary-color;
  }
  &:not(.is--disabled) {
    cursor: pointer;
    &.is--hover {
      background-color: $vhb-select-option-hover-background-color;
    }
  }
  &.is--disabled {
    color: $vhb-disabled-color;
    cursor: no-drop;
  }
}

.vhb-select--empty-placeholder {
  padding: 0 10px;
  text-align: center;
  color: $vhb-select-empty-color;
}

.vhb-select,
.vhb-select--panel {
  font-size: $vhb-font-size;
  &.size--medium {
    font-size: $vhb-font-size-medium;
  }
  &.size--small {
    font-size: $vhb-font-size-small;
  }
  &.size--mini {
    font-size: $vhb-font-size-mini;
  }
}

.vhb-select--panel {
  .vhb-optgroup--title,
  .vhb-select-option {
    height: $vhb-select-option-height-default;
  }
  .vhb-optgroup--title,
  .vhb-select-option,
  .vhb-select--empty-placeholder {
    line-height: $vhb-select-option-height-default;
  }
  &.size--medium {
    .vhb-optgroup--title,
    .vhb-select-option {
      height: $vhb-select-option-height-medium;
    }
    .vhb-optgroup--title,
    .vhb-select-option,
    .vhb-select--empty-placeholder {
      line-height: $vhb-select-option-height-medium;
    }
  }
  &.size--small {
    .vhb-optgroup--title,
    .vhb-select-option {
      height: $vhb-select-option-height-small;
    }
    .vhb-optgroup--title,
    .vhb-select-option,
    .vhb-select--empty-placeholder {
      line-height: $vhb-select-option-height-small;
    }
  }
  &.size--mini {
    .vhb-optgroup--title,
    .vhb-select-option {
      height: $vhb-select-option-height-mini;
    }
    .vhb-optgroup--title,
    .vhb-select-option,
    .vhb-select--empty-placeholder {
      line-height: $vhb-select-option-height-mini;
    }
  }
}
