/*
 * Bootstrap 4 → 5 Compatibility Layer
 * ------------------------------------
 * This stylesheet maps removed or renamed Bootstrap 4 utility classes
 * to their Bootstrap 5 equivalents, preserving the existing look and
 * style across all views during the migration.
 *
 * As views are updated to use native BS5 classes, entries here can
 * be removed.
 */

/* ===================================================================
   Spacing utilities — BS4 ml-x/mr-x/pl-x/pr-x → BS5 ms-x/me-x/ps-x/pe-x
   In LTR mode, start=left and end=right, so these are direct aliases.
   =================================================================== */

/* margin-left (BS4 ml-*) */
.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }
.ml-auto { margin-left: auto !important; }
.ml-n1 { margin-left: -0.25rem !important; }
.ml-n2 { margin-left: -0.5rem !important; }
.ml-n3 { margin-left: -1rem !important; }
.ml-n4 { margin-left: -1.5rem !important; }
.ml-n5 { margin-left: -3rem !important; }

/* margin-right (BS4 mr-*) */
.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mr-5 { margin-right: 3rem !important; }
.mr-auto { margin-right: auto !important; }
.mr-n1 { margin-right: -0.25rem !important; }
.mr-n2 { margin-right: -0.5rem !important; }
.mr-n3 { margin-right: -1rem !important; }
.mr-n4 { margin-right: -1.5rem !important; }
.mr-n5 { margin-right: -3rem !important; }

/* padding-left (BS4 pl-*) */
.pl-0 { padding-left: 0 !important; }
.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pl-4 { padding-left: 1.5rem !important; }
.pl-5 { padding-left: 3rem !important; }

