@import '../../scss/variables/colors';

$base-class: 'checkbox';

.#{$base-class} {
  display: inline-block;

  &__label {
    cursor: pointer;
    display: inline-flex;
    flex: 0 1 auto;
    align-items: flex-start;
    width: 100%;
  }

  &__square {
    position: relative;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 4px;
    background-color: #f3f7f9;
    border: 1px solid #bcc6d0;
    margin-right: 8px;
    transition: all 0.2s ease;
    box-sizing: border-box;
  }

  &__checkmark {
    opacity: 0;
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    fill: #fff;
    transition: all 0.2s ease;
    pointer-events: none;
  }

  &--selected {
    .#{$base-class}__square {
      background-color: $primary-color;
      border-color: $primary-color;
    }

    .#{$base-class}__checkmark {
      opacity: 1;
    }
  }

  &__text {
    font-size: 15px;
    line-height: 20px;
    flex: 1 0 auto;
    color: $font-primary-color;
  }

  &__input {
    width: 100%;
    height: 100%;
    display: none;

    &:checked + .#{$base-class}__square {
      background-color: $primary-color;
      border-color: $primary-color;

      .#{$base-class}__checkmark {
        opacity: 1;
      }
    }
  }

  &--disabled {
    .#{$base-class} {
      &__square {
        opacity: 0.4;
        border-color: $font-tertiary-color;
        background-color: $font-tertiary-color;
      }

      &__label,
      &__input,
      &__text {
        color: $font-tertiary-color;
        cursor: not-allowed;
      }
    }
  }

  &__helper {
    cursor: default;
    margin-left: 24px;
  }
}
