@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../tree/style/mixin';
@import '../../checkbox/style/mixin';

@yee-select-prefix-cls: ~'@{yee-prefix}-select';
@yee-select-tree-prefix-cls: ~'@{yee-prefix}-select-tree';

.yeeCheckboxFn(@yee-checkbox-prefix-cls: ~'@{yee-prefix}-select-tree-checkbox');

.@{yee-select-tree-prefix-cls} {
  .yee-reset-component;

  margin: 0;
  margin-top: -4px;
  padding: 0 4px;
  li {
    margin: 8px 0;
    padding: 0;
    white-space: nowrap;
    list-style: none;
    outline: 0;
    &.filter-node {
      > span {
        font-weight: 500;
      }
    }
    ul {
      margin: 0;
      padding: 0 0 0 18px;
    }
    .@{yee-select-tree-prefix-cls}-node-content-wrapper {
      display: inline-block;
      width: ~'calc(100% - 24px)';
      margin: 0;
      padding: 3px 5px;
      color: @yee-text-color;
      text-decoration: none;
      border-radius: @yee-border-radius-sm;
      cursor: pointer;
      transition: all 0.3s;
      &:hover {
        background-color: @yee-item-hover-bg;
      }
      &.@{yee-select-tree-prefix-cls}-node-selected {
        background-color: @yee-primary-2;
      }
    }
    span {
      &.@{yee-select-tree-prefix-cls}-checkbox {
        margin: 0 4px 0 0;
        + .@{yee-select-tree-prefix-cls}-node-content-wrapper {
          width: ~'calc(100% - 46px)';
        }
      }
      &.@{yee-select-tree-prefix-cls}-switcher,
      &.@{yee-select-tree-prefix-cls}-iconEle {
        display: inline-block;
        width: 24px;
        height: 24px;
        margin: 0;
        line-height: 22px;
        text-align: center;
        vertical-align: middle;
        border: 0 none;
        outline: none;
        cursor: pointer;
      }
      &.@{yee-select-prefix-cls}-icon_loading {
        .@{yee-select-prefix-cls}-switcher-loading-icon {
          position: absolute;
          left: 0;
          display: inline-block;
          color: @yee-primary-color;
          font-size: 14px;
          transform: none;
          svg {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            margin: auto;
          }
        }
      }
      &.@{yee-select-tree-prefix-cls}-switcher {
        position: relative;
        &.@{yee-select-tree-prefix-cls}-switcher-noop {
          cursor: auto;
        }
        &.@{yee-select-tree-prefix-cls}-switcher_open {
          .yee-antTreeSwitcherIcon();
        }
        &.@{yee-select-tree-prefix-cls}-switcher_close {
          .yee-antTreeSwitcherIcon();
          .@{yee-select-prefix-cls}-switcher-icon {
            svg {
              transform: rotate(-90deg);
            }
          }
        }

        &.@{yee-select-tree-prefix-cls}-switcher_open,
        &.@{yee-select-tree-prefix-cls}-switcher_close {
          .@{yee-select-prefix-cls}-switcher-loading-icon {
            position: absolute;
            left: 0;
            display: inline-block;
            width: 24px;
            height: 24px;
            color: @yee-primary-color;
            font-size: 14px;
            transform: none;
            svg {
              position: absolute;
              top: 0;
              right: 0;
              bottom: 0;
              left: 0;
              margin: auto;
            }
          }
        }
      }
    }
  }

  .@{yee-select-tree-prefix-cls}-treenode-loading {
    .@{yee-select-tree-prefix-cls}-iconEle {
      display: none;
    }
  }
  &-child-tree {
    display: none;
    &-open {
      display: block;
    }
  }
  li&-treenode-disabled {
    > span:not(.@{yee-select-tree-prefix-cls}-switcher),
    > .@{yee-select-tree-prefix-cls}-node-content-wrapper,
    > .@{yee-select-tree-prefix-cls}-node-content-wrapper span {
      color: @yee-disabled-color;
      cursor: not-allowed;
    }
    > .@{yee-select-tree-prefix-cls}-node-content-wrapper:hover {
      background: transparent;
    }
  }
  &-icon__open {
    margin-right: 2px;
    vertical-align: top;
  }
  &-icon__close {
    margin-right: 2px;
    vertical-align: top;
  }
}

.@{yee-select-prefix-cls}-tree-dropdown {
  .yee-reset-component;
  .@{yee-select-prefix-cls}-dropdown-search {
    position: sticky;
    top: 0;
    z-index: 1;
    display: block;
    padding: 4px;
    background: @yee-component-background;
    .@{yee-select-prefix-cls}-search__field__wrap {
      width: 100%;
    }
    .@{yee-select-prefix-cls}-search__field {
      box-sizing: border-box;
      width: 100%;
      padding: 4px 7px;
      border: @yee-border-width-base @yee-border-style-base @yee-border-color-base;
      border-radius: 4px;
      outline: none;
    }
    &.@{yee-select-prefix-cls}-search--hide {
      display: none;
    }
  }
  .@{yee-select-prefix-cls}-not-found {
    display: block;
    padding: 7px 16px;
    color: @yee-disabled-color;
    cursor: not-allowed;
  }
}
