/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';
@import './vars.less';

@cascader-node-prefix-cls: ~'@{css-prefix}cascader-node';
@radio-prefix-cls: ~'@{css-prefix}radio';
@checkbox-prefix-cls: ~'@{css-prefix}checkbox';

.@{cascader-node-prefix-cls} {
  .inject-CascaderNode-vars();

  &.is-selectable.in-active-path {
    color: var(--tv-CascaderNode-text-color);
  }

  &.in-active-path,
  &.is-active {
    background: var(--tv-CascaderNode-selectable-active-bg-color);
    color: var(--tv-CascaderNode-selectable-text-color);
    &:hover {
      background: var(--tv-CascaderNode-hover-bg-color);
    }
  }

  &.in-active-path:hover {
    background: var(--tv-CascaderNode-hover-bg-color);
  }

  &:not(.is-disabled):not(.in-active-path):not(.is-active) {
    &:focus,
    &:hover {
      background: var(--tv-CascaderNode-hover-bg-color);
      color: var(--tv-CascaderNode-hover-text-color);
    }
  }

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

  &.is-disabled {
    color: var(--tv-CascaderNode-disabled-text-color);
    fill: var(--tv-CascaderNode-disabled-text-color);
    cursor: not-allowed;
    .@{cascader-node-prefix-cls}__prefix,
    .@{cascader-node-prefix-cls}__postfix {
      fill: var(--tv-CascaderNode-disabled-icon-color);
    }
  }

  &__prefix,
  &__postfix {
    font-size: var(--tv-CascaderNode-icon-size);
    fill: var(--tv-CascaderNode-icon-color);
  }

  &.in-active-path,
  &.is-active {
    .@{cascader-node-prefix-cls}__postfix {
      fill: var(--tv-CascaderNode-active-icon-color);
    }
    .@{cascader-node-prefix-cls}__label {
      font-weight: var(--tv-CascaderNode-active-font-weight);
      svg {
        fill: var(--tv-CascaderNode-active-icon-color);
      }
    }
  }

  &__prefix {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: var(--tv-CascaderNode-prefix-display) !important;
  }

  &__postfix {
    position: absolute;
    top: 50%;
    right: var(--tv-CascaderNode-postfix-right);
    transform: translateY(-50%);
  }

  &__label {
    max-width: var(--tv-CascaderNode-label-max-width);
    flex: 1;
    flex-basis: auto\9;
    padding: var(--tv-CascaderNode-label-padding-y) var(--tv-CascaderNode-label-padding-x);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    svg {
      font-size: var(--tv-CascaderNode-icon-size);
      fill: var(--tv-CascaderNode-icon-color);
    }
    // 兼容ie10-ie11
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
      flex-basis: auto;
    }
  }

  & > .@{radio-prefix-cls} {
    margin-right: var(--tv-CascaderNode-radio-margin-right);
    .@{radio-prefix-cls}__label {
      padding-left: 0;
    }
  }

  & > .@{checkbox-prefix-cls} {
    margin-right: var(--tv-CascaderNode-radio-margin-right);
  }
}
