@charset "UTF-8";

/* Aflex BS5 custom overrides. Mirrors FabControlV2 base.css conventions. */

/* Flex overflow: Bootstrap has no min-h-0 utility; needed so flex children can shrink and scroll. */
.min-h-0 {
    min-height: 0 !important;
}

/* Dashboard: the page is a two-row viewport layout on desktop and simple stacked cards on mobile. */
.dashboard-page {
    overflow: hidden;
}

.dashboard-row,
.dashboard-card {
    flex: 1 1 0;
    min-height: 0;
}

.dashboard-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
}

.dashboard-chart {
    height: 100%;
    min-height: 0;
}

@media (min-width: 1200px) {
    html:has(.dashboard-page),
    body:has(.dashboard-page) {
        height: 100%;
        overflow: hidden;
    }

    body:has(.dashboard-page) > header,
    body:has(.dashboard-page) > footer {
        flex-shrink: 0;
    }

    main:has(> .dashboard-page) {
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }
}

@media (max-width: 1199.98px) {
    .dashboard-page {
        overflow: visible;
    }

    .dashboard-row,
    .dashboard-card {
        flex: 0 0 auto;
    }

    .dashboard-card {
        min-height: 22rem !important;
    }

    .dashboard-chart {
        min-height: 16rem;
    }
}

/* Base font size — 14px anchor used by all .fs-N classes and form controls */
html {
    font-size: 14px;
}

/* Compact top padding for page containers */
main > .container-fluid {
    padding: 12px 15px 0;
}

/* Focus state: drop Bootstrap's blue halo (box-shadow), keep a thin blue border */
*:focus {
    box-shadow: none !important;
}

/* DataTables paints row selection as an inset box-shadow on each cell, and gives
   the first cell of each row a tabindex for keyboard support. The global *:focus
   rule above must not strip the selection fill from that focused cell. */
table.dataTable > tbody > tr.selected > *:focus {
    box-shadow: inset 0 0 0 9999px rgba(13, 110, 253, 0.9) !important;
    box-shadow: inset 0 0 0 9999px rgba(var(--dt-row-selected), 0.9) !important;
}

/* Mobile browsers, especially iOS Safari/WebKit, auto-zoom focused inputs below
   16px. Keep mobile form controls at 16px while preserving the compact desktop scale. */
@media (max-width: 991.98px) {
    .form-control,
    .form-select {
        font-size: 16px;
    }
}

/* On mobile, let nav search results expand the modal naturally instead of forcing
   a nested scroll area. The main modal viewport can scroll with the results. */
@media (max-width: 991.98px) {
    #modal_nav_search .modal-dialog {
        height: auto !important;
    }

    #modal_nav_search .modal-content {
        max-height: none !important;
        overflow: visible !important;
    }

    #modal_nav_search .modal-body {
        overflow: visible !important;
    }
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
}

/* DataTables Editor inline inputs: remove Editor's yellow focus fill and use the
   same thin blue border as normal Bootstrap form controls. */
div.DTE_Inline div.DTE_Field input:focus,
div.DTE_Inline div.DTE_Field textarea:focus {
    background-color: var(--bs-body-bg);
    border-color: #86b7fe;
    box-shadow: none !important;
    outline: 0;
}

/* DataTables Editor defaults inline text inputs to 5px vertical padding and
   30px height, which overflows our compact table rows. */
div.DTE_Inline div.DTE_Field input {
    /* height: 1.5rem; */
    /* min-height: 0; */
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

/* DataTables Editor briefly adds dte-highlight after saving. Use a subtle blue
   flash that matches our focus border instead of the default yellow/orange. */
table.dataTable tbody tr.dte-highlight,
table.dataTable tbody tr.dte-highlight > * {
    background-color: rgba(134, 183, 254, 0.2) !important;
    box-shadow: inset 0 0 0 9999px rgba(134, 183, 254, 0.2) !important;
    transition: background-color 500ms linear, box-shadow 500ms linear !important;
}

/* Select2 hides the native select, so Bootstrap's .is-invalid border never shows.
   Mirror it onto the select2 selection box. */
select.is-invalid + .select2-container--bootstrap-5 .select2-selection {
    border-color: var(--bs-form-invalid-border-color);
}

/* Select2 (bootstrap-5 theme) — keep the theme focus colour, remove the glow. */
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    box-shadow: none !important;
}

/* Links — no underline by default */
a {
    text-decoration: none;
}

