.#{$ns}CBGroup {
  font-size: var(--fontSizeSm);

  &-toolbar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding-bottom: 10px;

    .#{$ns}Button {
      transition: padding var(--animation-duration);
      min-width: unset;

      svg {
        width: 10px;
        height: 10px;
        top: 0;
        margin-right: 5px;
      }
    }

    &:not(:hover) .#{$ns}CBGroup-toolbarLeft .#{$ns}Button:not(.is-active) {
      width: 0;
      padding: 0;
      overflow: hidden;
      opacity: 0;
      margin: 0;
      border: 0;
    }

    .#{$ns}CBGroup-toolbarRight {
      transition: opacity var(--animation-duration);
      display: flex;
      align-items: center;

      .#{$ns}CBDelete {
        margin-left: var(--gap-xs);
      }
    }
    &:not(:hover) .#{$ns}CBGroup-toolbarRight {
      opacity: 0;
    }
  }

  &-field,
  &-operator {
    position: relative;
    display: inline-block;
    margin: px2rem(3px);
    vertical-align: middle;
  }

  &-fieldCaret,
  &-operatorCaret {
    transition: transform var(--animation-duration) ease-out;
    margin: 5px;
    display: flex;
    color: var(--Form-select-caret-iconColor);
    &:hover {
      color: var(--Form-select-caret-onHover-iconColor);
    }

    > svg {
      width: px2rem(10px);
      height: px2rem(10px);
      top: 0;
    }
  }

  &-fieldInput.is-active &-fieldCaret,
  &-operatorInput.is-active &-operatorCaret {
    transform: rotate(180deg);
  }

  &-placeholder {
    color: var(--text--muted-color);
    position: relative;
    margin-left: 30px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 5px;

    &:before {
      position: absolute;
      content: '';
      top: -10px;
      left: -30px;
      width: 20px;
      border-left: solid 1px var(--borderColor);
      bottom: 0;
    }

    &:after {
      position: absolute;
      content: '';
      top: 50%;
      width: 20px;
      left: -30px;
      border-top: solid 1px var(--borderColor);
    }

    &:last-child {
      &:before {
        border-bottom-left-radius: 5px;
        border-bottom: solid 1px var(--borderColor);
        bottom: 50%;
      }

      &:after {
        display: none;
      }
    }
  }
}

.#{$ns}CBDelete {
  @include icon-color();
  cursor: pointer;
  margin-left: auto;
  transition: opacity var(--animation-duration);
}

.#{$ns}CBGroupOrItem {
  position: relative;
  margin-left: px2rem(30px);

  & + & {
    margin-top: px2rem(10px);
  }

  &-body {
    display: flex;
    padding: 2px 7px;
    border-radius: 5px;
    flex-direction: row;
    align-items: center;
    position: relative;

    background: rgba(0, 0, 0, 0.03);
    transition: all var(--animation-duration) ease-out;

    > .#{$ns}CBGroup {
      margin: 3px;
    }
  }

  &-body:not(:hover) .#{$ns}CBDelete {
    opacity: 0;
  }

  &.is-dragging {
    display: none;
  }

  &.is-ghost > &-body:before {
    position: absolute;
    z-index: 2;
    content: '';
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba($info, 0.2);
  }

  &-dragbar {
    cursor: move;
    width: 20px;
    margin-left: -5px;
    opacity: 0;
    text-align: center;
    transition: opacity var(--animation-duration) ease-out;
    @include icon-color();
  }

  .#{$ns}CBGroup {
    flex-grow: 1;
  }

  &:hover > &-body {
    background: rgba(0, 0, 0, 0.05);
  }

  &:hover > &-body > &-dragbar {
    opacity: 1;
  }

  &:before {
    position: absolute;
    content: '';
    top: -10px;
    left: -30px;
    width: 20px;
    border-left: solid 1px var(--borderColor);
    bottom: 0;
  }

  &:after {
    position: absolute;
    content: '';
    top: 50%;
    width: 20px;
    left: -30px;
    border-top: solid 1px var(--borderColor);
  }

  &:last-child {
    &:before {
      border-bottom-left-radius: 5px;
      border-bottom: solid 1px var(--borderColor);
      bottom: 50%;
    }

    &:after {
      display: none;
    }
  }
}

.#{$ns}CBInputSwitch {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  // margin: px2rem(3px);
  cursor: pointer;
  > a {
    @include icon-color();
  }

  svg {
    width: px2rem(10px);
    height: px2rem(10px);
  }
}

.#{$ns}CBFunc {
  display: inline-block;
  vertical-align: middle;
  margin: px2rem(3px);

  &-select {
    display: inline-block;
    position: relative;
  }

  &-error {
    color: var(--danger);
  }

  &-args {
    display: inline-block;
    > span {
      display: inline-block;
      padding: 0 5px;
      color: var(--info);
    }

    > div {
      display: inline-block;
    }
  }
}

.#{$ns}CBValue {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: px2rem(3px);
}

.#{$ns}CBFormula {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: px2rem(3px);

  &-label {
    background: var(--ResultBox-value-bg);
    color: var(--text--muted-color);
    display: block;
    font-size: var(--fontSizeSm);
    align-self: center;
    margin: -5px 5px -5px -8px;
    padding: 5px;
    border-radius: 5px;
    user-select: none;
  }
}

.#{$ns}CBSeprator {
  width: 20px;
  text-align: center;
  display: inline-block;
  user-select: none;
}
