@use "variables" as *;
@import "common";

// Split Button Sizes
.p-splitbutton {
    .p-splitbutton-menubutton {
        border-radius: 0 $border-radius-md $border-radius-md 0;
        padding: 0 $spacing-1;
    }

    .p-splitbutton-defaultbutton {
        border-radius: $border-radius-md 0 0 $border-radius-md;
    }

    &.p-button-lg {
        .p-splitbutton-menubutton,
        .p-splitbutton-defaultbutton {
            @extend #large;
        }

        .p-splitbutton-menubutton {
            border-radius: 0 $border-radius-lg $border-radius-lg 0;
        }

        .p-splitbutton-defaultbutton {
            border-radius: $border-radius-lg 0 0 $border-radius-lg;
        }
    }

    &.p-button-sm {
        .p-splitbutton-menubutton,
        .p-splitbutton-defaultbutton {
            @extend #small;
        }
        .p-splitbutton-menubutton {
            border-radius: 0 $border-radius-sm $border-radius-sm 0;
            padding: 0 $spacing-0;
        }

        .p-splitbutton-defaultbutton {
            border-radius: $border-radius-sm 0 0 $border-radius-sm;
        }
    }

    // Basic Split Button Severity
    .p-splitbutton-defaultbutton:enabled,
    .p-splitbutton-menubutton:enabled {
        @extend #main-primary-severity;
    }

    &.p-button-secondary {
        .p-splitbutton-defaultbutton:enabled,
        .p-splitbutton-menubutton:enabled {
            @extend #main-secondary-severity;
        }
    }
}

// Split Buttons severities
// Oulined Split Button Severity

.p-splitbutton.p-button-outlined {
    .p-splitbutton-defaultbutton:enabled.p-button {
        border-right: none;
    }

    .p-splitbutton-defaultbutton:enabled,
    .p-splitbutton-menubutton:enabled {
        @extend #outlined-primary-severity;
        color: $color-palette-primary;
    }

    &.p-button-sm {
        .p-splitbutton-defaultbutton:enabled.p-button {
            border-right: none;
        }

        .p-splitbutton-defaultbutton:enabled,
        .p-splitbutton-menubutton:enabled {
            @extend #outlined-primary-severity-sm;
        }
    }

    &.p-button-secondary {
        .p-splitbutton-defaultbutton:enabled,
        .p-splitbutton-menubutton:enabled {
            @extend #outlined-secondary-severity;
            color: $color-palette-secondary;
        }

        &.p-button-sm {
            .p-splitbutton-defaultbutton:enabled,
            .p-splitbutton-menubutton:enabled {
                @extend #outlined-secondary-severity-sm;
            }
        }
    }
}

// Disable Split Button
.p-splitbutton {
    .p-splitbutton-defaultbutton:disabled,
    .p-splitbutton-menubutton:disabled {
        @extend #button-disabled;
    }

    &.p-button-outlined {
        .p-splitbutton-defaultbutton:disabled,
        .p-splitbutton-menubutton:disabled {
            @extend #button-disabled-outlined;
        }
    }
}

// Severity for text button
.p-splitbutton.p-button-text {
    @extend #text-primary-severity;

    .p-button {
        &,
        &:hover,
        &:focus {
            color: $color-palette-primary;
            background-color: transparent;
            border: transparent;
        }
    }
}
