/*
 * components/table: the console's data table (ui/DataTable.js), lifted from DS components/data/DataTable.jsx and
 * RowActionsMenu.jsx, on the --table-* tokens (ds/chrome.css):
 *   frame      --table-border hairline, --radius-lg, --surface-card; the grid scrolls inside it
 *   header     the white --table-head-bg band, --table-head-fg ink, --table-head-h (32px), --text-2xs/600,
 *              0.01em tracking, labels as authored (no text-transform), nowrap, sticky, and the table's ONE
 *              horizontal rule beneath it
 *   rows       --table-row-h (34px), --type-body-sm, --s-1/--s-3 cell padding, NO row rules: the band is the
 *              boundary and the FIRST row carries it; hover --table-row-hover-bg
 *   actions    the 100px Actions column pinned to the trailing edge, the one vertical rule; glyphs in
 *              --table-action-fg, the action's tone on hover only
 *   footer     "Total Records: {n}" left (--type-body semibold), the pager right
 * Translucent dark-scheme tints (the header band, the hover wash) are painted as an image over an opaque colour, so
 * the sticky header and the pinned column stay opaque when rows scroll under them.
 */

/* ---- frame ---- */
.ae-data-table { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ae-data-table.is-filled { flex: 1 1 auto; height: 100%; }
.ae-table-frame {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface-card); border: var(--border-width-hairline) solid var(--table-border); border-radius: var(--radius-lg);
}
.ae-data-table.is-filled .ae-table-frame { flex: 1 1 auto; }
.ae-table-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; }

/* ---- grid ---- */
.ae-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.ae-table th, .ae-table td {
  height: var(--table-row-h); padding: var(--s-1) var(--s-3); text-align: left; vertical-align: middle;
  font: var(--type-body-sm); color: var(--text-body); border: 0;
}
.ae-table thead th {
  position: sticky; top: 0; z-index: 1; height: var(--table-head-h);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold); line-height: 1.3; letter-spacing: 0.01em;
  color: var(--table-head-fg); white-space: nowrap;
  background-color: var(--surface-card); background-image: linear-gradient(var(--table-head-bg), var(--table-head-bg));
  border-bottom: var(--border-width-hairline) solid var(--table-border);
}
.ae-table tbody th { font-weight: var(--weight-medium); color: var(--text-strong); }

/* rows: the band is the separator, first row tinted; hover one step darker, drawn over the band */
.ae-table tbody tr {
  background-color: var(--table-row-bg); transition: background-color var(--duration-fast) var(--ease-standard);
}
.ae-table.is-striped tbody tr:nth-child(odd) { background-color: var(--table-row-alt-bg); }
.ae-table tbody tr:hover {
  background-image: linear-gradient(var(--table-row-hover-bg), var(--table-row-hover-bg));
}
.ae-table.is-striped tbody tr.ae-table__empty-row, .ae-table tbody tr.ae-table__empty-row:hover { background: var(--table-row-bg); }
.ae-table td.ae-table__empty { height: 120px; text-align: center; color: var(--text-subtle); } /* DS: the 120px empty row */

/* alignment */
.ae-table .is-right { text-align: right; }
.ae-table .is-center { text-align: center; }

.ae-table thead .is-right .ae-table__label { text-align: right; }
.ae-table thead .is-center .ae-table__label { text-align: center; }

/* header cell: label at the column's alignment, the sort glyph pushed to the far end */
.ae-table__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); }
.ae-table__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ae-table__sort {
  display: inline-flex; flex-shrink: 0; padding: 0; border: 0; border-radius: var(--radius-xs); background: transparent;
  color: var(--table-action-fg); cursor: pointer; transition: var(--transition-control);
}
.ae-table__sort .icon { opacity: 0.55; } /* DS SortGlyph: the unsorted two-headed arrow is quieter */
.ae-table__sort.is-sorted { color: var(--text-strong); }
.ae-table__sort.is-sorted .icon, .ae-table__sort:hover .icon { opacity: 1; }
.ae-table__sort:hover { color: var(--text-strong); }
.ae-table__sort:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* the pinned Actions column: its own opaque band (inherited from the row), so the data slides under it */
.ae-table .ae-table__actions {
  position: sticky; right: 0; width: 100px; min-width: 100px; text-align: left; white-space: nowrap;
  background: inherit; color: var(--table-action-fg); border-left: var(--border-width-hairline) solid var(--table-border);
}
.ae-table thead th.ae-table__actions {
  z-index: 2; background-color: var(--surface-card); background-image: linear-gradient(var(--table-head-bg), var(--table-head-bg));
}
/* sticky cells are stacking contexts: lift the one being used so its tooltip or menu is not painted under the next row */
.ae-table tbody .ae-table__actions:hover, .ae-table tbody .ae-table__actions:focus-within { z-index: 2; }

/* row actions (DS RowActionsMenu): 26px plain icon buttons, 15px glyphs, 2px apart */
.ae-row-actions { display: inline-flex; align-items: center; gap: 2px; }
.ae-row-actions__more { display: inline-flex; }
.ae-icon-btn.ae-row-action { width: 26px; height: 26px; color: var(--table-action-fg); text-decoration: none; }
.ae-icon-btn.ae-row-action:hover { color: var(--text-strong); text-decoration: none; }
.ae-icon-btn.ae-row-action--danger:hover { color: var(--status-danger-fg); }
.ae-icon-btn.ae-row-action--warning:hover { color: var(--status-warning-fg); }
.ae-icon-btn.ae-row-action--success:hover { color: var(--status-success-fg); }
.ae-icon-btn.ae-row-action--info:hover { color: var(--status-info-fg); }
.ae-icon-btn.ae-row-action--brand:hover { color: var(--text-brand); }
.ae-icon-btn.ae-row-action:disabled { color: var(--table-action-fg); }
.ae-icon-btn.ae-row-action.is-active { color: var(--text-brand); }

/* ---- footer: Total Records left, the pager hard right; --s-2 above it equals the list card's inset ---- */
.ae-table-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-4);
  width: 100%; padding-block-start: var(--s-2);
}
.ae-table-footer__total { font: var(--type-body); font-weight: var(--weight-semibold); color: var(--text-strong); }
.ae-pager { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); min-height: var(--control-h-sm); }
.ae-pager__text { font: var(--type-body-sm); color: var(--text-muted); white-space: nowrap; }
.ae-pager__size { position: relative; display: inline-flex; align-items: center; }
/* the rows-per-page value is a control, so it is drawn as one; 20px trailing inset centres the value by its caret */
.ae-pager__select {
  appearance: none; -webkit-appearance: none; height: var(--control-h-sm); margin: 0;
  padding-inline: var(--s-2) 20px; font: var(--type-body-sm); color: var(--text-strong); cursor: pointer;
  background: var(--surface-card); border: var(--border-width-hairline) solid var(--border-default);
  border-radius: var(--radius-control); outline: none; transition: var(--transition-control);
}
.ae-pager__select:hover { border-color: var(--border-strong); }
.ae-pager__select:focus-visible { border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.ae-pager__select option { background: var(--surface-raised); color: var(--text-strong); }
.ae-pager__caret { position: absolute; inset-inline-end: 2px; pointer-events: none; color: var(--text-subtle); }
.ae-pager__nav { display: inline-flex; gap: var(--s-1); }

.ae-table .is-dim > * { color: var(--text-muted); }

