/**
<label class="toggle-switch">
    <input type="checkbox" name="name" />
    <div class="toggle-switch-label">Label</div>
    <div class="toggle-switch-wrapper">
        <div class="toggle-switch-content" data-toggle-switch-value-0="Off" data-toggle-switch-value-1="On">
            <span class="toggle-switch-handle"></span>
        </div>
    </div>
</label>
 */
.toggle-switch {
    margin: 0;
    padding: 0;
    width: 60px;
    height: 28px;
    position: relative;
    display: block;
    text-align: left;
    box-sizing: border-box;

    input {
        display: none;
    }

    .toggle-switch-wrapper {
        height: 100%;
        padding: 4px;
        background: $color__ops-gray;
        border-radius: 50px;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.2s ease-in-out;
    }

    .toggle-switch-content {
        position: relative;
        height: 100%;
        line-height: 0;
        transition: inherit;
        will-change: transform;

        &::before,
        &::after {
            content: "";
            position: absolute;
            width: calc(100% - 20px);
            height: 20px;
            line-height: 20px;
            font-weight: 400;
            text-align: center;
            color: inherit;
        }

        &::before {
            content: attr(data-toggle-switch-value-1);
            right: 100%;
            color: #fff;
        }

        &::after {
            content: attr(data-toggle-switch-value-0);
            right: 0;
            color: #fff;
        }
    }

    .toggle-switch-handle {
        position: relative;
        display: inline-block;
        width: 20px;
        height: 20px;
        background: #fff;
        border-radius: 50%;
    }

    input:checked + .toggle-switch-wrapper {
        background: $color__ops-blue;

        .toggle-switch-content {
            transform: translateX(calc(100% - 20px));
        }
    }

    input:disabled + .toggle-switch-wrapper {
        opacity: 0.8;
        cursor: default;
    }

    input:disabled + .toggle-switch-wrapper .toggle-switch-handle::before {
        content: ""; // @todo - lock icon
        position: absolute;
        display: block;
        top: 50%;
        left: 50%;
        line-height: 1;
        font-family: "op3-icons";
        color: #808080;
        transform: translate(-50%, -50%);
    }

    input:checked:disabled + .toggle-switch-wrapper .toggle-switch-handle::before {
        color: $color__ops-gray;
    }
}
