/* Styles for static/js/table-sort.js */
.table-sort-button {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-weight: inherit;
    white-space: nowrap;
}

.table-sort-button:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Highlight the column the table is sorted by. The child selectors are there
   to outrank Bootstrap's .table cell styles without needing !important; a page
   with its own header colours can override with a more specific rule. */
table[data-sortable] > thead > tr > th:has(> .table-sort-button):hover {
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.06);
}

table[data-sortable] > thead > tr > th[aria-sort] {
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.12);
    color: var(--bs-primary, #0d6efd);
    box-shadow: inset 0 -3px 0 var(--bs-primary, #0d6efd);
}

/* Sort arrow: faint on hover, solid on the active column */
.table-sort-button::after {
    content: "\2195";  /* up-down arrow */
    font-size: 0.8em;
    opacity: 0;
    transition: opacity 0.15s;
}

.table-sort-button:hover::after,
.table-sort-button:focus-visible::after {
    opacity: 0.4;
}

th[aria-sort="ascending"] .table-sort-button::after {
    content: "\25B2";  /* up triangle */
    opacity: 1;
}

th[aria-sort="descending"] .table-sort-button::after {
    content: "\25BC";  /* down triangle */
    opacity: 1;
}
