/* ===============================================================
   Lumen DataTable
   =============================================================== */

/* Standalone DataTable = self-contained card (matches the prior
   `.section` chrome). When the table lives inside a Section with
   `bodyClassName="section-body--flush"`, the parent Section already
   provides the card and we drop our own border/radius. */
.dt-wrap {
  display: block;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}
.dt-wrap--flush {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

/* ----- Toolbar -------------------------------------------------- */
.dt-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-panel);
  min-height: 44px;
  box-sizing: border-box;
}
.dt-wrap--flush .dt-toolbar { padding-left: 20px; padding-right: 20px; }

.dt-toolbar-left,
.dt-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-toolbar-hint { font-size: 12px; color: var(--text-tertiary); }

/* Floating-popover anchor */
.dt-toolbar-anchor { position: relative; display: inline-flex; }

/* Active-filter chip */
.dt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 8px 0 10px; border-radius: 13px;
  background: var(--sol-primary-50);
  color: var(--sol-primary-700);
  border: 1px solid var(--sol-primary-100);
  font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.dt-chip:hover { background: var(--sol-primary-100); }
.dt-chip-x { font-size: 10px; opacity: 0.7; }

/* Toolbar buttons use the global Btn primitive (variant="ghost"); we only
   tweak inline spacing here. */
.dt-toolbar-btn { padding: 6px 10px; font-size: 12.5px; }
.dt-dirty { color: var(--sol-primary-500); font-weight: 700; }
.dt-badge-count {
  display: inline-flex; align-items: center; height: 16px;
  padding: 0 5px; border-radius: 8px;
  background: var(--surface-subtle); color: var(--text-secondary);
  font-size: 10.5px; font-weight: 600;
}

/* ----- Table ---------------------------------------------------- */
.dt-table { width: 100%; border-collapse: collapse; font-size: 13px; }

/* Override the global .data-table th uppercase rule.
   Padding moves onto the inner trigger so the whole cell is clickable. */
.dt-table th.dt-th {
  position: relative;
  text-align: start;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
  text-transform: none;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  vertical-align: middle;
}
.dt-table th.dt-th--end { text-align: end; }
.dt-table th.dt-th--sorted,
.dt-table th.dt-th--open { color: var(--text-primary); }

/* Whole-cell click trigger */
.dt-th-trigger {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 9px 14px;
  background: transparent; border: none; cursor: pointer;
  font: inherit; color: inherit;
  letter-spacing: inherit; text-transform: inherit;
  text-align: start;
}
.dt-th--end .dt-th-trigger { justify-content: flex-end; text-align: end; }
.dt-th-trigger:hover,
.dt-th--open .dt-th-trigger { background: var(--surface-muted); }
.dt-th-trigger:focus-visible { outline: 2px solid var(--sol-primary-200); outline-offset: -2px; }

.dt-th-label-text { font: inherit; font-weight: 600; }
.dt-th-filter-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--sol-primary-500);
  flex-shrink: 0;
}
.dt-th-chevron {
  color: var(--text-tertiary);
  margin-inline-start: auto;
  opacity: 0.45;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.dt-th-trigger:hover .dt-th-chevron,
.dt-th--open .dt-th-chevron { opacity: 1; }
/* When the column is sorted, the chevron itself shows the direction (chevronU
   or chevronD) and colored blue — no separate sort indicator, no rotation. */
.dt-th-chevron--sorted { opacity: 1; color: var(--sol-primary-500); }
.dt-th--open .dt-th-chevron:not(.dt-th-chevron--sorted) { transform: rotate(180deg); }

.dt-th-static {
  display: inline-block;
  padding: 9px 14px;
  font: inherit; color: inherit;
  letter-spacing: inherit; text-transform: inherit;
}

.dt-table td.dt-td { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.dt-table td.dt-td--end { text-align: end; }
.dt-table tr:last-child td { border-bottom: none; }
.dt-table tbody tr:hover td { background: var(--surface-subtle); }

.dt-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 32px 16px !important;
  font-size: 13px;
}

.dt-dismiss-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: transparent;
}

