/**
 * Bootstrap 3 → 5 CSS Compatibility Shim
 *
 * Maps BS3 class names to BS5-compatible styles so pages can transition
 * incrementally. Loaded ONLY when $bs_version === 5 in head.php.
 * Remove this file once Phase 4 (full migration cleanup) is complete.
 *
 * ThePipeTool — BS5 Migration
 */

/* ============================================================
   GRID: col-xs-* (removed in BS5 — xs is now just col-*)
   ============================================================ */
.col-xs-1  { flex: 0 0 auto; width: 8.333333%; }
.col-xs-2  { flex: 0 0 auto; width: 16.666667%; }
.col-xs-3  { flex: 0 0 auto; width: 25%; }
.col-xs-4  { flex: 0 0 auto; width: 33.333333%; }
.col-xs-5  { flex: 0 0 auto; width: 41.666667%; }
.col-xs-6  { flex: 0 0 auto; width: 50%; }
.col-xs-7  { flex: 0 0 auto; width: 58.333333%; }
.col-xs-8  { flex: 0 0 auto; width: 66.666667%; }
.col-xs-9  { flex: 0 0 auto; width: 75%; }
.col-xs-10 { flex: 0 0 auto; width: 83.333333%; }
.col-xs-11 { flex: 0 0 auto; width: 91.666667%; }
.col-xs-12 { flex: 0 0 auto; width: 100%; }

/* col-xs-offset-* (BS5 uses offset-*) */
.col-xs-offset-0  { margin-left: 0; }
.col-xs-offset-1  { margin-left: 8.333333%; }
.col-xs-offset-2  { margin-left: 16.666667%; }
.col-xs-offset-3  { margin-left: 25%; }
.col-xs-offset-4  { margin-left: 33.333333%; }
.col-xs-offset-5  { margin-left: 41.666667%; }
.col-xs-offset-6  { margin-left: 50%; }
.col-xs-offset-7  { margin-left: 58.333333%; }
.col-xs-offset-8  { margin-left: 66.666667%; }
.col-xs-offset-9  { margin-left: 75%; }
.col-xs-offset-10 { margin-left: 83.333333%; }
.col-xs-offset-11 { margin-left: 91.666667%; }

/* col-md-offset-* (BS5 uses offset-md-*) */
@media (min-width: 768px) {
    .col-md-offset-0  { margin-left: 0; }
    .col-md-offset-1  { margin-left: 8.333333%; }
    .col-md-offset-2  { margin-left: 16.666667%; }
    .col-md-offset-3  { margin-left: 25%; }
    .col-md-offset-4  { margin-left: 33.333333%; }
    .col-md-offset-5  { margin-left: 41.666667%; }
    .col-md-offset-6  { margin-left: 50%; }
}

/* ============================================================
   FLOAT UTILITIES: pull-left / pull-right
   ============================================================ */
.pull-left  { float: left !important; }
.pull-right { float: right !important; }

/* ============================================================
   IMAGES: img-responsive / img-circle
   ============================================================ */
.img-responsive {
    display: block;
    max-width: 100%;
    height: auto;
}
.img-circle {
    border-radius: 50%;
}

/* ============================================================
   BUTTONS: btn-default (removed in BS5)
   ============================================================ */
.btn-default {
    color: #333;
    background-color: #fff;
    border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus,
.btn-default:active,
.btn-default.active {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
}

/* ============================================================
   PANELS → CARD fallback (BS5 removed panels)
   ============================================================ */
.panel {
    margin-bottom: 1rem;
    background-color: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
}
.panel-default {
    border-color: var(--bs-border-color, #dee2e6);
}
.panel-heading {
    padding: 0.75rem 1.25rem;
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: calc(var(--bs-border-radius, 0.375rem) - 1px) calc(var(--bs-border-radius, 0.375rem) - 1px) 0 0;
}
.panel-body {
    padding: 1.25rem;
}
.panel-footer {
    padding: 0.75rem 1.25rem;
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0 0 calc(var(--bs-border-radius, 0.375rem) - 1px) calc(var(--bs-border-radius, 0.375rem) - 1px);
}
.panel-title {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1rem;
}

/* ============================================================
   FORMS: form-group (deprecated in BS5 but still common)
   ============================================================ */
.form-group {
    margin-bottom: 1rem;
}

/* ============================================================
   ACCESSIBILITY: sr-only (renamed to visually-hidden in BS5)
   ============================================================ */
.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;
}

/* ============================================================
   CLOSE BUTTON: BS3 .close with × (BS5 uses .btn-close)
   ============================================================ */
button.close {
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    opacity: 0.5;
    cursor: pointer;
}
button.close:hover {
    opacity: 0.75;
}

/* ============================================================
   LABELS → BADGES (BS3 .label renamed to .badge in BS5)
   Scoped to span.label to avoid conflict with <label> elements
   ============================================================ */
span.label {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--bs-border-radius, 0.375rem);
}
span.label-default { background-color: #6c757d; }
span.label-primary { background-color: #0d6efd; }
span.label-success { background-color: #198754; }
span.label-info    { background-color: #0dcaf0; color: #000; }
span.label-warning { background-color: #ffc107; color: #000; }
span.label-danger  { background-color: #dc3545; }

/* ============================================================
   RESPONSIVE VISIBILITY (BS3 hidden-*/visible-* classes)
   BS5 uses d-none, d-*-block etc. These shims cover the common cases.
   ============================================================ */

/* hidden-xs: hide on screens < 576px */
@media (max-width: 575.98px) {
    .hidden-xs { display: none !important; }
}
/* visible-xs: show ONLY on screens < 576px */
.visible-xs { display: none !important; }
@media (max-width: 575.98px) {
    .visible-xs { display: block !important; }
}

/* hidden-sm: hide on screens 576-767px */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hidden-sm { display: none !important; }
}
/* visible-sm: show ONLY on 576-767px */
.visible-sm { display: none !important; }
@media (min-width: 576px) and (max-width: 767.98px) {
    .visible-sm { display: block !important; }
}

/* hidden-md: hide on screens 768-991px */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hidden-md { display: none !important; }
}
/* visible-md: show ONLY on 768-991px */
.visible-md { display: none !important; }
@media (min-width: 768px) and (max-width: 991.98px) {
    .visible-md { display: block !important; }
}

/* hidden-lg: hide on screens >= 992px */
@media (min-width: 992px) {
    .hidden-lg { display: none !important; }
}
/* visible-lg: show ONLY on >= 992px */
.visible-lg { display: none !important; }
@media (min-width: 992px) {
    .visible-lg { display: block !important; }
}

/* ============================================================
   CAROUSEL: BS3 .item → BS5 .carousel-item
   ============================================================ */
.carousel .item {
    position: relative;
    display: none;
    transition: 0.6s ease-in-out left;
}
.carousel .item.active {
    display: block;
}

/* ============================================================
   NAVBAR: BS3 fallbacks for pages not yet fully migrated
   ============================================================ */
.navbar-default {
    background-color: #f8f8f8;
    border-color: #e7e7e7;
}
.navbar-fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

/* ============================================================
   GLYPHICON PLACEHOLDER
   Prevents layout shift when glyphicons are referenced but
   Bootstrap Icons hasn't been loaded yet (shouldn't happen, but safe)
   ============================================================ */
.glyphicon {
    display: inline-block;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
}

/* ============================================================
   NAV: nav-stacked (removed in BS5 — use flex-column instead)
   ============================================================ */
.nav-stacked {
    flex-direction: column;
}
.nav-stacked > li {
    width: 100%;
}
