/* ==========================================================================
   BrightAI Design System - Tables Component
   ========================================================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.table th,
.table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.table th {
  background-color: var(--gray-50);
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.05em;
  user-select: none;
  white-space: nowrap;
}

.table tbody tr {
  transition: var(--transition-fast);
}

.table tbody tr:hover {
  background-color: var(--color-surface-hover);
}

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

/* --- TABLE STATES & TYPES --- */

/* Striped rows style */
.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--gray-50);
}
.table-striped tbody tr:nth-of-type(odd):hover {
  background-color: var(--color-surface-hover);
}

/* Compact Table density */
.table-compact th,
.table-compact td {
  padding: var(--spacing-sm) var(--spacing-md);
}

/* --- SORTABLE & FILTERABLE TABLE HEADERS --- */

.th-sortable {
  cursor: pointer;
}

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

.th-sort-icon {
  display: inline-flex;
  align-items: center;
  margin-inline-start: var(--spacing-xs);
  transition: var(--transition-fast);
  color: var(--text-muted);
}

.th-sortable:hover .th-sort-icon {
  color: var(--text-secondary);
}

/* --- ALIGNMENT SHORTCUTS (RTL Compliant) --- */
.text-start { text-align: start !important; }
.text-end { text-align: end !important; }
.text-center { text-align: center !important; }

/* Numeric columns should be LTR or logically aligned depending on context */
.col-numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: end;
}

/* --- FILTER & HEADER BAR (Stripe style above table) --- */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* Badge/status inside table cells */
.table-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--spacing-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
}
