/**
 * DataTables Dark Theme for Bootstrap 5
 * Auto-switches when data-bs-theme="dark" is applied
 */

/* ==========================================================================
   Main DataTables Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dataTables_wrapper {
    color: #dee2e6;
}

/* Table styling */
[data-bs-theme="dark"] .dataTables_wrapper .table {
    --bs-table-bg: #212529;
    --bs-table-striped-bg: #2c3034;
    --bs-table-hover-bg: #32373b;
    color: #dee2e6;
    border-color: #495057;
}

[data-bs-theme="dark"] .dataTables_wrapper .table th,
[data-bs-theme="dark"] .dataTables_wrapper .table td {
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .dataTables_wrapper .table thead th {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}

/* Pagination */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #dee2e6 !important;
    background-color: #343a40;
    border-color: #495057;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #fff !important;
    background-color: #495057;
    border-color: #6c757d;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: #fff !important;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #6c757d !important;
    background-color: #212529;
    border-color: #495057;
    cursor: not-allowed;
}

/* Search and controls */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #343a40;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input:focus {
    background-color: #495057;
    border-color: #86b7fe;
    color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #343a40;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #dee2e6;
}

/* Processing indicator */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_processing {
    background-color: #343a40;
    color: #dee2e6;
    border-color: #495057;
}

/* ==========================================================================
   DataTables Buttons Dark Theme
   ========================================================================== */

/* Fix button margins - THIS IS KEY FOR YOUR REQUIREMENT */
[data-bs-theme="dark"] .dt-buttons .btn,
[data-bs-theme="dark"] .dt-button,
[data-bs-theme="dark"] .dataTables_wrapper .dt-buttons .btn,
[data-bs-theme="dark"] .dataTables_wrapper .dt-button {
    margin-bottom: 0 !important;
}

