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

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

.s-select--panel {
  display: none;
  position: absolute;
  left: 0;
  padding: 0.2em 0;
  color: $s-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 0.2s, opacity 0.2s;
    transform-origin: 0% 0%;
    &[data-placement="top"] {
      transform-origin: 0% 100%;
    }
  }
  &.animat--enter {
    opacity: 1;
    transform: scaleY(1);
  }
}

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

.s-optgroup {
  .s-optgroup--title {
    padding: 0 0.6em;
    color: $s-optgroup-title-color;
    font-size: 0.8em;
  }
}

.s-optgroup--wrapper {
  .s-select-option {
    padding: 0 1.6em;
  }
}

.s-select-option {
  padding: 0 0.8em;
  max-width: 800px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  &.is--checked {
    font-weight: 700;
    color: $s-primary-color;
  }
  &:not(.is--disabled) {
    cursor: pointer;
    &.is--hover {
      background-color: $s-select-option-hover-background-color;
    }
  }
  &.is--disabled {
    color: $s-disabled-color;
    cursor: no-drop;
  }
}

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

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