/*
 * Bootstrap 3/4 → Bootstrap 5 Compatibility Layer
 * Maps deprecated class names to Bootstrap 5 equivalents.
 * Include AFTER bootstrap.min.css so these overrides take effect.
 */

/* ============================================================
   GRID: col-xs-* (removed in BS5, now just col-*)
   ============================================================ */
.col-xs-1  { flex: 0 0 auto; width: 8.33333%; }
.col-xs-2  { flex: 0 0 auto; width: 16.66667%; }
.col-xs-3  { flex: 0 0 auto; width: 25%; }
.col-xs-4  { flex: 0 0 auto; width: 33.33333%; }
.col-xs-5  { flex: 0 0 auto; width: 41.66667%; }
.col-xs-6  { flex: 0 0 auto; width: 50%; }
.col-xs-7  { flex: 0 0 auto; width: 58.33333%; }
.col-xs-8  { flex: 0 0 auto; width: 66.66667%; }
.col-xs-9  { flex: 0 0 auto; width: 75%; }
.col-xs-10 { flex: 0 0 auto; width: 83.33333%; }
.col-xs-11 { flex: 0 0 auto; width: 91.66667%; }
.col-xs-12 { flex: 0 0 auto; width: 100%; }

/* ============================================================
   VISIBILITY: hidden-* (replaced by d-none/d-*-block in BS5)
   ============================================================ */
.hidden-xs { display: none !important; }
@media (min-width: 576px)  { .hidden-xs { display: block !important; } }
@media (min-width: 576px) and (max-width: 767.98px) { .hidden-sm { display: none !important; } }
@media (min-width: 768px) and (max-width: 991.98px) { .hidden-md { display: none !important; } }
@media (min-width: 992px) and (max-width: 1199.98px) { .hidden-lg { display: none !important; } }

/* ============================================================
   FLOATS: pull-right/pull-left → float-end/float-start
   ============================================================ */
.pull-right { float: right !important; }
.pull-left  { float: left !important; }

/* ============================================================
   BUTTONS: btn-default → btn-secondary
   ============================================================ */
.btn-default {
    color: #333;
    background-color: #fff;
    border-color: #ccc;
}
.btn-default:hover {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
}

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

/* ============================================================
   PANELS → CARDS
   ============================================================ */
