/**
* A Styled checkbox
*/

.multi-select-field {
  margin-top: 2px;

  &.multi-row {
    display: flex;
    > input {
      min-width:1px;
      flex:1;
    }
    &.center {
      margin-top:0;
      @extend .flex-align-items-center;
      .checkbox {
        margin-bottom: 0;
      }
    }
    .checkbox {
      margin-right: 10px;
      margin-bottom:0;
      &.empty {
        margin-right:5px;
      }
    }
    .checkbox:not(:last-of-type) {
      margin-right: 30px;
    }
  }
  .checkbox {
    margin-bottom: 10px;

    &:last-of-type {
      margin-bottom: 0;
    }
  }
}


.checkbox {
  padding: $checkboxMargin;
  position: relative;
  min-height:$checkboxAndOptionHeight;
  @include interface();
  cursor: pointer;
  display: block;
  > input {
    z-index: -1;
    position: absolute;
    left: 7px;
    top: 1px;
    width: 5px;
    height:5px;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    outline: none !important;
    box-shadow: none !important;
  }

  .checkbox-container {
    line-height: $baseLineHeight;
    display:block;
  }

  $offsetLeft: 0;

  .checkbox-container::before {
    content: ' ';
    box-shadow:$inputBoxShadow;
    width: $checkboxAndOptionHeight;
    height: $checkboxAndOptionHeight;
    position: absolute;
    left: $offsetLeft;
    border-radius: $globalRadius;
    background: $inputBackground;
    border: $inputBorder;
    transition: background .5s ease;
    top:0;
  }

  .checkbox-container::after {
    content: ' ';
    width: $checkboxAndOptionHeight;
    height: $checkboxAndOptionHeight;
    position: absolute;
    left: $offsetLeft;
    font-size: 12px;
    line-height: $checkboxAndOptionHeight;
    text-align: center;
    color: $checkRadioColor !important;
    transition: transform .3s ease;
    top:0;
  }

  &:active {
    .checkbox-container::before {
      background: darken($inputBackground, 5%);
    }
  }

  input[type="checkbox"], input[type="radio"] {
    &.invalid + .checkbox-container::before {
      background: $inputBackgroundInvalid;
    }
  }

  input[type="checkbox"], input[type="radio"] {
    &:focus {
      + .checkbox-container::before {
        background: darken($inputBackground, 5%);
      }
    }
  }
  input[type="checkbox"] + .checkbox-container::after {
    @include icon();
    @extend .icon-ok:before !optional;
    transform: scale3d(0, 0, 0) rotate3d(0,0,1,90deg);
  }

  input[type="radio"] + .checkbox-container::before {
    border-radius: 50%;
  }

  input[type="radio"] + .checkbox-container::after {
    transform: scale3d(0, 0, 0);
    font-size: 10px;
    content: ' ';
    width: 10px;
    height: 10px;
    background: $checkRadioColor;
    border-radius: 50%;
    top: 5px;
    left: 5px;
  }

  input[type="checkbox"]:checked + .checkbox-container::after {
    transform: scale3d(1, 1, 1) rotate3d(0,0,1,0deg);
  }
  input[type="radio"]:checked + .checkbox-container::after {
    transform: scale3d(1, 1, 1);
  }

  input[disabled] + .checkbox-container {
    cursor: not-allowed;
    color: $inputDisabledColor;
  }

  input[disabled] + .checkbox-container {
    &::before, &::after {
      border-color:$inputDisabledBorder;
      cursor: not-allowed;
      color: $inputDisabledColor !important;
    }
    &::before {
      background: $inputDisabledBg;
    }
  }

  input[disabled][type="radio"] + .checkbox-container {
    &::after {
      background: $inputDisabledColor !important;
    }
  }

}
