/**
 * Base data table styles.
 * Shared by display-only tables and Simple-DataTables controls.
 */

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
}

.data-table,
.sdt-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 15px;
}

.data-table thead,
.sdt-table thead {
  background: var(--table-header-bg);
}

.data-table thead th,
.sdt-table thead th {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-text);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
  position: relative;
  user-select: none;
}

.dt-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.data-table thead th:first-child,
.sdt-table thead th:first-child {
  padding-left: 20px;
}

.data-table thead th:last-child,
.sdt-table thead th:last-child {
  padding-right: 20px;
}

.data-table tbody td,
.sdt-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-color);
}

.data-table tbody tr:nth-child(even),
.sdt-table tbody tr:nth-child(even) {
  background: var(--info-item-bg);
}

.data-table tbody tr:hover td,
.sdt-table tbody tr:hover td {
  background: var(--info-item-bg);
}

.data-table tbody tr:last-child td,
.sdt-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table thead th:first-child,
.sdt-table thead th:first-child,
.data-table tbody td:first-child,
.sdt-table tbody td:first-child {
  padding-left: 20px;
}

.data-table thead th:last-child,
.sdt-table thead th:last-child,
.data-table tbody td:last-child,
.sdt-table tbody td:last-child {
  padding-right: 20px;
}

.data-table-align-left thead th,
.data-table-align-left tbody td {
  text-align: left;
}

.data-table-align-center thead th,
.data-table-align-center tbody td {
  text-align: center;
}

.data-table-align-right thead th,
.data-table-align-right tbody td {
  text-align: right;
}

.data-table-cell-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-color);
}

.data-table-cell-muted {
  font-size: 14px;
  color: var(--muted-text);
}

.data-table-cell-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.data-table-cell-image {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.data-table-cell-image img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  flex-shrink: 0;
}

.data-table-empty td,
.data-table-loading td {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted-text);
  font-size: 15px;
}

.data-table-empty td .data-table-empty-icon,
.data-table-loading td .data-table-loading-icon {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.data-table-section {
  margin-bottom: 24px;
}

.data-table-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  color: var(--heading-color);
  margin: 0 0 16px 0;
}

.data-table-section-title .fa,
.data-table-section-title .fas {
  color: var(--primary-blue);
  font-size: 20px;
}

/* Simple-DataTables layout controls */
.sdt-wrapper .dt-layout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 0.75em 0;
  padding: 0 20px;
  gap: 12px;
}

.sdt-wrapper .dt-layout-cell {
  display: flex;
  align-items: center;
}

.sdt-wrapper .dt-layout-start {
  justify-content: flex-start;
}

.sdt-wrapper .dt-layout-end {
  justify-content: flex-end;
  margin-left: auto;
}

.dt-info {
  margin: 0;
  color: var(--muted-text);
  font-size: 14px;
}

.dt-paging nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dt-paging-button {
  padding: 4px 8px;
  margin: 0;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
  border-radius: var(--radius-small);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.dt-paging-button:hover {
  border-color: var(--primary-blue);
  background: var(--info-item-bg);
  color: var(--primary-blue);
}

.dt-paging-button.current {
  border-color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 8%, transparent);
  color: var(--primary-blue);
  font-weight: 600;
}

.dt-paging-button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--muted-text);
  pointer-events: none;
}

/* Sortable column indicators */
table.sdt-table thead th.is-orderable {
  cursor: pointer;
}

table.sdt-table thead .dt-order-toggle {
  display: none !important;
}

table.sdt-table thead .dt-order-indicator {
  display: none;
  width: 0;
  height: 0;
  margin-left: 6px;
  flex-shrink: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

table.sdt-table thead .dt-order-indicator.is-asc,
table.sdt-table thead .dt-order-indicator.is-desc {
  display: inline-block;
}

table.sdt-table thead .dt-order-indicator.is-asc {
  border-bottom: 6px solid currentColor;
}

table.sdt-table thead .dt-order-indicator.is-desc {
  border-top: 6px solid currentColor;
}

@media (max-width: 767px) {
  .data-table-mobile-cards.data-table-wrap {
    overflow-x: auto;
    min-width: 0;
  }

  .data-table-mobile-cards .data-table,
  .data-table-mobile-cards .sdt-table {
    min-width: 720px;
  }

  .sdt-wrapper .dt-layout-row {
    display: block;
    padding: 0 12px;
  }

  .sdt-wrapper .dt-layout-cell {
    display: block;
    text-align: center;
    margin: 0.5em 0;
  }

  .dt-paging nav {
    justify-content: center;
    flex-wrap: wrap;
  }
}
