/* Global button stability fixes
   Goal: prevent height/text jump on active/focus/checked states */

.btn {
    box-sizing: border-box !important;
    line-height: 1.5 !important;
    white-space: nowrap !important;
    text-align: center !important;
}

.btn:hover,
.btn:focus,
.btn:active,
.btn:focus-visible,
.btn.active,
.btn.show {
    line-height: 1.5 !important;
}

/* Bootstrap active/toggle selectors sometimes change visual box model */
.btn-check:checked + .btn,
:not(.btn-check) + .btn:active,
.btn:first-child:active,
.btn.active,
.show > .btn.dropdown-toggle {
    box-sizing: border-box !important;
    transform: none !important;
    translate: none !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
}

/* Keep solid button border stable across states */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
.btn-light,
.btn-dark,
.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover,
.btn-light:hover,
.btn-dark:hover,
.btn-primary:focus,
.btn-secondary:focus,
.btn-success:focus,
.btn-danger:focus,
.btn-warning:focus,
.btn-info:focus,
.btn-light:focus,
.btn-dark:focus,
.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-danger:active,
.btn-warning:active,
.btn-info:active,
.btn-light:active,
.btn-dark:active,
.btn-check:checked + .btn-primary,
.btn-check:checked + .btn-secondary,
.btn-check:checked + .btn-success,
.btn-check:checked + .btn-danger,
.btn-check:checked + .btn-warning,
.btn-check:checked + .btn-info,
.btn-check:checked + .btn-light,
.btn-check:checked + .btn-dark,
:not(.btn-check) + .btn-primary:active,
:not(.btn-check) + .btn-secondary:active,
:not(.btn-check) + .btn-success:active,
:not(.btn-check) + .btn-danger:active,
:not(.btn-check) + .btn-warning:active,
:not(.btn-check) + .btn-info:active,
:not(.btn-check) + .btn-light:active,
:not(.btn-check) + .btn-dark:active {
    border-width: 1px !important;
    border-style: solid !important;
    border-color: transparent !important;
}
