$checkbox-width: 1.5rem;
$checkbox-height: 1.5rem;

.checkbox-composite {
  @include flex();
  @include flex-row();
  align-items: center;
  margin-bottom: 1rem;

  label {
    @include stretch();
    margin-left: $default-padding;
  }
}

input[type="checkbox"] {
  width: $checkbox-width;
  height: $checkbox-height;
  background-color: transparent;
  position: relative;
  outline: none;
  border: none;
  @include ignore-device-rendering();
}

input[type="checkbox"]:before {
  display: block;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' style='fill:rgba(41,41,41,0.8)' width='32' height='32' viewBox='0 0 24 24'><path d='M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z'/></svg>");
  background-position: center;
  background-size: contain;
  width: $checkbox-width;
  height: $checkbox-height;
  line-height: $default-height;
  content: '';
  position: absolute;
  box-sizing: border-box;
  border-radius: $default-border-radius;
}

input[type="checkbox"]:checked:before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' style='fill:rgba(41,41,41,0.8)' width='32' height='32' viewBox='0 0 24 24'><path d='M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/></svg>");
}

input[type="checkbox"]:focus:before {
  box-shadow: inset 0 0 0 0.25rem var(--color-focus-80);
}

input[type="checkbox"]:hover:before {
  box-shadow: inset 0 0 0 0.25rem var(--color-ui-1-30);
}

input[type="checkbox"]:focus,
input[type="checkbox"]:hover {
  box-shadow: none;
}
