// core
.p-cascadeselect {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.p-cascadeselect-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.p-cascadeselect-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  flex: 1 1 auto;
  width: 1%;
  text-overflow: ellipsis;
  cursor: pointer;
}

.p-cascadeselect-label-empty {
  overflow: hidden;
  visibility: hidden;
}

.p-cascadeselect .p-cascadeselect-panel {
  min-width: 100%;
}

.p-cascadeselect-item {
  cursor: pointer;
  font-weight: normal;
  white-space: nowrap;
}

.p-cascadeselect-item-content {
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.p-cascadeselect-group-icon {
  margin-left: auto;
}

.p-cascadeselect-items {
  margin: 0;
  padding: 0;
  list-style-type: none;
  min-width: 100%;
}

.p-fluid .p-cascadeselect {
  display: flex;
}

.p-fluid .p-cascadeselect .p-cascadeselect-label {
  width: 1%;
}

.p-cascadeselect-sublist {
  position: absolute;
  min-width: 100%;
  z-index: 1;
  display: none;
}

.p-cascadeselect-item-active {
  overflow: visible;
}

.p-cascadeselect-item-active > .p-cascadeselect-sublist {
  display: block;
  left: 100%;
  top: 0;
}

.p-cascadeselect-enter-from,
.p-cascadeselect-leave-active {
  opacity: 0;
}

.p-cascadeselect-enter-active {
  transition: opacity 150ms;
}

// theme
.p-cascadeselect {
  background: $inputBg;
  border: $inputBorder;
  transition: $formElementTransition;
  border-radius: $borderRadius;
  outline-color: transparent;

  &:not(.p-disabled):hover {
    border-color: $inputHoverBorderColor;
  }

  &:not(.p-disabled).p-focus {
    @include focused-input();
  }

  &.p-variant-filled {
    background-color: $inputFilledBg;

    &:enabled:hover {
      background-color: $inputFilledHoverBg;
    }

    &:enabled:focus {
      background-color: $inputFilledFocusBg;
    }
  }

  .p-cascadeselect-label {
    background: transparent;
    border: 0 none;
    padding: $inputPadding;

    &.p-placeholder {
      color: $inputPlaceholderTextColor;
    }

    &:enabled:focus {
      outline: 0 none;
      box-shadow: none;
    }
  }

  .p-cascadeselect-trigger {
    background: transparent;
    color: $inputIconColor;
    width: $inputGroupAddOnMinWidth;
    border-top-right-radius: $borderRadius;
    border-bottom-right-radius: $borderRadius;
  }

  &.p-invalid.p-component {
    @include invalid-input();
  }
}

.p-cascadeselect-panel {
  background: $inputOverlayBg;
  color: $inputListTextColor;
  border: $inputOverlayBorder;
  border-radius: $borderRadius;
  box-shadow: $inputOverlayShadow;

  .p-cascadeselect-items {
    padding: $inputListPadding;

    .p-cascadeselect-item {
      margin: $inputListItemMargin;
      border: $inputListItemBorder;
      color: $inputListItemTextColor;
      background: $inputListItemBg;
      transition: $listItemTransition;
      border-radius: $inputListItemBorderRadius;

      &:first-child {
        margin-top: 0;
      }

      &:last-child {
        margin-bottom: 0;
      }

      &.p-highlight {
        color: $highlightTextColor;
        background: $highlightBg;

        &.p-focus {
          background: $highlightFocusBg;
        }
      }

      &:not(.p-highlight):not(.p-disabled) {
        &.p-focus {
          color: $inputListItemTextHoverColor;
          background: $inputListItemHoverBg;
        }
      }

      .p-cascadeselect-item-content {
        padding: $inputListItemPadding;
      }

      .p-cascadeselect-group-icon {
        font-size: $menuitemSubmenuIconFontSize;
      }
    }
  }
}
