/* ========================================
   Benchmark Section
   ======================================== */

#section-benchmark {
    display: none;
    padding: 2rem;
    overflow-y: auto;
}

#section-benchmark.active-section {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Config bar */
.benchmark-config {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.config-item label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.config-item input,
.config-item select {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 120px;
}

.config-item input:focus,
.config-item select:focus {
    outline: none;
    border-color: var(--text-muted);
}

/* Algorithm selection panel */
.algo-selection {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.algo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.algo-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

.selection-actions {
    display: flex;
    gap: 0.5rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.checkbox-grid label:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.checkbox-grid input[type="checkbox"] {
    accent-color: var(--text-primary);
}

/* Progress indicator */
.benchmark-progress {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(6px);
    will-change: opacity, transform;
}

.benchmark-progress.is-visible {
    animation: bench-progress-in 220ms ease forwards;
}

.benchmark-progress.is-exiting {
    animation: bench-progress-out 200ms ease forwards;
}

@keyframes bench-progress-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bench-progress-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(4px);
    }
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-status {
    font-weight: 500;
    color: var(--text-primary);
}

.progress-stats {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.bench-lifecycle-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.bench-lifecycle-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.bench-lifecycle-icon .bench-morph-path {
    stroke: var(--text-primary);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    animation: bench-path-cycle 1.5s ease-in-out infinite alternate;
}

.bench-lifecycle-icon .bench-draw {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: bench-draw-line 0.55s ease forwards;
}

.bench-lifecycle-icon.success .bench-draw {
    stroke: var(--text-primary);
    stroke-width: 3.8;
}

.bench-lifecycle-icon.error .bench-draw {
    stroke: #ef4444;
    stroke-width: 3.8;
}

.bench-lifecycle-icon.stopped .bench-draw {
    stroke: var(--text-muted);
    stroke-width: 3.8;
}

.bench-lifecycle-icon.error .bench-draw.second,
.bench-lifecycle-icon.stopped .bench-draw.second {
    animation-delay: 0.15s;
}

@keyframes bench-path-cycle {
    0% {
        stroke-dashoffset: 100;
        fill: rgba(255, 255, 255, 0);
        stroke-width: 2;
    }

    50% {
        stroke-dashoffset: 0;
        fill: rgba(255, 255, 255, 0);
        stroke-width: 2;
    }

    80%,
    100% {
        stroke-dashoffset: 0;
        fill: currentColor;
        stroke-width: 0;
    }
}

@keyframes bench-draw-line {
    to {
        stroke-dashoffset: 0;
    }
}

.progress-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-percent {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-wrapper {
    margin-bottom: 0.75rem;
}

.progress-bar-track {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #666, #999);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-current-algo {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.current-label {
    margin-right: 0.5rem;
}

.current-algo-name {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Results table */
.results-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.results-container table {
    width: 100%;
    border-collapse: collapse;
}

.results-container thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    cursor: default;
}

.results-container thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.results-container thead th.sortable:hover {
    color: var(--text-primary);
}

.sort-arrow {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.results-container tbody td {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.results-container tbody tr:last-child td {
    border-bottom: none;
}

.results-container tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Export bar */
.benchmark-export {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
}