@import '../style/functions.scss';
@import '../style/theme.scss';
@import '../style/mixins.scss';

$select-prefix: 'dk-select';

.#{$select-prefix} {
  @include reset-component();
  display: inline-block;

  &-icon {
    transform: rotate(0deg);
    transition: transform 200ms linear;

    &-visible {
      transform: rotate(180deg);
    }
  }

  &-panel {
    position: absolute;
    top: 100%;
    left: 0;
    max-height: $select-panel-height;
    margin-top: 5px;
    box-shadow: $select-panel-shadow;
    background-color: $white;
    border-radius: $border-radius;
    transition: $select-panel-transition;
    transform-origin: center top;
    box-sizing: border-box;
    z-index: $zindex-select;
    overflow: scroll;

    &-enter {
      opacity: 0;
      transform: scaleY(0);
    }

    &-enter-active {
      opacity: 1;
      transform: scaleY(1);
    }

    &-exit {
      opacity: 1;
      transform: scaleY(1);
    }

    &-exit-active {
      opacity: 0;
      transform: scaleY(0);
    }
  }

  &-option {
    height: $select-option-height;
    padding: $input-padding-y $input-padding-x;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
    background: $white;
    box-sizing: border-box;
    color: $select-color;
    line-height: 20px;
    transition: $select-option-transition;

    &:hover {
      background: $select-option-hover-bg;
    }

    &-active {
      background: $select-option-active-bg;
      font-weight: bold;
      transition: none;

      &:hover {
        background: $select-option-active-bg;
      }
    }

    &-disabled {
      color: lighten($select-color, 20%);
      cursor: not-allowed;
      transition: none;

      &:hover {
        background: $white;
      }
    }
  }

  &-group {

    &-title {
      display: flex;
      align-items: center;
      height: $select-option-group-height;
      opacity: 0.7;
      color: $select-color;
      padding-left: $input-padding-x;
    }

    &-list {
      .#{$select-prefix}-option {
        padding-left: $input-padding-x + 8px;
      }
    }
  }
}