/* ===================================================================
   DATATABLE STYLING
   =================================================================== */

/* -------------------------------------------------------------------
   DataTables Wrapper & Controls
   ------------------------------------------------------------------- */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: var(--primary-dark);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid var(--primary-light);
  background: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  color: white !important;
  background: var(--primary-light) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  color: white !important;
  background: var(--light-gray) !important;
}

/* -------------------------------------------------------------------
   Table Rows & Cells
   ------------------------------------------------------------------- */
table.dataTable tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}

table.dataTable tbody tr {
  height: auto;
}

/* -------------------------------------------------------------------
   Table Headers
   ------------------------------------------------------------------- */
table.dataTable thead th {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.3;
  vertical-align: middle;
  padding-top: 8px;
  padding-bottom: 8px;
  text-align: center;
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

table.dataTable thead tr {
  height: auto !important;
}

.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
  width: 100% !important;
  table-layout: fixed;
}

/* -------------------------------------------------------------------
   Scrollable Tables
   ------------------------------------------------------------------- */
.scrollable-table {
  margin-top: 10px;
}

.dataTables_scrollBody {
  border-bottom: 1px solid var(--border-light);
}

.scrollable-query-result {
  margin-top: 15px;
  line-height: 1.3;
}

/* -------------------------------------------------------------------
   Fixed Filter Panels for Tables
   ------------------------------------------------------------------- */
.fixed-filter {
  position: sticky;
  top: 65px;
  z-index: 100;
  background-color: var(--light-gray);
}

.fixed-filter .box {
  margin-bottom: 10px;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.fixed-filter-box {
  position: sticky;
  top: 70px;
  z-index: 1050;
  background-color: var(--light-gray);
  transition: box-shadow 0.3s ease;
}

.fixed-filter-box .box {
  margin-bottom: 10px !important;
  box-shadow: 0 2px 8px var(--shadow-color);
  border-radius: 8px;
  background-color: #ffffff;
}

body.scrolled .fixed-filter-box .box {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* -------------------------------------------------------------------
   Tables Within Tab Content
   ------------------------------------------------------------------- */
.tab-content .box .dataTables_wrapper {
  margin-top: 10px;
  margin-bottom: 10px;
}

.tab-content .box .dataTables_wrapper .dataTables_scrollBody {
  overflow-y: auto !important;
  max-height: 600px !important;
  border-bottom: 1px solid var(--border-light);
}

.tab-content .box table.dataTable thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 10;
  background-color: #ffffff !important;
  border-bottom: 2px solid var(--border-light);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
