﻿/* ==========================================================================
   Bootstrap 4 -> 5 compatibility patch
   Restores BS4 look & behavior for classes removed in BS5, so existing
   markup keeps rendering the same. Load AFTER bootstrap.min.css.
   ========================================================================== */

/* BS5 underlines links by default; BS4 did not */
a {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* BS4 grid gutter was 30px (BS5 default is 24px) */
.row:not(.g-0) {
    --bs-gutter-x: 1.875rem;
}

/* .form-group (removed in BS5) */
.form-group {
    margin-bottom: 1rem;
}

/* BS5 removed default label bottom margin */
label {
    margin-bottom: 0.5rem;
}

/* .form-inline (removed in BS5) */
.form-inline {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
}
.form-inline .form-control:not([class*="col-"]),
.form-inline .form-select:not([class*="col-"]) {
    display: inline-block;
    width: auto;
    vertical-align: middle;
}
.form-inline .form-group {
    display: flex;
    flex: 0 0 auto;
    flex-flow: row wrap;
    align-items: center;
    margin-bottom: 0;
}
.form-inline label {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}
.form-inline .input-group {
    width: auto;
    flex-wrap: nowrap;
}
.form-inline .input-group > .form-control {
    width: 1%;
    flex: 1 1 auto;
    min-width: 10rem;
}

/* .form-row (removed in BS5) - BS4 exact values */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -5px;
    margin-left: -5px;
}
.form-row > .col,
.form-row > [class*="col-"] {
    padding-right: 5px;
    padding-left: 5px;
}

/* .input-group-prepend / .input-group-append (removed in BS5) */
.input-group-prepend,
.input-group-append {
    display: flex;
}

/* BS5 dropped sizing selectors for addons wrapped in prepend/append;
   without these the addon renders at default size, overflows narrow
   panels and wraps, letting the control stretch full width (BS4 values) */
