/**
 * The switch - the box around the slider
 *
 * @format
 */

:root {
    --this-wp-blue: #0073aa;
    --this-wp-blue-checked-but-disabled: #007f87;
    --switch-base: 20px;
    --switch-space: 2px;
}

/*
Use: 
<div>
    <span>...[label text]</span>
    <label for="check" class="switch">
        <input type="checkbox" name="check" id="check" value="1">
        <span class="slider [round]"></span>
    </label>
    <span>...[label text]</span>
</div>
[] = optioneel
*/

.ev-switch-container {
    display: flex;
    align-items: center;
    gap: 1em;
}

.ev-switch.switch {
    flex-shrink: 0;
    position: relative;
    display: inline-block;
    width: calc(calc(var(--switch-base) * 2) + calc(var(--switch-space) * 2));
    height: calc(calc(var(--switch-base) * 1) + calc(var(--switch-space) * 2));
}

/* Hide default HTML checkbox */
.ev-switch.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ev-switch-label-text {
    display: inline-flex;
}
.ev-switch.ev-switch-label {
    display: flex;
    gap: 0.5em;
}

/* The slider */
.ev-switch.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

.ev-switch.slider:before {
    position: absolute;
    content: '';
    height: var(--switch-base);
    width: var(--switch-base);
    left: var(--switch-space);
    bottom: var(--switch-space);
    background-color: white;
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

input.ev-switch:checked + .slider {
    background-color: var(--this-wp-blue);
}

input.ev-switch:focus + .slider {
    box-shadow: 0 0 1px var(--this-wp-blue);
}

input.ev-switch:checked + .slider {
    background-color: var(--this-wp-blue);
}

input.ev-switch:checked + .slider:before {
    -webkit-transform: translateX(var(--switch-base));
    -ms-transform: translateX(var(--switch-base));
    transform: translateX(var(--switch-base));
}

input[disabled].ev-switch:checked + .slider:before {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Rounded sliders */
.ev-switch.slider.round {
    border-radius: var(--switch-base);
}

.ev-switch.slider.round:before {
    border-radius: 50%;
}
