@mixin matcha-radio($theme) {
    $color-functions: (
        red: getRed,
        pink: getPink,
        purple: getPurple,
        deep-purple: getDeepPurple,
        indigo: getIndigo,
        blue: getBlue,
        light-blue: getLightBlue,
        cyan: getCyan,
        teal: getTeal,
        green: getGreen,
        light-green: getLightGreen,
        lime: getLime,
        yellow: getYellow,
        amber: getAmber,
        orange: getOrange,
        deep-orange: getDeepOrange,
        brown: getBrown,
        grey: getGrey,
        blue-grey: getBlueGrey,
        primary: getPrimary,
        accent: getAccent,
        success: getSuccess,
        warn: getWarn,
        danger: getDanger,
        info: getInfo,
    );

    matcha-radio {
        // default (no color) → uses accent
        &:not([color]) {
            input[type="radio"] {
                box-shadow: 0px 0px 0px 2px getBlueGrey($theme) inset;

                &:active:not(:disabled),
                &:checked:not(:disabled) {
                    box-shadow: 0px 0px 0px 2px getAccent($theme) inset,
                                0px 0px 0px 5px getSurface($theme) inset,
                                0px 0px 0px 10px getAccent($theme) inset;

                    &::after { background-color: transparent; }
                }
            }

            .matcha-radio-container {
                &:hover { background-color: rgba(getAccent($theme), 0.1); }
                .ripple { background: rgba(getAccent($theme), 0.2) !important; }
            }
        }

        // idle ring for all color variants
        &[color] {
            input[type="radio"] {
                box-shadow: 0px 0px 0px 2px getBlueGrey($theme) inset;
            }
        }

        // color variations
        @each $colorName, $colorFn in $color-functions {
            &[color="#{$colorName}"] {
                input[type="radio"] {
                    &:active:not(:disabled),
                    &:checked:not(:disabled) {
                        box-shadow: 0px 0px 0px 2px call(#{$colorFn}, $theme) inset,
                                    0px 0px 0px 5px getSurface($theme) inset,
                                    0px 0px 0px 10px call(#{$colorFn}, $theme) inset;

                        &::after { background-color: transparent; }
                    }
                }

                .matcha-radio-container {
                    &:hover { background-color: rgba(call(#{$colorFn}, $theme), 0.1); }
                    .ripple { background: rgba(call(#{$colorFn}Contrast, $theme), 0.2) !important; }
                }
            }
        }

        // disabled
        &[disabled] {
            input[type="radio"] {
                box-shadow: 0px 0px 0px 2px getGrey($theme) inset;

                &:checked {
                    box-shadow: 0px 0px 0px 2px getGrey($theme) inset,
                                0px 0px 0px 5px getSurface($theme) inset,
                                0px 0px 0px 10px getGrey($theme) inset;

                    &::after { background-color: transparent; }
                }
            }
        }

        .matcha-radio-label {
            color: getGrey($theme);
        }
    }
}

matcha-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;

    input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        width: 18px;
        height: 18px;
        padding: 0;
        margin: 0;
        border-radius: 50%;
        border-width: 0;
        border-style: solid;
        outline: none;
        cursor: pointer;
        position: relative;
        transition: all 0.2s ease;

        &:disabled {
            cursor: not-allowed;
            transition: none;
        }

        &:focus {}
    }

    .matcha-radio-label {
        font-size: 14px;
        user-select: none;
        cursor: pointer;
    }

    &[disabled] {
        cursor: not-allowed;
        opacity: 0.6;

        .matcha-radio-label {
            cursor: not-allowed;
        }
    }
}