.bootstrap-switch {
  display: inline-block;
  direction: ltr;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid;
  border-color: #ccc;
  position: relative;
  text-align: left;
  overflow: hidden;
  line-height: 8px;
  z-index: 0;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  vertical-align: middle;
  -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
}

.bootstrap-switch .bootstrap-switch-container {
  display: inline-block;
  top: 0;
  border-radius: 4px;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0)
}

.bootstrap-switch .bootstrap-switch-handle-off,
.bootstrap-switch .bootstrap-switch-handle-on,
.bootstrap-switch .bootstrap-switch-label {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-block !important;
  height: 100%;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 20px
}

.bootstrap-switch .bootstrap-switch-handle-off,
.bootstrap-switch .bootstrap-switch-handle-on {
  text-align: center;
  z-index: 1
}

.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary {
  color: #fff;
  background: #428bca
}

.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info {
  color: #fff;
  background: #5bc0de
}

.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success {
  color: #fff;
  background: #5cb85c
}

.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning {
  background: #f0ad4e;
  color: #fff
}

.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger {
  color: #fff;
  background: #d9534f
}

.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default {
  color: #000;
  background: #eee
}

.bootstrap-switch .bootstrap-switch-label {
  text-align: center;
  margin-top: -1px;
  margin-bottom: -1px;
  z-index: 100;
  color: #333;
  background: #fff
}

.bootstrap-switch .bootstrap-switch-handle-on {
  border-bottom-left-radius: 3px;
  border-top-left-radius: 3px
}

.bootstrap-switch .bootstrap-switch-handle-off {
  border-bottom-right-radius: 3px;
  border-top-right-radius: 3px
}

.bootstrap-switch input[type=checkbox],
.bootstrap-switch input[type=radio] {
  position: absolute !important;
  top: 0;
  left: 0;
  opacity: 0;
  z-index: -1
}

.bootstrap-switch input[type=checkbox].form-control,
.bootstrap-switch input[type=radio].form-control {
  height: auto
}

.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {
  padding: 1px 5px;
  font-size: 12px;
  line-height: 1.5
}

.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.5
}

.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {
  padding: 6px 16px;
  font-size: 18px;
  line-height: 1.33
}

.bootstrap-switch.bootstrap-switch-disabled,
.bootstrap-switch.bootstrap-switch-indeterminate,
.bootstrap-switch.bootstrap-switch-readonly {
  cursor: default !important
}

.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label {
  opacity: .5;
  cursor: default !important
}

.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
  -webkit-transition: margin-left .5s;
  transition: margin-left .5s
}

.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  border-bottom-right-radius: 3px;
  border-top-right-radius: 3px
}

.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 3px;
  border-top-left-radius: 3px
}

.bootstrap-switch.bootstrap-switch-focused {
  border-color: #66afe9;
  outline: 0;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
}

.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label {
  border-bottom-right-radius: 3px;
  border-top-right-radius: 3px
}

.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label {
  border-bottom-left-radius: 3px;
  border-top-left-radius: 3px
}

//Bootstrap Switch
.bootstrap-switch {
  border-width: $border-width;
  border-color: $border-color;
  border-radius: $border-radius;

  .bootstrap-switch-on,
  .bootstrap-switch-handle-on,
  .bootstrap-switch-handle-off {
    background-color: $theme;
    border-color: $theme;
    color: $white;

    &.bootstrap-switch-primary {
      background-color: $primary;
      border-color: $primary;
      color: $white;
    }

    &.bootstrap-switch-secondary {
      background-color: $secondary;
      border-color: $secondary;
      color: $gray-300;
    }

    &.bootstrap-switch-success {
      background-color: $success;
      border-color: $success;
      color: $white;
    }

    &.bootstrap-switch-info {
      background-color: $info;
      border-color: $info;
      color: $white;
    }

    &.bootstrap-switch-warning {
      background-color: $warning;
      border-color: $warning;
      color: $white;
    }

    &.bootstrap-switch-danger {
      background-color: $danger;
      border-color: $danger;
      color: $white;
    }

    &.bootstrap-switch-light {
      background-color: $gray-300;
      border-color: $gray-300;
      color: $gray-900;
    }

    &.bootstrap-switch-dark {
      background-color: $gray-900;
      border-color: $gray-900;
      color: $white;
    }
  }
}

