/* Bootstrap 5 Compatibility Shim for AppKit 3.7.0 migration */
/* Restores BS4 grid gutters and utility classes removed/renamed in BS5 */

/* ============================================================
   1. GRID SYSTEM - Restore BS4 gutter width (30px vs BS5's 24px)
   ============================================================ */
.row {
    --bs-gutter-x: 30px !important;
    --bs-gutter-y: 0 !important;
}
.row > * {
    padding-right: calc(var(--bs-gutter-x) * .5) !important;
    padding-left: calc(var(--bs-gutter-x) * .5) !important;
}

/* ============================================================
   2. MARGIN-RIGHT (mr-*) - renamed to me-* in BS5
   ============================================================ */
.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; }

/* ============================================================
   3. MARGIN-LEFT (ml-*) - renamed to ms-* in BS5
   ============================================================ */
.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; }

/* ============================================================
   4. PADDING-RIGHT (pr-*) - renamed to pe-* in BS5
   ============================================================ */
.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; }

/* ============================================================
   5. PADDING-LEFT (pl-*) - renamed to ps-* in BS5
   ============================================================ */
.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; }

/* ============================================================
   6. FLOAT utilities - renamed in BS5
   ============================================================ */
.float-left { float: left !important; }
.float-right { float: right !important; }
.float-sm-left { float: left !important; }
.float-sm-right { float: right !important; }
.float-md-left { float: left !important; }
.float-md-right { float: right !important; }
.float-lg-left { float: left !important; }
.float-lg-right { float: right !important; }

/* ============================================================
   7. TEXT ALIGNMENT - renamed in BS5
   ============================================================ */
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-sm-left { text-align: left !important; }
.text-sm-right { text-align: right !important; }
.text-md-left { text-align: left !important; }
.text-md-right { text-align: right !important; }
.text-lg-left { text-align: left !important; }
.text-lg-right { text-align: right !important; }
.text-justify { text-align: justify !important; }

/* ============================================================
   8. FONT WEIGHT - renamed in BS5
   ============================================================ */
.font-weight-bold { font-weight: 700 !important; }
.font-weight-bolder { font-weight: bolder !important; }
.font-weight-normal { font-weight: 400 !important; }
.font-weight-medium { font-weight: 500 !important; }
.font-weight-light { font-weight: 300 !important; }
.font-weight-lighter { font-weight: lighter !important; }
.font-italic { font-style: italic !important; }

/* ============================================================
   9. BORDER utilities - renamed in BS5
   ============================================================ */
.border-left { border-left: 1px solid #dee2e6 !important; }
.border-right { border-right: 1px solid #dee2e6 !important; }
.rounded-left { border-top-left-radius: 0.25rem !important; border-bottom-left-radius: 0.25rem !important; }
.rounded-right { border-top-right-radius: 0.25rem !important; border-bottom-right-radius: 0.25rem !important; }

/* ============================================================
   10. DROPDOWN - renamed in BS5
   ============================================================ */
.dropdown-menu-right { right: 0 !important; left: auto !important; }
.dropdown-menu-left { left: 0 !important; right: auto !important; }
.v-dropdown > .dropdown-menu { overflow: visible !important; white-space: nowrap; right: 0; left: auto !important; }
.a-table-scroller { overflow: visible !important; }

/* ============================================================
   11. NO-GUTTERS - removed in BS5 (replaced by g-0)
   ============================================================ */
.no-gutters { --bs-gutter-x: 0 !important; --bs-gutter-y: 0 !important; }
.no-gutters > .col, .no-gutters > [class*="col-"] { padding-right: 0 !important; padding-left: 0 !important; }

/* ============================================================
   12. CLOSE BUTTON - replaced by .btn-close in BS5
   ============================================================ */
button.close, .close {
    float: right;
    margin-left: auto;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
    background: transparent;
    border: 0;
    padding: 0;
    appearance: none;
}
button.close:hover, .close:hover { opacity: .75; }
.d-flex > .close, .d-flex > button.close { margin-left: auto !important; float: none !important; }

/* ============================================================
   13. BADGE color classes - renamed in BS5
   ============================================================ */
.badge-primary { background-color: #D04A02 !important; color: #fff !important; }
.badge-secondary { background-color: #6c757d !important; color: #fff !important; }
.badge-success { background-color: #198754 !important; color: #fff !important; }
.badge-danger { background-color: #dc3545 !important; color: #fff !important; }
.badge-warning { background-color: #ffc107 !important; color: #000 !important; }
.badge-info { background-color: #0dcaf0 !important; color: #000 !important; }

/* ============================================================
   14. RESPONSIVE margin/padding (mr-sm-*, ml-lg-*, etc.)
   ============================================================ */
@media (min-width: 576px) {
    .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; }
    .ml-sm-0 { margin-left: 0 !important; }
    .ml-sm-auto { margin-left: auto !important; }
    .pl-sm-0 { padding-left: 0 !important; }
    .pr-sm-0 { padding-right: 0 !important; }
}
@media (min-width: 768px) {
    .mr-md-0 { margin-right: 0 !important; }
    .mr-md-2 { margin-right: 0.5rem !important; }
    .mr-md-3 { margin-right: 1rem !important; }
    .ml-md-0 { margin-left: 0 !important; }
    .ml-md-auto { margin-left: auto !important; }
    .pl-md-0 { padding-left: 0 !important; }
    .pr-md-0 { padding-right: 0 !important; }
}
@media (min-width: 992px) {
    .mr-lg-0 { margin-right: 0 !important; }
    .mr-lg-2 { margin-right: 0.5rem !important; }
    .ml-lg-0 { margin-left: 0 !important; }
    .ml-lg-auto { margin-left: auto !important; }
    .pl-lg-0 { padding-left: 0 !important; }
    .pr-lg-0 { padding-right: 0 !important; }
}

/* ============================================================
   15. TEXT utilities removed in BS5
   ============================================================ */
.text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; }
.text-monospace { font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important; }

/* ============================================================
   16. FORM compatibility
   ============================================================ */
.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; }
.form-inline { display: flex; flex-flow: row wrap; align-items: center; }

/* ============================================================
   17. CARD - ensure BS3 .panel still works (legacy pages)
   ============================================================ */
.panel { margin-bottom: 20px; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.panel-default { border-color: #ddd; }
.panel-default > .panel-heading { color: #333; background-color: #f5f5f5; border-color: #ddd; }
.panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; }
.panel-body { padding: 15px; }
.panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px; color: inherit; }

/* ============================================================
   18. HIDDEN utility - removed in BS5 (replaced by .d-none)
       Needed by v-modal component's hidden trigger buttons
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   19. ICON FIX - icon-table-data-outline position fix
   ============================================================ */
