// https://m3.material.io/components/segmented-buttons/specs

.sd-segmented_button {
    display: inline-flex;
    align-items: center;
    --density: 0;
    --height: calc(var(--density) * 4px + 40px);
    .sd-segmented_button-item {
        overflow: hidden;
        height: var(--height);
        padding: 0 12px;
        cursor: pointer;
        $border: solid 1px var(--md-sys-color-outline);
        border-right: $border;
        border-top: $border;
        border-bottom: $border;
        user-select: none;
        &:first-child {
            border-left: $border;
            border-top-left-radius: var(--height);
            border-bottom-left-radius: var(--height);
        }
        &:last-child {
            border-right: $border;
            border-top-right-radius: var(--height);
            border-bottom-right-radius: var(--height);
        }
        font-size: 13px;
        line-height: 18px;
        color: var(--md-sys-color-on-surface);
        display: inline-flex;
        align-items: center;
        -webkit-tap-highlight-color: transparent; // remove webkit blue tap effect
        transition: all 200ms;
        svg {
            width: 16px;
            vertical-align: text-bottom;
        }
        &[data-sd-active='true'] {
            color: var(--md-sys-color-on-secondary-container);
            background: var(--md-sys-color-secondary-container);
            &:hover {
                filter: brightness(96%);
            }
            &:active {
                filter: brightness(92%);
            }
        }
        &[data-sd-active='false'] {
            &:hover {
                background: rgb(0 0 0 / 0.04);
            }
            &:active {
                background: rgb(0 0 0 / 0.08);
            }
            &:focus-visible {
                outline: none;
                background: rgb(0 0 0 / 0.12);
            }
        }
        &[data-sd-disabled='true'] {
            pointer-events: none;
            opacity: 0.38;
            border-right: none;
            & ~ .sd-segmented_button-item {
                border-left: $border;
            }
        }
        .sd-segmented_button-label {
            font-weight: bold;
        }
    }
}