.bootstrap-switch.bootstrap-switch-focused {
  border-color: $border-color;
  outline: 0;
  -webkit-box-shadow: none;
  box-shadow: none;
}

.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default,
.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default {
  background-color: $gray-300;
  border-color: $gray-300;
  color: $gray-900;
}

.bootstrap-switch-label:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 3px;
  margin-top: -2px;
  margin-left: -5px;
  display: inline-block;
  border-top: 1px solid #DDD;
  border-bottom: 1px solid #DDD;
}

//chkd
.p-radio {
  >span:first-child {
    margin-left: 6px;
  }

  position: relative;
  font-size: 100%;

  >input[type="radio"] {
    display: none;

    +.p-radio-style {
      position: relative;
      display: inline-block;
      width: 1.4em;
      height: 1.4em;
      vertical-align: middle;
      cursor: pointer;
      float: left;

      &:before {
        position: absolute;
        top: 0;
        left: 0;
        display: inline-block;
        width: 1.4em;
        height: 1.4em;
        content: '';
        border: 1px solid $gray-300;
        border-radius: 50%;
      }

      &:after {
        position: absolute;
        display: none;
        content: '';
        top: .15em;
        left: .5em;
        box-sizing: border-box;
        width: .4em;
        height: .85em;
        transform: rotate(45deg);
        border-right: 2px solid $white;
        border-bottom: 2px solid $white;
      }
    }

    &:checked+.p-radio-style {
      &:before {
        animation-name: none;
        border: 1px solid $theme;
        background: $theme;
      }

      &:after {
        display: block;
      }
    }

    &:checked[disabled]+.p-radio-style {
      opacity: .6;
    }
  }

  >input[type="radio"][disabled] {
    cursor: not-allowed;

    +.p-radio-style {
      cursor: not-allowed;
      color: $gray-300;

      &:hover {
        cursor: not-allowed;

        &:before {
          animation-name: none;
        }
      }

      &:before {
        cursor: not-allowed;
        border-color: $gray-300;
      }

      &:after {
        cursor: not-allowed;
      }
    }
  }

  &.p-radio-sm {
    font-size: 75%;
  }

  &.p-radio-lg {
    font-size: 125%;
  }

  &.p-radio-xl {
    font-size: 150%;
  }

  &.radio-color-primary {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $primary;
      border-color: $primary;
    }
  }

  &.radio-color-secondary {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $secondary;
      border-color: $secondary;
    }
  }

  &.radio-color-success {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $success;
      border-color: $success;
    }
  }

  &.radio-color-info {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $info;
      border-color: $info;
    }
  }

  &.radio-color-danger {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $danger;
      border-color: $danger;
    }
  }

  &.radio-color-warning {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $warning;
      border-color: $warning;
    }
  }

  &.radio-color-light {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $gray-300;
      border-color: $gray-300;
    }
  }

  &.radio-color-dark {
    >input[type="radio"]:checked+.p-radio-style:before {
      background-color: $gray-900;
      border-color: $gray-900;
    }
  }
}

