@import './base.less';

.@{css-prefix}.select {
  display: inline-block;
  background: #FFFFFF;
  border: 1px solid @input-border-color;
  line-height: @line-height;
  transition: box-shadow 0.1s ease, width 0.1s ease;
  border-radius: @border-radius;
  cursor: pointer;

  padding: @select-padding;
  position: relative;

  text-align: left;
  color: @base-font-color;
  font-size: 1em;
  min-width: @input-min-width;
  width: 100%;
  vertical-align: baseline;
  word-wrap: break-word;
  white-space: normal;
  outline: 0;
  .user-select(none);
  box-shadow: @input-box-shadow;

  + .select {
    margin-top: .5em;
  }

  //z-index: 3;

  &:hover {
    border-color: #C0C1C2;
  }
  &.active {
    border-color: @input-active-color;
    //border-bottom-left-radius: 0;
    //border-bottom-right-radius: 0;
  }

  .disabled;

  &.multiple {
    padding: @select-multiple-padding;

    > .text {
      margin: @select-multiple-child-margin;
    }

    > .tag {
      ~ input {
        margin: 0;
      }
    }
    
    > input {
      margin: @select-multiple-child-margin;
      width: 1em;
      position: static;
      padding: 0;
      line-height: @line-height;
    }

    &.search {
      > .text {
        position: absolute;
        display: inline-block;
        margin-left: @select-multiple-child-margin-left * 2;
      }
    }
  }

  > .tag {
    line-height: 1em;
    text-transform: none;
    background: #E8E8E8;
    cursor: pointer;
    display: inline-block;
    padding: .35em 0.6em;
    line-height: 1em;
    margin: @select-multiple-child-margin-vertical - .099 .35em;
    margin-left: 0;
    box-shadow: 0px 0px 0px 1px rgba(34, 36, 38, 0.15) inset;
    transition: background 0.1s ease;
    border: none;
    border-radius: @border-radius;
    color: rgba(0, 0, 0, 0.6);
    font-size: 1em;

    ~ input {
      margin-left: 0;
    }

    > i {
      opacity: .6;
      margin-left: 0.35em;
      cursor: pointer;
      display: inline-block;
      text-align: center;
      font-size: 0.9em;
      margin-top: -0.05em;
      &:hover {
        opacity: 1;
      }
    }
  }

  > .text {
    //min-width: 150px;
    cursor: text;
    position: relative;
    left: 0;
    z-index: 2;
    line-height: 1em;
    padding: .25em 0;
    overflow: hidden!important;
    text-overflow:ellipsis;
    white-space: nowrap;
    height: 21px;

    &.hint {
      opacity: .6;
    }
  }

  > input {
    padding: @select-padding;
    border: none;
    -webkit-tap-highlight-color: rgba(255,255,255,0);
    background: transparent;
    font-size: inherit;
    margin: 0;
    line-height: @line-height;
    vertical-align: baseline;
    width: 100%;
    position: absolute;
    z-index: 1;
    left: 0;
    top: 0;
    outline: 0;

    &:focus {
      border: none;
    }
  }

  > i {
    .icon-right;
    z-index: 2;
    position: absolute;
  }

  > .menu.vertical {
    position: absolute;
    top: calc(~"100% + 2px");
    left: 0;
    //border-color: @input-active-color;
    //border-top-width: 0;
    overflow: auto;
    margin: 0px -1px;
    min-width: calc(~"100% + 2px");
    width: auto;
    z-index: 10;
    max-height: 360px;

    > .item:first-child {
      border-top: 1px solid @menu-item-border-color;
    }
  }
}
