/* ============================================
   Bootstrap 5 Compatibility Shim for Bootstrap 3.3.6
   Adds missing BS5 utility classes on top of BS3
   + Fixes for tab, sizing, and layout compatibility
   ============================================ */

/* ============================================
   ROOT / BASE FIXES (Make BS3 look like BS5)
   ============================================ */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p { margin-top: 0; margin-bottom: 1rem; }

small, .small { font-size: 0.875em; }

/* ============================================
   DISPLAY UTILITIES
   ============================================ */
.d-none { display: none !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-inline-block { display: inline-block !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

/* ============================================
   FLEX UTILITIES
   ============================================ */
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-fill { flex: 1 1 auto !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }

.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-self-center { align-self: center !important; }

.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-start { justify-content: flex-start !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* ============================================
   SPACING UTILITIES (BS5 style)
   ============================================ */
/* Margin */
.m-0 { margin: 0 !important; }
.m-1 { margin: 0.25rem !important; }
.m-2 { margin: 0.5rem !important; }
.m-3 { margin: 1rem !important; }
.m-auto { margin: auto !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-auto { margin-top: auto !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-auto { margin-bottom: auto !important; }

.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-auto { margin-left: auto !important; }

.me-0 { margin-right: 0 !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-auto { margin-right: auto !important; }

.mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mx-1 { margin-left: 0.25rem !important; margin-right: 0.25rem !important; }
.mx-2 { margin-left: 0.5rem !important; margin-right: 0.5rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: 0.25rem !important; margin-bottom: 0.25rem !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

.pt-0 { padding-top: 0 !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }

.ps-0 { padding-left: 0 !important; }
.ps-2 { padding-left: 0.5rem !important; }
.ps-3 { padding-left: 1rem !important; }

.pe-0 { padding-right: 0 !important; }
.pe-2 { padding-right: 0.5rem !important; }
.pe-3 { padding-right: 1rem !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }

.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

@media (min-width: 576px) {
    .me-sm-2 { margin-right: 0.5rem !important; }
}

/* ============================================
   TEXT UTILITIES
   ============================================ */
.text-start { text-align: left !important; }
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }

@media (min-width: 768px) {
    .text-md-end { text-align: right !important; }
    .text-md-center { text-align: center !important; }
    .text-md-start { text-align: left !important; }
}

.text-decoration-none { text-decoration: none !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-wrap { white-space: normal !important; }
.text-nowrap { white-space: nowrap !important; }

.fw-bold { font-weight: 700 !important; }
.fw-bolder { font-weight: 800 !important; }
.fw-normal { font-weight: 400 !important; }
.fw-light { font-weight: 300 !important; }
.fst-italic { font-style: italic !important; }

.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }

.lh-1 { line-height: 1 !important; }
.lh-sm { line-height: 1.25 !important; }
.lh-base { line-height: 1.5 !important; }

/* ============================================
   BACKGROUND UTILITIES (BS5 style with .bg-*)
   ============================================ */
.bg-primary { background-color: #0d6efd !important; }
.bg-secondary { background-color: #6c757d !important; }
.bg-success { background-color: #198754 !important; }
.bg-danger { background-color: #dc3545 !important; }
.bg-warning { background-color: #ffc107 !important; }
.bg-info { background-color: #0dcaf0 !important; }
.bg-light { background-color: #f8f9fa !important; }
.bg-dark { background-color: #212529 !important; }
.bg-white { background-color: #fff !important; }
.bg-transparent { background-color: transparent !important; }

/* ============================================
   TEXT COLOR UTILITIES
   ============================================ */
.text-primary { color: #0d6efd !important; }
.text-secondary { color: #6c757d !important; }
.text-success { color: #198754 !important; }
.text-danger { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-info { color: #0dcaf0 !important; }
.text-light { color: #f8f9fa !important; }
.text-dark { color: #212529 !important; }
.text-white { color: #fff !important; }
.text-muted { color: #6c757d !important; }
.text-body { color: #212529 !important; }

/* ============================================
   BORDER UTILITIES
   ============================================ */
.border { border: 1px solid #dee2e6 !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid #dee2e6 !important; }
.border-bottom { border-bottom: 1px solid #dee2e6 !important; }
.border-start { border-left-style: solid !important; border-left-width: 1px !important; border-left-color: #dee2e6 !important; }
.border-end { border-right-style: solid !important; border-right-width: 1px !important; border-right-color: #dee2e6 !important; }

.border-primary { border-color: #0d6efd !important; }
.border-start.border-primary { border-left-color: #0d6efd !important; }
.border-end.border-primary { border-right-color: #0d6efd !important; }

.border-secondary { border-color: #6c757d !important; }
.border-success { border-color: #198754 !important; }
.border-start.border-success { border-left-color: #198754 !important; }

.border-danger { border-color: #dc3545 !important; }
.border-start.border-danger { border-left-color: #dc3545 !important; }
.border-end.border-danger { border-right-color: #dc3545 !important; }

.border-warning { border-color: #ffc107 !important; }
.border-start.border-warning { border-left-color: #ffc107 !important; }

.border-info { border-color: #0dcaf0 !important; }
.border-start.border-info { border-left-color: #0dcaf0 !important; }

/* ============================================
   ROUNDED / BORDER RADIUS
   ============================================ */
.rounded { border-radius: 0.375rem !important; }
.rounded-0 { border-radius: 0 !important; }
.rounded-1 { border-radius: 0.25rem !important; }
.rounded-2 { border-radius: 0.375rem !important; }
.rounded-3 { border-radius: 0.5rem !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 50rem !important; }
.rounded-top { border-top-left-radius: 0.375rem !important; border-top-right-radius: 0.375rem !important; }
.rounded-bottom { border-bottom-left-radius: 0.375rem !important; border-bottom-right-radius: 0.375rem !important; }

/* ============================================
   SHADOW
   ============================================ */
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; }
.shadow { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; }
.shadow-none { box-shadow: none !important; }

/* ============================================
   SIZING UTILITIES
   ============================================ */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }

.mw-100 { max-width: 100% !important; }
.mh-100 { max-height: 100% !important; }

.min-vw-100 { min-width: 100vw !important; }
.min-vh-100 { min-height: 100vh !important; }

.vw-100 { width: 100vw !important; }
.vh-100 { height: 100vh !important; }

/* ============================================
   POSITION UTILITIES
   ============================================ */
.position-static { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

.top-0 { top: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.start-0 { left: 0 !important; }
.end-0 { right: 0 !important; }

/* ============================================
   OVERFLOW UTILITIES
   ============================================ */
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-visible { overflow: visible !important; }
.overflow-scroll { overflow: scroll !important; }

/* ============================================
   BADGE (BS5 style overrides BS3 .label)
   ============================================ */
.badge.bg-primary { background-color: #0d6efd !important; }
.badge.bg-secondary { background-color: #6c757d !important; }
.badge.bg-success { background-color: #198754 !important; }
.badge.bg-danger { background-color: #dc3545 !important; }
.badge.bg-warning { background-color: #ffc107 !important; color: #212529 !important; }
.badge.bg-info { background-color: #0dcaf0 !important; color: #212529 !important; }
.badge.bg-light { background-color: #f8f9fa !important; color: #212529 !important; }
.badge.bg-dark { background-color: #212529 !important; }

/* ============================================
   PROGRESS BAR (BS5 style)
   ============================================ */
.progress-bar.bg-success { background-color: #198754 !important; }
.progress-bar.bg-warning { background-color: #ffc107 !important; }
.progress-bar.bg-danger { background-color: #dc3545 !important; }
.progress-bar.bg-info { background-color: #0dcaf0 !important; }
.progress-bar.bg-secondary { background-color: #6c757d !important; }
.progress-bar.bg-primary { background-color: #0d6efd !important; }

/* ============================================
   NAV / TAB FIXES for BS3
   ============================================ */
/* CRITICAL: Make .erp-tabs work as .nav-tabs for BS3 tab plugin */
.erp-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    list-style: none;
    margin-top: 0;
    flex-wrap: nowrap;
    border-bottom: none;
    position: relative;
}

.erp-tabs::-webkit-scrollbar {
    display: none;
}

.erp-tabs .nav-item {
    margin-bottom: 0;
}

.erp-tabs .erp-tab,
.erp-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #6c757d;
    text-decoration: none;
    border: none;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    white-space: nowrap;
    transition: all 0.2s ease;
    background: #e2e6ea;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.erp-tabs .erp-tab:hover,
.erp-tabs .nav-link:hover,
.erp-tabs .nav-item.active .erp-tab,
.erp-tabs .nav-item.active .nav-link {
    color: #0d6efd;
    background: #d6dce4;
}

.erp-tabs .erp-tab.active,
.erp-tabs .nav-link.active,
.erp-tabs li.active .erp-tab,
.erp-tabs li.active .nav-link {
    color: #fff !important;
    background: #0d6efd !important;
    border: none !important;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    box-shadow: none;
    z-index: 2;
    margin-bottom: 0;
}

.erp-tabs .erp-tab.active i,
.erp-tabs .nav-link.active i,
.erp-tabs li.active .erp-tab i,
.erp-tabs li.active .nav-link i {
    color: #fff !important;
}

.erp-tabs .erp-tab .badge,
.erp-tabs .nav-link .badge {
    font-size: 0.65rem;
    padding: 2px 6px;
}

/* Override BS3 .nav-tabs>li.active>a specificity (0,2,2) */
.erp-tabs.nav-tabs > li.active > a,
.erp-tabs.nav-tabs > li.active > a:focus,
.erp-tabs.nav-tabs > li.active > a:hover,
.erp-tabs.nav-tabs > li > a.active,
.erp-tabs.nav-tabs > li > a.active:focus,
.erp-tabs.nav-tabs > li > a.active:hover {
    color: #fff !important;
    background: #0d6efd !important;
    border: none !important;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    z-index: 2;
    margin-bottom: 0;
}

.erp-tabs.nav-tabs > li.active > a i,
.erp-tabs.nav-tabs > li > a.active i {
    color: #fff !important;
}

/* Override BS3 .nav-tabs>li>a hover (underline-style) */
.erp-tabs.nav-tabs > li > a:hover,
.erp-tabs.nav-tabs > li > a:focus {
    color: #0d6efd;
    background: #d6dce4;
    border-radius: 8px 8px 0 0;
}

.nav-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.nav-link:hover,
.nav-link:focus {
    color: #0a58ca;
}

/* BS3 tab pane fix - ensure hidden tabs are actually hidden, active tabs visible */
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-pane.fade { opacity: 0; transition: opacity 0.15s linear; }
.tab-pane.fade.in { opacity: 1; display: block; }

/* ============================================
   FORM CHECK (BS5 style)
   ============================================ */
.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}
.form-check .form-check-input {
    float: left;
    width: 1em;
    height: 1em;
    margin-left: -1.5em;
    margin-top: 0.25em;
    vertical-align: top;
}

/* ============================================
   INPUT GROUP (BS5 style fix for BS3)
   ============================================ */
.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

/* ============================================
   ALERT (BS5 style)
   ============================================ */
.alert-dismissible .close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 0.75rem 1.25rem;
    color: inherit;
}

/* ============================================
   MODAL (BS5 style fixes for BS3)
   ============================================ */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.5rem - 1px);
    border-top-right-radius: calc(0.5rem - 1px);
}

.modal-header .close {
    margin: -1rem -1rem -1rem auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    gap: 0.5rem;
}

/* ============================================
   CONTAINER FLUID (BS5 compat)
   ============================================ */
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* ============================================
   ROW (BS5 flexbox style override BS3 float)
   ============================================ */
.row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-top: 0 !important;
}

/* With g-* classes, use gap instead of negative margins */
.row.g-2,
.row.g-3,
.row.g-md-3,
.row.g-md-4,
.row.g-4 {
    margin-right: 0 !important;
    margin-left: 0 !important;
    gap: 0.5rem;
}

.row.g-3 { gap: 1rem; }
.row.g-4 { gap: 1.5rem; }

/* Columns inside g-* rows: no padding (gap handles spacing) */
.row.g-2 > [class*="col-"],
.row.g-3 > [class*="col-"],
.row.g-4 > [class*="col-"],
.row.g-md-3 > [class*="col-"],
.row.g-md-4 > [class*="col-"] {
    flex-shrink: 0;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* Columns inside rows WITHOUT g-*: use traditional 15px padding */
.row:not(.g-2):not(.g-3):not(.g-md-3):not(.g-md-4):not(.g-4):not(.g-0) > [class*="col-"] {
    flex-shrink: 0;
    padding-right: 15px !important;
    padding-left: 15px !important;
}

/* Rows without g-*: keep BS3 negative margin for column padding */
.row:not(.g-2):not(.g-3):not(.g-md-3):not(.g-md-4):not(.g-4):not(.g-0) {
    margin-right: -15px !important;
    margin-left: -15px !important;
}

@media (min-width: 768px) {
    .row.g-md-3 { gap: 1rem !important; }
    .row.g-md-4 { gap: 1.5rem !important; }
    .py-md-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .d-md-inline-block { display: inline-block !important; }
}

/* ============================================
   MISSING GRID CLASSES (BS5 col-xl-*, col-12)
   BS3 only has col-xs/sm/md/lg — no xl, no bare col-*
   Also: flexbox row needs cols to not shrink/grow
   ============================================ */

/* All BS3 col classes need flex: 0 0 auto to work in flexbox rows */
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6,
.col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12,
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
.col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
.col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    flex: 0 0 auto;
}

/* BS5 bare col-* classes (not in BS3) */
.col-12 { width: 100%; }
.col-6 { width: 50%; }
.col-4 { width: 33.333333%; }
.col-3 { width: 25%; }

@media (min-width: 1200px) {
    .col-xl-3 { width: 25%; position: relative; min-height: 1px; flex: 0 0 auto; }
    .col-xl-4 { width: 33.333333%; position: relative; min-height: 1px; flex: 0 0 auto; }
    .col-xl-6 { width: 50%; position: relative; min-height: 1px; flex: 0 0 auto; }
    .col-xl-12 { width: 100%; position: relative; min-height: 1px; flex: 0 0 auto; }
}

/* ============================================
   CARD (BS5 style fixes for BS3)
   ============================================ */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
    margin-bottom: 0;
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem 1rem;
}

.card-header {
    padding: 0.5rem 1rem;
    margin-bottom: 0;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header h5, .card-header h6 {
    font-size: 0.9rem;
    margin: 0;
}

.card-footer {
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.125);
}

.card-title {
    margin-bottom: 0.5rem;
}

.card-subtitle {
    margin-top: -0.25rem;
    margin-bottom: 0;
}

.card-text:last-child {
    margin-bottom: 0;
}

/* ============================================
   CLOSE BUTTON (BS5 style for BS3)
   ============================================ */
.close {
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.close:hover {
    color: #000;
    text-decoration: none;
    opacity: 0.75;
}

.close span {
    font-size: inherit;
    line-height: inherit;
}

/* ============================================
   LIST GROUP (BS5 style)
   ============================================ */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: 0.375rem;
}

/* ============================================
   BUTTON GROUP (BS5 style)
   ============================================ */
.btn-group {
    display: inline-flex;
    position: relative;
    vertical-align: middle;
}

.btn-group > .btn {
    position: relative;
    flex: 1 1 auto;
}

/* ============================================
   VISIBILITY
   ============================================ */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* ============================================
   POINTER EVENTS
   ============================================ */
.pe-none { pointer-events: none !important; }
.pe-auto { pointer-events: auto !important; }

/* ============================================
   USER SELECT
   ============================================ */
.user-select-all { user-select: all !important; }
.user-select-auto { user-select: auto !important; }
.user-select-none { user-select: none !important; }

/* ============================================
   SPACING - MISSING VALUES
   ============================================ */
.mb-4 { margin-bottom: 1.5rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }

/* ============================================
   TEXT - MISSING
   ============================================ */
.text-uppercase { text-transform: uppercase !important; }

/* ============================================
   FONT WEIGHT - MISSING
   ============================================ */
.fw-semibold { font-weight: 600 !important; }

/* ============================================
   OPACITY
   ============================================ */
.opacity-75 { opacity: 0.75 !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-25 { opacity: 0.25 !important; }
.opacity-0 { opacity: 0 !important; }
.opacity-100 { opacity: 1 !important; }

/* ============================================
   BACKGROUND OPACITY (BS5 bg-opacity-* with rgba)
   BS3 doesn't support CSS var(--bs-*-rgb), so we use rgba directly.
   ============================================ */
.bg-primary.bg-opacity-10 { background-color: rgba(13, 110, 253, 0.1) !important; }
.bg-primary.bg-opacity-25 { background-color: rgba(13, 110, 253, 0.25) !important; }
.bg-primary.bg-opacity-50 { background-color: rgba(13, 110, 253, 0.5) !important; }
.bg-primary.bg-opacity-75 { background-color: rgba(13, 110, 253, 0.75) !important; }

.bg-success.bg-opacity-10 { background-color: rgba(25, 135, 84, 0.1) !important; }
.bg-success.bg-opacity-25 { background-color: rgba(25, 135, 84, 0.25) !important; }
.bg-success.bg-opacity-50 { background-color: rgba(25, 135, 84, 0.5) !important; }

.bg-danger.bg-opacity-10 { background-color: rgba(220, 53, 69, 0.1) !important; }
.bg-danger.bg-opacity-25 { background-color: rgba(220, 53, 69, 0.25) !important; }
.bg-danger.bg-opacity-50 { background-color: rgba(220, 53, 69, 0.5) !important; }

.bg-warning.bg-opacity-10 { background-color: rgba(255, 193, 7, 0.1) !important; }
.bg-warning.bg-opacity-25 { background-color: rgba(255, 193, 7, 0.25) !important; }
.bg-warning.bg-opacity-50 { background-color: rgba(255, 193, 7, 0.5) !important; }

.bg-info.bg-opacity-10 { background-color: rgba(13, 202, 240, 0.1) !important; }
.bg-info.bg-opacity-25 { background-color: rgba(13, 202, 240, 0.25) !important; }
.bg-info.bg-opacity-50 { background-color: rgba(13, 202, 240, 0.5) !important; }

.bg-dark.bg-opacity-10 { background-color: rgba(33, 37, 41, 0.1) !important; }
.bg-dark.bg-opacity-25 { background-color: rgba(33, 37, 41, 0.25) !important; }
.bg-dark.bg-opacity-50 { background-color: rgba(33, 37, 41, 0.5) !important; }

/* ============================================
   BORDER WIDTH (BS5)
   ============================================ */
.border-4 { border-width: 4px !important; }
.border-start.border-4 { border-left-width: 4px !important; border-top: 0 !important; border-right: 0 !important; border-bottom: 0 !important; }
.border-end.border-4 { border-right-width: 4px !important; border-top: 0 !important; border-left: 0 !important; border-bottom: 0 !important; }
.border-top.border-4 { border-top-width: 4px !important; border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important; }
.border-bottom.border-4 { border-bottom-width: 4px !important; border-top: 0 !important; border-left: 0 !important; border-right: 0 !important; }
.border-1 { border-width: 1px !important; }
.border-2 { border-width: 2px !important; }
.border-3 { border-width: 3px !important; }
.border-5 { border-width: 5px !important; }

/* ============================================
   FORM COMPONENTS (BS5)
   ============================================ */
.form-check-input {
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    vertical-align: top;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid rgba(0, 0, 0, 0.25);
    appearance: none;
    -webkit-appearance: none;
    print-color-adjust: exact;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-input[type="checkbox"] {
    border-radius: 0.25em;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-label {
    cursor: pointer;
}

.form-switch {
    padding-left: 2.5em;
}

.form-switch .form-check-input {
    width: 2em;
    margin-left: -2.5em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
    background-position: left center;
    border-radius: 2em;
    transition: background-position 0.15s ease-in-out;
}

.form-switch .form-check-input:checked {
    background-position: right center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.form-label {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-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: #212529;
    background-color: #fff;
    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 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    appearance: none;
    -webkit-appearance: none;
}

.form-select-sm {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    padding-left: 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.form-select-lg {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-left: 1rem;
    font-size: 1.25rem;
    border-radius: 0.5rem;
}

/* ============================================
   SPINNER (BS5)
   ============================================ */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.spinner-grow {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    animation: spinner-grow 0.75s linear infinite;
}

@keyframes spinner-grow {
    0% { transform: scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* ============================================
   VISUALLY HIDDEN (BS5) - replaces BS3 .sr-only
   ============================================ */
.visually-hidden {
    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;
}

/* ============================================
   ALERT DISMISSIBLE (BS5 style for BS3)
   ============================================ */
.alert-dismissible {
    padding-right: 3rem;
    position: relative;
}

/* ============================================
   BUTTON CLOSE (BS5 style for BS3)
   ============================================ */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.375rem;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    color: #000;
    text-decoration: none;
    opacity: 0.75;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ============================================
   PLACEHOLDER (BS5)
   ============================================ */
.placeholder {
    display: inline-block;
    min-height: 1em;
    vertical-align: middle;
    cursor: wait;
    background-color: currentColor;
    opacity: 0.2;
}

.placeholder.btn::before {
    display: inline-block;
    content: "";
}

/* ============================================
   STICKY TOP (BS5)
   ============================================ */
.sticky-top { position: sticky; top: 0; z-index: 1020; }

/* ============================================
   RESPONSIVE DISPLAY FIXES
   ============================================ */
@media (max-width: 575.98px) {
    .d-sm-none.d-sm-inline { display: none !important; }
    .d-sm-none.d-sm-inline-block { display: none !important; }
}

/* ============================================
   BS3 SPECIFIC OVERRIDES (prevent BS3 conflicts)
   ============================================ */
/* Fix BS3 .label conflicting with BS5 .badge */
.label.bg-primary, .badge.bg-primary { background-color: #0d6efd !important; }
.label.bg-success, .badge.bg-success { background-color: #198754 !important; }
.label.bg-danger, .badge.bg-danger { background-color: #dc3545 !important; }
.label.bg-warning, .badge.bg-warning { background-color: #ffc107 !important; color: #212529 !important; }
.label.bg-info, .badge.bg-info { background-color: #0dcaf0 !important; color: #212529 !important; }
.label.bg-secondary, .badge.bg-secondary { background-color: #6c757d !important; }
.label.bg-dark, .badge.bg-dark { background-color: #212529 !important; }
.label.bg-light, .badge.bg-light { background-color: #f8f9fa !important; color: #212529 !important; }

/* Badge should look like BS5 badge, not BS3 .label */
.badge {
    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: 0.375rem;
}

.badge:empty { display: none; }

/* Ensure BS3 .badge doesn't conflict */
.badge-primary { background-color: #0d6efd !important; }
.badge-success { background-color: #198754 !important; }
.badge-danger { background-color: #dc3545 !important; }
.badge-warning { background-color: #ffc107 !important; color: #212529 !important; }
.badge-info { background-color: #0dcaf0 !important; color: #212529 !important; }

/* ============================================
   PROGRESS (BS5 style for BS3)
   ============================================ */
.progress {
    display: flex;
    height: 1rem;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: #e9ecef;
    border-radius: 0.375rem;
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    text-align: center;
    white-space: nowrap;
    background-color: #0d6efd;
    transition: width 0.6s ease;
    color: #fff;
}

/* ============================================
   BTN-CHECK (BS5 radio/checkbox for btn-group)
   ============================================ */
.btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.btn-check:checked + .btn,
.btn-check:active + .btn {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-check + .btn:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* ============================================
   FORM-CONTROL-COLOR (BS5 color picker)
   ============================================ */
.form-control-color {
    width: 3rem;
    height: auto;
    padding: 0.375rem;
}

.form-control-color.form-control-sm {
    width: 2rem;
}

.form-control-color.form-control-lg {
    width: 4rem;
}

/* ============================================
   COL AUTO FIX (BS5 flexbox)
   ============================================ */
.col-auto {
    flex: 0 0 auto;
    width: auto;
}

/* ============================================
   MISSING SPACING (BS5 extended)
   ============================================ */
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mb-6 { margin-bottom: 4rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-4 { margin-left: 1.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-4 { margin-right: 1.5rem !important; }
.mx-3 { margin-left: 1rem !important; margin-right: 1rem !important; }
.mx-4 { margin-left: 1.5rem !important; margin-right: 1.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.my-5 { margin-top: 3rem !important; margin-bottom: 3rem !important; }

.p-5 { padding: 3rem !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pt-5 { padding-top: 3rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pb-5 { padding-bottom: 3rem !important; }
.ps-3 { padding-left: 1rem !important; }
.ps-4 { padding-left: 1.5rem !important; }
.ps-5 { padding-left: 3rem !important; }
.pe-3 { padding-right: 1rem !important; }
.pe-4 { padding-right: 1.5rem !important; }
.pe-5 { padding-right: 3rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

/* ============================================
   MISSING GAP (BS5)
   ============================================ */
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* ============================================
   ORDER (BS5)
   ============================================ */
.order-0 { order: 0 !important; }
.order-1 { order: 1 !important; }
.order-2 { order: 2 !important; }
.order-3 { order: 3 !important; }
.order-last { order: 99999 !important; }
.order-first { order: -1 !important; }

/* ============================================
   Z-INDEX (BS5)
   ============================================ */
.z-0 { z-index: 0 !important; }
.z-1 { z-index: 1 !important; }
.z-2 { z-index: 2 !important; }
.z-3 { z-index: 3 !important; }

/* ============================================
   RESPONSIVE COL-XL (BS5)
   ============================================ */
@media (min-width: 1200px) {
    .col-xl { flex: 1 0 0%; }
    .col-xl-1 { width: 8.333333%; flex: 0 0 auto; }
    .col-xl-2 { width: 16.666667%; flex: 0 0 auto; }
    .col-xl-3 { width: 25%; flex: 0 0 auto; }
    .col-xl-4 { width: 33.333333%; flex: 0 0 auto; }
    .col-xl-5 { width: 41.666667%; flex: 0 0 auto; }
    .col-xl-6 { width: 50%; flex: 0 0 auto; }
    .col-xl-7 { width: 58.333333%; flex: 0 0 auto; }
    .col-xl-8 { width: 66.666667%; flex: 0 0 auto; }
    .col-xl-9 { width: 75%; flex: 0 0 auto; }
    .col-xl-10 { width: 83.333333%; flex: 0 0 auto; }
    .col-xl-11 { width: 91.666667%; flex: 0 0 auto; }
    .col-xl-12 { width: 100%; flex: 0 0 auto; }
    .d-xl-none { display: none !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
    .d-xl-inline { display: inline !important; }
    .d-xl-inline-block { display: inline-block !important; }
    .d-xl-inline-flex { display: inline-flex !important; }
    .mt-xl-0 { margin-top: 0 !important; }
    .mb-xl-0 { margin-bottom: 0 !important; }
    .mx-xl-auto { margin-left: auto !important; margin-right: auto !important; }
    .text-xl-end { text-align: right !important; }
    .text-xl-start { text-align: left !important; }
    .text-xl-center { text-align: center !important; }
}

/* ============================================
   RESPONSIVE COL-XXL (BS5)
   ============================================ */
@media (min-width: 1400px) {
    .col-xxl { flex: 1 0 0%; }
    .col-xxl-3 { width: 25%; flex: 0 0 auto; }
    .col-xxl-4 { width: 33.333333%; flex: 0 0 auto; }
    .col-xxl-6 { width: 50%; flex: 0 0 auto; }
    .col-xxl-12 { width: 100%; flex: 0 0 auto; }
}

/* ============================================
   RESPONSIVE DISPLAY (SM/MD)
   ============================================ */
@media (min-width: 576px) {
    .d-sm-flex { display: flex !important; }
    .d-sm-inline-flex { display: inline-flex !important; }
}

@media (min-width: 768px) {
    .d-md-flex { display: flex !important; }
    .d-md-inline-flex { display: inline-flex !important; }
}

/* ============================================
   RESPONSIVE SPACING
   ============================================ */
@media (min-width: 768px) {
    .mt-md-0 { margin-top: 0 !important; }
    .mb-md-0 { margin-bottom: 0 !important; }
    .py-md-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
    .py-md-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .px-md-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
    .gap-md-3 { gap: 1rem !important; }
    .gap-md-4 { gap: 1.5rem !important; }
}

@media (min-width: 992px) {
    .gap-lg-3 { gap: 1rem !important; }
    .gap-lg-4 { gap: 1.5rem !important; }
    .mb-lg-0 { margin-bottom: 0 !important; }
    .py-lg-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
}

/* ============================================
   RESPONSIVE TEXT
   ============================================ */
@media (min-width: 576px) {
    .text-sm-end { text-align: right !important; }
    .text-sm-start { text-align: left !important; }
}
