/* ═══════════════════════════════════════════════════════
   DxGrid – Modern skin override  (DevExpress Blazor 25.x)
   Uses CSS custom-property overrides — the supported way
   to restyle DxGrid without fighting selector specificity.
   MUST load AFTER the DevExpress theme stylesheet.
   ═══════════════════════════════════════════════════════ */

/* ─── Grid wrapper variables ─── */
.dxbl-grid {
    /* border & shape */
    --dxbl-grid-border-color: #e2e8f0;
    --dxbl-grid-border-radius: 8px;
    --dxbl-grid-border-width: 1px;
    --dxbl-grid-border-style: solid;
    /* general */
    --dxbl-grid-bg: #fff;
    --dxbl-grid-color: #334155;
    --dxbl-grid-font-size: .835rem;
    --dxbl-grid-line-height: 1.45;
    /* header */
    --dxbl-grid-header-bg: #f8fafc;
    --dxbl-grid-header-color: #64748b;
    --dxbl-grid-header-font-weight: 600;
    /* cell padding */
    --dxbl-grid-text-cell-padding-x: 0.75rem;
    --dxbl-grid-text-cell-padding-y: 0.45rem;
    /* hover */
    --dxbl-grid-hover-bg: #f0f5ff;
    --dxbl-grid-hover-color: #334155;
    /* selection */
    --dxbl-grid-selection-bg: #dbeafe;
    --dxbl-grid-selection-color: #1e40af;
    --dxbl-grid-selection-focus-bg: #bfdbfe;
    --dxbl-grid-selection-focus-color: #1e3a8a;
    /* focus */
    --dxbl-grid-focus-bg: #eff6ff;
    --dxbl-grid-focus-color: #1e40af;
    --dxbl-grid-focus-frame-color: var(--bs-primary, #0d6efd);
    /* footer / group footer */
    --dxbl-grid-footer-bg: #f8fafc;
    --dxbl-grid-footer-color: #475569;
    --dxbl-grid-footer-font-weight: 600;
    --dxbl-grid-group-footer-bg: #f1f5f9;
    --dxbl-grid-group-footer-color: #475569;
    --dxbl-grid-group-footer-font-weight: 600;
    /* fixed-column divider */
    --dxbl-grid-fixed-column-border-color: #e2e8f0;
    /* search highlight */
    --dxbl-grid-highlighted-text-bg: #fef08a;
    --dxbl-grid-highlighted-text-color: #1e293b;
    /* expand / collapse buttons */
    --dxbl-grid-expand-btn-bg: transparent;
    --dxbl-grid-expand-btn-color: #64748b;
    --dxbl-grid-expand-btn-hover-bg: #e0e7ff;
    --dxbl-grid-expand-btn-hover-color: var(--bs-primary, #0d6efd);
    /* edit form */
    --dxbl-grid-edit-form-padding-x: 1.25rem;
    --dxbl-grid-edit-form-padding-y: 1.25rem;
    --dxbl-grid-edit-row-bg: #fffbeb;
    --dxbl-grid-edit-row-color: #334155;
    /* outer shadow for a modern lifted look */
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06);
}

    /* ─── Header refinements ─── */
    .dxbl-grid .dxbl-grid-table > thead > tr > th {
        text-transform: uppercase;
        font-size: .72rem;
        letter-spacing: .04em;
        border-bottom-width: 2px;
        white-space: nowrap;
        transition: color .15s ease;
    }

        .dxbl-grid .dxbl-grid-table > thead > tr > th:hover {
            color: var(--bs-primary, #0d6efd);
        }

    /* ─── Remove vertical cell dividers ─── */
    .dxbl-grid .dxbl-grid-table > thead > tr > th,
    .dxbl-grid .dxbl-grid-table > tbody > tr > td,
    .dxbl-grid .dxbl-grid-table > tfoot > tr > td {
        border-right-width: 0;
    }

        /* ─── Softer row separators ─── */
        .dxbl-grid .dxbl-grid-table > tbody > tr > td:not(.dxbl-grid-empty-cell):not(.dxbl-grid-indent-cell) {
            border-bottom: 1px solid #f1f5f9;
        }

    /* ─── Alternate row stripe ─── */
    .dxbl-grid .dxbl-grid-table > tbody > tr:nth-child(even) > td:not(.dxbl-grid-empty-cell):not(.dxbl-grid-indent-cell) {
        background-color: #fafbfc;
    }

    .dxbl-grid .dxbl-grid-table.dxbl-grid-row-hover-enabled > tbody > tr:nth-child(even):hover > td:not(.dxbl-grid-empty-cell):not(.dxbl-grid-indent-cell) {
        background-color: var(--dxbl-grid-hover-bg);
    }

    /* ─── Smooth row transition ─── */
    .dxbl-grid .dxbl-grid-table > tbody > tr {
        transition: background-color .12s ease;
    }

        /* ─── Focused-row left accent bar ─── */
        .dxbl-grid .dxbl-grid-table > tbody > tr.dxbl-grid-focused-row:not(.dxbl-grid-group-row) {
            box-shadow: inset 3px 0 0 0 var(--bs-primary, #0d6efd);
        }

    /* ─── Pager buttons ─── */
    .dxbl-grid .dxbl-pager .dxbl-btn {
        border-radius: 6px;
        transition: all .15s ease;
    }

    /* ─── Search box container ─── */
    .dxbl-grid > .dxbl-grid-top-panel > .dxbl-grid-search-box-container .dxbl-text-edit {
        border-radius: 6px;
    }

    /* ─── Empty-data state ─── */
    .dxbl-grid .dxbl-grid-table .dxbl-grid-empty-data-area {
        color: #94a3b8;
    }

    /* ─── Scrollbar styling ─── */
    .dxbl-grid ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    .dxbl-grid ::-webkit-scrollbar-track {
        background: transparent;
    }

    .dxbl-grid ::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

        .dxbl-grid ::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }


/* ═══════════════════════════════════════════════════════
   DxButton – Modern override
   ═══════════════════════════════════════════════════════ */
.dxbl-btn {
    --dxbl-btn-border-radius: 6px;
    --dxbl-btn-focus-border-radius: 6px;
    --dxbl-btn-hover-border-radius: 6px;
    --dxbl-btn-active-border-radius: 6px;
    --dxbl-btn-disabled-border-radius: 6px;
    --dxbl-btn-box-shadow: none;
    --dxbl-btn-focus-shadow-blur: 0rem;
    --dxbl-btn-focus-shadow-spread: 0.15rem;
    transition: all .15s ease;
}

    /* slightly lift on hover */
    .dxbl-btn:not(.dxbl-disabled):not(:disabled):hover {
        box-shadow: 0 1px 4px rgba(0, 0, 0, .10);
    }

    /* active press feel */
    .dxbl-btn:not(.dxbl-disabled):not(:disabled):active {
        transform: scale(0.97);
    }

/* split button rounded connector */
.dxbl-btn-split .dxbl-btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.dxbl-btn-split .dxbl-btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}


/* ═══════════════════════════════════════════════════════
   DxToolbar – Modern override
   ═══════════════════════════════════════════════════════ */
.dxbl-toolbar {
    --dxbl-toolbar-btn-border-radius: 6px;
    --dxbl-toolbar-btn-focus-border-radius: 6px;
    --dxbl-toolbar-btn-hover-border-radius: 6px;
    --dxbl-toolbar-btn-active-border-radius: 6px;
    --dxbl-toolbar-btn-disabled-border-radius: 6px;
    --dxbl-toolbar-btn-box-shadow: none;
    --dxbl-toolbar-btn-focus-shadow-blur: 0rem;
    --dxbl-toolbar-btn-focus-shadow-spread: 0.15rem;
    --dxbl-toolbar-separator-color: #e2e8f0;
    --dxbl-toolbar-group-spacing: 0.5rem;
    --dxbl-toolbar-item-spacing: 0.25rem;
}

    .dxbl-toolbar .dxbl-btn,
    .dxbl-toolbar .dxbl-toolbar-dropdown-btn {
        border-radius: 6px;
        transition: all .15s ease;
    }

        .dxbl-toolbar .dxbl-btn:not(.dxbl-disabled):not(:disabled):hover,
        .dxbl-toolbar .dxbl-toolbar-dropdown-btn:not(.dxbl-disabled):not(:disabled):hover {
            box-shadow: 0 1px 4px rgba(0, 0, 0, .10);
        }

        .dxbl-toolbar .dxbl-btn:not(.dxbl-disabled):not(:disabled):active,
        .dxbl-toolbar .dxbl-toolbar-dropdown-btn:not(.dxbl-disabled):not(:disabled):active {
            transform: scale(0.97);
        }

    /* toolbar title */
    .dxbl-toolbar .dxbl-toolbar-title {
        font-weight: 600;
        letter-spacing: .01em;
    }

    /* toolbar dropdown button */
    .dxbl-toolbar .dxbl-toolbar-dropdown-btn {
        --dxbl-toolbar-dropdown-btn-border-color: transparent;
        border-radius: 6px;
    }

        .dxbl-toolbar .dxbl-toolbar-dropdown-btn:hover {
            background-color: #f0f5ff;
        }


/* ═══════════════════════════════════════════════════════
   DxPopup – Modern override
   ═══════════════════════════════════════════════════════ */
.dxbl-popup {
    --dxbl-popup-border-radius: 12px;
    --dxbl-popup-border-color: #a8a9aa;
    --dxbl-popup-shadow: 0 8px 30px rgba(0, 0, 0, .12);
    /* header */
    --dxbl-popup-header-bg: #f3f3f3;
    --dxbl-popup-header-color: #383838;
    --dxbl-popup-header-font-weight: 600;
    --dxbl-popup-header-padding-x: 1.15rem;
    --dxbl-popup-header-padding-y: 0.55rem;
    /* body */
    --dxbl-popup-body-padding-x: 1.15rem;
    --dxbl-popup-body-padding-y: 0.9rem;
    /* footer */
    --dxbl-popup-footer-bg: #f8fafc;
    --dxbl-popup-footer-padding-x: 1.25rem;
    --dxbl-popup-footer-padding-y: 0.6rem;
    /* close button */
    --dxbl-popup-header-btn-hover-bg: #fee2e2;
    --dxbl-popup-header-btn-hover-color: #dc2626;
}

    /* header bottom border */
    .dxbl-popup .dxbl-popup-header {
        border-bottom: 1px solid #e2e8f0;
    }

    /* footer top border */
    .dxbl-popup .dxbl-popup-footer {
        border-top: 1px solid #e2e8f0;
    }

    /* close button rounding */
    .dxbl-popup .dxbl-popup-header-button {
        border-radius: 6px;
        transition: all .15s ease;
    }

/* ─── Cap popups to the viewport and scroll the body instead of clipping ───
   Without this, a popup whose content is taller than the screen (e.g. a
   DxFormLayoutTabPages sized to its tallest page, see below) simply overflows
   past the bottom of the viewport - .dxbl-modal-body defaults to min-height:auto,
   which stops a flex child from ever shrinking below its content's natural size. */
.dxbl-popup {
    max-height: 90vh !important;
}

.dxbl-popup:not(.popup-body-contained) .dxbl-modal-body {
    min-height: 0 !important;
    overflow-y: auto !important;
}

.dxbl-popup.popup-body-contained .dxbl-modal-body {
    min-height: 0 !important;
    overflow: hidden !important;
}

/* Popups that wrap their form in .scrollable-blazor-form (machine edit forms, ...): let only that
   wrapper scroll. Otherwise the body scrolls too (double scrollbar) and the buttons scroll away.
   The flex/min-height chain also passes through the grid's popup edit-form wrapper and <form>. */
.dxbl-popup .dxbl-modal-body:has(.scrollable-blazor-form),
.dxbl-popup .dxbl-modal-body:has(.scrollable-blazor-form) .dxbl-grid-popup-edit-form,
.dxbl-popup .dxbl-modal-body:has(.scrollable-blazor-form) .dxbl-grid-popup-edit-form > form {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0 !important;
    overflow: hidden !important;
}

.dxbl-popup .dxbl-modal-body .scrollable-blazor-form {
    flex: 1 1 auto;
    min-height: 0;
}

/* backdrop */
.dxbl-popup-back {
    --dxbl-popup-back-bg: #0f172a;
    --dxbl-popup-back-opacity: 0.35;
}

/* ─── Mobile: full-width popups on small screens ─── */
@media (max-width: 576px) {
    .dxbl-modal > .dxbl-modal-root > .dxbl-popup {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
    }

    .dxbl-popup {
        --dxbl-popup-border-radius: 0;
        --dxbl-popup-body-padding-x: 0.75rem;
        --dxbl-popup-body-padding-y: 0.75rem;
        --dxbl-popup-header-padding-x: 0.75rem;
        --dxbl-popup-footer-padding-x: 0.75rem;
    }
}


/* ═══════════════════════════════════════════════════════
   Dropdowns (toolbar menus, filter menus, etc.)
   ═══════════════════════════════════════════════════════ */
.dxbl-dropdown {
    --dxbl-dropdown-border-radius: 8px;
    --dxbl-dropdown-border-color: #e2e8f0;
    --dxbl-dropdown-box-shadow: 0 4px 16px rgba(0, 0, 0, .10);
}

    /* dropdown menu items */
    .dxbl-dropdown .dxbl-menu-item:hover {
        background-color: #f0f5ff;
    }

    .dxbl-dropdown .dxbl-menu-item.dxbl-active {
        background-color: #dbeafe;
        color: #1e40af;
    }


/* ═══════════════════════════════════════════════════════
   Text editors (inputs, comboboxes, search boxes)
   ═══════════════════════════════════════════════════════ */
.dxbl-text-edit {
    --dxbl-text-edit-border-radius: 6px;
    --dxbl-text-edit-border-color: #e2e8f0;
    --dxbl-text-edit-focus-border-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 50%);
    --dxbl-text-edit-focus-shadow-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 12%);
    --dxbl-text-edit-focus-shadow-spread: 0.2rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}


