@selectPrefixCls: rc-tree-select;

.effect() {
  animation-duration: 0.3s;
  animation-fill-mode: both;
  transform-origin: 0 0;
}

.@{selectPrefixCls} {
  box-sizing: border-box;
  display: inline-block;
  position: relative;
  vertical-align: middle;
  color: #666;

  &-allow-clear {
    .@{selectPrefixCls}-selection--single .@{selectPrefixCls}-selection__rendered {
      padding-right: 40px;
    }
  }

  ul,
  li {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  > ul > li > a {
    padding: 0;
    background-color: #fff;
  }

  // arrow
  &-arrow {
    height: 26px;
    position: absolute;
    top: 1px;
    right: 1px;
    width: 20px;
    &:after {
      content: '';
      border-color: #999999 transparent transparent transparent;
      border-style: solid;
      border-width: 5px 4px 0 4px;
      height: 0;
      width: 0;
      margin-left: -4px;
      margin-top: -2px;
      position: absolute;
      top: 50%;
      left: 50%;
    }
  }

  &-selection {
    outline: none;
    user-select: none;
    -webkit-user-select: none;

    box-sizing: border-box;
    display: block;

    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #d9d9d9;

    &__clear {
      font-weight: bold;
      position: absolute;
    }
  }

  &-enabled {
    .@{selectPrefixCls}-selection {
      &:hover {
        border-color: #23c0fa;
        box-shadow: 0 0 2px fadeout(#2db7f5, 20%);
      }
      &:active {
        border-color: #2db7f5;
      }
    }

    &.@{selectPrefixCls}-focused {
      .@{selectPrefixCls}-selection {
        //border-color: #23c0fa;
        border-color: #7700fa;
        box-shadow: 0 0 2px fadeout(#2db7f5, 20%);
      }
    }
  }

  &-selection--single {
    height: 28px;
    cursor: pointer;
    position: relative;

    .@{selectPrefixCls}-selection__rendered {
      display: block;
      padding-left: 10px;
      padding-right: 20px;
      line-height: 28px;
    }

    .@{selectPrefixCls}-selection-selected-value {
      display: block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .@{selectPrefixCls}-selection__clear {
      top: 5px;
      right: 20px;
      &:after {
        content: '×';
      }
    }
  }

  &-disabled {
    color: #ccc;
    cursor: not-allowed;

    .@{selectPrefixCls}-selection--single,
    .@{selectPrefixCls}-selection__choice__remove {
      cursor: not-allowed;
      color: #ccc;

      &:hover {
        cursor: not-allowed;
        color: #ccc;
      }
    }
  }

  &-search__field__wrap {
    display: inline-block;
    position: relative;
  }

  &-search__field__placeholder {
    display: block;
    position: absolute;
    top: 0;
    left: 3px;
    color: #aaa;
  }

  &-search__field__mirror {
    position: absolute;
    top: 0;
    left: -9999px;
    white-space: pre;
    pointer-events: none;
  }

  &-search--inline {
    float: left;
    width: 100%;
    .@{selectPrefixCls}-search__field__wrap {
      width: 100%;
    }
    .@{selectPrefixCls}-search__field {
      border: none;
      font-size: 100%;
      //margin-top: 5px;
      background: transparent;
      outline: 0;
      width: 100%;
    }
    > i {
      float: right;
    }
  }

  &-enabled&-selection--multiple {
    cursor: text;
  }

  &-selection--multiple {
    min-height: 28px;

    .@{selectPrefixCls}-search--inline {
      width: auto;
      .@{selectPrefixCls}-search__field {
        width: 0.75em;
      }
    }

    .@{selectPrefixCls}-search__field__placeholder {
      top: 5px;
      left: 8px;
    }

    .@{selectPrefixCls}-selection__rendered {
      //display: inline-block;
      overflow: hidden;
      text-overflow: ellipsis;
      padding-left: 8px;
      padding-bottom: 2px;
      padding-right: 10px;
    }

    > ul > li {
      margin-top: 4px;
      height: 20px;
      line-height: 20px;
    }

    .@{selectPrefixCls}-selection__clear {
      top: 5px;
      right: 8px;
    }
  }

  &-enabled {
    .@{selectPrefixCls}-selection__choice {
      cursor: default;
      &:hover {
        .@{selectPrefixCls}-selection__choice__remove {
          opacity: 1;
          transform: scale(1);
        }
        .@{selectPrefixCls}-selection__choice__remove
          + .@{selectPrefixCls}-selection__choice__content {
          margin-left: -8px;
          margin-right: 8px;
        }
      }
    }
  }

  & &-selection__choice {
    background-color: #f3f3f3;
    border-radius: 4px;
    float: left;
    padding: 0 15px;
    margin-right: 4px;
    position: relative;
    overflow: hidden;
    transition: padding 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045),
      width 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);

    &__content {
      margin-left: 0;
      margin-right: 0;
      transition: margin 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    }

    &-zoom-enter,
    &-zoom-appear,
    &-zoom-leave {
      .effect();
      opacity: 0;
      animation-play-state: paused;
      animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    &-zoom-leave {
      opacity: 1;
      animation-timing-function: cubic-bezier(0.6, -0.28, 0.735, 0.045);
    }

    &-zoom-enter.@{selectPrefixCls}-selection__choice-zoom-enter-active,
    &-zoom-appear.@{selectPrefixCls}-selection__choice-zoom-appear-active {
      animation-play-state: running;
      animation-name: rcSelectChoiceZoomIn;
    }

    &-zoom-leave.@{selectPrefixCls}-selection__choice-zoom-leave-active {
      animation-play-state: running;
      animation-name: rcSelectChoiceZoomOut;
    }

    @keyframes rcSelectChoiceZoomIn {
      0% {
        transform: scale(0.6);
        opacity: 0;
      }
      100% {
        transform: scale(1);
        opacity: 1;
      }
    }

    @keyframes rcSelectChoiceZoomOut {
      to {
        transform: scale(0);
        opacity: 0;
      }
    }

    &__remove {
      color: #919191;
      cursor: pointer;
      font-weight: bold;
      padding: 0 0 0 8px;
      position: absolute;
      opacity: 0;
      transform: scale(0);
      top: 0;
      right: 2px;
      transition: opacity 0.3s, transform 0.3s;

      &:before {
        content: '×';
      }

      &:hover {
        color: #333;
      }
    }
  }

  &-dropdown {
    background-color: white;
    border: 1px solid #d9d9d9;
    box-shadow: 0 0px 4px #d9d9d9;
    border-radius: 4px;
    box-sizing: border-box;
    z-index: 100;
    left: -9999px;
    top: -9999px;
    //border-top: none;
    //border-top-left-radius: 0;
    //border-top-right-radius: 0;
    position: absolute;
    outline: none;

    &-hidden {
      display: none;
    }

    &-menu {
      outline: none;
      margin: 0;
      padding: 0;
      list-style: none;
      z-index: 9999;

      > li {
        margin: 0;
        padding: 0;
      }

      &-item-group-list {
        margin: 0;
        padding: 0;

        > li.@{selectPrefixCls}-menu-item {
          padding-left: 20px;
        }
      }

      &-item-group-title {
        color: #999;
        line-height: 1.5;
        padding: 8px 10px;
        border-bottom: 1px solid #dedede;
      }

      li&-item {
        margin: 0;
        position: relative;
        display: block;
        padding: 7px 10px;
        font-weight: normal;
        color: #666666;
        white-space: nowrap;

        &-selected {
          background-color: #ddd;
        }

        &-active {
          background-color: #5897fb;
          color: white;
          cursor: pointer;
        }

        &-disabled {
          color: #ccc;
          cursor: not-allowed;
        }

        &-divider {
          height: 1px;
          margin: 1px 0;
          overflow: hidden;
          background-color: #e5e5e5;
          line-height: 0;
        }
      }
    }

    &-slide-up-enter,
    &-slide-up-appear {
      .effect();
      opacity: 0;
      animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
      animation-play-state: paused;
    }

    &-slide-up-leave {
      .effect();
      opacity: 1;
      animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
      animation-play-state: paused;
    }

    &-slide-up-enter&-slide-up-enter-active&-placement-bottomLeft,
    &-slide-up-appear&-slide-up-appear-active&-placement-bottomLeft {
      animation-name: rcSelectDropdownSlideUpIn;
      animation-play-state: running;
    }

    &-slide-up-leave&-slide-up-leave-active&-placement-bottomLeft {
      animation-name: rcSelectDropdownSlideUpOut;
      animation-play-state: running;
    }

    &-slide-up-enter&-slide-up-enter-active&-placement-topLeft,
    &-slide-up-appear&-slide-up-appear-active&-placement-topLeft {
      animation-name: rcSelectDropdownSlideDownIn;
      animation-play-state: running;
    }

    &-slide-up-leave&-slide-up-leave-active&-placement-topLeft {
      animation-name: rcSelectDropdownSlideDownOut;
      animation-play-state: running;
    }

    @keyframes rcSelectDropdownSlideUpIn {
      0% {
        opacity: 0;
        transform-origin: 0% 0%;
        transform: scaleY(0);
      }
      100% {
        opacity: 1;
        transform-origin: 0% 0%;
        transform: scaleY(1);
      }
    }
    @keyframes rcSelectDropdownSlideUpOut {
      0% {
        opacity: 1;
        transform-origin: 0% 0%;
        transform: scaleY(1);
      }
      100% {
        opacity: 0;
        transform-origin: 0% 0%;
        transform: scaleY(0);
      }
    }

    @keyframes rcSelectDropdownSlideDownIn {
      0% {
        opacity: 0;
        transform-origin: 0% 100%;
        transform: scaleY(0);
      }
      100% {
        opacity: 1;
        transform-origin: 0% 100%;
        transform: scaleY(1);
      }
    }
    @keyframes rcSelectDropdownSlideDownOut {
      0% {
        opacity: 1;
        transform-origin: 0% 100%;
        transform: scaleY(1);
      }
      100% {
        opacity: 0;
        transform-origin: 0% 100%;
        transform: scaleY(0);
      }
    }
  }

  &-dropdown-search {
    display: block;
    padding: 4px;
    .@{selectPrefixCls}-search__field__wrap {
      width: 100%;
    }
    .@{selectPrefixCls}-search__field__placeholder {
      top: 4px;
    }
    .@{selectPrefixCls}-search__field {
      padding: 4px;
      width: 100%;
      box-sizing: border-box;
      border: 1px solid #d9d9d9;
      border-radius: 4px;
      outline: none;
    }
    &.@{selectPrefixCls}-search--hide {
      display: none;
    }
  }

  &-open {
    .@{selectPrefixCls}-arrow:after {
      border-color: transparent transparent #888 transparent;
      border-width: 0 4px 5px 4px;
    }
  }

  &-not-found {
    display: inline-block;
    padding: 8px;
  }
}

.custom-icon-demo {
  .@{selectPrefixCls} {
    &-selection__choice__remove {
      &:before {
        content: '';
      }
    }

    &-arrow {
      &:after {
        display: none;
      }
    }

    &-selection__clear {
      &:after {
        content: '';
      }
    }
  }
}