$slab-display-check: true !default;
/* $checkbox-text-gap: defines the padding-left of the input.*/
$checkbox-text-gap: $slab-checkbox-height * 1.5 !default;

@if $slab-display-check {
  // Hide native checkbox
  input[type="checkbox"]:not(:checked), input[type="checkbox"]:checked {
    @include position(absolute, $left: -9999px);
    opacity: 0;
  }

  // Styles for label after checkbox
  input[type="checkbox"]:not(.slab-checkbox-not-show) + label {

    @include user-selection(none);

    display: flex;
    align-items: center;
    position: relative;
    padding-left: $checkbox-text-gap;
    cursor: pointer;
    font-size: 1rem;

    &:empty {
      padding-left: $slab-checkbox-height;
    }

    &:before {
      @include size($slab-checkbox-height);

      @include position(absolute, $top: 1px, $left: 0);

      @include backface-visibility(hidden);

      content: '';
      z-index: 0;

      text-align: center;
      border-radius: 4px;
      border: solid 1px $medium-gray;
      line-height: 1em;
      color: $slab-checkbox-color;

      font-weight: bold;
      font-family: icomoon;
      font-size: $slab-checkbox-height - 3px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }
  }

  // Define background color and icon when checked
  input[type="checkbox"]:not(.slab-checkbox-not-show):checked + label:before {
    content: '\F00d';
    background-color: $slab-checkbox-border-color;
  }

  input[type="checkbox"]:not(.slab-checkbox-not-show):focus + label:before {
    border-color: #8cc8f7;
    outline: 0;
    box-shadow: 0 0 0 3px scale-color($primary, $alpha: -75%);
  }

  input[type="checkbox"]:not(.slab-checkbox-not-show):disabled + label {
    @extend .disabled;
  }

  .disabled {
    opacity: 0.5;
    cursor: default;
  }

}


.ag-theme-fresh .ag-checkbox-input-wrapper {
  input[type="checkbox"]:not(:checked), input[type="checkbox"]:checked {
    left: auto;
    position: relative;
  }

  background: none !important;
  font-family: 'icomoon' !important;
  font-size: 21px !important;
  border: solid 1px $medium-gray !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 2px !important;
  overflow: hidden !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ag-theme-fresh .ag-checkbox-input-wrapper::after {
  background-color: $white;
  width: 22px !important;
  height: 22px !important;
  content: '' !important;;
}


.ag-theme-fresh .ag-checkbox-input-wrapper.ag-checked::after {
  content: '\f00d' !important;
  width: 22px !important;
  height: 22px !important;
  color: $white !important;
  padding-top: 3px !important;
  padding-left: 2px !important;
  background-color: $slab-checkbox-border-color;
}

.ag-checkbox .ag-input-field {
  width: 22px !important;
  height: 22px !important;
}

.ag-checkbox-input-wrapper-cell-editor {
  margin-top: 2px;
  margin-left: auto;
  margin-right: auto;
}

.ag-checkbox-renderer-click-wrapper {
  z-index: 10;
  position: absolute;
  left: 0;
}

.ag-selection-checkbox-cell-renderer {
  margin-right: 0 !important;
}

