@import "animation";
@import "colors";

@grey-text: #333;
@placeholder-text: #999;
@disabled-text: #ccc;

@border-radius: 2px;
@highlight-color: #FFE684;

.cm-select{
  font-size: 12px;
  display: inline-block;
  position: relative;
  line-height: initial;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

  .cm-select-value{
    padding: 4px 16px 4px 6px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: @border-radius;
    color: @grey-text;
    min-width: 162px;
    display: block;
    background-color: #fff;
    background-image: none;
    transition: border-color ease-in-out .15s;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    &.placeholder{
      color: @placeholder-text;
    }
  }
  .cm-select-value-text{
    width: 100%;
    height: 100%;
    overflow: hidden;
    white-space: nowrap;
    display: inline-block;
    line-height: 17px;
    vertical-align: middle;
  }

  .cm-select-cert{
    position: absolute;
    display: inline-block;
    width: 9px;
    height: 14px;
    right: 5px;
    top: 8px;
    cursor: pointer;
    font: normal normal normal 14px/1 FontAwesome;
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    &:before {
      content: '\f107';
      width: 9px;
      height: 14px;
      position: absolute;
      right: 0;
      top: 0;
      z-index: 0;
      .transition(0.3s);
      -webkit-transform-origin:center center;
      -moz-transform-origin:center center;
      -ms-transform-origin:center center;
      -o-transform-origin:center center;
      transform-origin:center center;
    }
  }

  .cm-select-options-wrap{
    position: absolute;
    top: 30px;
    overflow: hidden;
    left: -10px;
    right: -10px;
    z-index: 1000;
  }

  .cm-select-options {
    display: none;
    .transition(0.45s);
    .translate(0, -100%);
    margin: 0 10px 10px 10px;
    background: @color-white;
    max-height: 300px;
    overflow-x: hidden;
    -webkit-box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
    -moz-box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
    box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;

    ul {
      margin: 0;
      padding: 0;
      list-style: none;
      li {
        position: relative;
        a {
          display: inline-block;
          padding: 5px 10px;
          width: 100%;
          height: 100%;
          -webkit-transition: background .3s ease;
          transition: background .3s ease;
          color: #888;
          color: rgba(0,0,0,0.65);
          &:hover{
            background-color: #ecf6fd;
            font-weight: 400;
          }
        }
        &.active a{
          background-color: #f7f7f7;
          font-weight: 700;
        }
      }
    }
  }

  &.hasEmptyOption{
    ul li:first-child {
      border-bottom: 1px solid #ccc;
    }
  }

  &.active {
    .cm-select-cert:before {
      .rotate(180deg);
    }
    .cm-select-options{
      .translate(0, 0);
    }
  }
  &.dropup{
    .cm-select-options-wrap {
      top: auto;
      bottom: 30px;
    }
    .cm-select-options {
      margin: 5px 10px 0 10px;
      .translate(0, 100%);
      -webkit-box-shadow: rgba(0, 0, 0, 0.117647) 0px -1px 6px, rgba(0, 0, 0, 0.117647) 0px -1px 4px;
      -moz-box-shadow: rgba(0, 0, 0, 0.117647) 0px -1px 6px, rgba(0, 0, 0, 0.117647) 0px -1px 4px;
      box-shadow: rgba(0, 0, 0, 0.117647) 0px -1px 6px, rgba(0, 0, 0, 0.117647) 0px -1px 4px;
    }

    &.active {
      .cm-select-options {
        .translate(0, 0);
      }
    }
  }
  &.disabled{
    .cm-select-value{
      border-color: #eee;
      color: #ccc;
      cursor: default;
    }
    .cm-select-cert:before {
      border-top-color: #eee;
    }
  }
  &.cm-autocomplete{
    .cm-select-value{
      display: inline-block;
      -webkit-user-select: initial;
      -moz-user-select: initial;
      -ms-user-select: initial;
      user-select: initial;
    }
  }
}

.invalid {
  .cm-select .cm-select-value{
    border-color: #E05B5B;
  }
}