/* padding-right (BS4 pr-*) */
.pr-0 { padding-right: 0 !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pr-3 { padding-right: 1rem !important; }
.pr-4 { padding-right: 1.5rem !important; }
.pr-5 { padding-right: 3rem !important; }

/* Responsive spacing: sm breakpoint */
@media (min-width: 576px) {
    .ml-sm-0 { margin-left: 0 !important; }
    .ml-sm-1 { margin-left: 0.25rem !important; }
    .ml-sm-2 { margin-left: 0.5rem !important; }
    .ml-sm-3 { margin-left: 1rem !important; }
    .ml-sm-4 { margin-left: 1.5rem !important; }
    .ml-sm-5 { margin-left: 3rem !important; }
    .ml-sm-auto { margin-left: auto !important; }
    .mr-sm-0 { margin-right: 0 !important; }
    .mr-sm-1 { margin-right: 0.25rem !important; }
    .mr-sm-2 { margin-right: 0.5rem !important; }
    .mr-sm-3 { margin-right: 1rem !important; }
    .mr-sm-4 { margin-right: 1.5rem !important; }
    .mr-sm-5 { margin-right: 3rem !important; }
    .mr-sm-auto { margin-right: auto !important; }
    .pl-sm-0 { padding-left: 0 !important; }
    .pl-sm-1 { padding-left: 0.25rem !important; }
    .pl-sm-2 { padding-left: 0.5rem !important; }
    .pl-sm-3 { padding-left: 1rem !important; }
    .pl-sm-4 { padding-left: 1.5rem !important; }
    .pl-sm-5 { padding-left: 3rem !important; }
    .pr-sm-0 { padding-right: 0 !important; }
    .pr-sm-1 { padding-right: 0.25rem !important; }
    .pr-sm-2 { padding-right: 0.5rem !important; }
    .pr-sm-3 { padding-right: 1rem !important; }
    .pr-sm-4 { padding-right: 1.5rem !important; }
    .pr-sm-5 { padding-right: 3rem !important; }
}

/* Responsive spacing: md breakpoint */
@media (min-width: 768px) {
    .ml-md-0 { margin-left: 0 !important; }
    .ml-md-1 { margin-left: 0.25rem !important; }
    .ml-md-2 { margin-left: 0.5rem !important; }
    .ml-md-3 { margin-left: 1rem !important; }
    .ml-md-4 { margin-left: 1.5rem !important; }
    .ml-md-5 { margin-left: 3rem !important; }
    .ml-md-auto { margin-left: auto !important; }
    .mr-md-0 { margin-right: 0 !important; }
    .mr-md-1 { margin-right: 0.25rem !important; }
    .mr-md-2 { margin-right: 0.5rem !important; }
    .mr-md-3 { margin-right: 1rem !important; }
    .mr-md-4 { margin-right: 1.5rem !important; }
    .mr-md-5 { margin-right: 3rem !important; }
    .mr-md-auto { margin-right: auto !important; }
    .pl-md-0 { padding-left: 0 !important; }
    .pl-md-1 { padding-left: 0.25rem !important; }
    .pl-md-2 { padding-left: 0.5rem !important; }
    .pl-md-3 { padding-left: 1rem !important; }
    .pl-md-4 { padding-left: 1.5rem !important; }
    .pl-md-5 { padding-left: 3rem !important; }
    .pr-md-0 { padding-right: 0 !important; }
    .pr-md-1 { padding-right: 0.25rem !important; }
    .pr-md-2 { padding-right: 0.5rem !important; }
    .pr-md-3 { padding-right: 1rem !important; }
    .pr-md-4 { padding-right: 1.5rem !important; }
    .pr-md-5 { padding-right: 3rem !important; }
}

/* Responsive spacing: lg breakpoint */
@media (min-width: 992px) {
    .ml-lg-0 { margin-left: 0 !important; }
    .ml-lg-1 { margin-left: 0.25rem !important; }
    .ml-lg-2 { margin-left: 0.5rem !important; }
    .ml-lg-3 { margin-left: 1rem !important; }
    .ml-lg-4 { margin-left: 1.5rem !important; }
    .ml-lg-5 { margin-left: 3rem !important; }
    .ml-lg-auto { margin-left: auto !important; }
    .mr-lg-0 { margin-right: 0 !important; }
    .mr-lg-1 { margin-right: 0.25rem !important; }
    .mr-lg-2 { margin-right: 0.5rem !important; }
    .mr-lg-3 { margin-right: 1rem !important; }
    .mr-lg-4 { margin-right: 1.5rem !important; }
    .mr-lg-5 { margin-right: 3rem !important; }
    .mr-lg-auto { margin-right: auto !important; }
    .pl-lg-0 { padding-left: 0 !important; }
    .pl-lg-1 { padding-left: 0.25rem !important; }
    .pl-lg-2 { padding-left: 0.5rem !important; }
    .pl-lg-3 { padding-left: 1rem !important; }
    .pl-lg-4 { padding-left: 1.5rem !important; }
    .pl-lg-5 { padding-left: 3rem !important; }
    .pr-lg-0 { padding-right: 0 !important; }
    .pr-lg-1 { padding-right: 0.25rem !important; }
    .pr-lg-2 { padding-right: 0.5rem !important; }
    .pr-lg-3 { padding-right: 1rem !important; }
    .pr-lg-4 { padding-right: 1.5rem !important; }
    .pr-lg-5 { padding-right: 3rem !important; }
}

/* Responsive spacing: xl breakpoint */
@media (min-width: 1200px) {
    .ml-xl-0 { margin-left: 0 !important; }
    .ml-xl-1 { margin-left: 0.25rem !important; }
    .ml-xl-2 { margin-left: 0.5rem !important; }
    .ml-xl-3 { margin-left: 1rem !important; }
    .ml-xl-4 { margin-left: 1.5rem !important; }
    .ml-xl-5 { margin-left: 3rem !important; }
    .ml-xl-auto { margin-left: auto !important; }
    .mr-xl-0 { margin-right: 0 !important; }
    .mr-xl-1 { margin-right: 0.25rem !important; }
    .mr-xl-2 { margin-right: 0.5rem !important; }
    .mr-xl-3 { margin-right: 1rem !important; }
    .mr-xl-4 { margin-right: 1.5rem !important; }
    .mr-xl-5 { margin-right: 3rem !important; }
    .mr-xl-auto { margin-right: auto !important; }
    .pl-xl-0 { padding-left: 0 !important; }
    .pl-xl-1 { padding-left: 0.25rem !important; }
    .pl-xl-2 { padding-left: 0.5rem !important; }
    .pl-xl-3 { padding-left: 1rem !important; }
    .pl-xl-4 { padding-left: 1.5rem !important; }
    .pl-xl-5 { padding-left: 3rem !important; }
    .pr-xl-0 { padding-right: 0 !important; }
    .pr-xl-1 { padding-right: 0.25rem !important; }
    .pr-xl-2 { padding-right: 0.5rem !important; }
    .pr-xl-3 { padding-right: 1rem !important; }
    .pr-xl-4 { padding-right: 1.5rem !important; }
    .pr-xl-5 { padding-right: 3rem !important; }
}

/* ===================================================================
   Float utilities — BS4 float-left/right → BS5 float-start/end
   =================================================================== */
.float-left  { float: left !important; }
.float-right { float: right !important; }
.float-none  { float: none !important; }

@media (min-width: 576px) {
    .float-sm-left  { float: left !important; }
    .float-sm-right { float: right !important; }
    .float-sm-none  { float: none !important; }
}
@media (min-width: 768px) {
    .float-md-left  { float: left !important; }
    .float-md-right { float: right !important; }
    .float-md-none  { float: none !important; }
}
@media (min-width: 992px) {
    .float-lg-left  { float: left !important; }
    .float-lg-right { float: right !important; }
    .float-lg-none  { float: none !important; }
}
@media (min-width: 1200px) {
    .float-xl-left  { float: left !important; }
    .float-xl-right { float: right !important; }
    .float-xl-none  { float: none !important; }
}

/* ===================================================================
   Text alignment — BS4 text-left/right/center → BS5 text-start/end
   =================================================================== */
.text-left   { text-align: left !important; }
.text-right  { text-align: right !important; }

@media (min-width: 576px) {
    .text-sm-left  { text-align: left !important; }
    .text-sm-right { text-align: right !important; }
}
@media (min-width: 768px) {
    .text-md-left  { text-align: left !important; }
    .text-md-right { text-align: right !important; }
}
@media (min-width: 992px) {
    .text-lg-left  { text-align: left !important; }
    .text-lg-right { text-align: right !important; }
}
@media (min-width: 1200px) {
    .text-xl-left  { text-align: left !important; }
    .text-xl-right { text-align: right !important; }
}

/* ===================================================================
   Font weight/style — BS4 font-weight-* → BS5 fw-*, font-italic → fst-italic
   =================================================================== */
.font-weight-bold    { font-weight: 700 !important; }
.font-weight-bolder  { font-weight: bolder !important; }
.font-weight-normal  { font-weight: 400 !important; }
.font-weight-light   { font-weight: 300 !important; }
.font-weight-lighter { font-weight: lighter !important; }
.font-italic         { font-style: italic !important; }

/* ===================================================================
   Rounded — BS4 rounded-left/right → BS5 rounded-start/end
   =================================================================== */
.rounded-left  { border-top-left-radius: var(--bs-border-radius) !important; border-bottom-left-radius: var(--bs-border-radius) !important; }
.rounded-right { border-top-right-radius: var(--bs-border-radius) !important; border-bottom-right-radius: var(--bs-border-radius) !important; }

/* ===================================================================
   Dropdown menu alignment — BS4 dropdown-menu-left/right → BS5 start/end
   =================================================================== */
.dropdown-menu-left  { --bs-position: start; }
.dropdown-menu-right { --bs-position: end; right: 0; left: auto; }

/* ===================================================================
   form-group  (removed in BS5 — was just margin-bottom: 1rem)
   =================================================================== */
.form-group {
    margin-bottom: 1rem;
}

/* ===================================================================
   form-row  (removed in BS5 — replaced by .row + gutters)
   =================================================================== */
.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;
}

