/**
 * @file
 * Table component styles
 * Replicating shadcn/ui Table component
 */

/* Table wrapper */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

/* Base table */
table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

/* Table header */
thead,
.table-header {
  background-color: var(--color-gray-50);
}

th,
.table-head {
  padding: var(--spacing-3) var(--spacing-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

/* Table body */
tbody tr,
.table-row {
  border-bottom: 1px solid var(--color-border);
  transition: background-color var(--transition-fast);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover,
.table-row:hover {
  background-color: var(--color-gray-50);
}

td,
.table-cell {
  padding: var(--spacing-3) var(--spacing-4);
  color: var(--color-text-primary);
  vertical-align: middle;
}

/* Sortable header */
.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  background-color: var(--color-gray-100);
}

.sortable::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: var(--spacing-2);
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--color-gray-400);
}

.sortable.asc::after {
  border-top: none;
  border-bottom: 4px solid var(--color-primary);
}

.sortable.desc::after {
  border-top: 4px solid var(--color-primary);
}

/* Table actions column */
.table-actions {
  display: flex;
  gap: var(--spacing-2);
  justify-content: flex-end;
}

/* Empty state */
.table-empty {
  text-align: center;
  padding: var(--spacing-12) var(--spacing-4);
  color: var(--color-text-muted);
}

.table-empty-icon {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--spacing-4);
  opacity: 0.5;
}

/* Loading state */
.table-loading {
  position: relative;
}

.table-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive table */
@media (max-width: 768px) {
  .table-responsive thead {
    display: none;
  }

  .table-responsive tr {
    display: block;
    margin-bottom: var(--spacing-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
  }

  .table-responsive td {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-2) 0;
    border-bottom: 1px solid var(--color-border-light);
  }

  .table-responsive td:last-child {
    border-bottom: none;
  }

  .table-responsive td::before {
    content: attr(data-label);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
  }
}

/* Striped table */
.table-striped tbody tr:nth-child(odd) {
  background-color: var(--color-gray-50);
}

/* Bordered table */
.table-bordered th,
.table-bordered td {
  border: 1px solid var(--color-border);
}

/* Compact table */
.table-compact th,
.table-compact td {
  padding: var(--spacing-2) var(--spacing-3);
}

/* Table with selection */
.table-select {
  width: var(--spacing-4);
}

/* Status in table */
.table-status {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
}

.table-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.table-status.active::before {
  background-color: var(--color-success);
}

.table-status.inactive::before {
  background-color: var(--color-gray-400);
}

.table-status.suspended::before {
  background-color: var(--color-warning);
}

.table-status.expired::before {
  background-color: var(--color-danger);
}

/* Pagination for tables */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4);
  border-top: 1px solid var(--color-border);
}

.table-pagination-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.table-pagination-controls {
  display: flex;
  gap: var(--spacing-1);
}
