@import "mixins/mixins";
@import "common/var";
@import "./checkbox";
@import "./radio";
@import "./scrollbar";

@include b(cascader-overlay) {
  position: relative;
  padding:2px 0;
  box-sizing: border-box;
  border-bottom: 1px solid $--border-color-base;
  &::after{
    position: absolute;
    right: 10px;
    top: 10px;
    color: #666666;
    font-family: "element-icons";
    font-style: normal;
    font-weight: 400;
    font-variant: normal;
    text-transform: none;
    content: "\e811";
  }
  .el-cascader__search-input{
    box-sizing: border-box;
    margin-left: 10px;
    width: calc(100% - 40px);
  }
}

@include b(cascader-panel) {
  display: inline-flex;
  border-radius: $--cascader-menu-radius;
  font-size: $--cascader-menu-font-size;

  @include when(bordered) {
    border: $--cascader-menu-border;
    border-radius: $--cascader-menu-radius;
  }
  @include m(medium) {
    .el-cascader-node{
      height: 32px;
      line-height: 32px;
    }
  }
  @include m(small) {
    .el-cascader-node{
      font-size: 12px;
      height: 30px;
      line-height: 30px;
    }
    .el-cascader-node__postfix {
      top: 9px;
    }
  }
  @include m(mini) {
    .el-cascader-node{
      font-size: 12px;
      height: 28px;
      line-height: 28px;
    }
    .el-cascader-node__postfix {
      top: 9px;
    }
  }
}

@include b(cascader-menu) {
  min-width: 180px;
  box-sizing: border-box;
  color: $--cascader-menu-font-color;
  border-right: $--cascader-menu-border;

  &:last-child {
    border-right: none;
    // .el-cascader-node {
    //   padding-right: 20px;
    // }
    .el-checkbox,
    .el-radio{
      & ~ .el-cascader-node__label{
        margin-right: 0px;
      }
    }
  }

  @include e(wrap) {
    height: 204px;
  }

  @include e(list) {
    position: relative;
    min-height: 100%;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    box-sizing: border-box;
  }

  @include e(hover-zone) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  @include e(empty-text) {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: $--cascader-color-empty;
  }
}

@include b(cascader-node) {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 10px 0 10px;
  height: 34px;
  line-height: 34px;
  outline: none;

  // 同级互斥
  @include when(radio) {
    .el-checkbox__input {
      .el-checkbox__inner{
        background: $--color-white;
        border-radius: 100%;
        &::after{
          width: 8px;
          height: 8px;
          border-radius: 100%;
          background-color: $--color-white;
          content: "";
          position: absolute;
          left: 50%;
          top: 50%;
          transition: transform .15s ease-in;
          transform: translate(-50%,-50%) scale(0);
          border: none;
        }
      }
      &.is-checked, &.is-indeterminate {
        .el-checkbox__inner {
          border-color: $--color-primary;

          &::after {
            transform: translate(-50%,-50%) scale(1);
            background-color: $--color-primary;
          }
        }
      }
      &.is-indeterminate {
        .el-checkbox__inner {
          border-color: $--color-primary;
          &::before {
            width: 6px;
            height: 6px;
            border-radius: 0;
            background-color: $--color-white;
            content: "";
            position: absolute;
            left: 50%;
            top: 50%;
            transition: transform .15s ease-in;
            transform: translate(-50%,-50%) scale(1);
            background-color: $--color-primary;
          }
        }
      }
    }
    
  }

  &.is-selectable.in-active-path {
    color: $--cascader-menu-font-color;
  }

  &:not(.is-disabled) {
    cursor: pointer;
    &:hover, &:focus {
      background: $--cascader-node-background-hover;
      // color: $--select-option-hover--font-color;
    }
  }

  &.in-active-path,
  &.is-selectable.in-checked-path,
  &.is-active {
    color: $--cascader-menu-selected-font-color;
    &:hover{
      color: $--select-option-selected-font-color;
    }
    // background-color: $--background-color-base;
  }

  @include when(disabled) {
    color: $--cascader-node-color-disabled;
    cursor: not-allowed;
  }

  @include e(prefix) {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 12px;
    font-weight: 700;
  }

  @include e(postfix) {
    position: absolute;
    right: 10px;
    top: 13px;
    font-size: 10px;
  }

  .el-checkbox,
  .el-radio{
    margin-right: 10px;
  }

  @include e(label) {
    flex: 1;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 20px;
    em {
      font-style: normal;
    }
  }

  > .el-radio {

    .el-radio__label {
      padding-left: 0;
    }
  }
}