/* ===================================================================
   form-inline  (removed in BS5)
   =================================================================== */
.form-inline {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
}

/* ===================================================================
   custom-select  (renamed to form-select in BS5)
   =================================================================== */
.custom-select {
    display: block;
    width: 100%;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    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;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.custom-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}
.custom-select-lg {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    border-radius: 0.5rem;
}

/* ===================================================================
   custom-control (checkbox/radio/switch) — renamed in BS5
   =================================================================== */
.custom-control {
    position: relative;
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5rem;
}
.custom-control-input {
    position: absolute;
    left: 0;
    z-index: -1;
    width: 1rem;
    height: 1.25rem;
    opacity: 0;
}
.custom-control-label {
    position: relative;
    margin-bottom: 0;
    vertical-align: top;
}
.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.custom-switch {
    padding-left: 2.25rem;
}

/* ===================================================================
   btn-block  (removed in BS5 — now use d-grid wrapper or w-100)
   =================================================================== */
.btn-block {
    display: block;
    width: 100%;
}

/* ===================================================================
   no-gutters  (renamed to g-0 in BS5)
   =================================================================== */
.no-gutters {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
}
.no-gutters > .col,
.no-gutters > [class*="col-"] {
    padding-right: 0;
    padding-left: 0;
}

/* ===================================================================
   close button  (BS4 .close → BS5 .btn-close, but keep old style)
   =================================================================== */
