/* ============================================================
   Aggregated Community Results Feature Styling
   ============================================================ */

/* Main container */
.aggregated-results {
    border-left: 4px solid #17a2b8;
}

/* Platform grouping */
.aggregated-results .platform-group {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
}

.aggregated-results .platform-group:last-child {
    border-bottom: none;
}

/* Browser group boxes */
.aggregated-results .browser-group {
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 0.25rem;
}

/* Dark theme support */
[data-theme="dark"] .aggregated-results .browser-group {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .aggregated-results h5,
[data-theme="dark"] .aggregated-results h6 {
    color: #212529;
}

/* Code/numbers styling */
.aggregated-results code {
    font-size: 0.95rem;
    color: #0066cc;
    background-color: transparent;
}

[data-theme="dark"] .aggregated-results code {
    color: #4d9fff;
}

/* Mobile optimizations */
@media (max-width: 767px) {
    .aggregated-results .card-header h4 small {
        display: block;
        margin-top: 0.5rem;
    }

    .aggregated-results .browser-group {
        margin-left: 0 !important;
        padding: 0.5rem;
    }
}

/* ============================================================
   CSS-only Bar Chart Visualizations
   ============================================================ */

/* Chart container */
.benchmark-chart-container {
    margin: 0.75rem 0;
    padding: 0.875rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0.375rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .benchmark-chart-container {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Individual bar row */
.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.625rem;
}

.chart-bar-row:last-child {
    margin-bottom: 0;
}

/* Test name label */
.chart-bar-label {
    flex: 0 0 140px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #212529);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .chart-bar-label {
    color: #212529;
}

/* Bar track (background) */
.chart-bar-track {
    flex: 1;
    height: 28px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .chart-bar-track {
    background: rgba(255, 255, 255, 0.08);
}

/* Bar fill (actual performance) */
.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066cc 0%, #0052a3 100%);
    transition: width 0.4s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* Fastest test styling */
.chart-bar-fill.fastest {
    background: linear-gradient(90deg, #28a745 0%, #20873a 100%);
}

[data-theme="dark"] .chart-bar-fill {
    background: linear-gradient(90deg, #4d9fff 0%, #2d7fd9 100%);
}

[data-theme="dark"] .chart-bar-fill.fastest {
    background: linear-gradient(90deg, #48d597 0%, #38b578 100%);
}

/* Performance value */
.chart-bar-value {
    flex: 0 0 100px;
    text-align: right;
    font-size: 0.8125rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 600;
    color: var(--text-secondary, #6c757d);
}

[data-theme="dark"] .chart-bar-value {
    color: var(--text-secondary, #adb5bd);
}

/* Details/summary for expanded info */
details.chart-details {
    margin-top: 0.75rem;
}

details.chart-details summary {
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-muted, #6c757d);
    user-select: none;
    list-style: none;
}

details.chart-details summary::-webkit-details-marker {
    display: none;
}

details.chart-details summary::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.2s ease;
    margin-right: 0.25rem;
}

details.chart-details[open] summary::before {
    transform: rotate(90deg);
}

details.chart-details summary:hover {
    color: var(--text-primary, #212529);
}

[data-theme="dark"] details.chart-details summary:hover {
    color: var(--text-primary, #e9ecef);
}

/* Mobile optimizations for charts */
@media (max-width: 767px) {
    .benchmark-chart-container {
        padding: 0.625rem;
    }

    .chart-bar-label {
        flex: 0 0 90px;
        font-size: 0.8125rem;
    }

    .chart-bar-track {
        height: 24px;
    }

    .chart-bar-value {
        flex: 0 0 75px;
        font-size: 0.75rem;
    }

    .chart-bar-row {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* Small screens - stack vertically if too cramped */
@media (max-width: 374px) {
    .chart-bar-row {
        flex-wrap: wrap;
    }

    .chart-bar-label {
        flex: 1 1 100%;
        margin-bottom: 0.25rem;
    }

    .chart-bar-track {
        flex: 1 1 auto;
        min-width: 0;
    }

    .chart-bar-value {
        flex: 0 0 auto;
    }
}
