/* ================================================================
   Xeus POS v3.7.3.151 - DataTables · estándar global / alto volumen
   ================================================================ */

/*
 * Mientras una vista AJAX se inserta o DataTables prepara la tabla, ocultamos
 * el HTML sin paginar. Así el usuario nunca ve 300/1.000/10.000 filas y luego
 * el salto visual a 5 registros.
 */
#app-content.xeus-dt-preinit .table-responsive:has(table.table:not(.no-datatable):not(.xeus-server-table)),
#app-content.xeus-dt-preinit .xeus-dt-shell {
  min-height: 180px;
  position: relative;
  overflow: hidden;
}

#app-content.xeus-dt-preinit table.table:not(.no-datatable):not(.xeus-server-table) {
  visibility: hidden !important;
}

#app-content.xeus-dt-preinit .table-responsive:has(table.table:not(.no-datatable):not(.xeus-server-table))::after,
.xeus-dt-shell.xeus-dt-loading::after {
  content: "Preparando datos...";
  position: absolute;
  inset: 0;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .94);
  color: #6b7280;
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .01em;
  z-index: 4;
}

.xeus-dt-shell {
  min-height: 170px;
  position: relative;
}

.xeus-dt-shell.xeus-dt-ready {
  min-height: 0;
}

.xeus-dt-shell.xeus-dt-ready::after {
  display: none;
}

/* Procesando búsquedas/cambios de página sin reflujo brusco. */
.dataTables_wrapper .dataTables_processing,
.dt-container .dt-processing {
  border: 0 !important;
  box-shadow: 0 10px 30px rgba(17, 24, 39, .12);
  border-radius: .75rem;
  background: rgba(255,255,255,.96) !important;
  min-width: 190px;
  padding: .8rem 1rem !important;
}

.xeus-dt-processing {
  display: inline-flex;
  gap: .55rem;
  align-items: center;
  color: #4b5563;
}

/* Evita que la tabla cambie de altura de forma agresiva al paginar. */
.dataTables_wrapper,
.dt-container {
  min-height: 190px;
}

.dataTables_wrapper table.dataTable,
.dt-container table.dataTable {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* El buscador espera unos milisegundos antes de consultar al servidor. */
.dataTables_filter input,
.dt-search input {
  min-width: 170px;
}

/* Controles compactos y estables. */
.dataTables_wrapper .row,
.dt-container .row {
  margin-left: 0;
  margin-right: 0;
}


/* v3.7.3.150 · Estado vacío estable.
 * La tabla conserva todos los controles DataTables, pero cuando el servidor
 * confirma 0 registros no debe quedar ningún spinner/overlay activo. */
.xeus-dt-shell.xeus-dt-empty::after,
.xeus-dt-empty .dataTables_processing,
.xeus-dt-empty .dt-processing,
.dataTables_wrapper.xeus-dt-empty .dataTables_processing,
.dt-container.xeus-dt-empty .dt-processing {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.xeus-dt-shell.xeus-dt-empty {
  min-height: 0;
}

.xeus-dt-empty.dataTables_wrapper,
.xeus-dt-empty.dt-container,
.xeus-dt-shell.xeus-dt-empty .dataTables_wrapper,
.xeus-dt-shell.xeus-dt-empty .dt-container {
  min-height: 0;
}

.xeus-dt-empty td.dataTables_empty,
.xeus-dt-empty td.dt-empty {
  padding: 1.15rem 1rem !important;
  text-align: center !important;
  color: #667085 !important;
  font-size: .84rem;
  background: #fff;
}

@media (max-width: 767.98px) {
  .dataTables_wrapper,
  .dt-container {
    min-height: 160px;
  }

  .dataTables_filter input,
  .dt-search input {
    min-width: 0;
    width: 100% !important;
  }
}


/* v3.7.3.151 · Failsafe universal para tablas vacías.
 * Aunque un inicializador legado o una respuesta AJAX termine fuera del orden
 * esperado, la presencia del mensaje vacío en tbody es suficiente para ocultar
 * cualquier overlay "Cargando datos / Procesando". */
.dataTables_wrapper:has(tbody td.dataTables_empty) .dataTables_processing,
.dataTables_wrapper:has(tbody td.dt-empty) .dataTables_processing,
.dt-container:has(tbody td.dataTables_empty) .dt-processing,
.dt-container:has(tbody td.dt-empty) .dt-processing,
.xeus-dt-shell:has(tbody td.dataTables_empty)::after,
.xeus-dt-shell:has(tbody td.dt-empty)::after {
  display:none !important;
  visibility:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
}

.dataTables_wrapper:has(tbody td.dataTables_empty),
.dataTables_wrapper:has(tbody td.dt-empty),
.dt-container:has(tbody td.dataTables_empty),
.dt-container:has(tbody td.dt-empty),
.xeus-dt-shell:has(tbody td.dataTables_empty),
.xeus-dt-shell:has(tbody td.dt-empty) {
  min-height:0 !important;
}

.dataTables_wrapper tbody td.dataTables_empty,
.dataTables_wrapper tbody td.dt-empty,
.dt-container tbody td.dataTables_empty,
.dt-container tbody td.dt-empty {
  padding:1.15rem 1rem !important;
  text-align:center !important;
  color:#667085 !important;
  background:#fff !important;
}
