@mixin _colorize-inactive-type-solid-button-toggle-item($theme, $color-functions) {

    &:not([inactivetype]),
    &[inactivetype="solid"] {
        @each $colorName, $colorFn in $color-functions {
            &[inactivecolor="#{'' + $colorName}"] {
                .button-group {

                    button[matcha-button],
                    a[matcha-button] {
                        &:not([active]) {
                            background: call(#{$colorFn}, $theme);
                            color: call(#{$colorFn}Contrast, $theme);
                            box-shadow: 0 0 0 0px inset;

                            .ripple {
                                background: call(#{$colorFn}ContrastAlpha, $theme);
                            }
                        }
                    }
                }
            }
        }

        &[disabled],
        &[disabled]:not([disabled="false"]),
        &[disabled="true"] {
            .button-group {

                button[matcha-button],
                a[matcha-button] {
                    &:not([active]) {
                        @include _disabled-solid-button($theme);
                    }
                }
            }
        }
    }
}

@mixin _colorize-inactive-type-basic-button-toggle-item($theme, $color-functions) {
    &[inactivetype="basic"] {
        @each $colorName, $colorFn in $color-functions {
            &[inactivecolor="#{'' + $colorName}"] {
                .button-group {

                    button[matcha-button],
                    a[matcha-button] {
                        &:not([active]) {
                            background: getSurface($theme);
                            color: call(#{$colorFn}, $theme);
                            box-shadow: 0 0 0 0px inset;

                            .ripple {
                                background: call(#{$colorFn}Alpha, $theme);
                            }
                        }
                    }
                }
            }
        }

        &[disabled],
        &[disabled]:not([disabled="false"]),
        &[disabled="true"] {
            .button-group {

                button[matcha-button],
                a[matcha-button] {
                    &:not([active]) {
                        @include _disabled-basic-button($theme);
                    }
                }
            }
        }
    }
}

@mixin _colorize-inactive-type-outline-button-toggle-item($theme, $color-functions) {
    &[inactivetype="outline"] {

        //disabled false
        &:not([disabled="true"]) {
            @each $colorName, $colorFn in $color-functions {
                &[inactivecolor="#{'' + $colorName}"] {
                    .button-group {

                        button[matcha-button],
                        a[matcha-button] {

                            //botão não ativo
                            &:not([active]) {
                                color: call(#{$colorFn}, $theme);
                                background: transparent;
                                box-shadow: 0 0 0 2px call(#{$colorFn}, $theme) inset;

                                .ripple {
                                    background: call(#{$colorFn}Alpha, $theme);
                                }
                            }
                        }
                    }
                }
            }
        }

        //disabled true
        &[disabled],
        &[disabled]:not([disabled="false"]),
        &[disabled="true"] {
            .button-group {

                button[matcha-button],
                a[matcha-button] {

                    //botão não ativo
                    &:not([active]) {
                        @include _disabled-outline-button($theme);
                    }
                }
            }
        }
    }
}

@mixin _colorize-inactive-type-alpha-button-toggle-item($theme, $color-functions) {
    &[inactivetype="alpha"] {
        @each $colorName, $colorFn in $color-functions {
            &[inactivecolor="#{'' + $colorName}"] {
                .button-group {

                    button[matcha-button],
                    a[matcha-button] {
                        &:not([active]) {
                            color: call(#{$colorFn}, $theme);
                            background: call(#{$colorFn}Alpha, $theme);
                            box-shadow: 0 0 0 0px;

                            .ripple {
                                background: call(#{$colorFn}ContrastAlpha, $theme)
                            }
                        }
                    }
                }
            }
        }

        &[disabled],
        &[disabled]:not([disabled="false"]),
        &[disabled="true"] {
            .button-group {

                button[matcha-button],
                a[matcha-button] {

                    //botão não ativo
                    &:not([active]) {
                        @include _disabled-alpha-button($theme);
                    }
                }
            }
        }
    }
}

@mixin _colorize-inactive-type-link-button-toggle-item($theme, $color-functions) {

    &[inactivetype="link"] {
        @each $colorName, $colorFn in $color-functions {
            &[inactivecolor="#{'' + $colorName}"] {
                .button-group {

                    button[matcha-button],
                    a[matcha-button] {
                        &:not([active]) {

                            background: transparent;
                            color: call(#{$colorFn}, $theme);
                            box-shadow: 0 0 0 0px;

                            .ripple {
                                background: call(#{$colorFn}Alpha, $theme);
                            }

                        }
                    }
                }
            }
        }

        &[disabled],
        &[disabled]:not([disabled="false"]),
        &[disabled="true"] {
            .button-group {

                button[matcha-button],
                a[matcha-button] {

                    //botão não ativo
                    &:not([active]) {
                        @include _disabled-link-button($theme);
                    }
                }
            }
        }
    }
}




@mixin matcha-button-toggle($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,
        disabled: getDisabled,
    );

matcha-button-toggle {
    display: flex;
    @include _colorize-inactive-type-solid-button-toggle-item($theme, $color-functions);
    @include _colorize-inactive-type-basic-button-toggle-item($theme, $color-functions);
    @include _colorize-inactive-type-outline-button-toggle-item($theme, $color-functions);
    @include _colorize-inactive-type-alpha-button-toggle-item($theme, $color-functions);
    @include _colorize-inactive-type-link-button-toggle-item($theme, $color-functions);

    &[disabled],
    &[disabled]:not([disabled="false"]),
    &[disabled="true"] {
        .button-group {

            button[matcha-button],
            a[matcha-button] {
                &[active] {

                    &[outline],
                    &[outline]:not([outline="false"]),
                    &[outline="true"] {
                        @include _disabled-outline-button($theme);
                    }

                    &[basic],
                    &[basic]:not([basic="false"]),
                    &[basic="true"] {
                        @include _disabled-basic-button($theme);
                    }

                    &[alpha],
                    &[alpha]:not([alpha="false"]),
                    &[alpha="true"] {
                        @include _disabled-alpha-button($theme);
                    }

                    &[link],
                    &[link]:not([link="false"]),
                    &[link="true"] {
                        @include _disabled-link-button($theme);
                    }

                    @include _disabled-solid-button($theme);
                }
            }
        }

    }
}
}

matcha-button-toggle {
    .button-group {
        &.gap-0 {
            gap: 0 !important;

            // Ajuste border-radius quando gap = 0
            button[matcha-button]:first-child {
                border-top-right-radius: 0;
                border-bottom-right-radius: 0;
            }

            button[matcha-button]:last-child {
                border-top-left-radius: 0;
                border-bottom-left-radius: 0;
            }

            button[matcha-button]:not(:first-child):not(:last-child) {
                border-radius: 0;
            }
        }
    }
}