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

label.pack-checkbox,
label.pack-radio,
label.pack-switch {
  display: inline-block;
  vertical-align: middle;
  width: 5rem;
  height: 5rem;
  position: relative;
  background: none;
}

label.pack-checkbox input,
label.pack-radio input,
label.pack-switch input {
  margin: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

label.pack-checkbox input ~ span:after,
label.pack-radio input ~ span:after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -1.1rem 0 0 -1.1rem;
  width: 2.2rem;
  height: 2.2rem;
  pointer-events: none;
}

label.pack-checkbox input ~ span:after {
  background: url(switches/images/check/default.png) no-repeat center top / 2.2rem auto;
}

label.pack-radio input ~ span:after {
  background: url(switches/images/radio/default.png) no-repeat center top / 2.2rem auto;
}

label.pack-checkbox input:checked ~ span:after,
label.pack-radio input:checked ~ span:after,
label.pack-switch input:checked ~ span:after {
  background-position: center bottom;
}

/* 'Dangerous' switches */

label.pack-checkbox.danger input ~ span:after {
  background-image: url(switches/images/check/danger.png);
}

label.pack-radio.danger input ~ span:after {
  background-image: url(switches/images/radio/danger.png);
}


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

label.pack-switch input ~ span:after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 6rem;
  margin: -1.4rem 0rem 0rem;
  height: 2.7rem;
  pointer-events: none;
  border-radius: 1.35rem;
  overflow: hidden;
  background: #e6e6e6 url(switches/images/switch/background_off.png) no-repeat -3.2rem 0rem / 9.2rem 2.7rem;
  transition: background 0.2s ease;
}

/* switch: 'ON' state */
label.pack-switch input:checked ~ span:after {
  background: #e6e6e6 url(switches/images/switch/background.png) no-repeat 0rem 0rem / 9.2rem 2.7rem;
}

/* switch: disabled state */
label.pack-switch input:disabled ~ span:after {
  opacity: 0.4;
}

label.pack-switch input.uninit ~ span:after {
  transition: none;
}

/******************************************************************************
 * Right-To-Left tweaks
 */

html[dir="rtl"] label.pack-checkbox input,
html[dir="rtl"] label.pack-radio input,
html[dir="rtl"] label.pack-switch input {
  left: auto;
  right: 0;
}

html[dir="rtl"] label.pack-checkbox input ~ span:after,
html[dir="rtl"] label.pack-radio input ~ span:after {
  left: auto;
  right: 50%;
  margin-left: auto;
  margin-right: -1.1rem;
}

html[dir="rtl"] label.pack-switch input ~ span:after {
  left: 0;
  right: auto;
}

