.switch {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin-left: -11px;
    margin-right: 16px;
    margin-inline-start: -11px;
    margin-inline-end: 16px;
    vertical-align: middle;
    -webkit-tap-highlight-color: transparent;

    &.disabled {
        color: var(--palette-text-disabled) !important;
        cursor: default;
    }

    &.readonly, .readonly:hover {
        cursor: default;
        background-color: transparent !important;
    }
}

.switch-span {
    width: 58px;
    height: 38px;
    display: inline-flex;
    padding: 12px;
    z-index: 0;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
    vertical-align: middle;

    & .switch-track {
        width: 100%;
        height: 100%;
        opacity: 0.48;
        z-index: -1;
        transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
        border-radius: 7px;
        background-color: var(--palette-black);
    }
}

.switch-base {
    padding: 9px;
    top: 0;
    left: 0;
    color: #fafafa;
    z-index: 1;
    position: absolute;
    transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;

    &.checked {
        transform: translateX(20px);

        & + .switch-track {
            opacity: 0.5;
        }
    }

    &:hover {
        background-color: var(--palette-action-default-hover);
    }

    &.switch-disabled {
        color: var(--palette-grey-default) !important;

        & + .switch-track {
            opacity: 0.12 !important;
        }

        &:hover, &:focus-visible {
            cursor: default;
            background-color: transparent !important;
        }
    }
}

.switch-button {
    display: flex;
    align-items: inherit;
    justify-content: inherit;

    & .switch-input {
        top: 0;
        left: 0;
        width: 100%;
        cursor: inherit;
        height: 100%;
        margin: 0;
        opacity: 0;
        padding: 0;
        z-index: 1;
        position: absolute;
    }

    & .switch-thumb {
        width: 20px;
        height: 20px;
        box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
        border-radius: 50%;
        background-color: currentColor;
    }
}