// -----------------------------------------------------------------------------
// This file contains all styles related to the cascader component.
// -----------------------------------------------------------------------------
// @import "./variables.scss";
.#{$namespace}cascader{
  position: relative;
  display: inline-block;
  vertical-align: middle;
  line-height: $cascader-line-height;
  &-input{

    &:hover {
      .#{$namespace}cascader-input-inner {
        >input {
          border: $cascader-hover-border;
        }
        >input[disabled] {
          border: $cascader-disabled-border;
        }
      }
    }

    &-inner {
      >input{
        cursor: pointer;
        &[readonly]{
          border-style: solid;
          background: $cascader-input-background;
        }
        &[readonly]:focus{
          border-style: solid !important;
        }
        &[disabled]{
          cursor: not-allowed;
          border-style: dotted;
          color: $text-color-secondary-lighter; // 找不到起作用的场景
          background-color: $cascader-disabled-input-background;
        }
      }
    }
    &-active{
      >input{
        border-color: $cascader-hover-border-color;
      }
    }
    .#{$namespace}cascader-icon-clear{
      position: absolute;
      display: inline-block;
      right: 10px;
      top: 0;
      bottom: 0;
      z-index: 1000;
      margin: auto;
      width: 1em;
      height: 1em;
      cursor: pointer;
      background: $cascader-clear-icon no-repeat;
      background-size: 100%;
    }
    .#{$namespace}cascader-icon-search{
      position: absolute;
      top: 0;
      right: 30px;
      bottom: 0;
      width: 1em;
      height: 1em;
      z-index: 1000;
      cursor: Default;
      margin: auto;
      color: #c9c9c9;
    }
    &-label{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      cursor: pointer;
      font-size: $cascader-label-font-size;
      background: transparent;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      padding: $cascader-label-padding;
      box-sizing: border-box;
      color: $cascader-label-color;
    }
    &-active-label{
      color: $cascader-label-active-color;
    }
  }
  &-icon-reverse{
    transform: rotate(180deg);
  }
  &-menu-wrapper{
    white-space: nowrap;
    display: inline-flex;
    justify-content: flex-start;
    align-items: stretch;
    box-shadow: $cascader-menu-box-shadow;
    background: $color-white; // 找不到起作用的场景
    border-radius: 2px;
    .#{$namespace}cascader-menu{
      .#{$namespace}cascader-menu-item{
        line-height: 16px;//防止外层有额外ul li样式覆盖
      }
    }
  }
  &-menu{
    position: relative;
    display: inline-block;
    white-space: nowrap;
    min-width: 160px;
    max-height: 290px;
    padding: 6px 0;
    margin: 0;
    border-right: $cascader-menu-right-border;
    background: $cascader-menu-background;
    overflow: auto;
    box-sizing: border-box;
    list-style-type: none;
    &-item{
      height: $cascader-menu-item-height;
      padding: $cascader-menu-item-padding;
      white-space: nowrap;
      cursor: pointer;
      outline: none;
      overflow: hidden;
      text-overflow: ellipsis;
      color: $cascader-menu-item-color;
      font-size: $cascader-menu-item-font-size;
      line-height: $cascader-menu-item-line-height;
      &:hover{
        background: $cascader-menu-item-hover-background;
      }
    }
    &-item-expanded {
      color: $cascader-menu-item-expanded-color;
    }
    // 有子节点的item样式
    &-item-extensible{
      position: relative;
      &::after{
        position: absolute;
        right: 8px;
        top: 50%;
        border: 1px solid $cascader-menu-item-extensible-icon-color;
        border-bottom: 0;
        border-right: 0;
        content: "";
        height: .65em;
        width: .65em;
        transform: translate(-75%, -50%) rotate(135deg);
      }
    }
    &-item-loading{
      pointer-events: none;
      &:before {
        content: '';
        display: inline-block;
        height: 1em;
        width: 1em;
        border-radius: .5em;
        line-height: $cascader-menu-item-loading-line-height;
        vertical-align: -0.15em;
        // currentColor：使用当前元素color||父级color||border-color，使loading颜色与文本颜色保持一致
        border: 1px solid currentColor;
        border-top-color: rgba(255, 255, 255, .35);
        margin-right: $cascader-menu-item-loading-margin-right;
        animation: loading .5s infinite linear;
      }
      
      // 仅在item-extensible&item-loading的时候起作用
      &:after {
        pointer-events: none;
        content: "";
        border-radius: inherit;
        position: absolute;
        right: 8px;
        top: calc($component-size / 2);
        background-color: rgba(255, 255, 255, .35);
      }
    }
    &-item-disabled {
      cursor: not-allowed;
      color: $cascader-menu-item-disabled-color;
    }
    &-item-highlight{
      color: $cascader-menu-item-highlight-color;
    }
  }
  
}
.#{$namespace}formfield .#{$namespace}cascader-input-label {
  padding-left: 14px !important;
}
