/* Custom table caption styling */
table.table > caption {
  caption-side: top;
  color: var(--ink);
}

/* CSS Zero table override */
:where(.table) {
  caption-side: bottom;
  font-size: var(--text-xs);
  inline-size: var(--size-full);

  caption {
    color: var(--color-text-subtle);
    margin-block-start: var(--size-4);
  }

  thead {
    color: var(--color-text-subtle);
  }

  tbody tr {
    border-block-start-width: var(--border);
  }

  th {
    font-weight: var(--font-medium);
    text-transform: uppercase;
    text-align: start;
  }

  th, td {
    padding: var(--size-1);
  }

  tfoot {
    background-color: rgb(from var(--color-border-light) r g b / .5);
    border-block-start-width: var(--border);
    font-weight: var(--font-medium);
  }
}

/* General table styles */
table {
  width: 100%;
  font-size: 0.75rem;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
}

table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
  vertical-align: top;
}

/* Table cell types */
.name-cell,
.user-cell,
.recipient-cell {
  font-weight: 600;
  min-width: 120px;
}

.email-cell,
.letter-cell {
  font-size: 0.7rem;
  max-width: 200px;
}

.address-cell {
  font-size: 0.7rem;
  max-width: 200px;
}

.amount-cell,
.status-cell,
.transaction-cell,
.date-cell {
  font-weight: 600;
  font-size: 0.7rem;
  min-width: 80px;
}

.action-cell {
  min-width: 80px;
}

.date-cell {
  font-family: var(--font-family-mono);
  font-size: 0.7rem;
  min-width: 80px;
}

.action-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Special table row states */
.needs-fulfillment-row {
  background: var(--color-red-50);
}

.needs-fulfillment-row td {
  border-bottom-color: var(--color-red-200);
}

/* Responsive table styles */
@media screen and (max-width: 768px) {
  /* Desktop: Show tables, hide cards */
  .table-wrapper {
    display: none;
  }
  
  .mobile-cards {
    display: block;
  }

  /* Mobile responsive tables: Traditional approach fallback */
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0;
    padding: 0.5rem;
  }

  .table td {
    text-align: right;
    padding-left: 50%;
    position: relative;
    border-bottom: 1px solid var(--border-color-subtle, #f3f4f6);
  }

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

  .table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.5rem;
    width: calc(50% - 1rem);
    padding-right: 0.5rem;
    font-weight: bold;
    text-align: left;
    white-space: nowrap;
  }

  .table td[data-label="Actions"] {
    padding-left: 0;
  }

  .table td[data-label="Actions"]::before {
    display: none;
  }

  .table td[data-label="Actions"] .flex-col {
    align-items: flex-end;
  }

  /* Touch interactions for table rows */
  .table tr:active {
    background-color: var(--color-secondary);
  }
}

/* Desktop: Show tables, hide cards */
@media screen and (min-width: 769px) {
  .table-wrapper {
    display: block;
  }
  
  .mobile-cards {
    display: none;
  }
}

 