/* Tables — full width by default */
table {
    width: 100% !important;
}

/* Batch item status icon column: keep the compact status icons on one line. */
.batch-item-status-column {
    min-width: 8rem;
    white-space: nowrap;
}

/* Preserve whitespace in <pre>-like contexts */
.show-white-space {
    white-space: pre-wrap;
}

/* Narrow check-box vertical padding */
.form-check {
    min-height: 1rem;
    margin-bottom: 0rem;
}

/* SweetAlert2 primary button colour match */
.swal2-confirm {
    background-color: #0d6efd !important;
}

/* Custom font-size scale (smaller than BS5 defaults) */
.fs-1 { font-size: calc(1.3rem + 0.6vw)   !important; }
.fs-2 { font-size: calc(1.275rem + 0.3vw) !important; }
.fs-3 { font-size: calc(1.26rem + 0.12vw) !important; }
.fs-4 { font-size: 1.25rem  !important; }
.fs-5 { font-size: 1.15rem  !important; }
.fs-6 { font-size: 1.075rem !important; }
.fs-7 { font-size: 0.95rem  !important; }
.fs-8 { font-size: 0.85rem  !important; }
.fs-9 { font-size: 0.75rem  !important; }
.fs-10 { font-size: 0.5rem  !important; }

/* Cards that need horizontal scroll on narrow viewports */
div.card-mobile-stretch {
    min-width: 800px;
}

/* Bootstrap card caps: transparent headers and footers by default. */
.card {
    --bs-card-cap-bg: transparent;
}

/* DataTables SearchPanes layout overrides */
div.dtsp-panesContainer button.dtsp-clearAll,
div.dtsp-panesContainer button.dtsp-collapseAll,
div.dtsp-panesContainer button.dtsp-showAll {
    float: right;
    padding: 0px !important;
}

div.dtsp-panesContainer div.dtsp-title {
    float: left;
    padding: 0px !important;
}

div.dtsp-panesContainer {
    margin-top: 0px !important;
    margin-bottom: 10px !important;
}

div.dtsp-panesContainer .custom-clear-filters {
    color: var(--bs-link-color);
    text-decoration: underline;
}

div.dtsp-panesContainer .custom-clear-filters:hover {
    color: var(--bs-link-hover-color);
}

/* FixedHeader match body font-size */
.fixedHeader-floating thead th,
.fixedHeader-locked thead th {
    font-size: 0.85rem !important;
}

/* Tom Select — apply the same thin blue border on focus. Its focus state is
   a .focus class on a wrapper div, not :focus, so the global rule misses it. */
.ts-wrapper.focus .ts-control,
.ts-wrapper.single.focus .ts-control {
    border-color: var(--bs-primary);
    box-shadow: none !important;
}

/* Wait spinner used by set_waiting() helper in base_bs5.js */
.wait-spinner {
    display: inline-flex;
    align-items: center;
}

/* Badge inside dropdown-item text: nudge up so it sits centred with the text
   (default baseline alignment makes it hang too low). */
.dropdown-item .badge {
    vertical-align: middle;
    position: relative;
    top: -1px;
}

/* Metronic-style purple badge/background. Matches BS5's `text-bg-*` pattern
   so it can be used as a drop-in like `<span class="badge text-bg-purple">`. */
.text-bg-purple {
    background-color: #7239EA !important;
    color: #fff !important;
}

/* Scrollable regions (e.g. dashboard card bodies): no scrollbar until hover/focus.
   Trackpad, mouse wheel, and touch still scroll. For “only while actively scrolling”
   you would add a class via scroll events — hover/focus is the simple CSS option. */
.card-scroll {
    scrollbar-width: none; /* Firefox: hidden until :hover (below) */
    -ms-overflow-style: none; /* legacy IE / old Edge */
}

.card-scroll:hover,
.card-scroll:focus-within {
    scrollbar-width: thin; /* Firefox: show a thin bar when the region is “active” */
}

.card-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.card-scroll:hover::-webkit-scrollbar,
.card-scroll:focus-within::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.card-scroll:hover::-webkit-scrollbar-track,
.card-scroll:focus-within::-webkit-scrollbar-track {
    background: transparent;
}

.card-scroll:hover::-webkit-scrollbar-thumb,
.card-scroll:focus-within::-webkit-scrollbar-thumb {
    background-color: var(--bs-border-color);
    border-radius: 4px;
}
