/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

.toggle {
    touch-action: pan-x;
    position: relative;
    cursor: pointer;
    user-select: none;
    margin-left: 10px;
    -webkit-tap-highlight-color: transparent;
}

.toggleScreenReader {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.toggleDisabled {
    cursor: not-allowed;
}

.toggleTrack {
    width: 50px;
    height: 24px;
    border-radius: 30px;
    background-color: var(--custom-dark-1);
    transition: all 0.2s ease;
}

.toggleTrackCheck {
    position: absolute;
    height: 15px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    left: 8px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.toggleChecked .toggleTrackCheck,
[data-theme="dark"] .toggle .toggleTrackCheck {
    opacity: 1;
    transition: opacity 0.25s ease;
}

.toggleTrackX {
    position: absolute;
    width: 12px;
    height: 15px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    right: 10px;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.toggleChecked .toggleTrackX,
[data-theme="dark"] .toggle .toggleTrackX {
    opacity: 0;
}

.toggleTrackThumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 22px;
    height: 22px;
    border: 1px solid #4d4d4d;
    border-radius: 50%;
    background-color: #fafafa;
    transition: all 0.25s ease;
}

.toggleFocused .toggleTrackThumb,
.toggle:hover .toggleTrackThumb {
    box-shadow: 0 0 2px 3px var(--ifm-color-primary);
}

/* stylelint-disable-next-line no-descending-specificity */
.toggleChecked .toggleTrackThumb,
[data-theme="dark"] .toggle .toggleTrackThumb {
    left: 27px;
}

.toggle:active:not(.toggleDisabled) .toggleTrackThumb {
    box-shadow: 0 0 5px 5px var(--ifm-color-primary);
}

.toggleIcon {
    align-items: center;
    display: flex;
    height: 15px;
    justify-content: center;
    width: 15px;

    svg > path {
        fill: var(--custom-blue-0);
    }
}
