.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch.tiny {
    width: 32px;
    height: 18px;
}

.switch.large {
    width: 54px;
    height: 26px;
}

.switch input {
    display: none;
}

.switch .on {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 32px;
    line-height: 24px;
    color: #fff;
    font-size: 13px;
    text-align: center;
    opacity: 0;
    transition: all 0.5s;
    -webkit-touch-callout: none;
    /* iOS Safari */
    -webkit-user-select: none;
    /* Safari */
    -khtml-user-select: none;
    /* Konqueror HTML */
    -moz-user-select: none;
    /* Old versions of Firefox */
    -ms-user-select: none;
    /* Internet Explorer/Edge */
    user-select: none;
    /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
}

.switch .off {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 32px;
    color: #fff;
    font-size: 13px;
    text-align: center;
    opacity: 0;
    transition: all 0.5s;
    -webkit-touch-callout: none;
    /* iOS Safari */
    -webkit-user-select: none;
    /* Safari */
    -khtml-user-select: none;
    /* Konqueror HTML */
    -moz-user-select: none;
    /* Old versions of Firefox */
    -ms-user-select: none;
    /* Internet Explorer/Edge */
    user-select: none;
    /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
}

.switch.tiny .on {
    line-height: 18px;
}

.switch.large .on {
    line-height: 26px;
}

.switch.tiny .off {
    line-height: 18px;
}

.switch.large .off {
    line-height: 26px;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 2px;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

.switch.tiny .slider:before {
    height: 16px;
    width: 16px;
    bottom: 1px;
    left: 1px;
}

.switch.large .slider:before {
    height: 22px;
    width: 22px;
}

input:checked+.slider {
    background-color: #2196F3;
}

input:checked+.slider.success {
    background-color: #28a745;
}

input:checked+.slider.warning {
    background-color: #ffc107;
}

input:checked+.slider.danger {
    background-color: #dc3545;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked+.slider:before {
    -webkit-transform: translateX(16px);
    -ms-transform: translateX(16px);
    transform: translateX(16px);
}

.switch.tiny input:checked+.slider:before {
    -webkit-transform: translateX(14px);
    -ms-transform: translateX(14px);
    transform: translateX(14px);
}

.switch.large input:checked+.slider:before {
    -webkit-transform: translateX(28px);
    -ms-transform: translateX(28px);
    transform: translateX(28px);
}

.switch.tiny .off {
    opacity: 1;
}

.switch.large .off {
    opacity: 1;
}

input:checked+.slider .on {
    opacity: 1 !important;
}

input:checked+.slider .off {
    opacity: 0 !important;
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.switch.tiny .slider.round {
    border-radius: 20px;
}

.switch.large .slider.round {
    border-radius: 28px;
}

.slider:before {
    border-radius: 2px;
}

.slider.round:before {
    border-radius: 50%;
}