@mixin button-group() {
    .btn-group {
        border-radius: 0.25rem;

        .btn-contained {
            box-shadow: none;
        }

        .rtl &,
        [dir="rtl"] & {
            & > .dropdown:first-child > .btn,
            & > .dropup:first-child > .btn,
            & > .dropstart:first-child > .btn,
            & > .dropend:first-child > .btn,
            & > .btn:first-child {
                border-radius: 0 0.25rem 0.25rem 0 !important;
            }

            & > .dropdown:last-child > .btn,
            & > .dropup:last-child > .btn,
            & > .dropstart:last-child > .btn,
            & > .dropend:last-child > .btn,
            & > .btn:last-child {
                border-radius: 0.25rem 0 0 0.25rem !important;
            }
        }

        .ltr &,
        [dir="ltr"] & {
            & > .dropdown:first-child > .btn,
            & > .dropup:first-child > .btn,
            & > .dropstart:first-child > .btn,
            & > .dropend:first-child > .btn {
                border-radius: 0.25rem 0 0 0.25rem !important;
            }

            & > .dropdown:last-child > .btn,
            & > .dropup:last-child > .btn,
            & > .dropstart:last-child > .btn,
            & > .dropend:last-child > .btn {
                border-radius: 0 0.25rem 0.25rem 0 !important;
            }
        }
    }

    .btn-group-vertical {
        border-radius: 0.25rem;

        .btn-contained {
            box-shadow: none;
        }

        & > .btn:first-child {
            border-radius: 0.25rem 0.25rem 0 0 !important;
        }
        & > .btn:last-child {
            border-radius: 0 0 0.25rem 0.25rem !important;
        }
    }
}

@mixin btnTheme($palette) {
    $text-primary: map-get($palette, text, primary);
    $bg: map-get($palette, bg, main);

    $primary-palette: map-get($palette, primary);
    $secondary-palette: map-get($palette, secondary);

    $primary: map-get($primary-palette, main);
    $primary-text: map-get($primary-palette, text);
    $primary-light: map-get($primary-palette, light);
    $primary-dark: map-get($primary-palette, dark);

    $secondary: map-get($secondary-palette, main);
    $secondary-text: map-get($secondary-palette, text);
    $secondary-light: map-get($secondary-palette, light);
    $secondary-dark: map-get($secondary-palette, dark);
}

@include button-group();

.theme-bd.theme-light {
    @include btnTheme(map-get($theme, light));
}

.theme-bd.theme-dark {
    @include btnTheme(map-get($theme, dark));
}
