:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --shadow: rgba(0, 0, 0, 0.1);
  --accent-primary: #0d6efd;
  --accent-secondary: rgb(79, 21, 186);
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --shadow: rgba(0, 0, 0, 0.1);
  --accent-primary: #0d6efd;
  --accent-secondary: rgb(79, 21, 186);
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-card: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --border-color: #495057;
  --shadow: rgba(0, 0, 0, 0.3);
  --accent-primary: #4b358d;
  --accent-secondary: rgb(79, 21, 186);
  --success: #51cf66;
  --warning: #ffd43b;
  --danger: #ff6b6b;
  --info: #74c0fc;
}
/* ===== DARK MODE ONLY STYLES ===== */
[data-theme="dark"] body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .navbar {
  background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .navbar-brand, 
[data-theme="dark"] .navbar-nav .nav-link {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .navbar-nav .nav-link:hover {
  color: var(--accent-primary) !important;
}

[data-theme="dark"] .card {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .table {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .container,
[data-theme="dark"] .main-container {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] a {
  color: #9775fa !important;
}

[data-theme="dark"] a:hover {
  color: #7c3aed !important;
}

/* ===== HOME PAGE & JUMBOTRON ===== */
[data-theme="dark"] .jumbotron {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .jumbotron h1,
[data-theme="dark"] .jumbotron h4,
[data-theme="dark"] .jumbotron p {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .jumbotron .lead {
  color: var(--text-secondary) !important;
}

/* ===== DROPDOWNS ===== */
[data-theme="dark"] .dropdown-menu {
  background-color: #1e1e1e !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-primary) !important;
  background-color: transparent !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background-color: #333333 !important;
  color: var(--accent-primary) !important;
}

[data-theme="dark"] .dropdown-item:active {
  background-color: var(--accent-primary) !important;
  color: white !important;
}

[data-theme="dark"] .dropdown-divider {
  border-color: var(--border-color) !important;
  border-top: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dropdown-item-text {
  color: var(--text-primary) !important;
  background-color: transparent !important;
}

[data-theme="dark"] .dropdown-item-text.text-muted {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .dropdown-toggle::after {
  border-top-color: var(--text-primary) !important;
}

/* Force dropdown menu to be dark even when Bootstrap overrides */
[data-theme="dark"] .show > .dropdown-menu {
  background-color: #1e1e1e !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dropdown-menu.show {
  background-color: #1e1e1e !important;
  border: 1px solid var(--border-color) !important;
}

/* Additional dropdown fixes */
[data-theme="dark"] .dropdown-toggle {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-toggle:hover,
[data-theme="dark"] .dropdown-toggle:focus {
  background-color: #333333 !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ===== FORMS & INPUTS ===== */
[data-theme="dark"] .form-control {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .form-control:focus {
  background-color: var(--bg-card) !important;
  border-color: var(--accent-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(151, 117, 250, 0.25) !important;
}

[data-theme="dark"] .form-control::placeholder {
  color: var(--text-muted) !important;
}

[data-theme="dark"] select.form-control {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* ===== CODE BLOCKS & PRE ===== */
[data-theme="dark"] pre,
[data-theme="dark"] code {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .code-block,
[data-theme="dark"] .highlight {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  padding: 15px !important;
  border-radius: 5px !important;
  border: 1px solid var(--border-color) !important;
}

/* ===== SEMANTIC COLORS FOR DARK MODE ===== */

/* Success colors */
[data-theme="dark"] .fa-check-circle,
[data-theme="dark"] .fa-check,
[data-theme="dark"] span[style*="color: green"],
[data-theme="dark"] span[style*="color: green"] i {
  color: #51cf66 !important;
}

/* Danger colors */
[data-theme="dark"] .fa-times-circle,
[data-theme="dark"] .fa-times,
[data-theme="dark"] span[style*="color: red"],
[data-theme="dark"] span[style*="color: red"] i {
  color: #ff6b6b !important;
}

/* Warning colors */
[data-theme="dark"] .fa-exclamation-triangle,
[data-theme="dark"] .fa-warning,
[data-theme="dark"] span[style*="color: yellow"],
[data-theme="dark"] span[style*="color: yellow"] i {
  color: #ffd43b !important;
}

/* Table danger rows - RED BACKGROUND */
[data-theme="dark"] tr.table-danger,
[data-theme="dark"] tr[style*="background-color: rgb(255, 0, 0)"] {
  background-color: #dc3545 !important;
  color: #ffffff !important;
  border-color: #dc3545 !important;
}

[data-theme="dark"] tr.table-danger td,
[data-theme="dark"] tr[style*="background-color: rgb(255, 0, 0)"] td {
  background-color: #dc3545 !important;
  color: #ffffff !important;
}

/* Fix specific table danger styling overrides */
[data-theme="dark"] table tr.table-danger,
[data-theme="dark"] table tr[style*="background-color: rgb(255, 0, 0)"] {
  background-color: #dc3545 !important;
  color: #ffffff !important;
}

[data-theme="dark"] table tr.table-danger:hover,
[data-theme="dark"] table tr[style*="background-color: rgb(255, 0, 0)"]:hover {
  background-color: #c82333 !important;
  color: #ffffff !important;
}

/* ===== NAVBAR FIXES ===== */
[data-theme="dark"] .navbar-toggler {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ===== ALERTS & NOTIFICATIONS ===== */
[data-theme="dark"] .alert {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .alert-success {
  background-color: rgba(81, 207, 102, 0.1) !important;
  border-color: #51cf66 !important;
  color: #51cf66 !important;
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(255, 107, 107, 0.1) !important;
  border-color: #ff6b6b !important;
  color: #ff6b6b !important;
}

[data-theme="dark"] .alert-warning {
  background-color: rgba(255, 212, 59, 0.1) !important;
  border-color: #ffd43b !important;
  color: #ffd43b !important;
}

[data-theme="dark"] .alert-info {
  background-color: rgba(116, 192, 252, 0.1) !important;
  border-color: #74c0fc !important;
  color: #74c0fc !important;
}

/* DataTables dark mode */
[data-theme="dark"] .dataTables_wrapper {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_filter input,
[data-theme="dark"] .dataTables_length select {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dt-buttons .dt-button {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-buttons .dt-button:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
}

/* DataTables pagination */
[data-theme="dark"] .dataTables_paginate .paginate_button {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_paginate .paginate_button:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

[data-theme="dark"] .dataTables_paginate .paginate_button.current {
  background-color: var(--accent-primary) !important;
  color: white !important;
  border-color: var(--accent-primary) !important;
}

/* DataTables search panes */
[data-theme="dark"] .dtsp-searchPane {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dtsp-searchPane .dtsp-topRow {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dtsp-searchPane .dtsp-searchCont input {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dtsp-searchPane .dtsp-panes .dtsp-pane {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dtsp-searchPane .dtsp-panes .dtsp-pane:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
}

/* SearchPanes collapse/show buttons */
[data-theme="dark"] .dtsp-collapseAll,
[data-theme="dark"] .dtsp-showAll,
[data-theme="dark"] .dtsp-clearAll {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dtsp-collapseAll:hover,
[data-theme="dark"] .dtsp-showAll:hover,
[data-theme="dark"] .dtsp-clearAll:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
}

/* ===== ADDITIONAL DATATABLES FIXES ===== */
[data-theme="dark"] .dataTables_info {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_length label {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_filter label {
  color: var(--text-primary) !important;
}

/* Table footer inputs */
[data-theme="dark"] tfoot input[type="text"] {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  padding: 5px !important;
}

[data-theme="dark"] tfoot input[type="text"]:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(151, 117, 250, 0.25) !important;
}

/* ===== BOOTSTRAP COMPONENTS ===== */
[data-theme="dark"] .btn {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .btn:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
}

[data-theme="dark"] .btn-primary {
  background-color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: white !important;
}

[data-theme="dark"] .btn-primary:hover {
  background-color: var(--accent-secondary) !important;
  border-color: var(--accent-secondary) !important;
}

/* ===== PAGINATION ===== */
[data-theme="dark"] .pagination .page-link {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .pagination .page-link:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

[data-theme="dark"] .pagination .page-item.active .page-link {
  background-color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: white !important;
}

[data-theme="dark"] .pagination .page-item.disabled .page-link {
  background-color: var(--bg-secondary) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-color) !important;
}

/* ===== PERMISSIONS & BADGES ===== */
[data-theme="dark"] .badge {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .badge-style {
  background-color: var(--accent-primary) !important;
  color: white !important;
  border: 1px solid var(--accent-primary) !important;
}

[data-theme="dark"] .badge.bg-primary {
  background-color: var(--accent-primary) !important;
  color: white !important;
}

[data-theme="dark"] .badge.bg-secondary {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .text-muted {
  color: var(--text-secondary) !important;
}

/* ===== MY FILES TABLE FIXES ===== */
[data-theme="dark"] #sortable {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] #sortable tbody tr[data-level="0"] {
  background-color: var(--bg-card) !important;
}

[data-theme="dark"] #sortable tbody tr[data-level="1"] {
  background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] #sortable tbody tr[data-level="2"] {
  background-color: var(--bg-card) !important;
}

[data-theme="dark"] #sortable tbody tr[data-level="3"] {
  background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] #sortable tbody tr td {
  background-color: inherit !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] #sortable tbody tr td span[style*="color: #007bff"] {
  color: var(--accent-primary) !important;
}

[data-theme="dark"] #sortable tbody tr td span[style*="color: #666"] {
  color: var(--text-secondary) !important;
}

/* ===== SHARED FILES TABLES ===== */
[data-theme="dark"] #myFilesTable,
[data-theme="dark"] #sharedFilesTable {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] #myFilesTable thead,
[data-theme="dark"] #sharedFilesTable thead {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] #myFilesTable tbody tr,
[data-theme="dark"] #sharedFilesTable tbody tr {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] #myFilesTable tbody tr:nth-child(even),
[data-theme="dark"] #sharedFilesTable tbody tr:nth-child(even) {
  background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] #myFilesTable tbody tr td,
[data-theme="dark"] #sharedFilesTable tbody tr td {
  background-color: inherit !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Force white text for permissions */
[data-theme="dark"] #myFilesTable td span,
[data-theme="dark"] #sharedFilesTable td span,
[data-theme="dark"] #myFilesTable td i,
[data-theme="dark"] #sharedFilesTable td i {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .table-responsive {
  background-color: var(--bg-primary) !important;
}

[data-theme="dark"] .dt-scroll {
  background-color: var(--bg-card) !important;
} 

/* ===== DATATABLES DARK MODE STYLES ===== */

/* SearchPanes Containers */
[data-theme="dark"] .dtsp-paneContainer,
[data-theme="dark"] .dtsp-panesContainer {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* SearchPanes Title Row */
[data-theme="dark"] .dtsp-titleRow {
  background-color: var(--bg-card) !important;
  border-bottom: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* SearchPanes Filter Buttons */
[data-theme="dark"] .dtsp-paneInputButton {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dtsp-paneInputButton:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dtsp-paneInputButton.selected {
  background-color: var(--accent-primary) !important;
  color: white !important;
  border-color: var(--accent-primary) !important;
}

/* SearchPanes Search Inputs */
[data-theme="dark"] .dtsp-search input {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dtsp-search input::placeholder {
  color: var(--text-muted) !important;
}

/* SearchPanes Control Buttons */
[data-theme="dark"] .dtsp-clearAll,
[data-theme="dark"] .dtsp-collapseAll {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dtsp-clearAll:hover,
[data-theme="dark"] .dtsp-collapseAll:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* SearchPanes Control Buttons for LIGHT MODE */
.dtsp-clearAll,
.dtsp-collapseAll,
.dtsp-showAll {
  background-color: #f8f9fa !important;
  color: #495057 !important;
  border: 1px solid #dee2e6 !important;
  padding: 6px 12px !important;
  margin: 3px !important;
  border-radius: 4px !important;
  font-size: 0.875rem !important;
  cursor: pointer !important;
}

.dtsp-clearAll:hover,
.dtsp-collapseAll:hover,
.dtsp-showAll:hover {
  background-color: #e9ecef !important;
  color: #495057 !important;
  border-color: #adb5bd !important;
}

.dtsp-clearAll:focus,
.dtsp-collapseAll:focus,
.dtsp-showAll:focus {
  outline: none !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Container for SearchPanes control buttons */
.dtsp-panesContainer .dtsp-title {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  flex-wrap: wrap !important;
}

/* Ensure buttons are properly contained */
.dtsp-titleRow {
  background-color: inherit !important;
  padding: 8px !important;
  border-bottom: 1px solid #dee2e6 !important;
}

[data-theme="dark"] .dtsp-titleRow {
  border-bottom-color: var(--border-color) !important;
}

/* DataTables Export Dropdown Menus */
[data-theme="dark"] .dt-button-collection {
  background-color: #1e1e1e !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 4px 6px var(--shadow) !important;
}

[data-theme="dark"] .dt-button-collection .dt-button {
  background-color: transparent !important;
  color: var(--text-primary) !important;
  border: none !important;
}

[data-theme="dark"] .dt-button-collection .dt-button:hover {
  background-color: #333333 !important;
  color: var(--text-primary) !important;
}

/* DataTables Global Search */
[data-theme="dark"] .dataTables_filter input,
[data-theme="dark"] #sortable_filter input,
[data-theme="dark"] #sortable-owners_filter input {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dataTables_filter label,
[data-theme="dark"] #sortable_filter label,
[data-theme="dark"] #sortable-owners_filter label {
  color: var(--text-primary) !important;
}

/* Additional SearchPanes Components */
[data-theme="dark"] .dtsp-panes2,
[data-theme="dark"] .dtsp-panes3,
[data-theme="dark"] .dtsp-panes4 {
  background-color: var(--bg-secondary) !important;
}

/* DataTables Info and Pagination */
[data-theme="dark"] .dataTables_info {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .dataTables_paginate .paginate_button {
  color: var(--text-primary) !important;
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dataTables_paginate .paginate_button:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_paginate .paginate_button.current {
  background-color: var(--accent-primary) !important;
  color: white !important;
  border-color: var(--accent-primary) !important;
}

/* DataTables Length Select */
[data-theme="dark"] .dataTables_length select {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dataTables_length label {
  color: var(--text-primary) !important;
}

/* DataTables Processing Indicator */
[data-theme="dark"] .dataTables_processing {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

/* DataTables Responsive Details */
[data-theme="dark"] table.dataTable tbody td.child {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* DataTables Button Groups */
[data-theme="dark"] .dt-buttons .dt-button {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .dt-buttons .dt-button:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

/* DataTables Export Button Specific Styling */
[data-theme="dark"] .dt-buttons .dt-button.btn-secondary {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .dt-buttons .dt-button.btn-secondary:hover,
[data-theme="dark"] .dt-buttons .dt-button.btn-secondary:focus,
[data-theme="dark"] .dt-buttons .dt-button.btn-secondary:active {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
  outline: none !important;
}

/* More specific targeting for DataTables export buttons */
[data-theme="dark"] .dt-buttons .buttons-collection.btn.btn-secondary.btn-sm {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .dt-buttons .buttons-collection.btn.btn-secondary.btn-sm:hover,
[data-theme="dark"] .dt-buttons .buttons-collection.btn.btn-secondary.btn-sm:focus,
[data-theme="dark"] .dt-buttons .buttons-collection.btn.btn-secondary.btn-sm:active {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Target the arrow specifically */
[data-theme="dark"] .dt-button-down-arrow {
  color: var(--text-primary) !important;
}

/* ===== DATATABLES SCROLL CONTAINERS ===== */
[data-theme="dark"] .dt-scroll,
[data-theme="dark"] .dt-scroll-head,
[data-theme="dark"] .dt-scroll-body,
[data-theme="dark"] .dt-scroll-foot {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-scroll-headInner,
[data-theme="dark"] .dt-scroll-footInner {
  background-color: var(--bg-card) !important;
}

/* DataTables Name Columns and Pills */
[data-theme="dark"] .dtsp-nameColumn {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dtsp-nameCont {
  background-color: transparent !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dtsp-name {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dtsp-pill {
  background-color: var(--accent-primary) !important;
  color: white !important;
  border-radius: 12px !important;
  padding: 2px 8px !important;
}

/* DataTables Column Headers */
[data-theme="dark"] .dt-column-title {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-column-order {
  color: var(--text-primary) !important;
}

/* DataTables Sizing Helper */
[data-theme="dark"] .dt-scroll-sizing {
  background-color: transparent !important;
  color: var(--text-primary) !important;
}

/* DataTables SearchPanes Table Body and Rows */
[data-theme="dark"] .dt-scroll table.dataTable,
[data-theme="dark"] .dt-scroll-body table.dataTable {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-scroll table.dataTable thead,
[data-theme="dark"] .dt-scroll-body table.dataTable thead {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-scroll table.dataTable tbody,
[data-theme="dark"] .dt-scroll-body table.dataTable tbody {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-scroll table.dataTable tbody tr,
[data-theme="dark"] .dt-scroll-body table.dataTable tbody tr {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dt-scroll table.dataTable tbody tr td,
[data-theme="dark"] .dt-scroll-body table.dataTable tbody tr td {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* DataTables SearchPanes specific table elements */
[data-theme="dark"] #DataTables_Table_0,
[data-theme="dark"] #DataTables_Table_0 thead,
[data-theme="dark"] #DataTables_Table_0 tbody,
[data-theme="dark"] #DataTables_Table_0 tbody tr,
[data-theme="dark"] #DataTables_Table_0 tbody tr td {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* SearchPanes sorting elements */
[data-theme="dark"] .sorting_1 {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* ===== EXPORT BUTTONS - NO BORDERS ===== */
/* Remove all borders from export buttons in both light and dark mode */
.dt-button,
.dt-buttons .dt-button,
.buttons-collection,
.buttons-excel,
.buttons-csv,
.buttons-pdf,
.buttons-print,
.buttons-copy,
.dt-button.buttons-collection.btn.btn-secondary.btn-sm,
.buttons-collection.btn.btn-secondary.btn-sm,
button.dt-button.buttons-collection.btn.btn-secondary.btn-sm {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

.dt-button:hover,
.dt-buttons .dt-button:hover,
.buttons-collection:hover,
.buttons-excel:hover,
.buttons-csv:hover,
.buttons-pdf:hover,
.buttons-print:hover,
.buttons-copy:hover,
.dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
.buttons-collection.btn.btn-secondary.btn-sm:hover,
button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

.dt-button:focus,
.dt-buttons .dt-button:focus,
.buttons-collection:focus,
.buttons-excel:focus,
.buttons-csv:focus,
.buttons-pdf:focus,
.buttons-print:focus,
.buttons-copy:focus,
.dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
.buttons-collection.btn.btn-secondary.btn-sm:focus,
button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

.dt-button:active,
.dt-buttons .dt-button:active,
.buttons-collection:active,
.buttons-excel:active,
.buttons-csv:active,
.buttons-pdf:active,
.buttons-print:active,
.buttons-copy:active,
.dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
.buttons-collection.btn.btn-secondary.btn-sm:active,
button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:active {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

/* Additional aggressive targeting for Bootstrap buttons */
.btn,
.btn-secondary,
.btn-sm,
.btn.btn-secondary,
.btn.btn-sm,
.btn.btn-secondary.btn-sm {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

.btn:hover,
.btn-secondary:hover,
.btn-sm:hover,
.btn.btn-secondary:hover,
.btn.btn-sm:hover,
.btn.btn-secondary.btn-sm:hover,
.btn:focus,
.btn-secondary:focus,
.btn-sm:focus,
.btn.btn-secondary:focus,
.btn.btn-sm:focus,
.btn.btn-secondary.btn-sm:focus,
.btn:active,
.btn-secondary:active,
.btn-sm:active,
.btn.btn-secondary:active,
.btn.btn-sm:active,
.btn.btn-secondary.btn-sm:active {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

/* DARK MODE - AGGRESSIVE BORDER REMOVAL */
[data-theme="dark"] .btn,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-sm,
[data-theme="dark"] .btn.btn-secondary,
[data-theme="dark"] .btn.btn-sm,
[data-theme="dark"] .btn.btn-secondary.btn-sm,
[data-theme="dark"] .dt-button,
[data-theme="dark"] .dt-buttons .dt-button,
[data-theme="dark"] .buttons-collection,
[data-theme="dark"] .buttons-excel,
[data-theme="dark"] .buttons-csv,
[data-theme="dark"] .buttons-pdf,
[data-theme="dark"] .buttons-print,
[data-theme="dark"] .buttons-copy,
[data-theme="dark"] .dt-button.buttons-collection.btn.btn-secondary.btn-sm,
[data-theme="dark"] .buttons-collection.btn.btn-secondary.btn-sm,
[data-theme="dark"] button.dt-button.buttons-collection.btn.btn-secondary.btn-sm {
  border: none !important;
  border-color: transparent !important;
  border-width: 0 !important;
  border-style: none !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

[data-theme="dark"] .btn:hover,
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-sm:hover,
[data-theme="dark"] .btn.btn-secondary:hover,
[data-theme="dark"] .btn.btn-sm:hover,
[data-theme="dark"] .btn.btn-secondary.btn-sm:hover,
[data-theme="dark"] .dt-button:hover,
[data-theme="dark"] .dt-buttons .dt-button:hover,
[data-theme="dark"] .buttons-collection:hover,
[data-theme="dark"] .buttons-excel:hover,
[data-theme="dark"] .buttons-csv:hover,
[data-theme="dark"] .buttons-pdf:hover,
[data-theme="dark"] .buttons-print:hover,
[data-theme="dark"] .buttons-copy:hover,
[data-theme="dark"] .dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
[data-theme="dark"] .buttons-collection.btn.btn-secondary.btn-sm:hover,
[data-theme="dark"] button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover {
  border: none !important;
  border-color: transparent !important;
  border-width: 0 !important;
  border-style: none !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

[data-theme="dark"] .btn:focus,
[data-theme="dark"] .btn-secondary:focus,
[data-theme="dark"] .btn-sm:focus,
[data-theme="dark"] .btn.btn-secondary:focus,
[data-theme="dark"] .btn.btn-sm:focus,
[data-theme="dark"] .btn.btn-secondary.btn-sm:focus,
[data-theme="dark"] .dt-button:focus,
[data-theme="dark"] .dt-buttons .dt-button:focus,
[data-theme="dark"] .buttons-collection:focus,
[data-theme="dark"] .buttons-excel:focus,
[data-theme="dark"] .buttons-csv:focus,
[data-theme="dark"] .buttons-pdf:focus,
[data-theme="dark"] .buttons-print:focus,
[data-theme="dark"] .buttons-copy:focus,
[data-theme="dark"] .dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
[data-theme="dark"] .buttons-collection.btn.btn-secondary.btn-sm:focus,
[data-theme="dark"] button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus {
  border: none !important;
  border-color: transparent !important;
  border-width: 0 !important;
  border-style: none !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

[data-theme="dark"] .btn:active,
[data-theme="dark"] .btn-secondary:active,
[data-theme="dark"] .btn-sm:active,
[data-theme="dark"] .btn.btn-secondary:active,
[data-theme="dark"] .btn.btn-sm:active,
[data-theme="dark"] .btn.btn-secondary.btn-sm:active,
[data-theme="dark"] .dt-button:active,
[data-theme="dark"] .dt-buttons .dt-button:active,
[data-theme="dark"] .buttons-collection:active,
[data-theme="dark"] .buttons-excel:active,
[data-theme="dark"] .buttons-csv:active,
[data-theme="dark"] .buttons-pdf:active,
[data-theme="dark"] .buttons-print:active,
[data-theme="dark"] .buttons-copy:active,
[data-theme="dark"] .dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
[data-theme="dark"] .buttons-collection.btn.btn-secondary.btn-sm:active,
[data-theme="dark"] button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:active {
  border: none !important;
  border-color: transparent !important;
  border-width: 0 !important;
  border-style: none !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

/* ULTRA AGGRESSIVE BORDER REMOVAL - MAXIMUM SPECIFICITY */
html[data-theme="dark"] body .dataTables_wrapper .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm,
html[data-theme="dark"] body .dataTables_wrapper .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm,
html[data-theme="dark"] body .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm,
html[data-theme="dark"] body .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm,
html[data-theme="dark"] body button.dt-button.buttons-collection.btn.btn-secondary.btn-sm,
html[data-theme="dark"] body .dt-button.buttons-collection.btn.btn-secondary.btn-sm {
  border: 0px solid transparent !important;
  border-top: 0px solid transparent !important;
  border-right: 0px solid transparent !important;
  border-bottom: 0px solid transparent !important;
  border-left: 0px solid transparent !important;
  border-width: 0px !important;
  border-style: none !important;
  border-color: transparent !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  outline: 0px !important;
  outline-width: 0px !important;
  outline-style: none !important;
  outline-color: transparent !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  -webkit-border-radius: 4px !important;
  -moz-border-radius: 4px !important;
}

/* FINAL NUCLEAR OPTION - TARGET SPECIFIC BUTTON */
button[aria-controls="myFilesTable"].dt-button.buttons-collection.btn.btn-secondary.btn-sm,
button[aria-controls].dt-button.buttons-collection.btn.btn-secondary.btn-sm,
[tabindex="0"].dt-button.buttons-collection.btn.btn-secondary.btn-sm,
[type="button"].dt-button.buttons-collection.btn.btn-secondary.btn-sm,
[aria-haspopup="dialog"].dt-button.buttons-collection.btn.btn-secondary.btn-sm {
  border: 0px solid rgba(0,0,0,0) !important;
  border-width: 0px !important;
  border-style: none !important;
  border-color: rgba(0,0,0,0) !important;
  border-top: 0px !important;
  border-right: 0px !important;
  border-bottom: 0px !important;
  border-left: 0px !important;
  box-shadow: 0 0 0 0 rgba(0,0,0,0) !important;
  outline: 0px solid rgba(0,0,0,0) !important;
  outline-width: 0px !important;
  outline-style: none !important;
  outline-color: rgba(0,0,0,0) !important;
  -webkit-box-shadow: 0 0 0 0 rgba(0,0,0,0) !important;
  -moz-box-shadow: 0 0 0 0 rgba(0,0,0,0) !important;
}

button[aria-controls="myFilesTable"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
button[aria-controls="myFilesTable"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
button[aria-controls="myFilesTable"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
button[aria-controls="myFilesTable"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:visited,
button[aria-controls].dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
button[aria-controls].dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
button[aria-controls].dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
button[aria-controls].dt-button.buttons-collection.btn.btn-secondary.btn-sm:visited,
[tabindex="0"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
[tabindex="0"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
[tabindex="0"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
[type="button"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
[type="button"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
[type="button"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
[aria-haspopup="dialog"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
[aria-haspopup="dialog"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
[aria-haspopup="dialog"].dt-button.buttons-collection.btn.btn-secondary.btn-sm:active {
  border: 0px solid rgba(0,0,0,0) !important;
  border-width: 0px !important;
  border-style: none !important;
  border-color: rgba(0,0,0,0) !important;
  border-top: 0px !important;
  border-right: 0px !important;
  border-bottom: 0px !important;
  border-left: 0px !important;
  box-shadow: 0 0 0 0 rgba(0,0,0,0) !important;
  outline: 0px solid rgba(0,0,0,0) !important;
  outline-width: 0px !important;
  outline-style: none !important;
  outline-color: rgba(0,0,0,0) !important;
  -webkit-box-shadow: 0 0 0 0 rgba(0,0,0,0) !important;
  -moz-box-shadow: 0 0 0 0 rgba(0,0,0,0) !important;
}

html[data-theme="dark"] body .dataTables_wrapper .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
html[data-theme="dark"] body .dataTables_wrapper .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
html[data-theme="dark"] body .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
html[data-theme="dark"] body .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
html[data-theme="dark"] body button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover,
html[data-theme="dark"] body .dt-button.buttons-collection.btn.btn-secondary.btn-sm:hover {
  border: 0px solid transparent !important;
  border-top: 0px solid transparent !important;
  border-right: 0px solid transparent !important;
  border-bottom: 0px solid transparent !important;
  border-left: 0px solid transparent !important;
  border-width: 0px !important;
  border-style: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: 0px !important;
  outline-width: 0px !important;
  outline-style: none !important;
  outline-color: transparent !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

html[data-theme="dark"] body .dataTables_wrapper .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
html[data-theme="dark"] body .dataTables_wrapper .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
html[data-theme="dark"] body .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
html[data-theme="dark"] body .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
html[data-theme="dark"] body button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus,
html[data-theme="dark"] body .dt-button.buttons-collection.btn.btn-secondary.btn-sm:focus {
  border: 0px solid transparent !important;
  border-top: 0px solid transparent !important;
  border-right: 0px solid transparent !important;
  border-bottom: 0px solid transparent !important;
  border-left: 0px solid transparent !important;
  border-width: 0px !important;
  border-style: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: 0px !important;
  outline-width: 0px !important;
  outline-style: none !important;
  outline-color: transparent !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}

html[data-theme="dark"] body .dataTables_wrapper .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
html[data-theme="dark"] body .dataTables_wrapper .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
html[data-theme="dark"] body .dt-buttons button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
html[data-theme="dark"] body .dt-buttons .dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
html[data-theme="dark"] body button.dt-button.buttons-collection.btn.btn-secondary.btn-sm:active,
html[data-theme="dark"] body .dt-button.buttons-collection.btn.btn-secondary.btn-sm:active {
  border: 0px solid transparent !important;
  border-top: 0px solid transparent !important;
  border-right: 0px solid transparent !important;
  border-bottom: 0px solid transparent !important;
  border-left: 0px solid transparent !important;
  border-width: 0px !important;
  border-style: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: 0px !important;
  outline-width: 0px !important;
  outline-style: none !important;
  outline-color: transparent !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
}
