/* ========================================================================== 
   FILE: __core/coreCss/components.tables.css
   PURPOSE: Dense table standard for listings.
   SCOPE: Generated lists and table-like views.
   DEPENDS: tokens.css, base.css.
   NOTES: Keeps data density near 12-13px with better hierarchy.
   ========================================================================== */

/* [TABLES] Dense table baseline */
.dd-table,
.core_DDKV26listadodatahead {
  font-size: var(--fs-data);
  line-height: var(--lh-data);
  color: var(--text);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: 100%;
}

.core_DDKV26listadodatahead:not(.dd-grid-view) {
  table-layout: auto;
}

.dd-list-wrapper,
.dd-list-wrapper .dt-layout-row,
.dd-list-wrapper .dt-layout-cell,
.dd-list-wrapper .dt-layout-table,
.dd-list-wrapper .dt-layout-full,
.dd-list-wrapper .dt-scroll,
.dd-list-wrapper .dt-scroll-head,
.dd-list-wrapper .dt-scroll-headInner,
.dd-list-wrapper .dt-scroll-body {
  width: 100% !important;
  max-width: 100% !important;
}

.dd-list-wrapper .dt-layout-table {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.core_DDKV26listadodatahead:not(.dd-grid-view) th,
.core_DDKV26listadodatahead:not(.dd-grid-view) td,
.core_DDKV26listadodatahead:not(.dd-grid-view) .dataenlista,
.core_DDKV26listadodatahead:not(.dd-grid-view) .core_titulolistado {
  min-width: var(--dd-col-min-w, 60px); /* floor anti-collapse; override per surface si es necesario */
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

/* Special renderers carry multiple labels, hierarchy paths, badges, or a status.
   Keep their list columns readable; narrow viewports scroll inside DataTables. */
.core_DDKV26listadodatahead:not(.dd-grid-view) td.dd-cell-special {
  min-width: 9rem;
}

/* Columna de checkbox no hereda el floor — tiene ancho fijo propio */
.core_DDKV26listadodatahead:not(.dd-grid-view) th.dd-col-check,
.core_DDKV26listadodatahead:not(.dd-grid-view) td.dd-col-check {
  min-width: 40px;
  max-width: 40px;
}

.core_DDKV26listadodatahead:not(.dd-grid-view) img,
.core_DDKV26listadodatahead:not(.dd-grid-view) svg {
  max-width: 100%;
}

.dd-table td,
.dd-table th,
.core_DDKV26listadodatahead > :not(caption) > * > *,
.dataenlista,
.core_titulolistado {
  padding: 8px var(--sp-2);
  border-color: var(--divider);
  border-right: none;
  border-left: none;
}

.dd-selectall-add-btn {
  min-width: 4rem;
  min-height: 2rem;
  padding: 0.3rem 0.5rem;
}

/* [TABLES] Header: surface con acento de marca arriba */
.core_titulolistado,
.dd-table thead th {
  background: var(--surface-3);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}

/* Linea de acento de marca en el top del thead */
.core_DDKV26listadodatahead thead tr:first-child .core_titulolistado {
  box-shadow: inset 0 2px 0 var(--primary);
}

/* [TABLES] Prevent DataTables row-border class from stacking a second border
   on the <tr> element — the <th> already has border-bottom, stacking causes
   visual double-line in dark mode where border contrast is higher. */
.core_DDKV26listadodatahead.row-border thead > tr,
.core_DDKV26listadodatahead.row-border tfoot > tr {
  border-bottom: none !important;
}

/* [TABLES] Indicador de seleccion lateral con barra azul */
.core_DDKV26listadodatahead tbody > tr.datagrid-row-selected > td.dataenlista,
.core_DDKV26listadodatahead tbody > tr.datagrid-row-selected-dark > td.dataenlista {
  background: var(--listing-row-selected) !important;
  color: var(--listing-row-selected-text) !important;
  box-shadow: inset 3px 0 0 var(--primary) !important;
}

/* [TABLES] Drag handle — color via token */
.dd-drag-handle path {
  fill: var(--text-muted);
}

.dataTables_info {
  font-size: 0.9rem !important;
  color: var(--info) !important;
}

.dd-table tbody tr:hover {
  background: var(--listing-row-hover);
}

/* SpecialTemplater content inside DDK list cells uses shared theme tokens. */
.dd-special-lines {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
  line-height: 1.35;
  vertical-align: middle;
}
.dd-special-lines__primary { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.dd-special-lines__secondary { color: var(--text-muted); font-size: 0.6875rem; overflow-wrap: anywhere; }
.dd-special-hierarchy {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
  font-size: 0.6875rem;
  line-height: 1.5;
}
.dd-special-hierarchy__separator { margin-inline: 2px; color: var(--text-muted); }
.dd-special-hierarchy__item { color: var(--text-muted); overflow-wrap: anywhere; }
.dd-special-hierarchy__item.is-current { color: var(--text); font-weight: 600; }
.dd-special-badge-list { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 3px; max-width: 100%; }
.dd-special-badge-list__item {
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.dd-special-badge-list__empty { color: var(--text-muted); font-size: 0.6875rem; }
.dd-special-badge-info {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--dd-special-badge-color, var(--text-muted)) 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--dd-special-badge-color, var(--text-muted)) 10%, var(--surface-1));
  color: var(--dd-special-badge-color, var(--text-muted));
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* [NUVEX] Timeline/detail cells used by radicacion bitacora listings */
.nuvex-timeline-summary {
  color: var(--text);
  line-height: 1.35;
}

.nuvex-timeline-detail-row {
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 2px;
}

.nuvex-timeline-detail-row strong {
  color: var(--text);
  font-weight: 700;
}

.nuvex-timeline-detail-row span {
  color: var(--text-muted);
}

.nuvex-timeline-empty {
  color: var(--text-muted);
}

/* [TABLES] Listing model independent from Bootstrap .table defaults */
.core_DDKV26listadodatahead.dataTable tbody > tr > td,
.core_DDKV26listadodatahead tbody > tr > td {
  transition: background-color 120ms ease;
}

.core_DDKV26listadodatahead.dataTable tbody > tr > td.dataenlista,
.core_DDKV26listadodatahead tbody > tr > td.dataenlista {
  background: var(--listing-row-even) !important;
  color: var(--text) !important;
}

.core_DDKV26listadodatahead.dataTable.stripe tbody > tr:nth-child(odd) > td.dataenlista,
.core_DDKV26listadodatahead.stripe tbody > tr:nth-child(odd) > td.dataenlista {
  background: var(--listing-row-odd) !important;
}

.core_DDKV26listadodatahead.dataTable.order-column tbody > tr > .sorting_1,
.core_DDKV26listadodatahead.dataTable.order-column tbody > tr > .sorting_2,
.core_DDKV26listadodatahead.dataTable.order-column tbody > tr > .sorting_3 {
  background: transparent !important;
  box-shadow: none !important;
}

/* [TABLES] Uniformar indicador de ordenamiento del header en DataTables */
.core_DDKV26listadodatahead.dataTable thead th,
.core_DDKV26listadodatahead.dataTable thead td {
  position: relative;
}

.core_DDKV26listadodatahead.dataTable thead th .dt-column-header,
.core_DDKV26listadodatahead.dataTable thead td .dt-column-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
}

.core_DDKV26listadodatahead.dataTable thead th .dt-column-title,
.core_DDKV26listadodatahead.dataTable thead td .dt-column-title {
  order: 1;
}

.core_DDKV26listadodatahead.dataTable thead th .dt-column-order,
.core_DDKV26listadodatahead.dataTable thead td .dt-column-order {
  order: 2;
  margin-left: 0.1rem;
  flex: 0 0 auto;
  right: auto !important;
  left: auto !important;
}

.core_DDKV26listadodatahead.dataTable thead .sorting,
.core_DDKV26listadodatahead.dataTable thead .sorting_asc,
.core_DDKV26listadodatahead.dataTable thead .sorting_desc,
.core_DDKV26listadodatahead.dataTable thead .sorting_disabled {
  background-position: right 0.55rem center !important;
  padding-right: 1.8rem !important;
}

.core_DDKV26listadodatahead.dataTable.hover tbody > tr:not(.datagrid-row-selected):not(.datagrid-row-selected-dark):hover > td.dataenlista,
.core_DDKV26listadodatahead.hover tbody > tr:not(.datagrid-row-selected):not(.datagrid-row-selected-dark):hover > td.dataenlista,
.core_DDKV26listadodatahead tbody > tr:not(.datagrid-row-selected):not(.datagrid-row-selected-dark):hover > td.dataenlista {
  background: var(--listing-row-hover) !important;
  box-shadow: inset 0 0 0 9999px var(--listing-row-hover) !important;
}

/* [TABLES] Keep selected-row colors visible even with DataTables stripe classes */
.core_DDKV26listadodatahead.dataTable tbody > tr.datagrid-row-selected > td,
.core_DDKV26listadodatahead.dataTable tbody > tr.datagrid-row-selected-dark > td,
.core_DDKV26listadodatahead tbody > tr.datagrid-row-selected > td,
.core_DDKV26listadodatahead tbody > tr.datagrid-row-selected-dark > td,
.core_DDKV26listadodatahead tbody > tr.datagrid-row-selected > td.dataenlista,
.core_DDKV26listadodatahead tbody > tr.datagrid-row-selected-dark > td.dataenlista {
  background: var(--listing-row-selected) !important;
  color: var(--listing-row-selected-text) !important;
  box-shadow: inset 0 0 0 9999px var(--listing-row-selected) !important;
}

.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected:hover > td,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark:hover > td,
.core_DDKV26listadodatahead.hover tbody > tr.datagrid-row-selected:hover > td,
.core_DDKV26listadodatahead.hover tbody > tr.datagrid-row-selected-dark:hover > td,
.core_DDKV26listadodatahead.hover tbody > tr.datagrid-row-selected:hover > td.dataenlista,
.core_DDKV26listadodatahead.hover tbody > tr.datagrid-row-selected-dark:hover > td.dataenlista {
  background: var(--listing-row-selected) !important;
  color: var(--listing-row-selected-text) !important;
  box-shadow: inset 0 0 0 9999px var(--listing-row-selected) !important;
}

.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected > .sorting_1,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected > .sorting_2,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected > .sorting_3,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark > .sorting_1,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark > .sorting_2,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark > .sorting_3,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected:hover > .sorting_1,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected:hover > .sorting_2,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected:hover > .sorting_3,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark:hover > .sorting_1,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark:hover > .sorting_2,
.core_DDKV26listadodatahead.dataTable.hover tbody > tr.datagrid-row-selected-dark:hover > .sorting_3 {
  background: var(--listing-row-selected) !important;
  color: var(--listing-row-selected-text) !important;
  box-shadow: inset 0 0 0 9999px var(--listing-row-selected) !important;
}

/* Read-only queue states: visible labels, theme-aware outlined chips. */
.dd-queue-status {
  display: inline-flex;
  max-width: 100%;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--queue-state-color, var(--text-muted));
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
.dd-queue-status--pending { --queue-state-color: var(--text-muted); }
.dd-queue-status--running { --queue-state-color: var(--info); }
.dd-queue-status--ingested { --queue-state-color: #8956c7; }
.dd-queue-status--review { --queue-state-color: var(--warning); }
.dd-queue-status--paused { --queue-state-color: #ad6f51; }
.dd-queue-status--failed { --queue-state-color: var(--danger); }
.dd-queue-status--complete { --queue-state-color: var(--success); }

/* [TABLES] Reparto chips */
.dd-reparto-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-1));
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.dd-reparto-chip--state {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-1));
}

/* Opt-in DDK navigation/content state for views without grid columns. */
.ddk-grid-empty-state {
  box-sizing: border-box;
  display: grid;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 0.75rem);
  background: var(--surface-1);
  color: var(--text);
}

.ddk-grid-empty-state__title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ddk-grid-empty-state__message {
  max-width: 70ch;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
