/* ----------------------------------
 * CHECKBOXES / RADIOS
 * ---------------------------------- */

label:not([for])  {
  display: inline-block;
  vertical-align: middle;
  width: 5rem;
  height: 5rem;
  position: relative;
  background: none;
}

label:not([for]) input[type="checkbox"],
label:not([for]) input[type="radio"] {
  margin: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

label:not([for]) input + span {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -1.1rem 0 0 -1.1rem;
  width: 2.2rem;
  height: 2.2rem;
  pointer-events: none;
}

label:not([for]) input[type="checkbox"] + span {
  background: url(switches/images/check/default.png) no-repeat center top / 2.2rem auto;
}

label:not([for]) input[type="radio"] + span {
  background: url(switches/images/radio/default.png) no-repeat center top / 2.2rem auto;
}

label:not([for]) input:checked + span {
  background-position: center bottom;
}

/* 'Dangerous' switches */

label:not([for]).danger input[type="checkbox"] + span {
  background-image: url(switches/images/check/danger.png);
}

label:not([for]).danger input[type="radio"] + span {
  background-image: url(switches/images/radio/danger.png);
}


/* ----------------------------------
 * ON/OFF SWITCHES
 * ---------------------------------- */

label input[type="checkbox"][data-type="switch"] + span {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -1.1rem 0 0 -2.7rem;
  width: 5.1rem;
  height: 2.1rem;
  pointer-events: none;
  border-radius: 1.2rem;
  border: 0.1rem solid #c2c2c2;
  overflow: hidden;
  background: #e6e6e6 url(switches/images/switch/background_off.png) no-repeat -3.2rem 0 / 8.3rem 2.1rem;
  transition: background 0.2s ease, border 0.2s ease;
}

/* switch: 'ON' state */
label input[type="checkbox"][data-type="switch"]:checked + span {
  background: #e6e6e6 url(switches/images/switch/background.png) no-repeat 0 0 / 8.3rem 2.1rem;
  border-color: #00abcd;
}

/* switch: disabled state */
label input[data-type="switch"]:disabled + span {
  opacity: 0.4;
}

label input[type="checkbox"][data-type="switch"].uninit + span {
  transition: none;
  opacity: 0.4;
}