/* Kendo Grid look & feel for DataTables grids created by shGrid() (wwwroot/js/kendo-replacement.js)
   High-readability palette. Brand navy #0B2A5B (redesign safehotline.css --navy).
   Contrast: #212529 on #fff 15.4:1; #fff on #0B2A5B 14.6:1; #212529 on #cfe0f5 12:1 (WCAG AA). */
:root {
    --sh-brand: #0B2A5B; --sh-brand-dark: #061833; --sh-text: #212529; --sh-border: #d5dbe3;
    --sh-zebra: #f6f8fb; --sh-hover: #e3eefb; --sh-selected: #c4dafa;
}
div.dt-container table.sh-kgrid { border: 1px solid var(--sh-border) !important; border-collapse: collapse !important; font-size: 14px; color: var(--sh-text); background: #fff; }
div.dt-container table.sh-kgrid > tbody > tr > *,
div.dt-container table.sh-kgrid.table > tbody > tr > * {
    color: var(--sh-text) !important; background-color: #fff !important; --bs-table-accent-bg: transparent; --bs-table-color: var(--sh-text);
    box-shadow: none !important; border: 1px solid var(--sh-border) !important; padding: 8px 10px !important; vertical-align: middle;
}
div.dt-container table.sh-kgrid > tbody > tr:nth-child(even) > * { background-color: var(--sh-zebra) !important; }
div.dt-container table.sh-kgrid > tbody > tr > * a { color: #143A73; }
div.dt-container table.sh-kgrid > tbody > tr:hover > * { background-color: var(--sh-hover) !important; }
div.dt-container table.sh-kgrid > tbody > tr.selected > *,
div.dt-container table.sh-kgrid > tbody > tr.k-state-selected > * { background-color: var(--sh-selected) !important; color: var(--sh-text) !important; }
div.dt-container table.sh-kgrid > tbody > tr > td.dt-empty { color: #495057 !important; }

/* header */
div.dt-container table.sh-kgrid > thead > tr > th {
    background: var(--sh-brand) !important; color: #fff !important; font-weight: 700; border: 1px solid var(--sh-brand-dark) !important;
    padding: 9px 10px !important; vertical-align: middle; white-space: nowrap; position: relative;
}
div.dt-container table.sh-kgrid > thead > tr > th.sh-filterable { padding-right: 44px !important; }
div.dt-container table.sh-kgrid > thead > tr > th.sh-filtered { background: var(--sh-brand-dark) !important; }
div.dt-container table.sh-kgrid > thead > tr > th:focus-visible { outline: 2px solid #ffd43b; outline-offset: -2px; }

/* sort indicators: single white arrow on the active column only, like Kendo */
table.sh-kgrid thead th .dt-column-order:before, table.sh-kgrid thead th .dt-column-order:after { color: #fff !important; }
table.sh-kgrid thead th.dt-orderable-asc .dt-column-order:before,
table.sh-kgrid thead th.dt-orderable-desc .dt-column-order:after { opacity: 0 !important; }
table.sh-kgrid thead th.dt-ordering-asc .dt-column-order:before { opacity: 1 !important; content: "\25B2" !important; font-size: .7em; }
table.sh-kgrid thead th.dt-ordering-desc .dt-column-order:after { opacity: 1 !important; content: "\25BC" !important; font-size: .7em; }
table.sh-kgrid thead th.dt-ordering-asc .dt-column-order:after,
table.sh-kgrid thead th.dt-ordering-desc .dt-column-order:before { opacity: 0 !important; }
table.sh-kgrid thead th.sh-filterable .dt-column-order { right: 26px !important; }

/* filter funnel */
.sh-filter-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 3px; color: #fff !important; cursor: pointer; line-height: 1; }
.sh-filter-btn:hover, .sh-filter-btn:focus { background: rgba(255,255,255,.25); color: #fff !important; outline: none; }
.sh-filter-btn:focus-visible { outline: 2px solid #fff; }
.sh-filter-btn.sh-filter-active, .sh-filter-btn.sh-filter-active:hover { background: #ffd43b; color: #212529 !important; }

/* filter popup */
.sh-filter-menu { position: absolute; z-index: 2000; width: 240px; background: #fff; color: var(--sh-text); border: 1px solid var(--sh-border); border-radius: 6px;
    padding: 10px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.18) !important; }
.sh-filter-menu .sh-fm-help { margin-bottom: 8px; color: var(--sh-text); font-weight: 600; }
.sh-filter-menu select, .sh-filter-menu input { margin-bottom: 6px; color: var(--sh-text); border-color: #adb5bd; }
.sh-filter-menu .sh-fm-logic { width: 80px; }
.sh-filter-menu .sh-fm-buttons { display: flex; gap: 6px; margin-top: 4px; }
.sh-filter-menu .sh-fm-buttons .btn { flex: 1; font-weight: 600; }
.sh-filter-menu .sh-fm-apply { background: var(--sh-brand); border-color: var(--sh-brand); color: #fff; }
.sh-filter-menu .sh-fm-apply:hover { background: var(--sh-brand-dark); border-color: var(--sh-brand-dark); }
.sh-filter-menu .sh-fm-clear { color: #343a40; border-color: #6c757d; }
.sh-filter-menu .sh-fm-clear:hover { background: #e9ecef; color: #212529; }

/* pager bar, Kendo style */
div.dt-container:has(> .dt-layout-row > .dt-layout-cell > table.sh-kgrid) > .dt-layout-row:last-child,
div.dt-container .dt-layout-row:has(.dt-paging) { background: #f1f4f8; color: var(--sh-text); font-size: 14px; border: 1px solid var(--sh-border); border-top: 0; margin-top: 0 !important; padding: 6px 8px; align-items: center; }
div.dt-container .dt-paging .pagination { margin: 0; }
div.dt-container .dt-paging .page-link { padding: .25rem .55rem; min-width: 2rem; text-align: center; border-radius: 50% !important; border: 0; background: transparent; margin: 0 1px; color: #143A73 !important; font-weight: 600; }
div.dt-container .dt-paging .page-link:hover { background: var(--sh-hover); }
div.dt-container .dt-paging .page-item.active .page-link { background: var(--sh-brand) !important; color: #fff !important; }
div.dt-container .dt-paging .page-item.disabled .page-link { background: transparent; color: #6c757d !important; opacity: 1; font-weight: 400; }
div.dt-container .dt-length { display: inline-flex; align-items: center; gap: 4px; margin-left: 12px; color: var(--sh-text); }
div.dt-container .dt-length select { width: auto; display: inline-block; color: var(--sh-text); }
div.dt-container .dt-layout-row:has(.dt-paging) .dt-layout-start { display: flex; align-items: center; flex-wrap: wrap; }
div.dt-container .dt-info { padding-top: 0 !important; color: #343a40 !important; }

/* Export buttons: right-aligned, styled like site buttons */
div.dt-container .dt-layout-row:first-child { justify-content: flex-end; }
div.dt-container .dt-layout-cell.dt-layout-end { margin-left: auto; }
div.dt-container .dt-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 6px; }
div.dt-container .dt-buttons .dt-button.sh-export-btn,
div.dt-container .dt-buttons button.sh-export-btn {
    background: #fff !important; background-image: none !important;
    color: #0B2A5B !important; border: 1.5px solid #0B2A5B !important; border-radius: 8px !important;
    padding: 6px 14px !important; font: 600 14px/1.3 Inter, system-ui, sans-serif !important;
    box-shadow: none !important; margin: 0 !important; cursor: pointer;
}
div.dt-container .dt-buttons .sh-export-btn:hover,
div.dt-container .dt-buttons .sh-export-btn:focus-visible {
    background: #0B2A5B !important; color: #fff !important;
}
div.dt-container .dt-buttons .sh-export-btn::before { margin-right: 6px; font-weight: 700; }
div.dt-container .dt-buttons .sh-export-excel::before { content: "\2193"; }
div.dt-container .dt-buttons .sh-export-pdf::before { content: "\2193"; }

/* Export buttons: always right-aligned */
div.dt-container .dt-layout-row:has(.dt-buttons) { display: flex !important; justify-content: flex-end !important; }
div.dt-container .dt-layout-row:has(.dt-buttons) > .dt-layout-cell { display: flex !important; justify-content: flex-end !important; margin-left: auto !important; width: auto; text-align: right; }
div.dt-container .dt-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; }

/* Bootstrap 4 theme lacks BS5 ms-auto: push DataTables end cells right; tighten top row */
div.dt-container .dt-layout-end, div.dt-container .ms-auto { margin-left: auto !important; }
div.dt-container > .row.mt-2:first-child:has(.dt-buttons) { margin-top: 0 !important; margin-bottom: 4px !important; }
div.dt-container .dt-buttons { margin: 0 !important; padding: 0 !important; }
