/**
 * TreeSelect Component Style for uxcore
 * @author biangang.bg
 *
 * Copyright 2014-2015, Uxcore Team, Alinw.
 * All rights reserved.
 */

@__treeSelectPrefixCls: uxcore-tree-select;

.effect() {
    animation-duration: .3s;
    animation-fill-mode: both;
    transform-origin: 0 0;
}
.arrowClose() {
    position: relative;
    content: '';
    display: block;
    top: 5px;
    left: 8px;
    width: 0px;
    height: 0px;
    border-color: transparent transparent transparent rgba(31, 56, 88, 0.4);
    border-style: solid;
    border-width: 4px 0 4px 4px;
}
.arrowOpen() {
    position: relative;
    content: '';
    display: block;
    top: 7px;
    left: 6px;
    width: 0px;
    height: 0px;
    border-color: rgba(31, 56, 88, 0.4) transparent transparent transparent;
    border-style: solid;
    border-width: 4px 4px 0 4px;
}

.@{__treeSelectPrefixCls} {
    font-family: PingFangSC-Regular;    
    box-sizing: border-box;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    color: @text-secondary-color;
    
    ul, li {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    
    &-selection {
        outline: none;
        user-select: none;
        -webkit-user-select: none;
        box-sizing: border-box;
        display: block;
        background-color: #fff;
        border-radius: @input-border-radius;
        border: 1px solid @border-color;
        &:hover {
            border-color: @border-hover-color;
        }
        &:active {
            border-color: @border-hover-color;
        }
        &__placeholder {
            i {
                font-style: normal;
            }
        }
    }
    
    &-focused &-selection {
        border-color: @border-hover-color;
    }
    
    &-enabled &-selection {
        &:hover {
            border-color: @border-hover-color;
        }
        &:active {
            border-color: @border-hover-color;
        }
    }
    
    &-selection-selected-value {
        overflow: hidden;
        padding-right: 10px;
        text-overflow: ellipsis;
    }
    
    // &-arrow {
    //     position: absolute;
    //     top: 1px;
    //     right: 1px;
    //     width: 20px;
    //     height: 32px;
    //     b {
    //         position: absolute;
    //         top: 0;
    //         right: 0;
    //         left: 0;
    //         bottom: 0;
    //         margin: auto;
    //         width: 0;
    //         height: 0;
    //         border-color: @text-thirdary-color transparent transparent transparent;
    //         border-style: solid;
    //         border-width: 4px 4px 0 4px;
    //     }
    // }
    
    &-selection--single {
        cursor: pointer;
        position: relative;

        .@{__treeSelectPrefixCls}-selection__placeholder {
            position: absolute;
            top: 0;
            color: rgba(31, 56, 88, 0.4);
        }

        .@{__treeSelectPrefixCls}-selection__rendered {
            display: block;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            padding-left: 10px;
            padding-right: 20px;
        }

        .@{__treeSelectPrefixCls}-selection__clear {
            font-weight: bold;
            position: absolute;
            color: @text-thirdary-color;
            top: 7px;
            right: 20px;
            &:after {
                content: '×'
            }
        }
        .@{__treeSelectPrefixCls}-arrow {
            position: absolute;
            top: 1px;
            right: 1px;
            width: 20px;
            height: 32px;
            b {
                position: absolute;
                top: 0;
                right: 0;
                left: 0;
                bottom: 0;
                margin: auto;
                width: 0;
                height: 0;
                border-color: @text-thirdary-color transparent transparent transparent;
                border-style: solid;
                border-width: 4px 4px 0 4px;
            }
        }
    }

    .@{__treeSelectPrefixCls}-size-large &-selection--single {
        height: 36px;
        .@{__treeSelectPrefixCls}-selection__rendered {
            line-height: 34px;
        }
    }
    .@{__treeSelectPrefixCls}-size-middle &-selection--single {
        height: 32px;
        .@{__treeSelectPrefixCls}-selection__rendered {
            line-height: 30px;
        }
        .@{__treeSelectPrefixCls}-selection__clear {
            top: 6px;
        }
        .@{__treeSelectPrefixCls}-arrow {
            top: 0px;
        }

    }
    .@{__treeSelectPrefixCls}-size-small &-selection--single {
        height: 28px;
        .@{__treeSelectPrefixCls}-selection__rendered {
            line-height: 26px;
        }
        .@{__treeSelectPrefixCls}-selection__clear {
            top: 3px;
        }
        .@{__treeSelectPrefixCls}-arrow {
            top: -3px;
        }
    }

    
    &-disabled {
        color: @text-disabled-color;
        cursor: not-allowed;

        .@{__treeSelectPrefixCls}-selection {
            background-color: @bg-disabled-color;
            &:hover, &:active {
                border-color: @border-disabled-color;
            }
        }

        .@{__treeSelectPrefixCls}-selection--single,
        .@{__treeSelectPrefixCls}-selection__choice__remove {
            cursor: not-allowed;
            color: @text-disabled-color;

            &:hover, &:active {
                border-color: @border-disabled-color;
            }
        }
    }
    
    &-search__field__wrap {
        display: inline-block;
        position: relative;
    }

    &-search__field__placeholder {
        position: absolute;
        top: 0;
        left: 3px;
        color: rgba(31, 56, 88, 0.4);
        i {
            font-style: normal;
        }
    }

    &-search__field__mirror {
        position: absolute;
        top: 0;
        left: -9999px;
        white-space: pre;
        pointer-events: none;
    }
    
    &-search--inline {
        width: 100%;
        position: relative;
        .@{__treeSelectPrefixCls}-search__field__wrap {
            width: 100%;
        }
        .@{__treeSelectPrefixCls}-search__field {
            border: none;
            font-size: 100%;
            line-height: 16px;
            background: transparent;
            outline: 0;
            width: 100%;
        }
        .@{__treeSelectPrefixCls}-selection-selected-value {
            position: absolute;
            left: 0;
            top: 0;
            opacity: 0.4;
            filter: "alpha(opacity=40)";
            width: 100%;
        }
        > i {
            float: right;
        }
    }

    &-enabled.@{__treeSelectPrefixCls}-selection--multiple {
        cursor: text;
    }
    
    &-selection--multiple {
        .@{__treeSelectPrefixCls}-search--inline {
            float: left;
            width: auto;
            line-height: 22px;
            height: 22px;
            .@{__treeSelectPrefixCls}-search__field {
                &__wrap {
                    width: auto;
                }
                width: 0.75em;
            }
        }

        .@{__treeSelectPrefixCls}-selection__rendered {
            overflow: hidden;
            text-overflow: ellipsis;
            padding-left: 8px;
            padding-bottom: 2px;
        }

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

    .@{__treeSelectPrefixCls}-size-large &-selection--multiple {
        
        min-height: 36px;
        .@{__treeSelectPrefixCls}-search__field__placeholder {
            top: 9px;
            left: 8px;
        }
    }
    .@{__treeSelectPrefixCls}-size-middle &-selection--multiple {
        min-height: 32px;
        .@{__treeSelectPrefixCls}-search__field__placeholder {
            top: 7px;
            left: 8px;
        }
    }
    .@{__treeSelectPrefixCls}-size-small &-selection--multiple {
        min-height: 28px;
        .@{__treeSelectPrefixCls}-search__field__placeholder {
            top: 6px;
            left: 8px;
        }
    }
    
    &-enabled {
        .@{__treeSelectPrefixCls}-selection__choice {
            cursor: default;
            &:hover {
                .@{__treeSelectPrefixCls}-selection__choice__remove {
                    opacity: 1;
                    transform: scale(1);
                }
                .@{__treeSelectPrefixCls}-selection__choice__content {
                    margin-left: -8px;
                    margin-right: 8px;
                }
            }
        }
    }
    
    & .@{__treeSelectPrefixCls}-selection__choice {
        background-color: #f3f3f3;
        border-radius: 4px;
        float: left;
        padding: 0 15px;
        margin-right: 4px;
        position: relative;
        overflow: hidden;
        transition: padding .3s cubic-bezier(0.6, -0.28, 0.735, 0.045), width .3s cubic-bezier(0.6, -0.28, 0.735, 0.045);

        &__content {
            margin-left: 0;
            margin-right: 0;
            transition: margin .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.@{__treeSelectPrefixCls}-selection__choice-zoom-enter-active,
        &-zoom-appear.@{__treeSelectPrefixCls}-selection__choice-zoom-appear-active {
            animation-play-state: running;
            animation-name: rcSelectChoiceZoomIn;
        }

        &-zoom-leave.@{__treeSelectPrefixCls}-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 4px 0 0;
            position: absolute;
            opacity: 0;
            transform: scale(0);
            top: 0;
            right: 2px;
            transition: opacity .3s, transform .3s;
            &:before {
                content: '×'
            }

            &:hover {
                color: #333;
            }
        }
    }
    
    &-dropdown {
        font-family: PingFangSC-Regular;            
        z-index: 1070;
        box-shadow: @box-shadow-1;
        left: -9999px;
        top: -9999px;
        position: absolute;
        outline: none;
        max-height: 312px;
        overflow: hidden;
        &-hidden {
            display: none;
        }
        span.@{__treeSelectPrefixCls}-tree-title {
            display: inline-block;
            vertical-align: middle;
            padding-right: 5px;
            text-overflow: ellipsis;
            white-space: nowrap;
            cursor: default;
        }
        .@{__treeSelectPrefixCls}-not-found {
            display: inline-block;
            margin: 10px 0 0 20px;
        }
    }

    
    &-dropdown-search {
        display: block;
        padding: 18px 18px 0px;
        position: relative;
        .@{__treeSelectPrefixCls}-search__field__wrap {
            width: 100%;
        }
        .@{__treeSelectPrefixCls}-search_icon {
            position: absolute;
            right: 4px;
            top: 3px;
            font-size: 13px;
        }
        .@{__treeSelectPrefixCls}-search__field__placeholder {
            top: 4px;
            padding-left: 6px;
        }
        .@{__treeSelectPrefixCls}-search__field {
            padding: 4px 4px 4px 7px;
            width: 100%;
            box-sizing: border-box;
            border: 1px solid #d9d9d9;
            border-radius: @input-border-radius;
            outline: none;
        }
        &.@{__treeSelectPrefixCls}-search--hide {
            display: none;
        }
    }

    &-open {
        .@{__treeSelectPrefixCls}-arrow b {
            border-color: transparent transparent #888 transparent;
            border-width: 0 4px 4px 4px;
        }
    }

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

.@{__treeSelectPrefixCls}-inline {
    z-index: 2;
    .@{__treeSelectPrefixCls}-selection {
        border: 0 none;
        &__rendered {
            display: inline-block;
            padding: 0 10px;
            height: 36px;
        }
        &__placeholder {
            position: static;
        }
        &-selected-value {
            padding-right: 0;
        }
    }
    &.@{__treeSelectPrefixCls}-open {
        .@{__treeSelectPrefixCls}-selection {
            border: 1px solid @border-color;
            border-bottom-color: #fff;
        }
    }
    .@{__treeSelectPrefixCls}-arrow {
        position: relative;
        display: inline-block;
        vertical-align: top;
    }
}
.@{__treeSelectPrefixCls}-inline-dropdown {
    z-index: 1;
    box-shadow: none;
}

@keyframes slideUpIn {
    0% {
        opacity: 0;
        transform-origin: 0 0;
        transform: scaleY(.8);
    }

    100% {
        opacity: 1;
        transform-origin: 0 0;
        transform: scaleY(1);
    }
}

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

    100% {
        opacity: 0;
        transform-origin: 0 0;
        transform: scaleY(.8);
    }
}

@keyframes slideDownIn {
    0% {
        opacity: 0;
        transform-origin: 100% 100%;
        transform: scaleY(.8);
    }

    100% {
        opacity: 1;
        transform-origin: 100% 100%;
        transform: scaleY(1);
    }
}

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

    100% {
        opacity: 0;
        transform-origin: 100% 100%;
        transform: scaleY(.8);
    }
}

.@{__treeSelectPrefixCls}-dropdown-placement-bottomLeft {
    &.slideUp-enter,
    &.slideUp-appear {
        opacity: 0;
        transform-origin: 0 0;
        transform: scaleY(.8);
        animation-timing-function: ease;
        animation-duration: .3s;
    }
    &.slideUp-enter-active,
    &.slideUp-appear-active {
        visibility: visible;
        animation-name: slideUpIn;
    }
    &.slideUp-leave {
        opacity: 1;
        transform-origin: 0 0;
        transform: scaleY(1);
        animation-timing-function: ease;
        animation-duration: .3s;
    }
    &.slideUp-leave-active {
        visibility: visible;
        animation-name: slideUpOut;
    }
}

.@{__treeSelectPrefixCls}-dropdown-placement-topLeft {
    &.slideUp-enter,
    &.slideUp-appear {
        opacity: 0;
        transform-origin: 100% 100%;
        transform: scaleY(.8);
        animation-timing-function: ease;
        animation-duration: .3s;
    }
    &.slideUp-enter-active,
    &.slideUp-appear-active {
        visibility: visible;
        animation-name: slideDownIn;
    }
    &.slideUp-leave {
    opacity: 1;
        transform-origin: 100% 100%;
        transform: scaleY(1);
        animation-timing-function: ease;
        animation-duration: .3s;
    }
    &.slideUp-leave-active {
        visibility: visible;
        animation-name: slideDownOut;
    }
}

.@{__treeSelectPrefixCls}-dropdown-left,
.@{__treeSelectPrefixCls}-dropdown-right {
    background-color: white;
    border: 1px solid #dcdcdc;
    border-radius: @input-border-radius 0 0 @input-border-radius;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: middle;
    width: 50%;
    height: 100%;
    overflow-y: auto;
    height: 100%;
}
.@{__treeSelectPrefixCls}-dropdown-all {
    background-color: white;
    border: 1px solid #dcdcdc;
    border-radius: @input-border-radius 0 0 @input-border-radius;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: middle;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    height: 100%;
}


.@{__treeSelectPrefixCls}-dropdown-right {
    border-left-color: transparent;
    overflow-y: hidden;
    padding-bottom: 3px;
    position: relative;
    border-radius:  0 @input-border-radius @input-border-radius 0;
    &-selected {
        &-title {
            color: rgba(31, 56, 88, 0.6);
        }
        &-number {
            color: rgba(0, 0, 0, 0.8);
        }
    }
    &-allClear {
        float: right;
        cursor: pointer;
        color: #3C99D8;
    }
    &-noContent {
        color: rgba(31,56,88,0.4);
        font-size: 12px;
        line-height: 48px;
        background: rgba(31,56,88,0.04);
        border: 1px dashed rgba(31,56,88,0.20);
        height: 48px;
        width: 75%;
        text-align: center;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        position: absolute;
    }
    &-title {
        text-align: center;
        font-size: 14px;
    }
}

.@{__treeSelectPrefixCls}-rightTreeNode {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    overflow: auto;
    &-clear {
        position: absolute;
        right: 15px;
        top: 1px;
        cursor: pointer;
        color: #3C99D8;
        transition: opacity .3s, transform .3s;
        transform: scale(0);
        -ms-transform: scale(0);
    }

    &-hoverNode {
        &:hover{
            background: rgba(31,56,88,0.04);
            .@{__treeSelectPrefixCls}-rightTreeNode-clear {
                opacity: 1;
                transform: scale(1);
                -ms-transform: scale(1);
            }
        }
        span {
            vertical-align: middle;
        }
        height: 28px;
        line-height: 28px;
        padding: 0 16px;
        white-space: nowrap;
        position: relative;
    }
    &-label {
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    &-allSelect {
        color: rgba(31,56,88,0.6);
        margin-left: 12px;
    }
    &-arrow-switch {
        width: 18px;
        height: 18px;
        display: inline-block;
        vertical-align: middle;
        border: 0 none;
        cursor: pointer;
    }
    .@{__treeSelectPrefixCls}-rightTreeNode-arrow-close {
        &:after {
            .arrowClose();
        }
    }
    .@{__treeSelectPrefixCls}-rightTreeNode-arrow-open {
        &:after {
            .arrowOpen();
        }
    }

}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
   /* IE10/11-specific styles go here */
   .@{__treeSelectPrefixCls}-selection--multiple {
    .@{__treeSelectPrefixCls}-search--inline {
      .@{__treeSelectPrefixCls}-search__field {
        width: 50px!important;
      }
    }
  }
}

@tree-assets-img: 'https://aliwork.alicdn.com/tps/TB1k_tsKpXXXXcQXFXXXXXXXXXX-130-87.png';

@__select-tree-node-prefix-cls: uxcore-tree-select-tree;

.@{__select-tree-node-prefix-cls} {
	.@{__select-tree-node-prefix-cls}-node-selected {
			color: @brand-primary;
	}
  margin: 0;
  padding: 14px 18px;
  li {
    padding: 0;
    margin: 0;
    list-style: none;
    white-space: nowrap;
    outline: 0;
    line-height: 24px;
    ul {
      margin: 0;
      padding: 0 0 0 18px;
      &.@{__select-tree-node-prefix-cls}-line {
        background: url("https://t.alipayobjects.com/images/T13BtfXl0mXXXXXXXX.gif") 0 0 repeat-y;
      }
    }
    a {
      display: inline-block;
      padding: 2px 6px;
      cursor: pointer;
      text-decoration: none;
      line-height: 18px;
      vertical-align: middle;
      color: #666;
      &:hover {
        background-color: hsv(round(hsvhue(@brand-primary) + 2), round(hsvsaturation(@brand-primary) - 78%), round(hsvvalue(@brand-primary) + 5%));
      }
    }
    span {
      &.@{__select-tree-node-prefix-cls}-switcher-noop,
      &.@{__select-tree-node-prefix-cls}-switcher,
      {
        margin-right: 2px;
        width: 18px;
        height: 18px;
        display: inline-block;
        vertical-align: middle;
        border: 0 none;
        cursor: pointer;
        outline: none;
        background-color: transparent;
        background-repeat: no-repeat;
        background-attachment: scroll;
        background-image: url(@tree-assets-img);
      }
      &.@{__select-tree-node-prefix-cls}-iconEle {
        margin-right: 2px;
        width: 18px;
        height: 18px;
        display: inline-block;
        vertical-align: middle;
        border: 0 none;
        outline: none;
      }
      &.@{__select-tree-node-prefix-cls}-icon_loading {
          margin-right: 2px;
          background: url('https://t.alipayobjects.com/images/rmsweb/T1YxhiXgJbXXXXXXXX.gif') no-repeat scroll 0 0;
      }
      &.@{__select-tree-node-prefix-cls}-switcher-noop {
        background-image: none;
      }
      &.@{__select-tree-node-prefix-cls}-switcher {
        &-disabled {
          background: #fff;
          position: relative;
          &:after {
            content: '-';
            position: absolute;
            top: 8px;
            left: 6px;
            color: gray;
          }
        }
        &.@{__select-tree-node-prefix-cls}-roots_open {
          background-position: -112px 0px;
        }
        &.@{__select-tree-node-prefix-cls}-roots_close {
          background-position: -94px 0px;
        }
        &.@{__select-tree-node-prefix-cls}-center_open {
          background-position: -112px -18px;
        }
        &.@{__select-tree-node-prefix-cls}-center_close {
          background-position: -94px -18px;
        }
        &.@{__select-tree-node-prefix-cls}-bottom_open {
          background-position: -112px -36px;
        }
        &.@{__select-tree-node-prefix-cls}-bottom_close {
          background-position: -94px -36px;
        }
      }
    }
  }
  &-child-tree {
    display: none;
    &-open {
      display: block;
    }
  }
  &-treenode-disabled {
    > span.uxcore-tree-select-tree-title {
      cursor: not-allowed !important;
    }
    > span,
    > a {
      color: #ccc;
    }
  }
}
.use-svg {
  .@{__select-tree-node-prefix-cls}-switcher {
    &.@{__select-tree-node-prefix-cls}-switcher_open {
        background: none;
        &:after {
            .arrowOpen();
        }
      }
      &.@{__select-tree-node-prefix-cls}-switcher_close {
        background: none;
        &:after {
            .arrowClose();
        }
      }  
    &.@{__select-tree-node-prefix-cls}-noline_open {
      background: url('https://img.alicdn.com/tps/TB1IvveJVXXXXbcXFXXXXXXXXXX-14-10.svg') 50% 50% no-repeat;
      background-size: 50% auto;
    }
    &.@{__select-tree-node-prefix-cls}-noline_close {
      background: url('https://img.alicdn.com/tps/TB17BHzJVXXXXXEXXXXXXXXXXXX-10-14.svg') 50% 50% no-repeat;
      background-size: auto 50%;
    }
  }
  .@{__select-tree-node-prefix-cls}-checkbox {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 0 3px;
    vertical-align: middle;
    cursor: pointer;
    outline: none;
    background: url("@{svg-path}/checkbox-normal.svg") no-repeat;
    &.@{__select-tree-node-prefix-cls}-checkbox-checked {
      background: url("@{svg-path}/checkbox-checked.svg") no-repeat;
      &.@{__select-tree-node-prefix-cls}-checkbox-disabled {
        background: url("@{svg-path}/checkbox-checked-disabled.svg") no-repeat;
      }
    }
    &.@{__select-tree-node-prefix-cls}-checkbox-indeterminate {
      background: url("@{svg-path}/checkbox-partial-checked.svg") no-repeat;
    }
    &-checkbox-disabled {
      background: url("@{svg-path}/checkbox-disabled.svg") no-repeat;
    }
  }
}
.no-svg {
  .@{__select-tree-node-prefix-cls}-switcher {
    &.@{__select-tree-node-prefix-cls}-noline_open {
      background-position: -115px -72px;
    }
    &.@{__select-tree-node-prefix-cls}-noline_close {
      background-position: -97px -72px;
    }
  }
  .@{__select-tree-node-prefix-cls}-checkbox {
    margin-right: 2px;
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    outline: none;
    background-image: url(@tree-assets-img);
    width: 14px;
    height: 14px;
    background-position: 0 0;
    &.@{__select-tree-node-prefix-cls}-checkbox-checked {
      background-position: -15px 0;
    }
    &.@{__select-tree-node-prefix-cls}-checkbox-indeterminate {
      background-position: -15px -28px;
    }
    &-disabled {
      background-position: 0 -28px!important;
    }
  }
}