.input-group-sm > .input-group-prepend > .input-group-text,
.input-group-sm > .input-group-append > .input-group-text,
.input-group-sm > .input-group-prepend > .btn,
.input-group-sm > .input-group-append > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}
.input-group-lg > .input-group-prepend > .input-group-text,
.input-group-lg > .input-group-append > .input-group-text,
.input-group-lg > .input-group-prepend > .btn,
.input-group-lg > .input-group-append > .btn {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    line-height: 1.5;
}
.input-group-prepend {
    margin-right: -1px;
}
.input-group-append {
    margin-left: -1px;
}
.input-group > .input-group-prepend > .btn,
.input-group > .input-group-prepend > .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group > .input-group-append > .btn,
.input-group > .input-group-append > .input-group-text {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group > .input-group-append:not(:last-child) > .btn,
.input-group > .input-group-append:not(:last-child) > .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group > .input-group-prepend:not(:first-child) > .btn,
.input-group > .input-group-prepend:not(:first-child) > .input-group-text {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* col-* combined with .input-group on the same element:
   BS4 capped the column via max-width, so .input-group's width:100%
   could not exceed it; BS5 uses width and loses to .input-group's
   width:100%, making the column expand to full row and wrap. */
.input-group.col-6 {
    max-width: 50%;
}
@media (min-width: 576px) {
    .input-group.col-sm-6 {
        max-width: 50%;
    }
}
@media (min-width: 768px) {
    .input-group.col-md-3 {
        max-width: 25%;
    }
    .input-group.col-md-6 {
        max-width: 50%;
    }
}

/* .btn-block (removed in BS5) */
.btn-block {
    display: block;
    width: 100%;
}
.btn-block + .btn-block {
    margin-top: 0.5rem;
}

/* .card-deck (removed in BS5) - BS4 desktop behavior */
@media (min-width: 576px) {
    .card-deck {
        display: flex;
        flex-flow: row wrap;
        margin-right: -15px;
        margin-left: -15px;
    }
    .card-deck .card {
        flex: 1 0 0%;
        margin-right: 15px;
        margin-bottom: 0;
        margin-left: 15px;
    }
}

/* BS4 badge sizing (BS5 default padding is larger) */
.badge {
    padding: 0.25em 0.4em;
}

/* BS5 paints th/td backgrounds from --bs-table-bg, covering row-level
   bg-* utilities (BS4 cells were transparent, letting tr colors show);
   cell-level color likewise hides tr-level text-* utilities */
.table tr[class*="bg-"] > th,
.table tr[class*="bg-"] > td {
    --bs-table-bg: transparent;
    background-color: transparent;
}
.table tr[class*="text-"] > th,
.table tr[class*="text-"] > td {
    color: inherit;
}

/* form-control combined with col-N: BS4's col max-width capped the
   form-control width:100%; BS5 col-N uses width, which loses to the
   later .form-control rule */
.form-control.col-10,
.form-select.col-10 {
    max-width: 83.33333333%;
}

/* BS5 dropped width:100% on .table-responsive; without it the BFC box
   shrinks beside floats (e.g. the per-page selector) instead of
   dropping below like BS4 */
.table-responsive {
    width: 100%;
}

/* modal-content/header/body used standalone (fancybox iframes) have no
   .modal ancestor, so BS5's --bs-modal-* vars are undefined and paddings
   collapse to 0; define the defaults here */
.modal-content {
    --bs-modal-padding: 1rem;
    --bs-modal-header-padding-x: 1rem;
    --bs-modal-header-padding-y: 1rem;
    --bs-modal-header-padding: 1rem 1rem;
    --bs-modal-header-border-color: var(--bs-border-color);
    --bs-modal-header-border-width: var(--bs-border-width);
    --bs-modal-title-line-height: 1.5;
    --bs-modal-footer-gap: 0.5rem;
    --bs-modal-footer-border-color: var(--bs-border-color);
    --bs-modal-footer-border-width: var(--bs-border-width);
    --bs-modal-color: ;
    --bs-modal-bg: var(--bs-body-bg);
    --bs-modal-border-color: var(--bs-border-color-translucent);
    --bs-modal-border-width: var(--bs-border-width);
    --bs-modal-border-radius: var(--bs-border-radius-lg);
    --bs-modal-inner-border-radius: calc(var(--bs-border-radius-lg) - (var(--bs-border-width)));
}

/* .form-check-inline: BS4 was inline-flex with zero left padding;
   BS5 keeps the 1.5em check gutter, adding stray indent before each
   inline option and changing vertical alignment */
.form-check-inline {
    display: inline-flex;
    align-items: center;
    padding-left: 0;
    margin-right: 0.75rem;
}
.form-check-inline .form-check-input {
    float: none;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0.3125rem;
}

/* ASP.NET asp:CheckBox / asp:RadioButton render CssClass on a wrapper
   <span>, not the input; BS5's .form-check-input draws a bordered box
   (appearance:none) which shows as an extra empty outline next to the
   real native control. Strip the box visuals from the span. */
span.form-check-input {
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    margin-top: 0;
    vertical-align: baseline;
}

/* give select.form-control the same chevron as .form-select so all
   dropdowns look consistent under BS5 */
select.form-control:not([multiple]):not([size]) {
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* BS5's table color selector (.table > :not(caption) > * > *) has lower
   specificity than BS4's (.table .thead-dark th), so page-level rules
   like ".table-responsive th{background:#f2f2f2}" (sticky headers in
   Report_*.aspx) now override the dark heading. Pin BS4's colors back
   with a stronger selector. */
.table thead.table-dark th {
    color: #fff;
    background-color: #212529;
    border-color: #32383e;
}

/* BS5 changed .btn-info from BS4's dark-teal/white (#17a2b8) to bright
   cyan/black (#0dcaf0). Restore the BS4 look, darkened to #117a8b so
   white text passes WCAG AA (BS4's own #17a2b8 was only 3.04:1). */
.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-bg: #117a8b;
    --bs-btn-border-color: #117a8b;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0f6b7a;
    --bs-btn-hover-border-color: #0e6371;
    --bs-btn-focus-shadow-rgb: 17, 122, 139;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0e6371;
    --bs-btn-active-border-color: #0d5c69;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #117a8b;
    --bs-btn-disabled-border-color: #117a8b;
}
.btn-outline-info {
    --bs-btn-color: #117a8b;
    --bs-btn-border-color: #117a8b;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #117a8b;
    --bs-btn-hover-border-color: #117a8b;
    --bs-btn-focus-shadow-rgb: 17, 122, 139;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #117a8b;
    --bs-btn-active-border-color: #117a8b;
    --bs-btn-disabled-color: #117a8b;
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: #117a8b;
}

/* BS5 moved .dropdown-menu default positioning (top/left, dropup's
   bottom, -end's right) into Popper's inline styles; menus toggled
   manually (jQuery .show()/.hide(), no data-bs-popper attribute) render
   in normal flow and can escape the viewport. Restore BS4 statics. */
.dropdown-menu:not([data-bs-popper]) {
    top: 100%;
    left: 0;
    margin-top: 0.125rem;
}
.dropup .dropdown-menu:not([data-bs-popper]) {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0.125rem;
}
.dropdown-menu-end:not([data-bs-popper]),
.dropdown-menu-right:not([data-bs-popper]) {
    right: 0;
    left: auto;
}

/* bootstrap-datetimepicker (Stefan Petre lineage) spacing under BS5 */
.datetimepicker table tr td,
.datetimepicker table tr th {
    padding: 4px 5px;
}
