/* Based on https://github.com/justboil/bulma-switch-control */

.switch {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-right: 0.5em;
}

.switch + .switch:last-child {
  margin-right: 0;
}

.switch input[type=checkbox] {
  position: absolute;
  left: 0;
  opacity: 0;
  outline: none;
  z-index: -1;
}

.switch input[type=checkbox] + .check {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 2.75em;
  height: 1.575em;
  padding: 0.2em;
  background: #b5b5b5;
  border-radius: 4px;
  transition: background 150ms ease-out, box-shadow 150ms ease-out;
}

.switch input[type=checkbox] + .check:before {
  content: "";
  display: block;
  border-radius: 4px;
  width: 1.175em;
  height: 1.175em;
  background: whitesmoke;
  transition: transform 150ms ease-out;
  will-change: transform;
  transform-origin: left;
}

.switch input[type=checkbox]:checked + .check {
  background: var(--bulma-link);
}

.switch input[type=checkbox]:checked + .check:before {
  transform: translate3d(100%, 0, 0);
}

.switch input[type=checkbox]:focus, .switch input[type=checkbox]:active {
  outline: none;
}

.switch .control-label {
  padding-left: 0.5em;
}

.switch.is-rounded input[type=checkbox] + .check {
  border-radius: 9999px;
}

.switch.is-rounded input[type=checkbox] + .check:before {
  border-radius: 9999px;
}

.switch.is-small {
  border-radius: 2px;
  font-size: 0.75rem;
}

.switch.is-medium {
  font-size: 1.25rem;
}

.switch.is-large {
  font-size: 1.5rem;
}

.switch[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  color: #7a7a7a;
}