/* ----- Popovers (match .bulk-pg-menu visual language) ----------- */
.dt-popover {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 240px;
  z-index: 100;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  font-size: 13px;
  color: var(--text-primary);
}
.dt-popover--end { inset-inline-start: auto; inset-inline-end: 0; }
.dt-popover--columns  { min-width: 220px; }
.dt-popover--views    { min-width: 260px; }
.dt-popover--col-menu { min-width: 240px; }

.dt-popover-head {
  padding: 10px 12px 6px;
}
.dt-popover-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  text-transform: none; letter-spacing: 0;
}

.dt-popover-body { padding: 2px; max-height: 280px; overflow-y: auto; }
.dt-popover-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 6px;
  padding: 6px 6px 4px;
  margin-top: 2px;
}
.dt-popover-foot--stack { flex-direction: column; align-items: stretch; gap: 4px; padding: 4px; }

/* ----- Menu items (sort / clear / hide actions inside col menu) - */
.dt-menu-group { display: flex; flex-direction: column; padding: 0 2px; }
.dt-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 13px;
  color: var(--text-primary); text-align: start;
}
.dt-menu-item:hover { background: var(--surface-subtle); }
.dt-menu-item--active { color: var(--sol-primary-500); }
.dt-menu-item-check { margin-inline-start: auto; color: var(--sol-primary-500); }
.dt-menu-divider {
  height: 1px; background: var(--border-subtle);
  margin: 4px 6px;
}
.dt-menu-section-title {
  padding: 8px 10px 4px;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ----- Filter editors ------------------------------------------- */
.dt-filter-body {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.dt-filter-body--enum { padding: 4px; max-height: 220px; overflow-y: auto; }
.dt-filter-row { display: flex; align-items: center; gap: 6px; }
.dt-filter-row--pair {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px;
  align-items: center;
}
.dt-filter-sep { color: var(--text-tertiary); font-size: 12px; }
.dt-filter-empty {
  color: var(--text-tertiary); font-size: 12px;
  padding: 12px 8px; text-align: center;
}

.dt-input {
  width: 100%; height: 30px; padding: 0 8px; box-sizing: border-box;
  border: 1px solid var(--border-subtle); border-radius: 6px;
  background: var(--surface-panel);
  color: var(--text-primary);
  font: inherit; font-size: 12.5px;
}
.dt-input:focus {
  outline: 2px solid var(--sol-primary-200);
  outline-offset: -1px;
  border-color: var(--sol-primary-400);
}

.dt-filter-check,
.dt-col-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13px;
  user-select: none;
}
.dt-filter-check:hover,
.dt-col-toggle:hover { background: var(--surface-subtle); }
.dt-filter-check input,
.dt-col-toggle input { margin: 0; }

/* ----- Views menu ----------------------------------------------- */
.dt-view-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0; border-radius: 6px;
}
.dt-view-row:hover { background: var(--surface-subtle); }
.dt-view-row--active { background: var(--sol-primary-50); }
.dt-view-row--single {
  background: transparent; border: none; padding: 8px 10px;
  text-align: start; font: inherit; cursor: pointer; color: inherit;
  width: 100%; border-radius: 6px;
}
.dt-view-row--single:hover { background: var(--surface-subtle); }
.dt-view-row--single.dt-view-row--active { background: var(--sol-primary-50); }
.dt-view-name {
  flex: 1; text-align: start;
  background: transparent; border: none; padding: 8px 10px;
  font: inherit; cursor: pointer; color: inherit;
}
.dt-view-del {
  background: transparent; border: none;
  padding: 4px 8px; cursor: pointer;
  color: var(--text-tertiary); font-size: 11px; border-radius: 4px;
}
.dt-view-del:hover { color: var(--sol-error); background: var(--surface-subtle); }
.dt-view-name-form { display: flex; gap: 6px; align-items: center; width: 100%; padding: 2px; }

/* ----- Dark mode ------------------------------------------------ */
[data-theme="dark"] .dt-chip {
  background: rgba(82, 152, 219, 0.18);
  color: var(--sol-primary-200);
  border-color: rgba(82, 152, 219, 0.30);
}
[data-theme="dark"] .dt-chip:hover { background: rgba(82, 152, 219, 0.28); }
[data-theme="dark"] .dt-view-row--active,
[data-theme="dark"] .dt-view-row--single.dt-view-row--active {
  background: rgba(82, 152, 219, 0.15);
}

