/* ==========================================================================
   History: every stored report, filterable by name and profile, sortable
   ========================================================================== */

.history-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.history-search-wrap { flex: 1 1 320px; max-width: 460px; }
.history-search-wrap .input-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.history-search-wrap .input:focus ~ .input-kbd,
.history-search-wrap .input:not(:placeholder-shown) ~ .input-kbd { opacity: 0; }
.history-selects { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.select-sm { width: auto; height: 44px; font-size: var(--fs-md); }
html.js .history-selects .btn { display: none; }

.history-count { margin-bottom: var(--space-4); color: var(--text-3); font-size: var(--fs-sm); }
.history-count .mono { color: var(--text); }
.history-count a { margin-left: 6px; }

.history-card { padding: 0; }
.history-table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.history-table thead th:last-child { border-top-right-radius: var(--radius-lg); }
.history-table th:first-child, .history-table td:first-child { padding-left: var(--space-6); }
.history-table tbody tr { position: relative; }
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table td { padding-top: 14px; padding-bottom: 14px; }

/* The repository link covers the whole row */
.history-row { display: flex; flex-direction: column; gap: 5px; color: var(--text); }
.history-row::after { content: ""; position: absolute; inset: 0; }
.history-row:hover { text-decoration: none; }
.history-row:focus-visible { outline: none; }
.history-table tbody tr:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.history-name { font-weight: 600; font-size: var(--fs-md); overflow-wrap: break-word; }
.history-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.history-url { color: var(--text-3); font-size: var(--fs-xs); }
.history-when-sm { display: none; color: var(--text-3); font-size: var(--fs-xs); }

.col-score { width: 220px; }
.score-cell { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; }
.score-num { font-weight: 600; text-align: right; }
.score-cell .bar { height: 6px; }
.history-when { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.history-date { color: var(--text); font-size: var(--fs-sm); }
.history-time { color: var(--text-3); font-size: var(--fs-xs); }
.history-ago:not(:empty)::before { content: "\00b7"; margin: 0 6px; }
.col-chevron { width: 40px; }
.history-chevron { width: 16px; height: 16px; color: var(--text-3); transition: transform var(--dur-fast), color var(--dur-fast); }
.history-table tbody tr:hover .history-chevron { transform: translateX(2px); color: var(--accent); }

.filter-empty { padding: var(--space-6); color: var(--text-2); text-align: center; font-size: var(--fs-md); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-6);
}
.pagination .icon { width: 15px; height: 15px; }
.pagination-info { color: var(--text-2); font-size: var(--fs-sm); }

@media (max-width: 640px) {
    .history-search-wrap { max-width: none; flex-basis: 100%; }
    .history-selects { width: 100%; }
    .history-selects .select { flex: 1; min-width: 0; }
    .history-search-wrap .input-kbd { display: none; }
    .hide-sm { display: none; }
    .history-table th:first-child, .history-table td:first-child { padding-left: var(--space-4); }
    .history-table th, .history-table td { padding-left: 8px; padding-right: 8px; }
    .col-score { width: 84px; }
    .score-cell { grid-template-columns: 1fr; gap: 4px; }
    .score-num { text-align: left; }
    .col-chevron { display: none; }
    .history-when-sm { display: inline; }
}