button.close {
    padding: 0;
    background-color: transparent;
    border: 0;
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
button.close:hover,
button.close:focus {
    color: #000;
    text-decoration: none;
    opacity: .75;
}

/* ===================================================================
   Badge color variants  (BS4 badge-{color} → BS5 text-bg-{color})
   =================================================================== */
.badge-primary   { color: #fff; background-color: #0d6efd; }
.badge-secondary { color: #fff; background-color: #6c757d; }
.badge-success   { color: #fff; background-color: #198754; }
.badge-danger    { color: #fff; background-color: #dc3545; }
.badge-warning   { color: #212529; background-color: #ffc107; }
.badge-info      { color: #fff; background-color: #0dcaf0; }
.badge-light     { color: #212529; background-color: #f8f9fa; }
.badge-dark      { color: #fff; background-color: #212529; }

/* ===================================================================
   BS4 .badge-pill → BS5 .rounded-pill on .badge
   =================================================================== */
.badge-pill {
    padding-right: 0.6em;
    padding-left: 0.6em;
    border-radius: 50rem;
}

/* ===================================================================
   media object  (removed in BS5 — keep for compat)
   =================================================================== */
.media {
    display: flex;
    align-items: flex-start;
}
.media-body {
    flex: 1;
}

/* ===================================================================
   card-deck  (removed in BS5 — was a flex container for cards)
   =================================================================== */
.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-left: 15px;
    margin-bottom: 0;
}

/* ===================================================================
   jumbotron  (removed in BS5)
   =================================================================== */
.jumbotron {
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
}

/* ===================================================================
   form-group-sm sizing  (removed in BS5)
   =================================================================== */
.form-group-sm .form-control {
    height: 30px;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
}

/* ===================================================================
   input-group-append / input-group-prepend (removed in BS5)
   Children go directly inside .input-group now.
   =================================================================== */
.input-group-append,
.input-group-prepend {
    display: flex;
}
.input-group-prepend {
    margin-right: -1px;
}
.input-group-append {
    margin-left: -1px;
}

/* ===================================================================
   BS4 sr-only → BS5 visually-hidden (keep old name working)
   =================================================================== */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* ===================================================================
   thead-light / thead-dark  (removed in BS5)
   =================================================================== */
.thead-light th {
    color: #495057;
    background-color: #e9ecef;
    border-color: #dee2e6;
}
.thead-dark th {
    color: #fff;
    background-color: #343a40;
    border-color: #454d55;
}

/* ===================================================================
   Embed responsive  (BS4 embed-responsive → BS5 ratio)
   =================================================================== */
.embed-responsive {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
}
.embed-responsive::before {
    display: block;
    content: "";
}
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.embed-responsive-16by9::before { padding-top: 56.25%; }
.embed-responsive-4by3::before  { padding-top: 75%; }
.embed-responsive-21by9::before { padding-top: 42.857143%; }
.embed-responsive-1by1::before  { padding-top: 100%; }

/* ===================================================================
   Border utilities — BS4 border-left/right → BS5 border-start/end
   =================================================================== */
.border-left   { border-left: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }
.border-right  { border-right: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }
.border-left-0 { border-left: 0 !important; }
.border-right-0 { border-right: 0 !important; }

/* ===================================================================
   text-monospace — renamed to font-monospace in BS5
   =================================================================== */
.text-monospace {
    font-family: var(--bs-font-monospace) !important;
}
