/*
 * Copyright (c) 2026 Yu Chen. All rights reserved.
 * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
 */

.benchmark-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.benchmark-controls label {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 650;
    gap: 6px;
    min-width: 150px;
}

.benchmark-controls select,
.benchmark-controls input {
    background: var(--gray-light);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    min-height: 38px;
    padding: 8px 10px;
}

.benchmark-search-label {
    flex: 1 1 220px;
}

.benchmark-btn {
    align-items: center;
    background: var(--primary);
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 650;
    gap: 8px;
    min-height: 38px;
    padding: 9px 14px;
}

.benchmark-btn:hover {
    background: var(--secondary);
}

.benchmark-btn-secondary {
    background: var(--gray-light);
    border: 1px solid var(--glass-border);
    color: var(--primary);
}

.benchmark-btn-secondary:hover {
    background: rgba(67, 97, 238, 0.1);
}

.benchmark-collapsible-panel {
    margin-top: 10px;
}

.benchmark-subheader {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.benchmark-subheader h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 750;
}

.benchmark-radar-wrap {
    height: 480px;
    position: relative;
}

.benchmark-view-tabs {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 16px;
}

.benchmark-view-tab {
    align-items: center;
    background: var(--gray-light);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 750;
    gap: 8px;
    min-height: 40px;
    padding: 9px 13px;
}

.benchmark-view-tab.active,
.benchmark-view-tab:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.benchmark-task-tabs {
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 18px;
    padding-bottom: 10px;
}

.benchmark-task-tab {
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 750;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
}

.benchmark-task-tab.active,
.benchmark-task-tab:hover {
    background: var(--gray-light);
    border-color: var(--primary);
    color: var(--primary);
}

.benchmark-task-tab-count {
    background: rgba(67, 97, 238, 0.1);
    border-radius: 999px;
    color: var(--primary);
    font-size: 12px;
    min-width: 26px;
    padding: 2px 7px;
    text-align: center;
}

.benchmark-view-panel {
    display: none;
}

.benchmark-view-panel.active {
    display: block;
}

.benchmark-radar-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.benchmark-radar-panel {
    background: var(--gray-light);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    min-width: 0;
    padding: 14px;
}

.benchmark-radar-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 750;
    margin-bottom: 8px;
}

.benchmark-bar-grid {
    display: grid;
    gap: 18px;
}

.benchmark-track-bar-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.benchmark-bar-panel {
    background: var(--gray-light);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    min-width: 0;
    padding: 14px;
}

.benchmark-release-note {
    margin: 0 0 14px;
}

.benchmark-release-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr;
}

.benchmark-release-wrap {
    height: 520px;
    position: relative;
}

.benchmark-bar-panel-wide {
    grid-column: 1 / -1;
}

.benchmark-bar-wrap {
    height: 340px;
    position: relative;
}

.benchmark-bar-wrap-small {
    height: 300px;
}

.benchmark-table {
    border-collapse: collapse;
    width: 100%;
}

.benchmark-table th {
    background: var(--gray-light);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    position: sticky;
    top: 0;
    white-space: nowrap;
    z-index: 1;
}

