.#{$boldr-ns}select {
  cursor: pointer;
  display: inline-block;
  font-size: 12px;
  line-height: 1.5;
  margin-right: 10px;
  outline: none;
  position: relative;
  text-align: left;
  user-select: none;
  width: 160px;
  vertical-align: middle;

  &.disabled {
    color: #cacaca;
    cursor: not-allowed;

    .#{$boldr-ns}select-input,
    .#{$boldr-ns}select-text,
    .#{$boldr-ns}select-tags {
      border-color: #e5e5e5;
      background-color: $select-c-bg-gray;

      &::after {
        opacity: 0.25;
      }
    }
  }
}

.#{$boldr-ns}select-input,
.#{$boldr-ns}select-text,
.#{$boldr-ns}select-tags {
  box-sizing: border-box;
  border: 1px solid $select-c-border;
  border-radius: 2px;
  display: inline-block;
  min-height: 30px;
  max-height: 76px;
  outline: none;
  padding: 5px 10px;
  transition: border-color 0.25s;
  width: 100%;
  background-color: #fff;
  position: relative;
}

.#{$boldr-ns}select-simple {
  color: $select-c-blue;

  &::after {
    content: '';
    border-left: 4px solid transparent;
    border-top: 6px solid $select-c-blue;
    border-right: 4px solid transparent;
    display: inline-block;
    margin-left: 5px;
    height: 1px;
    transition: transform 0.25s;
  }
}

.#{$boldr-ns}select-text {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding: 5px 20px 5px 10px;

  &::after {
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAMAAAC38k/IAAAAM1BMVEUAAAAzMzMzMzMzMzMzMzMzMzM0NDQ0NDQ1NTU1NTU9PT1VVVU0NDQzMzMzMzM1NTUzMzOoQ7gOAAAAEHRSTlMA99vkxpd9STUhCgPOzGhlqqcGJgAAAEBJREFUCNdFy8kRwCAMwEDZ3JDD/VebCXhgf3qIR83pi9gmXCduyokCyVwCuvrfAarMuzLlPzLLiGZx4FoIDeADc4gEoYNfTDsAAAAASUVORK5CYII=)
      no-repeat;
    background-size: 6px 5px;
    content: '';
    height: 5px;
    margin-top: -3px;
    position: absolute;
    right: 10px;
    top: 50%;
    transition: transform 0.25s;
    width: 6px;
  }
}

.#{$boldr-ns}select-tags {
  padding: 2px 5px;
  overflow-y: auto;
  margin-bottom: -5px;
  line-height: 24px;

  &::-webkit-scrollbar {
    display: none;
  }

  .#{$boldr-ns}select-inner {
    border: 0;
    display: inline-block;
    outline: none;
  }

  .#{$boldr-ns}select-tag {
    background-color: $select-c-bg-gray;
    border: 1px solid $select-c-border;
    border-radius: 2px;
    display: inline-block;
    margin: 2px 0;
    margin-right: 2px;
    padding: 0 4px;
    line-height: 18px;
  }

  .#{$boldr-ns}select-delete {
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAACampqbm5uZmZn/DnGVAAAAA3RSTlMAnUqokJgHAAAAPklEQVQI12PQYACivQwMdQz7HRj/MchfYP/CwP5F/gID4996BwaG+r8MDAzyXyAEmAuWACsBKwZrAxsANgoAoL4XU6vB5h4AAAAASUVORK5CYII=)
      no-repeat;
    background-size: 8px;
    display: inline-block;
    height: 8px;
    margin-left: 2px;
    width: 8px;
  }
}

