.nut-checkbox {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-height: scale-px(32px);

  &.nut-checkbox-nolabel {
    min-width: scale-px(32px);
    justify-content: center;
  }

  &-icon {
    color: $color-text-disabled;
    background-color: $color-background-overlay;
    transition-duration: 0.3s;
    transition-property: color, border-color, background-color;
    font-size: $checkbox-icon-font-size;
    border-radius: 50%;
    flex-shrink: 0;
  }

  &-icon-wrap {
    font-size: 0px;
    line-height: 0;
    border-radius: 50%;
    box-shadow: none;
  }

  &-icon-checked {
    color: $color-primary;
    background-color: $white;
    transition-duration: 0.3s;
    transition-property: color, border-color, background-color;
    border-radius: 50%;
    box-shadow: none;

    &.nut-checkbox-icon-disabled {
      color: $color-primary-disabled-special;
      background-color: $color-background-overlay;
      box-shadow: none;
    }
  }

  &-label {
    margin-left: $checkbox-label-margin-left;
    font-size: $checkbox-label-font-size;
    color: $checkbox-label-color;
    flex-shrink: 0;

    &-disabled {
      color: $color-text-disabled;
    }
  }

  &-icon-indeterminate {
    color: $color-primary;
    background-color: $white;
    box-shadow: none;
    border-radius: 50%;

    &.nut-checkbox-icon-disabled {
      color: $color-primary-disabled-special;
      background-color: $color-background-overlay;
      box-shadow: none;
    }
  }

  &-icon-disabled {
    color: $color-text-disabled;
    background-color: $color-background-overlay;
    border-radius: 50%;
    box-shadow: none;
  }

  &-reverse {
    flex-direction: row-reverse;

    .nut-checkbox-label {
      margin-right: $checkbox-label-margin-left;
      margin-left: 0;
    }
  }

  &-button {
    position: relative;
    /* #ifdef dynamic */
    display: flex;
    /* #endif */
    /* #ifndef dynamic */
    display: inline-flex;
    /* #endif */
    align-items: center;
    min-height: scale-px(32px);
    padding: $checkbox-button-padding;
    font-size: $checkbox-button-font-size;
    background: $checkbox-button-background;
    border-radius: $checkbox-button-border-radius;
    color: $checkbox-label-color;
    box-sizing: border-box;
    border: scale-px(1px) solid $checkbox-button-background;
    overflow: hidden;

    &-active {
      background: $color-primary-light-pressed;
      color: $color-primary;
      border: $checkbox-button-active-border;
    }

    &-disabled {
      color: $color-text-disabled;
      border: scale-px(1px) solid $checkbox-button-background;
    }

    &-icon {
      position: absolute;
      right: 0;
      bottom: 0;
      width: 0;
      height: 0;
      border-top: $icon-size-10 solid transparent;
      border-left: $icon-size-10 solid transparent;
      border-bottom: $icon-size-10 solid $color-primary;
      border-right: $icon-size-10 solid $color-primary;
      display: flex;
      align-items: flex-end;
      justify-content: flex-end;
    }

    .nut-checkbox-button-icon-checked {
      width: scale-px(12px);
      height: scale-px(12px);
      position: absolute;
      color: $white;
      right: 0;
      bottom: 0;
      transform: translate(scale-px(-1px), scale-px(-2px));
    }

    .nut-icon {
      position: absolute;
      font-size: $font-size-s;
      width: scale-px(12px);
      height: scale-px(12px);

      &:before {
        top: auto;
        bottom: scale-px(-22px);
        margin-left: scale-px(6px);
      }
    }
  }

  .nut-checkbox-button-active.nut-checkbox-button-disabled {
    background: $color-text-disabled;
    color: $white;
    border: scale-px(1px) solid $color-text-disabled;
  }

  &-list-item {
    display: flex;
    justify-content: space-between;
    padding: $checkbox-list-item-padding;
    border-top: $checkbox-list-item-border;

    .nut-checkbox-label {
      flex: none;
    }

    .nut-icon {
      flex: none;
    }
  }
}

[dir='rtl'] .nut-checkbox,
.nut-rtl .nut-checkbox {
  &-label {
    margin-left: 0;
    margin-right: $checkbox-label-margin-left;
  }

  &-reverse {
    .nut-checkbox-label {
      margin-left: $checkbox-label-margin-left;
      margin-right: 0;
    }
  }

  &-button {
    &-icon {
      right: auto;
      left: 0;
      border-right: scale-px(10px) solid transparent;
      border-left: scale-px(10px) solid $color-primary;

      &-checked {
        left: auto;
        right: 50%;
        transform: translate(scale-px(3px), scale-px(-3px));
      }

      .nut-icon {
        &:before {
          margin-left: 0;
          margin-right: scale-px(6px);
        }
      }
    }
  }
}
