/*
 * Scoped to .edr-bookings-table — the DataTable container div on the bookings
 * list only; no other DataTable is affected. Mirrors contracts-table.css:
 * content-sized columns with a 40px floor, horizontal scroll when the table
 * outgrows the card, and a sticky shadowed action column.
 */
 .edr-bookings-table {
  overflow-x: auto;
}

/*
 * width: max-content — the table is exactly as wide as its columns' content
 * needs, never squeezed to fit the viewport; the container scrolls instead.
 * min-width: 100% keeps it filling the card when content is narrow.
 */
.edr-bookings-table table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

.edr-bookings-table th,
.edr-bookings-table td {
  min-width: 40px;
}

/*
 * Mantine Badge caps itself at max-width: 100%; inside an auto-layout table
 * cell that resolves against min-content and clips the label. Let badges size
 * to their text so the column grows to fit them.
 */
.edr-bookings-table .mantine-Badge-root {
  max-width: none;
}

/*
 * Full-width rows (error / empty state) span every column via colspan — leave
 * their wrapping alone.
 */
.edr-bookings-table th,
.edr-bookings-table td:not([colspan]) {
  white-space: nowrap;
}

/* Sticky header row. */
.edr-bookings-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/*
 * Sticky action column, shrunk to its content. The width overrides the inline
 * width DataTable stamps from tanstack's default column size — hence
 * !important. `:not([colspan])` keeps the full-width error/empty rows out.
 */
.edr-bookings-table th:last-child,
.edr-bookings-table td:last-child:not([colspan]) {
  width: 1% !important;
  position: sticky;
  right: 0;
  box-shadow: -12px 0 16px -6px rgba(16, 32, 47, 0.3);
}

/*
 * Sticky cells sit above the scrolling ones, so they need their own opaque
 * background or the columns underneath show through.
 */
.edr-bookings-table td:last-child:not([colspan]) {
  /* Very light blue-grey tint sets the action column apart from the rows. */
  background: #f5f8fb;
  z-index: 2;
}

/* Row hover uses the tailwind `hover:bg-accent` class on the <tr>. */
.edr-bookings-table tbody tr:hover td:last-child:not([colspan]) {
  background: var(--accent, #f4fbf8);
}

/* Header cell is sticky on both axes — it must outrank the body's sticky column. */
.edr-bookings-table th:last-child {
  background: #f4f7fa;
  z-index: 3;
}