//chkd
.p-checkbox {
  >span:first-child {
    margin-left: 6px;
  }

  position: relative;
  font-size: 100%;

  >input[type="checkbox"] {
    display: none;

    +.p-checkbox-style {
      position: relative;
      display: inline-block;
      width: 1.4em;
      height: 1.4em;
      vertical-align: middle;
      cursor: pointer;
      float: left;

      &:before {
        position: absolute;
        top: 0;
        left: 0;
        display: inline-block;
        width: 1.4em;
        height: 1.4em;
        content: '';
        border: 1px solid $gray-300;
        border-radius: 3px;
      }

      &:after {
        position: absolute;
        display: none;
        content: '';
        top: .15em;
        left: .5em;
        box-sizing: border-box;
        width: .4em;
        height: .85em;
        transform: rotate(45deg);
        border-right: 2px solid $white;
        border-bottom: 2px solid $white;
      }
    }

    &:checked+.p-checkbox-style {
      &:before {
        animation-name: none;
        border: $primary;
        background: $primary;
      }

      &:after {
        display: block;
      }
    }

    &:checked[disabled]+.p-checkbox-style:before {
      opacity: 0.5;
    }
  }

  >input[type="checkbox"][disabled] {
    cursor: not-allowed;

    +.p-checkbox-style {
      cursor: not-allowed;
      opacity: 0.5;
    }
  }

  &.p-checkbox-sm {
    font-size: 75%;
  }

  &.p-checkbox-lg {
    font-size: 125%;
  }

  &.p-checkbox-xl {
    font-size: 150%;
  }

  &.checkbox-color-primary {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $primary;
    }
  }

  &.checkbox-color-secondary {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $secondary;
    }
  }

  &.checkbox-color-success {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $success;
    }
  }

  &.checkbox-color-info {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $info;
    }
  }

  &.checkbox-color-danger {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $danger;
    }
  }

  &.checkbox-color-warning {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $warning;
    }
  }

  &.checkbox-color-light {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $gray-300;
    }
  }

  &.checkbox-color-dark {
    >input[type="checkbox"]:checked+.p-checkbox-style:before {
      background-color: $gray-900;
    }
  }
}

label {
  &.p-radio {
    display: block;
    cursor: pointer;
  }

  &.p-checkbox {
    display: block;
    cursor: pointer;
  }
}

.p-switch {
  >span:first-child {
    margin-left: 6px;
  }

  box-sizing: border-box;
  display: inline-block;
  font-size: 100%;
  height: 1.6em;
  position: relative;

  .p-switch-style {
    height: 1.6em;
    left: 0;
    background: $gray-300;
    border-radius: .8em;
    display: inline-block;
    position: relative;
    top: 0;
    transition: all .3s ease-in-out;
    width: 3em;
    cursor: pointer;
    float: left;

    &:before {
      display: block;
      content: '';
      height: 1.4em;
      position: absolute;
      width: 1.4em;
      background-color: $white;
      border-radius: 50%;
      left: .1em;
      top: .1em;
      transition: all .3s ease-in-out;
    }
  }

  >input[type="checkbox"] {
    display: none;

    &:checked+.p-switch-style {
      background-color: $primary;

      &:before {
        left: 50%;
      }
    }

    &:checked[disabled]+.p-switch-style {
      opacity: 0.5;
    }
  }

  &.p-switch-sm {
    font-size: 75%;
  }

  &.p-switch-lg {
    font-size: 125%;
  }

  &.p-switch-xl {
    font-size: 150%;
  }

  >input[type="checkbox"][disabled]+.p-switch-style {
    cursor: not-allowed;
    opacity: 0.5;
  }

  &.switch-color-primary {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $primary;
    }
  }

  &.switch-color-secondary {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $secondary;
    }
  }

  &.switch-color-success {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $success;
    }
  }

  &.switch-color-info {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $info;
    }
  }

  &.switch-color-danger {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $danger;
    }
  }

  &.switch-color-warning {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $warning;
    }
  }

  &.switch-color-light {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $gray-300;
    }
  }

  &.switch-color-dark {
    >input[type="checkbox"]:checked+.p-switch-style {
      background-color: $gray-900;
    }
  }
}

.p-switch-style {
  box-sizing: border-box;

  &:before {
    box-sizing: border-box;
  }
}