.panel {
    margin-bottom: 1rem;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.375rem;
}
.panel-heading {
    padding: 0.75rem 1.25rem;
    background-color: rgba(0,0,0,.03);
    border-bottom: 1px solid rgba(0,0,0,.125);
    border-radius: calc(0.375rem - 1px) calc(0.375rem - 1px) 0 0;
}
.panel-body {
    padding: 1.25rem;
}
.panel-footer {
    padding: 0.75rem 1.25rem;
    background-color: rgba(0,0,0,.03);
    border-top: 1px solid rgba(0,0,0,.125);
}
.panel-title {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1rem;
}
.panel-default > .panel-heading { background-color: #f8f9fa; }
.panel-primary > .panel-heading { background-color: #0d6efd; color: #fff; border-color: #0d6efd; }
.panel-success > .panel-heading { background-color: #198754; color: #fff; }
.panel-info    > .panel-heading { background-color: #0dcaf0; }
.panel-warning > .panel-heading { background-color: #ffc107; }
.panel-danger  > .panel-heading { background-color: #dc3545; color: #fff; }

/* ============================================================
   WELLS → card bg-light
   ============================================================ */
.well {
    min-height: 20px;
    padding: 19px;
    margin-bottom: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

/* ============================================================
   FORMS: form-group (removed in BS5)
   ============================================================ */
.form-group {
    margin-bottom: 1rem;
}
.control-label {
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.form-horizontal .control-label {
    padding-top: calc(0.375rem + 1px);
}

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

/* ============================================================
   THUMBNAILS
   ============================================================ */
.thumbnail {
    display: block;
    padding: 4px;
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

/* ============================================================
   NAVBAR: BS3 classes mapped to BS5
   ============================================================ */
.navbar-default {
    background-color: #fff;
    border-color: #e7e7e7;
}
.navbar-toggle {
    position: relative;
    float: right;
    padding: 9px 10px;
    margin-right: 15px;
    background-color: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.navbar-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #888;
    border-radius: 1px;
    margin-top: 4px;
}

/* ============================================================
   TEXT UTILITIES
   ============================================================ */
.text-danger  { color: #dc3545 !important; }
.text-success { color: #198754 !important; }
.text-warning { color: #ffc107 !important; }
.text-info    { color: #0dcaf0 !important; }
.text-muted   { color: #6c757d !important; }

/* ============================================================
   SPACING: BS3 custom spacing → BS5 mapping
   ============================================================ */
.m-b-0  { margin-bottom: 0 !important; }
.m-b-5  { margin-bottom: 5px !important; }
.m-b-10 { margin-bottom: 10px !important; }
.m-b-15 { margin-bottom: 15px !important; }
.m-b-20 { margin-bottom: 20px !important; }
.m-b-30 { margin-bottom: 30px !important; }
.m-b-40 { margin-bottom: 40px !important; }
.m-t-0  { margin-top: 0 !important; }
.m-t-5  { margin-top: 5px !important; }
.m-t-10 { margin-top: 10px !important; }
.m-t-15 { margin-top: 15px !important; }
.m-t-20 { margin-top: 20px !important; }
.m-t-30 { margin-top: 30px !important; }
.m-t-40 { margin-top: 40px !important; }
.m-l-5  { margin-left: 5px !important; }
.m-l-10 { margin-left: 10px !important; }
.m-r-5  { margin-right: 5px !important; }
.m-r-10 { margin-right: 10px !important; }
.p-t-10 { padding-top: 10px !important; }
.p-b-5  { padding-bottom: 5px !important; }
.p-b-10 { padding-bottom: 10px !important; }
.p-10   { padding: 10px !important; }
.p-20   { padding: 20px !important; }

/* ============================================================
   GLYPHICONS → mapped to empty (use FontAwesome or Linea instead)
   ============================================================ */
.glyphicon { display: inline-block; font-family: inherit; }
.glyphicon-ok:before    { content: "\2713"; }
.glyphicon-remove:before { content: "\2717"; }
.glyphicon-search:before { content: "\1F50D"; }

/* ============================================================
   MISC DEPRECATED
   ============================================================ */
.caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    vertical-align: middle;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}
.center-block {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.clearfix::after {
    display: block;
    clear: both;
    content: "";
}

/* ============================================================
   SIDEBAR: Fix BS5 .collapse conflict with sidebar
   ============================================================ */
/* BS5 .collapse uses display:none — override for sidebar only */
.sidebar .navbar-collapse,
.sidebar-nav.navbar-collapse,
.slimscrollsidebar {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
}
/* Sidebar must scroll independently */
.sidebar {
    height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: fixed !important;
    padding-bottom: 60px;
    padding-top: 0 !important;
    top: 40px !important;
    margin-top: 0 !important;
}
/* Remove gap between navbar and sidebar menu */
.sidebar .sidebar-nav {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
#side-menu {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
/* Hide sidebar-search spacer */
.sidebar-search {
    display: none;
}
/* Logo area: center with padding, match sidebar background */
body:not(.bo-admin-shell) .top-left-part {
    background-color: #1a2332 !important;
    text-align: center !important;
    padding: 10px 15px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
body:not(.bo-admin-shell) .top-left-part .logo {
    text-decoration: none;
}
body:not(.bo-admin-shell) .top-left-part .logo img {
    max-height: 35px;
}
/* Close gap: navbar bottom border/margin flush with sidebar */
.navbar.navbar-default,
.navbar-default.navbar-static-top {
    margin-bottom: 0 !important;
    border-bottom: none !important;
    min-height: 40px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
.navbar-header {
    z-index: 101;
    min-height: 40px !important;
}
.navbar-top-links > li > a {
    padding: 8px 12px !important;
    line-height: 24px !important;
}
body:not(.bo-admin-shell) .top-left-part {
    height: 40px !important;
    padding: 5px 15px !important;
}
body:not(.bo-admin-shell) .top-left-part .logo img {
    max-height: 25px !important;
}
html, body {
    height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden;
}
#wrapper {
    overflow: visible;
    min-height: 100%;
}
#page-wrapper {
    margin-top: 40px;
    min-height: calc(100vh - 40px);
    overflow: visible !important;
}
/* Override slimScroll inline styles that cap the height */
.sidebar .slimScrollDiv,
.sidebar .slimscrollsidebar {
    height: auto !important;
    overflow: visible !important;
}
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
/* Custom mobile close state */
.sidebar .navbar-collapse.sidebar-closed,
.sidebar-nav.navbar-collapse.sidebar-closed,
.slimscrollsidebar.sidebar-closed {
    display: none !important;
}
/* Logo: show full logo by default, short "MB" only when collapsed */
.logo b.logo-short, b.logo-short { display: none !important; }
.logo .logo-full { display: inline !important; }
.content-wrapper .logo-short { display: inline !important; }
.content-wrapper .logo-full { display: none !important; }
@media (max-width: 767px) {
    .logo-short { display: inline !important; }
    .logo-full { display: none !important; }
}

/* ============================================================
   DATATABLES: Fix display & pagination issues
   ============================================================ */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 10px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-block !important;
    padding: 6px 12px !important;
    margin: 0 2px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    background: #fff !important;
    color: #0d6efd !important;
    cursor: pointer !important;
    text-decoration: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #e9ecef !important;
    color: #0a58ca !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #0d6efd !important;
    color: #fff !important;
    border-color: #0d6efd !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #f8f9fa !important;
    color: #6c757d !important;
    cursor: default !important;
    border-color: #dee2e6 !important;
}
.table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    display: block !important;
}
.dataTables_wrapper {
    display: block !important;
    width: 100% !important;
}
.dataTables_scroll {
    width: 100% !important;
}
table.dataTable {
    width: 100% !important;
}

/* Fix BS5 removing list-style from .nav */
#side-menu .nav-second-level {
    list-style: none;
    padding-left: 0;
}

/* ============================================================
   BS3→BS5 Modal Fix
   Theme style.css uses .modal.in (BS3) but BS5 uses .modal.show
   ============================================================ */
.modal.show {
    display: block !important;
    opacity: 1 !important;
}
.modal.show .modal-dialog {
    transform: translate(0, 0) !important;
}
.modal-backdrop.show {
    opacity: 0.5 !important;
}

/* ============================================================
   Date input line-height fix (theme forces 48px)
   ============================================================ */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    input[type="date"].form-control,
    input[type="time"].form-control,
    input[type="datetime-local"].form-control,
    input[type="month"].form-control {
        line-height: normal !important;
    }
}

/* ============================================================
   SUMMERNOTE: Isolate from theme style.css overrides
   ============================================================ */
.note-editor.note-frame {
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    background: #fff !important;
}
.note-editor.note-frame .note-editable,
.note-editor.note-frame .note-editable p,
.note-editor.note-frame .note-editable div,
.note-editor.note-frame .note-editable span,
.note-editor.note-frame .note-editable li {
    font-family: 'Segoe UI', 'Roboto', sans-serif !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #333 !important;
}
.note-editor.note-frame .note-editable h1 { font-size: 1.6em !important; }
.note-editor.note-frame .note-editable h2 { font-size: 1.35em !important; }
.note-editor.note-frame .note-editable h3 { font-size: 1.15em !important; }
.note-editor.note-frame .note-toolbar {
    background: #f5f5f5 !important;
    border-bottom: 1px solid #ddd !important;
    padding: 5px 8px !important;
}
.note-editor.note-frame .note-toolbar .note-btn {
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 3px !important;
    color: #333 !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    height: auto !important;
    box-shadow: none !important;
}
.note-editor.note-frame .note-toolbar .note-btn:hover { background: #e8e8e8 !important; }
.note-editor.note-frame .note-toolbar .note-btn.active { background: #ddd !important; }
.note-editor .note-toolbar .dropdown-menu,
.note-editor .note-dropdown-menu {
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    z-index: 1060 !important;
}
.note-editor.note-frame.fullscreen {
    z-index: 1050 !important;
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
}
.note-editor.note-frame .note-statusbar {
    background: #f5f5f5 !important;
    border-top: 1px solid #ddd !important;
}
