/* grid-columns.css - header behaviour drawn by js/grid-columns.js: sticky header, sort buttons, resize handles,
   drop markers, frozen leading columns and compact density. Theme variables only; literal colours are fallbacks. */

table.gc-table { table-layout: fixed; }
table.gc-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--ms-ribbon-bg, #f3f2f1);
  user-select: none; cursor: default;
  overflow: hidden; white-space: nowrap;
  padding-right: 12px;
}
table.gc-table thead th:not(.gc-fixed) { cursor: grab; }
table.gc-table thead th:not(.gc-fixed) .gc-sort { cursor: grab; }
table.gc-table thead th.gc-dragging { cursor: grabbing; opacity: 0.6; }
.gc-table tbody td, .gc-table tbody th { overflow: hidden; text-overflow: ellipsis; }

/* Sort button: looks like the heading text, behaves like a button. */
.gc-sort {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0;
  padding: 0; margin: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: start; cursor: pointer;
}
.gc-sort:hover .gc-label { text-decoration: underline; }
.gc-sort:focus-visible { outline: 2px solid var(--ms-blue, #0067b8); outline-offset: 2px; border-radius: 2px; }
.gc-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gc-sort-ind { display: inline-flex; align-items: center; flex-shrink: 0; font-size: 9px; line-height: 1; color: var(--ms-blue, #0067b8); }
.gc-sort-ind[data-dir="asc"]::after { content: '\25B2'; content: '\25B2' / ''; }
.gc-sort-ind[data-dir="desc"]::after { content: '\25BC'; content: '\25BC' / ''; }
.gc-sort-ind[data-order]::before { content: attr(data-order); content: attr(data-order) / ''; font-size: 10px; font-weight: 700; margin-right: 1px; }

/* Resize handle at the right edge of a heading. */
.gc-resize {
  position: absolute; top: 0; right: 0; width: 7px; height: 100%;
  cursor: col-resize; z-index: 1; touch-action: none;
}
.gc-resize::after {
  content: ''; position: absolute; top: 20%; bottom: 20%; right: 0; width: 2px; border-radius: 1px;
  background: transparent;
}
.gc-resize:hover::after, .gc-resize:focus-visible::after, .gc-resize.active::after { background: var(--ms-blue, #0067b8); }
.gc-resize:focus-visible { outline: 2px solid var(--ms-blue, #0067b8); outline-offset: -2px; }

/* Drop marker while a heading is dragged. */
table.gc-table thead th.gc-drop-before { box-shadow: inset 3px 0 0 var(--ms-blue, #0067b8); }
table.gc-table thead th.gc-drop-after { box-shadow: inset -3px 0 0 var(--ms-blue, #0067b8); }

/* Frozen leading columns: left offsets are set on the table as --gc-left-<index>. */
table.gc-table thead th.gc-frozen { z-index: 3; }
.gc-table .gc-frozen { position: sticky; left: 0; }
.gc-table .gc-frozen-1 { left: var(--gc-left-1, 0); }
.gc-table .gc-frozen-2 { left: var(--gc-left-2, 0); }
.gc-table .gc-frozen-3 { left: var(--gc-left-3, 0); }
/* Low specificity so the grid's striping, hover and selection backgrounds still win. */
.gc-table :where(tbody) .gc-frozen { z-index: 1; background-color: var(--ms-surface, #fff); }
.gc-table :where(tbody tr[aria-selected="true"], tbody tr.u-background-f3f9fd) > .gc-frozen { background-color: inherit; }
.gc-table .gc-frozen-last { box-shadow: inset -2px 0 0 var(--ms-border-dark, #c8c6c4); }
table.gc-table thead th.gc-frozen-last.gc-drop-after { box-shadow: inset -3px 0 0 var(--ms-blue, #0067b8); }

/* Compact density. */
.gc-table.gc-compact tbody td,
.gc-table.gc-compact tbody th { padding-top: 2px; padding-bottom: 2px; line-height: 1.2; height: auto; }

@media (prefers-reduced-motion: no-preference) {
  .gc-resize::after { transition: background-color 0.12s ease; }
  table.gc-table thead th { transition: opacity 0.12s ease; }
}

@media (forced-colors: active) {
  .gc-resize:focus-visible, .gc-sort:focus-visible { outline-color: Highlight; }
  table.gc-table thead th.gc-drop-before { border-left: 3px solid Highlight; }
  table.gc-table thead th.gc-drop-after { border-right: 3px solid Highlight; }
}
