/* ============================================================
   RosterDive — Page: Roster Shared Dives
   Page-specific styles not covered by DS components.
   DS components used: datatable, filters-bar, toolbar, badge,
   alert, modal, filter-modal, inline-header
   Tokens: css/tokens.css

   Responsive (responsive.md §10 Option B): on mobile the 7-column
   shares table becomes a stack of cards, one per shared dive. The
   column header of each cell comes from the `data-label` attribute
   set by roster_shared_dive_table.js (i18n keys), so no data is
   hidden and no horizontal scroll is required.
   ============================================================ */

@media (max-width: 599px) {
  /* Drop the DS 600px min-width: the table is no longer a grid. */
  #shared-dives-table .datatable__table {
    min-width: 0;
  }

  #shared-dives-table .datatable__table thead {
    display: none;
  }

  #shared-dives-table .datatable__table,
  #shared-dives-table .datatable__table tbody,
  #shared-dives-table .datatable__table tr,
  #shared-dives-table .datatable__table td {
    display: block;
    width: 100%;
  }

  #shared-dives-table .datatable__table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
  }

  #shared-dives-table .datatable__table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    border: none;
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0;
    text-align: right;
    /* Long recipient emails must not force the card wider than the row. */
    overflow-wrap: anywhere;
  }

  #shared-dives-table .datatable__table tr td:last-child {
    border-bottom: none;
  }

  #shared-dives-table .datatable__table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    text-align: left;
  }

  /* State rows (loading/empty/error) are not cards: keep the message
     centered and full width, without a column header. */
  #shared-dives-table .datatable__table td.datatable__loading,
  #shared-dives-table .datatable__table td.datatable__empty,
  #shared-dives-table .datatable__table td.datatable__error {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  #shared-dives-table .datatable__table td.datatable__loading::before,
  #shared-dives-table .datatable__table td.datatable__empty::before,
  #shared-dives-table .datatable__table td.datatable__error::before {
    content: none;
  }
}