.benchmark-table th,
.benchmark-table td {
    border-bottom: 1px solid var(--glass-border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

.benchmark-table td {
    color: var(--text-primary);
    font-size: 13px;
}

.benchmark-table tbody tr:hover {
    background: rgba(67, 97, 238, 0.04);
}

.benchmark-table .numeric {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.benchmark-sortable-th {
    cursor: pointer;
    user-select: none;
}

.benchmark-sort-header {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    gap: 6px;
    justify-content: inherit;
    padding: 0;
    text-align: inherit;
    width: 100%;
}

.benchmark-table .numeric .benchmark-sort-header {
    justify-content: flex-end;
}

.benchmark-sort-icon {
    color: var(--primary);
    font-size: 10px;
    line-height: 1;
}

.benchmark-sort-icon-muted {
    color: var(--text-secondary);
    opacity: 0.45;
}

.benchmark-task-section {
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-top: 18px;
    overflow: hidden;
}

.benchmark-task-section-heading {
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 16px;
}

.benchmark-task-section-heading h4 {
    margin: 0 0 4px;
}

.benchmark-task-section-heading p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

.benchmark-table .benchmark-column-group {
    border-left: 1px solid var(--glass-border);
    text-align: center;
}

.benchmark-row-unranked td {
    opacity: 0.7;
}

/* A method the track requires but that has no result: every cell is "-". */
.benchmark-row-missing td {
    color: var(--text-secondary);
    opacity: 0.6;
}

.benchmark-unranked {
    color: var(--text-secondary);
    display: block;
    font-size: 12px;
    font-weight: 400;
}

.benchmark-metric-cell {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    min-width: 94px;
}

.benchmark-rank {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-secondary);
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    line-height: 1.35;
    min-width: 32px;
    min-height: 26px;
    padding: 2px 8px;
}

.benchmark-rank-top-1 {
    background: #fff3bf;
    border-color: #f59e0b;
    color: #8a5a00;
}

.benchmark-rank-top-2 {
    background: #eef2f7;
    border-color: #94a3b8;
    color: #475569;
}

.benchmark-rank-top-3 {
    background: #f7d6c1;
    border-color: #c26a32;
    color: #8a3d12;
}

.benchmark-rank-empty {
    border-color: var(--glass-border);
    color: var(--text-secondary);
    font-weight: 500;
}

.benchmark-method-name {
    font-weight: 750;
    white-space: nowrap;
}

.benchmark-muted {
    color: var(--text-secondary);
}

.benchmark-empty {
    color: var(--text-secondary);
    padding: 28px;
    text-align: center;
}

.benchmark-direction {
    color: var(--text-secondary);
    display: block;
    font-size: 10px;
    font-weight: 500;
    margin-top: 2px;
}

.benchmark-direction i {
    font-size: 9px;
}

@media (max-width: 768px) {
    .benchmark-radar-wrap {
        height: 360px;
    }

    .benchmark-controls label {
        min-width: 100%;
    }

    .benchmark-btn {
        justify-content: center;
        width: 100%;
    }

    .benchmark-subheader {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .benchmark-depth-compare,
    .benchmark-reconstruction-grid,
    .benchmark-radar-grid,
    .benchmark-track-bar-grid {
        grid-template-columns: 1fr;
    }

    .benchmark-bar-wrap {
        height: 340px;
    }

}

/* Dataset tabs: a second, lighter row under the task tabs ("Overall" plus one tab per dataset of the task). */
.benchmark-dataset-tabs {
    margin-top: -8px;
}

.benchmark-dataset-tab {
    font-size: 12px;
    font-weight: 650;
    min-height: 30px;
    padding: 5px 10px;
}

/* Overview filters (tracks, datasets, model types) */
.benchmark-filter-card {
    overflow: visible;
    padding-bottom: 14px;
    position: relative;
    z-index: 5;
}

.benchmark-radar-empty {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    font-size: 14px;
    height: 100%;
    justify-content: center;
    padding: 0 24px;
    text-align: center;
}

.benchmark-filter-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.benchmark-filter-menu {
    position: relative;
}

.benchmark-filter-menu summary {
    background: var(--gray-light);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    list-style: none;
    padding: 8px 12px;
    user-select: none;
}

.benchmark-filter-menu summary::-webkit-details-marker {
    display: none;
}

.benchmark-filter-menu summary::after {
    content: " \25BE";
    color: var(--text-secondary);
}

.benchmark-filter-menu[open] summary {
    border-color: var(--primary);
}

.benchmark-filter-count {
    color: var(--primary);
    font-weight: 700;
}

.benchmark-filter-panel {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    left: 0;
    max-height: 420px;
    min-width: 260px;
    overflow-y: auto;
    padding: 10px 12px;
    position: absolute;
    top: calc(100% + 6px);
    z-index: 20;
}

.benchmark-filter-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.benchmark-filter-actions button {
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    padding: 3px 8px;
}

.benchmark-filter-group {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 8px 0 4px;
    text-transform: uppercase;
}

.benchmark-filter-option {
    align-items: center;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    font-size: 13px;
    gap: 8px;
    padding: 3px 0;
    white-space: nowrap;
}

.benchmark-filter-option small {
    color: var(--text-secondary);
}

.benchmark-filter-help {
    font-size: 12px;
    margin: 10px 0 0;
}

/* Chart export bar (js/chart_export.js): floats over each chart, shown on hover */
.chart-export-host {
    position: relative;
}

.chart-export-bar {
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    display: flex;
    font-size: 11px;
    gap: 4px;
    opacity: 0;
    padding: 3px 4px 3px 8px;
    position: absolute;
    right: 8px;
    top: 8px;
    transition: opacity 0.15s ease;
    z-index: 4;
}

.chart-export-bar[hidden] {
    display: none;
}

.chart-export-host:hover > .chart-export-bar,
.chart-export-bar:focus-within {
    opacity: 1;
}

@media (hover: none) {
    .chart-export-bar {
        opacity: 0.9;
    }
}

.chart-export-bar button {
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    min-width: 34px;
    padding: 3px 6px;
}

.chart-export-bar button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.chart-export-bar button:disabled {
    cursor: progress;
}

/* A SLAM cell whose sequences all failed (e.g. "7 GPU OOM"): the failure in place of the metric. */
.benchmark-failed-cell {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

.benchmark-radar-note {
    font-size: 12px;
    margin: 6px 0 0;
}

.benchmark-filter-footnote {
    border-top: 1px solid var(--border-color, rgba(148, 163, 184, 0.3));
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 8px;
    padding-top: 6px;
}

.benchmark-release-title {
    align-items: center;
    display: flex;
    gap: 10px;
}

.benchmark-release-reset {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
}

.benchmark-release-reset[hidden] {
    display: none;
}

/* "Half page width" score-vs-date charts: two per row, shorter, so an exported figure is half as wide. */
.benchmark-release-grid-half {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.benchmark-release-grid-half .benchmark-release-wrap {
    height: 420px;
}

@media (max-width: 900px) {
    .benchmark-release-grid-half {
        grid-template-columns: 1fr;
    }
}

/* Results shown with a caveat (BENCHMARK_METHOD_FLAGS in js/benchmark.js): a tag by the name, a note under the tables. */
.benchmark-method-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(248, 150, 30, 0.14);
    color: #b45309;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

[data-theme="dark"] .benchmark-method-flag {
    color: var(--warning);
}

.benchmark-flag-note {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.5;
}

.benchmark-flag-note i {
    color: var(--warning);
    margin-right: 4px;
}

/* Wide tables (js/table_drag.js): drag sideways with the mouse; the columns through Method stay in place. */
.table-container.is-draggable {
    cursor: grab;
}

.table-container.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.table-container.is-dragging .benchmark-sort-header {
    cursor: grabbing;
}

.benchmark-table .sticky-col {
    background: var(--card-bg);
    position: sticky;
    z-index: 2;
}

.benchmark-table th.sticky-col {
    background: var(--gray-light);
    z-index: 3;
}

/* The row hover tint, drawn over the held cells' opaque background. */
.benchmark-table tbody tr:hover td.sticky-col {
    background-image: linear-gradient(rgba(67, 97, 238, 0.04), rgba(67, 97, 238, 0.04));
}

/* A dimmed row fades the held cells' content, not their background (the scrolled columns would show through). */
.benchmark-row-unranked td.sticky-col {
    color: color-mix(in srgb, var(--text-primary) 70%, var(--card-bg));
    opacity: 1;
}

.benchmark-row-unranked td.sticky-col > * {
    opacity: 0.7;
}

.table-container.is-scrolled .sticky-col-last {
    box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.25);
}

/* A method limitation (its own code, operators or outputs failed, not the run): a badge under the method name, and
   the failed cells it explains, marked with the amber accent; the text stays in the text tokens. */
.benchmark-limitation,
.benchmark-limitation-cell {
    --limitation-accent: #c2410c;
}

[data-theme="dark"] .benchmark-limitation,
[data-theme="dark"] .benchmark-limitation-cell {
    --limitation-accent: #fbbf24;
}

.benchmark-limitation {
    border: 1px solid var(--limitation-accent);
    border-radius: 999px;
    color: var(--text-secondary);
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 2px;
    padding: 0 7px;
    cursor: help;
}

.benchmark-limitation-cell {
    box-shadow: inset 2px 0 0 var(--limitation-accent);
}
