$transition-time: .3s;

$color-filled: var(--teal);
$color-not-filled: var(--gray);

$container-width: 40px;
$container-height: 20px;

$ball-size: 16px;
$ball-active-size: 25px;
$ball-gap: 2px;

.checkbox-toggle{
    position: relative;
    display: flex;

    // &.spacing-top{
    //     padding-top: 23px;
    // }

    &.label-top{
        flex-direction: column;

        .label-text{
            padding-left: 0;
            margin-bottom: 0.3rem;
            order: 1;
        }

        .checkbox-input, .checkbox-label{
            order: 2;
        }
    }

    .checkbox-input{
        height: 100%;
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        visibility: hidden;

        &:checked {
            & + .checkbox-label{
                background-color: $color-filled;

                &:after{
                    left: calc(100% - #{$ball-gap});
                    transform: translateX(-100%);
                }
            }
        }

        &:disabled {
            & + .checkbox-label{
                cursor: not-allowed;
                opacity: .4;
            }
        }
    }

    .checkbox-label{
        margin: 0px;
        cursor: pointer;
        text-indent: -9999px;
        width: $container-width;
        height: $container-height;
        background: $color-not-filled;
        display: block;
        border-radius: $container-height;
        position: relative;
        transition: background-color $transition-time;

        &:after {
            content: '';
            position: absolute;
            top: $ball-gap;
            left: $ball-gap;
            width: $ball-size;
            height: $ball-size;
            background: #fff;
            border-radius: $ball-size;
            transition: left $transition-time, transform $transition-time, width $transition-time;
        }

        &:active:after {
            width: $ball-active-size;
        }
    }

    .label-text{
        padding-left: 10px;
        font-size: 0.8125rem;
        letter-spacing: 0.1px;
        font-weight: 700;
        cursor: pointer;
    }
}