/* ============================================================
   CHARDI.AI — TABLE
   ============================================================ */

.table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tenders-table {
  width: 100%;
  min-width: 860px;
  font-size: var(--text-sm);
}

/* ── Header ── */
.tenders-table thead {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
}

.tenders-table thead tr {
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-strong);
}

.tenders-table th {
  padding: 10px var(--spacing-md);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.th--sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

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

.th--active {
  color: var(--color-accent) !important;
}

.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sort-arrow {
  font-size: 10px;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform: translateY(2px);
}

.th--active .sort-arrow {
  opacity: 1;
}

.sort-arrow--asc  { transform: translateY(0); }
.sort-arrow--desc { transform: translateY(0) rotate(180deg); }

/* ── Rows ── */
.tenders-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
  position: relative;
}
.tenders-table tbody tr:last-child {
  border-bottom: none;
}

/* ── Cells ── */
.tenders-table td {
  padding: 12px var(--spacing-md);
  vertical-align: middle;
}

/* ── Title Cell ── */
.td-title {
  max-width: 280px;
  min-width: 200px;
}

.td-title__text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
  color: var(--color-text-primary);
  font-weight: 450;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

/* ── Buyer Cell ── */
.td-buyer {
  min-width: 140px;
}

.td-buyer__name {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.td-buyer__type {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── State Cell ── */
.td-state {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Category Cell ── */
.td-category {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  max-width: 150px;
}

/* ── Value Cell ── */
.td-value {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  text-align: right;
}

/* ── Deadline Cell ── */
.td-deadline {
  white-space: nowrap;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  margin-top: 2px;
  font-weight: 500;
}

.deadline-badge--urgent {
  background: rgba(239,68,68,0.12);
  color: var(--color-deadline-urgent);
}

.deadline-badge--soon {
  background: rgba(245,158,11,0.12);
  color: var(--color-deadline-soon);
}

/* ── Source Cell ── */
.td-source {
  white-space: nowrap;
}

/* ── Skeleton Rows ── */
.skeleton-row td {
  padding: 14px var(--spacing-md);
}

.skeleton-row .skel {
  display: block;
  height: 12px;
  border-radius: var(--radius-sm);
}

.skeleton-row .skel--title {
  width: 85%;
  margin-bottom: 6px;
}
.skeleton-row .skel--title-sm {
  width: 55%;
}
.skeleton-row .skel--buyer   { width: 80%; }
.skeleton-row .skel--short   { width: 40px; }
.skeleton-row .skel--medium  { width: 70px; }
.skeleton-row .skel--value   { width: 80px; margin-left: auto; }
.skeleton-row .skel--badge   { width: 55px; height: 20px; border-radius: var(--radius-full); }

/* ── Row entrance animation ── */
@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tenders-table tbody tr {
  animation: rowFadeIn 0.25s ease forwards;
}

.tenders-table tbody tr:nth-child(1)  { animation-delay: 0ms; }
.tenders-table tbody tr:nth-child(2)  { animation-delay: 25ms; }
.tenders-table tbody tr:nth-child(3)  { animation-delay: 50ms; }
.tenders-table tbody tr:nth-child(4)  { animation-delay: 75ms; }
.tenders-table tbody tr:nth-child(5)  { animation-delay: 100ms; }
.tenders-table tbody tr:nth-child(6)  { animation-delay: 125ms; }
.tenders-table tbody tr:nth-child(7)  { animation-delay: 150ms; }
.tenders-table tbody tr:nth-child(8)  { animation-delay: 175ms; }
.tenders-table tbody tr:nth-child(9)  { animation-delay: 200ms; }
.tenders-table tbody tr:nth-child(10) { animation-delay: 225ms; }