:host {
  display: block;
}

.checkbox {
  display: flex;
  align-items: center;
  font-family: var(--sc-input-font-family);
  font-size: var(--sc-input-font-size-medium);
  font-weight: var(--sc-input-font-weight);
  color: var(--sc-input-color);
  vertical-align: middle;
  cursor: pointer;
}

.checkbox__control {
  flex: 0 0 auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sc-checkbox-size);
  height: var(--sc-checkbox-size);
  border: solid var(--sc-input-border-width) var(--sc-input-border-color);
  border-radius: 2px;
  background-color: var(--sc-input-background-color);
  color: var(--sc-color-white);
  transition: var(--sc-transition-fast) border-color, var(--sc-transition-fast) opacity, var(--sc-transition-fast) background-color, var(--sc-transition-fast) color, var(--sc-transition-fast) box-shadow;
}
.checkbox__control input[type=checkbox] {
  position: absolute;
  opacity: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}
.checkbox__control .checkbox__icon {
  display: inline-flex;
  width: var(--sc-checkbox-size);
  height: var(--sc-checkbox-size);
}
.checkbox__control .checkbox__icon svg {
  width: 100%;
  height: 100%;
}

.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
  border-color: var(--sc-input-border-color-hover);
  background-color: var(--sc-input-background-color-hover);
}

.checkbox.checkbox--focused:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control {
  border-color: var(--sc-input-border-color-focus);
  background-color: var(--sc-input-background-color-focus);
  box-shadow: 0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary);
}

.checkbox--checked .checkbox__control,
.checkbox--indeterminate .checkbox__control {
  border-color: var(--sc-color-primary-500);
  background-color: var(--sc-color-primary-500);
}

.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
  opacity: 0.8;
}

.checkbox.checkbox--checked:not(.checkbox--disabled).checkbox--focused .checkbox__control,
.checkbox.checkbox--indeterminate:not(.checkbox--disabled).checkbox--focused .checkbox__control {
  border-color: var(--sc-color-white);
  background-color: var(--sc-color-primary-500);
  box-shadow: 0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary);
}

.checkbox--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox__label {
  line-height: var(--sc-checkbox-size);
  margin-left: 0.5em;
  flex: 1;
}

.checkbox--is-required .checkbox__label:after {
  content: " *";
  color: var(--sc-color-danger-500);
}

::slotted(*) {
  display: inline-block;
}