/* Coneso CF — Bootstrap 4 → 5.3 compatibility shim (Phase C.1).
 *
 * Loaded ONLY on the BS5 vendor path (`_head_*_bs5.html`, gated by the
 * `UI_SIDEBAR_NAV` feature flag). It re-implements the handful of Bootstrap 4
 * utility CLASSES that Bootstrap 5 renamed or dropped, so the ~640 existing
 * template lines that still use the BS4 names render identically under BS5
 * WITHOUT bulk-rewriting every template (see FASTAPI_MIGRATION_PLAN §C.1).
 *
 * This is a transitional file: as templates are rewritten to native BS5
 * classes, the corresponding rule here can be removed. It must load AFTER
 * bootstrap.min.css so these declarations win the cascade.
 *
 * Scope note: only utilities actually present in the active templates are
 * shimmed (verified by the Phase-C inventory). JS-behaviour attributes
 * (`data-toggle`/`data-target`/`data-dismiss`) are NOT CSS and are handled by
 * dual `data-bs-*` attributes in the templates instead.
 */

/* --- form-group: BS5 removed the 1rem bottom margin ---------------------- */
.form-group { margin-bottom: 1rem; }
.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;
}
/* BS5 dropped .form-inline; emulate the old inline-flex row. */
.form-inline {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
}
.form-inline .form-control { display: inline-block; width: auto; vertical-align: middle; }

/* --- directional spacing utilities (ml/mr/pl/pr -> ms/me/ps/pe) ---------- */
/* BS5 renamed left/right to start/end. Re-add the left/right aliases for the
 * 0–5 spacer scale (0, .25, .5, 1, 1.5, 3 rem). */
.ml-0 { margin-left: 0 !important; }       .mr-0 { margin-right: 0 !important; }
.ml-1 { margin-left: .25rem !important; }  .mr-1 { margin-right: .25rem !important; }
.ml-2 { margin-left: .5rem !important; }   .mr-2 { margin-right: .5rem !important; }
.ml-3 { margin-left: 1rem !important; }    .mr-3 { margin-right: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }  .mr-4 { margin-right: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }    .mr-5 { margin-right: 3rem !important; }
.ml-auto { margin-left: auto !important; } .mr-auto { margin-right: auto !important; }
.pl-0 { padding-left: 0 !important; }       .pr-0 { padding-right: 0 !important; }
.pl-1 { padding-left: .25rem !important; }  .pr-1 { padding-right: .25rem !important; }
.pl-2 { padding-left: .5rem !important; }   .pr-2 { padding-right: .5rem !important; }
.pl-3 { padding-left: 1rem !important; }    .pr-3 { padding-right: 1rem !important; }
.pl-4 { padding-left: 1.5rem !important; }  .pr-4 { padding-right: 1.5rem !important; }
.pl-5 { padding-left: 3rem !important; }    .pr-5 { padding-right: 3rem !important; }

/* --- text + float alignment (left/right -> start/end) -------------------- */
.text-left  { text-align: left !important; }
.text-right { text-align: right !important; }
.float-left  { float: left !important; }
.float-right { float: right !important; }

/* --- grid gutters (no-gutters -> g-0) ----------------------------------- */
.no-gutters { margin-right: 0; margin-left: 0; }
.no-gutters > .col,
.no-gutters > [class*="col-"] { padding-right: 0; padding-left: 0; }

/* --- badges: BS5 split colour into .bg-* + .text-* ---------------------- */
.badge-primary   { color: #fff; background-color: var(--bs-primary, #0d6efd); }
.badge-secondary { color: #fff; background-color: var(--bs-secondary, #6c757d); }
.badge-success   { color: #fff; background-color: var(--bs-success, #198754); }
.badge-danger    { color: #fff; background-color: var(--bs-danger, #dc3545); }
.badge-warning   { color: #000; background-color: var(--bs-warning, #ffc107); }
.badge-info      { color: #000; background-color: var(--bs-info, #0dcaf0); }
.badge-light     { color: #000; background-color: var(--bs-light, #f8f9fa); }
.badge-dark      { color: #fff; background-color: var(--bs-dark, #212529); }

/* --- misc renamed utilities -------------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* BS4 .close button glyph (BS5 = .btn-close, an SVG background). Keep the old
 * text-× look for any template still using <button class="close">×</button>. */
.close {
  float: right; font-size: 1.5rem; font-weight: 700; line-height: 1;
  color: #000; opacity: .5; background: transparent; border: 0;
}
.close:hover { opacity: .75; }

/* BS5 input-group dropped the append/prepend wrappers; they now just sit
 * inline. Neutralise the old wrapper so it doesn't double-pad. */
.input-group-append,
.input-group-prepend { display: flex; }
.input-group-append .input-group-text,
.input-group-prepend .input-group-text { margin-bottom: 0; }