/* ═══════════════════════════════════════════════════════
   DxFormLayout – Modern override
   Compact spacing to maximise content density in popups.
   ═══════════════════════════════════════════════════════ */
.dxbl-fl {
    --dxbl-fl-item-spacing-y: 0.35rem;
    --dxbl-fl-item-spacing-x: 0.75rem;
    --dxbl-fl-group-spacing-y: 0.5rem;
    --dxbl-fl-group-content-padding-x: 0.5rem;
    --dxbl-fl-group-content-padding-y: 0.4rem;
}

    /* ─── DxFormLayoutGroup (card-like sections) ─── */
    .dxbl-fl .dxbl-fl-group > .dxbl-group {
        --dxbl-group-border-radius: 8px;
        --dxbl-group-border-color: #82b8ff;
        --dxbl-group-border-width: 1px;
        --dxbl-group-bg: #ffffff;
        /* header — compact */
        --dxbl-group-header-bg: #006eff;
        --dxbl-group-header-color: #fdfdfd;
        --dxbl-group-header-font-weight: 500;
        --dxbl-group-header-border-radius: 7px;
        --dxbl-group-header-padding-x: 0.5rem;
        --dxbl-group-header-padding-y: 0.2rem;
        /* expand/collapse button */
        --dxbl-group-header-btn-hover-bg: #e0e7ff;
        --dxbl-group-header-btn-hover-color: var(--bs-primary, #0d6efd);
        box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
        transition: box-shadow .2s ease;
    }

        /* subtle lift on group hover */
        .dxbl-fl .dxbl-fl-group > .dxbl-group:hover {
            box-shadow: 0 2px 8px rgba(0, 0, 0, .07);
        }

        /* header bottom separator — thin accent line when expanded */
        .dxbl-fl .dxbl-fl-group > .dxbl-group.expanded > .dxbl-group-header {
            border-bottom: 1px solid #93c5fd;
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
        }

        /* header pseudo-element background tint — override the default 5% opacity */
        .dxbl-fl .dxbl-fl-group > .dxbl-group > .dxbl-group-header::before {
            opacity: 0;
        }

        /* group body content padding — compact */
        .dxbl-fl .dxbl-fl-group > .dxbl-group > .dxbl-group-body > .dxbl-group-body-content {
            padding: 0.4rem 0.5rem;
        }

    /* spacing between consecutive groups */
    .dxbl-fl .dxbl-fl-group + .dxbl-fl-group {
        margin-top: 0.35rem;
    }

    /* ─── DxFormLayoutTabPages ─── */
    .dxbl-fl .dxbl-fl-tab-group {
        --dxbl-fl-tab-group-tab-border-color: #acc8ec;
        --dxbl-fl-tab-group-bottom-border-color: #e2e8f0;
        --dxbl-fl-tab-group-tab-selected-color: var(--bs-primary, #0d6efd);
        --dxbl-fl-tab-group-tab-selected-border-color: var(--bs-primary, #0d6efd);

        --dxbl-fl-tab-group-tab-hover-bg: #f0f5ff;
        --dxbl-fl-tab-group-tab-hover-color: var(--bs-primary, #0d6efd);
        --dxbl-fl-tab-group-tab-selected-bg: #fff;
        --dxbl-fl-tab-group-content-padding-x: 0.5rem;
        --dxbl-fl-tab-group-content-padding-y: 0.5rem;
    }

        /* active tab bottom indicator — primary-coloured underline */
        .dxbl-fl .dxbl-fl-tab-group .nav-link.active {
            border-bottom: 2px solid #93c5fd;
            font-weight: 600;
        }

        /* tab transition */
        .dxbl-fl .dxbl-fl-tab-group .nav-link {
            transition: color .15s ease, background-color .15s ease;
            border-radius: 6px 6px 0 0;
        }

    /* ─── DxFormLayoutTabPages – stop the popup/panel height jumping when switching tabs ───
       Requires RenderMode="TabsRenderMode.AllTabs" on the DxFormLayoutTabPages, otherwise
       inactive pages aren't in the DOM and there's nothing here to size against.
       DevExpress renders the inactive page as a `.dxbl-tabs-content` sibling moved off-screen
       (position:absolute, left/top:-10000px) with an inline height mirroring the active page -
       that's what causes the jump. Fix: stack every page in the same grid cell at its own
       natural (auto) height so the row sizes to the tallest page; only the active one is shown.
       Overflow past the viewport is handled by the popup-level scroll fix above, not here -
       capping just this inner panel left content below it (e.g. Save/Cancel buttons) clipped. */
    .dxbl-fl-gt .dxbl-tabs-content-panel {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    .dxbl-fl-gt .dxbl-tabs-content {
        position: static !important;
        left: auto !important;
        top: auto !important;
        height: auto !important;
        grid-row: 1 !important;
        grid-column: 1 !important;
    }

    .dxbl-fl-gt .dxbl-tabs-content:not(.dxbl-active) {
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* ─── Sticky Cancel/Save action row (desktop) ───
       `.sticky-actions` already exists mobile-only in phonePopup.css (position:fixed, <=768px).
       This is the desktop equivalent, used by ContactEditForm/CoursesPage/EmployeeEditOLD/
       GroupsPage/Parking/Places_new/TablesPage/EWarehouses etc: pins the button row to the
       bottom of the scrolling popup body (.dxbl-modal-body, see overflow fix above) instead
       of letting it scroll away with the rest of the content. */
    @media (min-width: 769px) {
        .sticky-actions {
            position: sticky;
            bottom: -0.75rem;
            background: #fff;
            padding: 0.5rem 0;
            margin-top: 0.5rem;
            z-index: 2;
            box-shadow: 0 -2px 6px rgba(0, 0, 0, .08);
        }
    }

    /* ─── Form-layout item labels ─── */
    .dxbl-fl .dxbl-fl-cpt {
        color: rgb(78, 85, 94);
        font-size: .78rem;
        font-weight: 500;
    }

