// Switches (toggles)
// ----------------------------------------------------------------------------
// The following styles have been adapted from https://jsfiddle.net/yeyene/42p6s7ps/

.checkbox-switch {
    position: relative;
}

.checkbox-switch label {
    margin-bottom: 0;
}

.checkbox-switch input {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 0%;
    margin: 0;
    filter: opacity(0%);
}

.checkbox-switch input + span {
    cursor: pointer;
    user-select: none;
}

.checkbox-switch input + span:before {
    position: absolute;
    left: 0;
    display: inline-block;
}

.checkbox-switch input + span {
    padding-left: 40px;
}

.checkbox-switch input + span:before {
    content: "";
    height: 20px;
    width: 40px;
    background: rgba(100, 100, 100, 0.2);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
    transition: background 0.2s ease-out;
}

.checkbox-switch input + span:after {
    background: var(--white);
    content: "";
    display: block;
    height: 20px;
    left: 0;
    position: absolute;
    text-align: center;
    top: 0;
    transition: margin-left 0.1s ease-in-out;
    width: 20px;
}

.checkbox-switch input:checked + span:after {
    margin-left: 20px;
    content: "";
}

.checkbox-switch input:checked + span:before {
    transition: background 0.2s ease-in;
}

.checkbox-switch input + span {
    padding-left: 40px;
}

.checkbox-switch input + span:before {
    border-radius: 20px;
    width: 40px;
}

.checkbox-switch input + span:after {
    background: var(--white);
    border: solid transparent 2px;
    border-radius: 20px;
    content: "";
    background-clip: padding-box;
    width: 20px;
}

.checkbox-switch input:not(:checked) + span:after {
    animation: popOut ease-in 0.3s normal;
}

.checkbox-switch input:checked + span:after {
    content: "";
    margin-left: 20px;
    border: solid transparent 2px;
    background-clip: padding-box;
    animation: popIn ease-in 0.3s normal;
}

.checkbox-switch input:checked + span:before {
    background: var(--color-success);
}

.checkbox-switch input:not(checked) + span:before {
    background: var(--color-danger);
}

.checkbox-switch input + span:before {
    box-shadow: none;
}

.checkbox-switch.disabled label {
    cursor: not-allowed;
}
.checkbox-switch input:disabled + span:before {
    background: var(--gray-300);
    cursor: not-allowed;
}