/* Button styling */
[data-bs-theme="dark"] .dt-buttons .btn-secondary,
[data-bs-theme="dark"] .dt-button {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

[data-bs-theme="dark"] .dt-buttons .btn-secondary:hover,
[data-bs-theme="dark"] .dt-button:hover {
    background-color: #5c636a;
    border-color: #565e64;
    color: #fff;
}

[data-bs-theme="dark"] .dt-buttons .btn-secondary:focus,
[data-bs-theme="dark"] .dt-button:focus {
    background-color: #5c636a;
    border-color: #565e64;
    box-shadow: 0 0 0 0.25rem rgba(108, 117, 125, 0.5);
}

/* Button collection dropdown */
[data-bs-theme="dark"] .dt-button-collection {
    background-color: #343a40;
    border-color: #495057;
}

[data-bs-theme="dark"] .dt-button-collection .dt-button {
    background-color: transparent;
    color: #dee2e6;
    border: none;
}

[data-bs-theme="dark"] .dt-button-collection .dt-button:hover {
    background-color: #495057;
    color: #fff;
}

/* ==========================================================================
   Search Panes Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dtsp-searchPanes {
    background-color: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .dtsp-searchPane {
    background-color: #343a40;
    border-color: #495057;
}

[data-bs-theme="dark"] .dtsp-searchPane .dtsp-topRow {
    background-color: #495057;
    color: #f8f9fa;
}

[data-bs-theme="dark"] .dtsp-searchPane .dtsp-searchCont {
    background-color: #343a40;
    border-color: #495057;
}

[data-bs-theme="dark"] .dtsp-searchPane .dtsp-searchCont input {
    background-color: #495057;
    border-color: #6c757d;
    color: #dee2e6;
}

[data-bs-theme="dark"] .dtsp-searchPane table.dataTable {
    background-color: #343a40;
}

[data-bs-theme="dark"] .dtsp-searchPane table.dataTable tbody tr {
    background-color: #343a40;
}

[data-bs-theme="dark"] .dtsp-searchPane table.dataTable tbody tr:hover {
    background-color: #495057;
}

[data-bs-theme="dark"] .dtsp-searchPane table.dataTable tbody tr.selected {
    background-color: #0d6efd;
    color: #fff;
}

/* Search pane buttons with margin fix */
[data-bs-theme="dark"] .dtsp-searchPane .dt-button,
[data-bs-theme="dark"] .dtsp-searchPane .btn {
    margin-bottom: 0 !important;
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

/* ==========================================================================
   Search Builder Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dtsb-searchBuilder {
    background-color: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .dtsb-group {
    background-color: #343a40;
    border-color: #495057;
}

[data-bs-theme="dark"] .dtsb-criteria {
    background-color: #495057;
    border-color: #6c757d;
}

[data-bs-theme="dark"] .dtsb-group select,
[data-bs-theme="dark"] .dtsb-criteria select,
[data-bs-theme="dark"] .dtsb-criteria input {
    background-color: #343a40;
    border-color: #6c757d;
    color: #dee2e6;
}

/* Search builder buttons with margin fix */
[data-bs-theme="dark"] .dtsb-searchBuilder .dt-button,
[data-bs-theme="dark"] .dtsb-searchBuilder .btn {
    margin-bottom: 0 !important;
}

/* ==========================================================================
   Responsive Modal Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dtr-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

[data-bs-theme="dark"] .dtr-modal-content {
    background-color: #343a40;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .dtr-modal-header {
    background-color: #495057;
    border-color: #6c757d;
    color: #f8f9fa;
}

[data-bs-theme="dark"] .dtr-modal-close {
    color: #f8f9fa;
}

[data-bs-theme="dark"] .dtr-modal-close:hover {
    color: #fff;
}

/* Responsive details table */
[data-bs-theme="dark"] .dtr-details {
    background-color: #343a40;
}

[data-bs-theme="dark"] .dtr-details .table {
    background-color: #343a40;
    color: #dee2e6;
}

[data-bs-theme="dark"] .dtr-details .table td {
    border-color: #495057;
}

/* ==========================================================================
   Column Visibility Dark Theme
   ========================================================================== */

/* Main collection container */
[data-bs-theme="dark"] .dt-button-collection,
[data-bs-theme="dark"] .dt-button-collection.dropdown-menu,
[data-bs-theme="dark"] .dt-button-collection.dtb-collection,
[data-bs-theme="dark"] .buttons-collection {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

/* Individual buttons in collection */
[data-bs-theme="dark"] .dt-button-collection .dt-button,
[data-bs-theme="dark"] .dt-button-collection button,
[data-bs-theme="dark"] .dt-button-collection a,
[data-bs-theme="dark"] .buttons-collection .dt-button,
[data-bs-theme="dark"] .buttons-collection button,
[data-bs-theme="dark"] .buttons-collection a {
    color: #dee2e6 !important;
    background-color: transparent !important;
    border: none !important;
    margin-bottom: 0 !important;
    padding: 0.375rem 0.75rem !important;
    text-align: left !important;
    width: 100% !important;
    display: block !important;
}

/* Hover state */
[data-bs-theme="dark"] .dt-button-collection .dt-button:hover,
[data-bs-theme="dark"] .dt-button-collection button:hover,
[data-bs-theme="dark"] .dt-button-collection a:hover,
[data-bs-theme="dark"] .buttons-collection .dt-button:hover,
[data-bs-theme="dark"] .buttons-collection button:hover,
[data-bs-theme="dark"] .buttons-collection a:hover {
    background-color: #495057 !important;
    color: #fff !important;
}

/* Active/selected state */
[data-bs-theme="dark"] .dt-button-collection .dt-button.active,
[data-bs-theme="dark"] .dt-button-collection button.active,
[data-bs-theme="dark"] .dt-button-collection a.active,
[data-bs-theme="dark"] .buttons-collection .dt-button.active,
[data-bs-theme="dark"] .buttons-collection button.active,
[data-bs-theme="dark"] .buttons-collection a.active {
    background-color: #0d6efd !important;
    color: #fff !important;
}

/* Column visibility specific classes */
[data-bs-theme="dark"] .dt-button-collection.dtb-collection-closeable {
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .dt-button-collection .dt-button.dt-button-active,
[data-bs-theme="dark"] .buttons-collection .dt-button.dt-button-active {
    background-color: #198754 !important;
    color: #fff !important;
}

/* Fixed positioning */
[data-bs-theme="dark"] .dt-button-collection.fixed {
    background-color: #343a40 !important;
    border: 1px solid #495057 !important;
}

/* Two column layout */
[data-bs-theme="dark"] .dt-button-collection.two-column .dt-button,
[data-bs-theme="dark"] .dt-button-collection.three-column .dt-button,
[data-bs-theme="dark"] .dt-button-collection.four-column .dt-button {
    width: auto !important;
    display: inline-block !important;
}

/* ==========================================================================
   Fixed Columns Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .DTFC_LeftWrapper table.dataTable,
[data-bs-theme="dark"] .DTFC_RightWrapper table.dataTable {
    background-color: #212529;
}

[data-bs-theme="dark"] .DTFC_LeftWrapper table.dataTable th,
[data-bs-theme="dark"] .DTFC_RightWrapper table.dataTable th,
[data-bs-theme="dark"] .DTFC_LeftWrapper table.dataTable td,
[data-bs-theme="dark"] .DTFC_RightWrapper table.dataTable td {
    background-color: #212529;
    border-color: #495057;
}

/* ==========================================================================
   Scrolling Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dataTables_scrollHead table.dataTable,
[data-bs-theme="dark"] .dataTables_scrollBody table.dataTable {
    background-color: #212529;
}

[data-bs-theme="dark"] .dataTables_scrollHead,
[data-bs-theme="dark"] .dataTables_scrollBody,
[data-bs-theme="dark"] .dataTables_scrollFoot {
    background-color: #212529;
    border-color: #495057;
}

/* ==========================================================================
   RowGroup Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dtrg-group {
    background-color: #495057 !important;
    color: #f8f9fa !important;
    border-color: #6c757d !important;
}

[data-bs-theme="dark"] .dtrg-group td {
    background-color: #495057 !important;
    color: #f8f9fa !important;
    border-color: #6c757d !important;
    font-weight: bold;
}

[data-bs-theme="dark"] .dtrg-level-0 {
    background-color: #495057 !important;
}

[data-bs-theme="dark"] .dtrg-level-1 {
    background-color: #343a40 !important;
}

/* ==========================================================================
   RowReorder Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dt-rowReorder-moving {
    background-color: #495057 !important;
    color: #dee2e6 !important;
    opacity: 0.8 !important;
}

[data-bs-theme="dark"] .dt-rowReorder-moving td {
    background-color: #495057 !important;
    border-color: #6c757d !important;
}

[data-bs-theme="dark"] .dt-rowReorder-float {
    background-color: #343a40 !important;
    border: 2px solid #0d6efd !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

/* ==========================================================================
   KeyTable Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .focus {
    background-color: #0d6efd !important;
    color: #fff !important;
    outline: 2px solid #86b7fe !important;
    outline-offset: -2px !important;
}

[data-bs-theme="dark"] .focus-disabled {
    background-color: #6c757d !important;
    color: #adb5bd !important;
}

/* ==========================================================================
   AutoFill Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dt-autofill-handle {
    background-color: #0d6efd !important;
    border: 1px solid #0d6efd !important;
}

[data-bs-theme="dark"] .dt-autofill-select {
    background-color: rgba(13, 110, 253, 0.3) !important;
    border: 2px dashed #0d6efd !important;
}

[data-bs-theme="dark"] .dt-autofill-background {
    background-color: rgba(13, 110, 253, 0.15) !important;
}

/* ==========================================================================
   ColReorder Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .DTCR_pointer {
    background-color: #0d6efd !important;
    height: 100% !important;
    width: 2px !important;
}

[data-bs-theme="dark"] .DTCR_clone {
    background-color: #343a40 !important;
    border: 1px solid #495057 !important;
    opacity: 0.8 !important;
}

/* ==========================================================================
   StateRestore Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dt-button-collection .dtsb-titleRow {
    background-color: #495057 !important;
    color: #f8f9fa !important;
    border-color: #6c757d !important;
}

[data-bs-theme="dark"] .dt-sr-modal {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

[data-bs-theme="dark"] .dt-sr-modal-content {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .dt-sr-modal-header {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .dt-sr-modal input,
[data-bs-theme="dark"] .dt-sr-modal textarea {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #dee2e6 !important;
}

/* ==========================================================================
   DateTime Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .editor-datetime {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .editor-datetime-header {
    background-color: #495057 !important;
    color: #f8f9fa !important;
    border-color: #6c757d !important;
}

[data-bs-theme="dark"] .editor-datetime-calendar table {
    background-color: #343a40 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .editor-datetime-calendar td {
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .editor-datetime-calendar td:hover {
    background-color: #495057 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .editor-datetime-calendar td.selected {
    background-color: #0d6efd !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .editor-datetime-calendar td.disabled {
    color: #6c757d !important;
    background-color: #2c3034 !important;
}

/* ==========================================================================
   Scroller Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .DTS {
    background-color: #212529 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .DTS .dataTables_scrollBody {
    background-color: #212529 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .DTS .dataTables_scrollHead,
[data-bs-theme="dark"] .DTS .dataTables_scrollFoot {
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

/* ==========================================================================
   Editor Extension Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .DTE {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

[data-bs-theme="dark"] .DTE_Body {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .DTE_Header {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .DTE_Footer {
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .DTE_Field_Input input,
[data-bs-theme="dark"] .DTE_Field_Input textarea,
[data-bs-theme="dark"] .DTE_Field_Input select {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .DTE_Field_Input input:focus,
[data-bs-theme="dark"] .DTE_Field_Input textarea:focus,
[data-bs-theme="dark"] .DTE_Field_Input select:focus {
    background-color: #495057 !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="dark"] .DTE_Field_Error {
    color: #dc3545 !important;
}

[data-bs-theme="dark"] .DTE_Field_Label {
    color: #dee2e6 !important;
}

/* ==========================================================================
   Additional Controls Dark Theme
   ========================================================================== */

/* Date range picker (if used) */
[data-bs-theme="dark"] .dtr-date,
[data-bs-theme="dark"] .daterangepicker {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
}

/* Select2 integration */
[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .select2-dropdown {
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-results__option {
    background-color: #343a40 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #0d6efd !important;
    color: #fff !important;
}

/* Bootstrap Select integration */
[data-bs-theme="dark"] .bootstrap-select .dropdown-menu {
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .bootstrap-select .dropdown-item {
    color: #dee2e6 !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .bootstrap-select .dropdown-item:hover,
[data-bs-theme="dark"] .bootstrap-select .dropdown-item:focus {
    background-color: #495057 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .bootstrap-select .dropdown-item.active {
    background-color: #0d6efd !important;
    color: #fff !important;
}

/* ==========================================================================
   Custom Input Controls Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dataTables_wrapper input[type="search"],
[data-bs-theme="dark"] .dataTables_wrapper input[type="text"],
[data-bs-theme="dark"] .dataTables_wrapper input[type="number"],
[data-bs-theme="dark"] .dataTables_wrapper input[type="email"],
[data-bs-theme="dark"] .dataTables_wrapper input[type="url"],
[data-bs-theme="dark"] .dataTables_wrapper input[type="password"],
[data-bs-theme="dark"] .dataTables_wrapper textarea,
[data-bs-theme="dark"] .dataTables_wrapper select {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .dataTables_wrapper input:focus,
[data-bs-theme="dark"] .dataTables_wrapper textarea:focus,
[data-bs-theme="dark"] .dataTables_wrapper select:focus {
    background-color: #495057 !important;
    border-color: #86b7fe !important;
    color: #fff !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* ==========================================================================
   Loading Indicators Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .dataTables_processing {
    background-color: rgba(52, 58, 64, 0.95) !important;
    color: #dee2e6 !important;
    border: 1px solid #495057 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .dt-loader {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

[data-bs-theme="dark"] .dt-loader-content {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #dee2e6 !important;
}

/* ==========================================================================
   Global Button Margin Fix
   ========================================================================== */

/* Ensure ALL buttons in DataTables have zero bottom margin */
[data-bs-theme="dark"] .dataTables_wrapper .btn,
[data-bs-theme="dark"] .dataTables_wrapper button,
[data-bs-theme="dark"] .dataTables_wrapper .dt-button,
[data-bs-theme="dark"] .dataTables_wrapper .paginate_button,
[data-bs-theme="dark"] .dt-buttons .btn,
[data-bs-theme="dark"] .dt-button-collection .btn,
[data-bs-theme="dark"] .dtsp-searchPane .btn,
[data-bs-theme="dark"] .dtsb-searchBuilder .btn,
[data-bs-theme="dark"] .DTE_Footer .btn,
[data-bs-theme="dark"] .dt-sr-modal .btn,
[data-bs-theme="dark"] .editor-datetime .btn {
    margin-bottom: 0 !important;
}

/* Also apply to light theme for consistency */
.dataTables_wrapper .btn,
.dataTables_wrapper button,
.dataTables_wrapper .dt-button,
.dataTables_wrapper .paginate_button,
.dt-buttons .btn,
.dt-button-collection .btn,
.dtsp-searchPane .btn,
.dtsb-searchBuilder .btn,
.DTE_Footer .btn,
.dt-sr-modal .btn,
.editor-datetime .btn {
    margin-bottom: 0 !important;
}

/* ==========================================================================
   Tooltips and Popovers Dark Theme
   ========================================================================== */

[data-bs-theme="dark"] .tooltip .tooltip-inner {
    background-color: #343a40 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .tooltip .tooltip-arrow::before {
    border-color: #343a40 !important;
}

[data-bs-theme="dark"] .popover {
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .popover-header {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .popover-body {
    color: #dee2e6 !important;
}

/* ==========================================================================
   Print Styling Dark Theme Override
   ========================================================================== */

@media print {
    [data-bs-theme="dark"] .dataTables_wrapper,
    [data-bs-theme="dark"] .dataTables_wrapper .table,
    [data-bs-theme="dark"] .dataTables_wrapper .table th,
    [data-bs-theme="dark"] .dataTables_wrapper .table td {
        background-color: white !important;
        color: black !important;
        border-color: #dee2e6 !important;
    }
}

/* ==========================================================================
   Responsive Extension Control Icon Enhancement
   ========================================================================== */

/* Light theme - ensure dtr-control icons are visible */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    /* Override semi-transparent black with solid color */
    border-left-color: #495057 !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control.arrow-right::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control.arrow-right::before {
    border-right-color: #495057 !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > th.dtr-control:before {
    border-top-color: #495057 !important;
}

table.dataTable.dtr-column > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > th.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > td.control:before,
table.dataTable.dtr-column > tbody > tr > th.control:before {
    border-left-color: #495057 !important;
}

table.dataTable.dtr-column > tbody > tr > td.dtr-control.arrow-right::before,
table.dataTable.dtr-column > tbody > tr > th.dtr-control.arrow-right::before,
table.dataTable.dtr-column > tbody > tr > td.control.arrow-right::before,
table.dataTable.dtr-column > tbody > tr > th.control.arrow-right::before {
    border-right-color: #495057 !important;
}

table.dataTable.dtr-column > tbody > tr.dtr-expanded td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.dtr-expanded th.dtr-control:before,
table.dataTable.dtr-column > tbody > tr.dtr-expanded td.control:before,
table.dataTable.dtr-column > tbody > tr.dtr-expanded th.control:before {
    border-top-color: #495057 !important;
}

/* Dark theme - brighter icons for better visibility */
[data-bs-theme="dark"] table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
[data-bs-theme="dark"] table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    border-left-color: #dee2e6 !important;
}

[data-bs-theme="dark"] table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control.arrow-right::before,
[data-bs-theme="dark"] table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control.arrow-right::before {
    border-right-color: #dee2e6 !important;
}

[data-bs-theme="dark"] table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > td.dtr-control:before,
[data-bs-theme="dark"] table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > th.dtr-control:before {
    border-top-color: #dee2e6 !important;
}

[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > td.dtr-control:before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > th.dtr-control:before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > td.control:before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > th.control:before {
    border-left-color: #dee2e6 !important;
}

[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > td.dtr-control.arrow-right::before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > th.dtr-control.arrow-right::before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > td.control.arrow-right::before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr > th.control.arrow-right::before {
    border-right-color: #dee2e6 !important;
}

[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr.dtr-expanded td.dtr-control:before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr.dtr-expanded th.dtr-control:before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr.dtr-expanded td.control:before,
[data-bs-theme="dark"] table.dataTable.dtr-column > tbody > tr.dtr-expanded th.control:before {
    border-top-color: #dee2e6 !important;
}