/* SSI Benchmark Site - Main Styles */

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0;
    margin: 30px 0 20px 0;
    border-bottom: 2px solid #ddd;
}

.tab-link {
    padding: 12px 24px;
    text-decoration: none;
    color: #666;
    border: none;
    background: #e8e8e8;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
    position: relative;
    bottom: -2px;
}

.tab-link:hover {
    background: #d0d0d0;
    color: #333;
}

.tab-link.active {
    background: white;
    color: #ce422b;
    font-weight: 600;
    border-bottom: 2px solid white;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

h2 {
    margin-top: 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    color: #555;
    margin-top: 30px;
}

.implementation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.implementation-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.implementation-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.implementation-card h2 {
    margin-top: 0;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.implementation-card p {
    color: #666;
    margin: 20px 0;
}

.view-button {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 10px;
}

.python-button {
    background: #3776ab;
    color: white;
}

.python-button:hover {
    background: #2a5a84;
    transform: scale(1.05);
}

.rust-button {
    background: #ce422b;
    color: white;
}

.rust-button:hover {
    background: #a03421;
    transform: scale(1.05);
}

.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 30px 0;
    text-align: center;
}

.flamegraph-preview {
    display: block;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
    opacity: 0.9;
    transition: opacity 0.2s, transform 0.2s;
    background: white;
    cursor: pointer;
}

.flamegraph-preview:hover {
    opacity: 1;
    transform: scale(1.01);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.flamegraph-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.flamegraph-section {
    max-width: 100%;
}

.flamegraph-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.flamegraph-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.flamegraph-card h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.2rem;
}

.flamegraph-card p {
    color: #666;
    margin: 0.5rem 0 1rem 0;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .flamegraph-cards {
        grid-template-columns: 1fr;
    }
}

footer {
    margin-top: 60px;
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Section styling */
section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin: 40px 0;
}

.tip-text {
    margin-top: 20px;
    color: #666;
    font-style: italic;
}

.chart-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin: 40px 0;
}

/* Benchmark cards for atomic page */
.benchmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.benchmark-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.benchmark-card h4 {
    margin-top: 0;
}

.benchmark-links {
    margin-top: 15px;
}

.benchmark-links a {
    display: inline-block;
    padding: 8px 16px;
    background: #ce422b;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 10px;
    transition: background 0.2s;
}

.benchmark-links a:hover {
    background: #a03421;
}

/* Dual chart layout (for atomic/validate/help pages) */
.dual-chart-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.chart-half {
    min-width: 0; /* Allow grid items to shrink */
}

.chart-half h3 {
    margin-top: 0;
    color: #555;
}

.flamegraph-preview-small {
    display: block;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
    opacity: 0.9;
    transition: opacity 0.2s, transform 0.2s;
    background: white;
    cursor: pointer;
}

.flamegraph-preview-small:hover {
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.flamegraph-preview-small img {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 900px) {
    .dual-chart-layout {
        grid-template-columns: 1fr;
    }
}

/* Performance Results Table */
.perf-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9em;
}

.perf-table thead tr {
    background: #f2f2f2;
}

.perf-table th {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.perf-table th.numeric {
    text-align: right;
}

.perf-table th.centered {
    text-align: center;
}

.perf-table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.perf-table td.numeric {
    text-align: right;
}

.perf-table td.centered {
    text-align: center;
}

.perf-table a {
    color: #ce422b;
    text-decoration: none;
}

.perf-table a:hover {
    text-decoration: underline;
}

/* Sortable Table Indicators */
.perf-table th.sorted-asc::after,
.perf-table th.sorted-desc::after {
    content: '';
    display: inline-block;
    margin-left: 8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    vertical-align: middle;
}

.perf-table th.sorted-asc::after {
    border-bottom: 6px solid #333;
}

.perf-table th.sorted-desc::after {
    border-top: 6px solid #333;
}

/* Summary Box */
.summary-box {
    background: #f9f9f9;
    border: 2px solid #ce422b;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.summary-box h3 {
    margin-top: 0;
    color: #ce422b;
}

.summary-box p {
    font-size: 1.1em;
    margin: 0;
}

/* Regression Analysis Styles */
.regression-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    font-size: 0.85em;
    margin-left: 10px;
}

.regression-focused {
    background: #dc3545;
}

.regression-mixed {
    background: #fd7e14;
}

.regression-diffuse {
    background: #0d6efd;
}

.change-value {
    font-weight: bold;
    font-size: 1.2em;
}

.delta-value {
    font-weight: 600;
}

section code {
    background: #f8f9fa;
    color: #d63384;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Cross-version history table */
.history-table-scroll {
    overflow-x: auto;
    margin: 20px 0;
}

.history-table {
    min-width: max-content;
    font-size: 0.82em;
}

.history-table th {
    white-space: nowrap;
    font-size: 0.9em;
}

.history-table td.cv-na {
    color: #bbb;
    text-align: right;
}