.#{$boldr-ns}select-popup {
  box-shadow: 0 1px 4px $select-c-half-black;
  left: 0;
  outline: none;
  overflow-y: auto;
  position: absolute;
  width: 100%;
  z-index: 1;
  margin-top: 2px;
  background-color: $select-c-white;
  max-height: 224px;

  &::-webkit-scrollbar {
    display: none;
  }

  .#{$boldr-ns}select-option,
  .#{$boldr-ns}select-filter,
  .#{$boldr-ns}select-empty {
    background-color: $select-c-white;
    display: block;
    outline: none;
    padding: 5px 10px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  .#{$boldr-ns}select-search {
    position: relative;
    box-sizing: border-box;

    &::before {
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAM1BMVEUAAABmZmZmZmZnZ2dnZ2dmZmZnZ2dmZmZsbGxnZ2dmZmZoaGhnZ2dmZmZnZ2dmZmZmZmYOy3DdAAAAEHRSTlMAVttEnOWJNwzzpVHsz8ZQ9cP58AAAAItJREFUKM+FkdsSgCAIRFXEa7f//9okSsqRaZ8WjrOoGJYtLmdXrPmquuOWq+9+OF4KQ39C6lX6mFL0l33SKB+BPSDNYW/pEPWZUMV3K5QjAymt9KQoIPas3FwSkFqZNbBoUZs23GvXBeWBq/YlQT5xkP0nsqg1dCKrXTYPzQkZxGTXCJoZ0YDZEeEEs9MNoPE7LN4AAAAASUVORK5CYII=)
        no-repeat;
      background-position: center;
      background-size: 12px;
      content: '';
      height: 100%;
      left: 10px;
      position: absolute;
      width: 12px;
    }
  }

  .#{$boldr-ns}select-filter {
    border-color: $select-c-light-border;
    border-style: solid;
    border-width: 0 0 1px;
    padding-left: 30px;
    width: 100%;
    box-sizing: border-box;
    height: 30px;
  }

  .#{$boldr-ns}select-option {
    &.current,
    &:hover {
      background-color: $select-c-blue;
      border-color: $select-c-blue;
      color: $select-c-white;
    }

    &.active {
      color: $select-c-blue;
    }

    &.active:hover,
    &.active.current {
      color: $select-c-white;
    }
  }

  .#{$boldr-ns}select-empty {
    color: $select-c-light-gray;
  }
}

.has-error {
  :not(.no-error) {
    & > .#{$boldr-ns}select-input,
    & > .#{$boldr-ns}select-text,
    & > .#{$boldr-ns}select-tags {
      border: 1px solid $select-error-border-color;
      color: #f44;
    }
  }
}


.selectfield-component {
  display: inline-block;
  position: relative;

  label {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    color: #233040;
    // font-family: proxima_nova;
    font-weight: 200;
  }

  .selectfield-value {
    background-color: $white;
    border: 2px solid $neutral-3;
    border-radius: 3px;
    color: $primary-4;
    cursor: pointer;
    background: $white;
    position: relative;
    padding: 10px 29px 10px 10px;
    user-select: none;
    transition: border-color ease-in-out .15s;

    > svg:last-of-type {
      position: absolute;
      right: 10px;
      top: 13px;
      transform: rotate(0);
    }

    > .icon {
      left: 10px;
      position: absolute;
      top: 50%;
      transform: translate(0, -50%);
    }

    &:hover {
      border-color: rgba($neutral-4, .4);
    }

    &:focus {
      border-color: rgba($neutral-4, .6);
      outline: 0;
    }
  }

  .display-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
  }

  ul {
    background-color: $white;
    border-radius: 3px;
    box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    margin: 3px 0 30px;
    overflow: auto;
    padding: 0;
    position: absolute;
    width: 100%;
    max-height: 152px;
    z-index: 3;

    li {
      @include vertical-align('block');
      color: $primary-4;
      cursor: pointer;
      display: block;
      padding: 10px;
      text-decoration: none;
      min-height: 18px;

      svg {
        margin-right: 10px;
      }

      &:not(.not-clickable):hover {
        svg {
          fill: $white;
        }
        background-color: $primary-1;
        color: $white;
      }

      &.not-clickable {
        cursor: default;
      }

      &.hidden {
        display: none;
      }
    }

    // @media #{$media-small-minus} {
    //   left: 0;
    //   min-width: 100%;
    // }
  }

  &.selectfield-disabled {
    cursor: not-allowed;

    > div {
      background-color: rgba($neutral-3, .6);
      border-color: $neutral-3;
      cursor: not-allowed;

      > svg {
        fill: $neutral-4;
      }
    }

    > ul {
      display: none;
    }

    &:hover .selectfield-value {
      border-color: $neutral-3;
    }
  }

  &.selectfield-error {
    > div {
      border-color: $danger;
    }
  }

  &.active:not(.selectfield-disabled) {
    .selectfield-value {
      border-color: rgba($neutral-4, .6);

      > svg:last-of-type {
        transform: rotate(180deg);
      }
    }
    ul {
      display: inline-block;
    }
  }

  &.has-icon .selectfield-value {
    padding-left: 35px;
  }

  &.fill {
    width: 100%;
  }

  // @media #{$media-small-minus} {
  //   min-width: 100%;
  // }
}
