/* ============================================================
   DATA TABLE — bets, transactions, leaderboards
   Sticky header, hover row, semantic numeric columns
   ============================================================ */

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;       /* corners clip the table */
}

.table-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  flex-wrap: wrap;
}

.table-card__title-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.table-card__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.table-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.table-card__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Table layout */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  /* min-width prevents squishing on narrow viewports — let it scroll */
  min-width: 720px;
}

.table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* Sortable header — clickable, with chevron indicator */
.table thead th.is-sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.table thead th.is-sortable:hover {
  color: var(--text-secondary);
}

.table__sort-icon {
  display: inline-block;
  margin-left: var(--space-1);
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  stroke-width: 2.5;
  opacity: 0.5;
}

.table thead th.is-sorted .table__sort-icon {
  opacity: 1;
  color: var(--color-primary);
}

.table thead th.is-sorted--asc .table__sort-icon {
  transform: rotate(180deg);
}

.table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

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

.table tbody tr:hover {
  background: var(--bg-subtle);
}

.table td {
  padding: var(--space-4);
  color: var(--text-primary);
  vertical-align: middle;
}

/* Numeric cell — mono font, right-aligned */
.table th.is-numeric,
.table td.is-numeric {
  text-align: right;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* Match cell — two-line layout (teams + league) */
.match-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.match-cell__teams {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.match-cell__league {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.match-cell__league-dot {
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--text-disabled);
}

/* Pick cell */
.pick-cell {
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  font-size: var(--text-sm);
  letter-spacing: -0.01em;
}

/* CLV value coloring */
.clv-value {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}
.clv-value--positive { color: var(--color-success-text); }
.clv-value--negative { color: var(--color-danger-text); }
.clv-value--neutral  { color: var(--text-tertiary); }

/* P&L cell */
.pnl-value {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}
.pnl-value--positive { color: var(--color-success-text); }
.pnl-value--negative { color: var(--color-danger-text); }
.pnl-value--neutral  { color: var(--text-tertiary); }

/* ============================================================
   STATUS CHIP — used in tables for bet status
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  white-space: nowrap;
  border: 1px solid transparent;
}

.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.chip--won {
  background: var(--color-success-subtle);
  color: var(--color-success-text);
}
.chip--won .chip__dot { background: var(--color-success); }

.chip--lost {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
}
.chip--lost .chip__dot { background: var(--color-danger); }

.chip--pending {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}
.chip--pending .chip__dot { background: var(--text-tertiary); }

.chip--void {
  background: var(--color-warning-subtle);
  color: var(--color-warning-text);
}
.chip--void .chip__dot { background: var(--color-warning); }

/* Phase chip — small, monospace, used to tag bets by their phase */
.chip--phase {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 1px var(--space-2);
  font-size: 11px;
}

.chip--phase-1 { background: var(--color-success-subtle); color: var(--color-success-text); border-color: transparent; }
.chip--phase-2 { background: var(--color-warning-subtle); color: var(--color-warning-text); border-color: transparent; }
.chip--phase-4 { background: var(--color-primary-subtle); color: var(--color-primary); border-color: transparent; }

/* ============================================================
   Generic semantic chip variants — use these for billing,
   payouts, KYC status, etc. (alongside --won/--lost/--pending)
   ============================================================ */

.chip--success {
  background: var(--color-success-subtle);
  color: var(--color-success-text);
  border-color: transparent;
}

.chip--danger {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
  border-color: transparent;
}

.chip--warning {
  background: var(--color-warning-subtle);
  color: var(--color-warning-text);
  border-color: transparent;
}

.chip--info {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border-color: transparent;
}
