@import "../style-scss/import";

.mu-switch {
    position: relative;
    display: inline-block;
    height: 24px;
    line-height: 24px;
    cursor: pointer;
    user-select: none;
    input[type="checkbox"] {
        display: none;
        &:checked {
            + .mu-switch-wrapper {
                .mu-switch-track {
                    background-color: rgba($primaryColor, .5);
                }
                .mu-switch-thumb {
                    background-color: $primaryColor;
                    color: $primaryColor;
                    transform: translate3d(18px, 0, 0);
                }
            }

        }
    }
    &.disabled {
        input[type="checkbox"]:checked {
            + .mu-switch-wrapper {
                .mu-switch-track {
                    background-color: $lighterPrimaryColor;
                }
                .mu-switch-thumb {
                    background-color: $grey300;
                }
            }
        }
    }

    * {
        pointer-events: none;
    }
    &.disabled {
        cursor: not-allowed;
    }
}

.mu-switch-wrapper {
    display: flex;
    width: 100%;
    height: 24px;
    align-items: center;
    justify-content: space-between;
}

.mu-switch-container {
    width: 38px;
    padding: 4px 0 4px 2px;
    position: relative;
    margin-right: 8px;
    transition: all 450ms $easeOutFunction;
    .mu-switch.label-left & {
        margin-right: 0;
        margin-left: 8px;
    }
    .mu-switch.no-label & {
        margin-left: 0;
        margin-right: 0;
    }
}

.mu-switch-label {
    color: $textColor;
    .mu-switch.disabled & {
        color: $disabledColor;
    }
}

.mu-switch-track {
    width: 100%;
    height: 14px;
    border-radius: 30px;
    background-color: $lighterPrimaryColor;
    transition: all 450ms $easeOutFunction;
    .mu-switch.disabled & {
        background-color: $lighterPrimaryColor;
    }
}

.mu-switch-thumb {
    position: absolute;
    top: 1px;
    left: 0;
    width: 20px;
    height: 20px;
    line-height: 24px;
    color: $textColor;
    background-color: $darkerAccentColor;
    border-radius: 50%;
    @include depth(1);
    transition: all 450ms $easeOutFunction;
    backface-visibility: hidden;
    .mu-switch.disabled & {
        background-color: $grey300;
    }
}

.mu-switch-ripple-wrapper {
    height: 200%;
    width: 200%;
    top: -10px;
    left: -10px;
}