@import '../../styles/variables';
@import '../../styles/mixins';

$input-check-size: 16px;
$input-check-color-disabled: lighten($gray70, 10%);

.Checkbox {
  position: relative;
  user-select: none;
  white-space: nowrap;

  &_error > &__label::before {
    border-color: $error-color;
  }

  &__input {
    display: none;
  }

  &__input[disabled] + &__label::before,
  &__input[disabled]:checked + &__label::before {
    border-color: $input-check-color-disabled;
  }

  &__input[disabled] + &__label {
    color: $gray50;
  }

  &__input[disabled] + &__label {
    cursor: not-allowed;
  }

  &__label {
    min-height: $input-check-size;

    &::before {
      transition: background .2s linear 0s;
      border-radius: 2px;
    }

    &-icon {
      display: none;
    }
  }

  &__input:checked + &__label {
    &::before {
      border-color: $action-color;
      background: $action-color;
    }

    .Checkbox__label-icon {
      display: block;
      position: absolute;
      top: 2px;
      left: 2px;
      line-height: 1;
    }
  }

  &__input[disabled]:checked + &__label::before {
    background: $input-check-color-disabled;
  }

  &__label {
    position: relative;
    padding-left: $input-check-size + 8px;
    cursor: pointer;

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      display: block;
      margin-top: $input-check-size * -.5;
      content: '';
      border: 1px solid $gray70;
      background: $white;
      transform: translateY(50%);
      @include size($input-check-size);
    }

    &:empty {
      padding-left: 0;
    }
  }

  &__description {
    padding-left: $input-check-size + 8px;
    margin-top: 4px;
    font-size: 12px;
  }
}

