@use './index.scss' as *;
@use '../mixins/mixins.scss' as *;
@use '../mixins/var' as *;
@use '../common/var.scss' as *;

@include b(dsh-justify-between) {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;

  .select-tag{
    display: none;
  }
}

@include b(dsh-cascader-panel) {
  @include set-component-css-var('dsh-cascader', $cascader);
}

@include b(dsh-cascader-panel) {
  display: flex;
  border-radius: getCssVar('dsh-cascader-menu', 'radius');
  font-size: getCssVar('dsh-cascader-menu', 'font-size');

  @include when(bordered) {
    border: getCssVar('dsh-cascader-menu', 'border');
    border-radius: getCssVar('dsh-cascader-menu', 'radius');
  }
}

@include b(dsh-cascader-menu) {
  min-width: 240px !important;
  box-sizing: border-box;
  color: getCssVar('dsh-cascader-menu', 'text-color');
  border-right: getCssVar('dsh-cascader-menu', 'border');

  &:last-child {
    border-right: none;

    .#{$namespace}-dsh-cascader-node {
      padding-right: 20px;
    }
  }

  @include e(wrap) {
    // Raise the priority
    &.#{$namespace}-scrollbar__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%);
    display: flex;
    align-items: center;
    color: getCssVar('dsh-cascader', 'color-empty');

    .is-loading {
      margin-right: 2px;
    }
  }
}

@include b(dsh-cascader-node) {
  position: relative;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  padding: 0 24px 0 12px;
  height: 32px;
  line-height: 32px;

  &.is-selectable {
    color: getCssVar('dsh-cascader-menu', 'text-color');
  }

  &.in-active-path,
  &.is-selectable,
  &.is-active {
    color: getCssVar('dsh-cascader-menu', 'selected-text-color');
    font-weight: unset;
  }

  &.in-active-path,
  &.is-selectable.in-checked-path {
    color: getCssVar('dsh-cascader-menu', 'selected-text-color');
    background: #005bf51a !important;

    @include e(postfix) {
      color: getCssVar('dsh-cascader-menu', 'selected-text-color');
    }
  }

  &:not(.is-disabled) {
    cursor: pointer;

    &:focus {
      background: #005bf51a !important;
    }
    &:hover {
      background: getCssVar('dsh-cascader-node', 'background-hover');
    }
  }

  @include when(disabled) {
    color: getCssVar('dsh-cascader-node', 'color-disabled');
    cursor: not-allowed;
  }

  &:hover {
    .select-tag {
      display: block;
      background: #005bf5 !important;
      color: #fff;
      position: relative;
      border-top: 0;
      padding-right: 8px;
      padding-left: 8px;
      margin-right: -8px;
      margin-left: 50px;
      &::before {
        content: '';
        width: 0;
        height: 0;
        position: absolute;
        right: 84%;
        top: 0;
        border-left: solid 12px transparent;
        border-top: solid 16px #005bf5;
        border-right: solid 12px transparent;
        border-bottom: solid 16px #005bf5;
      }
    }
  }

  @include e(prefix) {
    position: absolute;
    left: 10px;
  }

  @include e(postfix) {
    position: absolute;
    color: #606266;
    right: 10px;
    font-size: 16px;
  }

  @include m(label) {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  @include e(label) {
    flex: 1;
    text-align: left;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  > .#{$namespace}-checkbox {
    margin-right: 0;
  }

  > .#{$namespace}-radio {
    margin-right: 0;

    .#{$namespace}-radio__label {
      padding-left: 0;
    }
  }
}
