/* ==========================================================================
   Visualizations Page Styles
   ========================================================================== */

/* ---------- Header & Nav ---------- */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 1.1em;
}

.nav {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.nav a {
    color: #667eea;
    text-decoration: none;
    margin-right: 20px;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover {
    color: #764ba2;
}

/* ---------- Layout ---------- */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* ---------- Controls ---------- */
.controls {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 0.9em;
}

.control-group select {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

#cpu1Select:focus, #cpu2Select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ---------- Filters ---------- */
.filters-section {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.filters-section h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.filter-select-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-select {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.filter-checkbox-item label {
    font-weight: normal;
    margin: 0;
    cursor: pointer;
    font-size: 0.9em;
    color: #475569;
    user-select: none;
}

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

.filter-action-btn {
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-action-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.filter-action-btn:active {
    background: #e2e8f0;
}

/* ---------- Charts ---------- */
.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

#chart {
    min-height: 600px;
    width: 100%;
}

/* ---------- Download button ---------- */
.download-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

/* ---------- Bar limit ---------- */
.bar-limit-group {
    margin-bottom: 15px;
    text-align: right;
}

.bar-limit-group label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
    color: #334155;
}

.bar-limit-group input {
    width: 100px;
    padding: 8px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

/* ---------- Stats cards ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #64748b;
    font-size: 0.9em;
}

/* ---------- CPU Comparison ---------- */
.comparison-controls {
    max-width: 800px;
    margin: 0 auto 30px;
}

.comparison-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.comparison-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    text-align: center;
}

.comparison-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.compare-btn-container {
    text-align: center;
}

.compare-btn {
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.compare-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.compare-btn:active:not(:disabled) {
    transform: translateY(0);
}

.compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.comparison-download-row {
    text-align: right;
    margin-bottom: 15px;
}

/* ---------- Comparison table ---------- */
.comparison-table-container {
    max-width: 1200px;
    margin: 0 auto;
}

.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.comparison-table thead tr {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.comparison-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #e2e8f0;
}

.comparison-table th:first-child {
    text-align: left;
}

/* ---------- Comparison cell styles ---------- */
.comparison-label-cell {
    padding: 16px 20px;
    font-weight: 600;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.comparison-value-cell {
    padding: 16px 20px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
}

.comparison-value {
    color: #1e293b;
    font-weight: 500;
}

.comparison-diff-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.diff-better {
    background: #d1fae5;
    color: #065f46;
}

.diff-worse {
    background: #fee2e2;
    color: #991b1b;
}

.diff-same {
    background: #f1f5f9;
    color: #475569;
}

.diff-different {
    background: #fffbeb;
    color: #d97706;
}

.highlight-better {
    background: #d1fae5;
}

.highlight-worse {
    background: #fee2e2;
}

.row-even {
    background: #f8fafc;
}

.row-odd {
    background: #ffffff;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .container {
        padding: 15px;
    }

    .controls {
        padding: 15px;
    }

    .controls-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-select {
        min-width: 100%;
    }

    .filter-checkbox-group {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        max-height: 150px;
    }

    .filters-section {
        padding: 15px;
    }

    .chart-container {
        padding: 15px;
    }

    .chart-title {
        font-size: 1.1em;
    }

    #chart {
        min-height: 400px;
        margin-bottom: 20px;
    }

    .js-plotly-plot {
        overflow-x: auto;
    }

    .chart-container:last-child {
        margin-bottom: 40px;
        padding-bottom: 30px;
    }

    html {
        scroll-behavior: smooth;
    }

    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Comparison table mobile */
    .chart-container:last-child {
        padding: 15px 10px !important;
    }

    .comparison-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
        width: calc(100% + 20px);
    }

    .comparison-table {
        min-width: 650px !important;
        font-size: 11px;
        width: 100%;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 5px;
        font-size: 10px;
        white-space: nowrap;
    }

    .comparison-table th:first-child,
    .comparison-table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 10;
        min-width: 110px;
        max-width: 110px;
    }

    .comparison-table th:not(:first-child),
    .comparison-table td:not(:first-child) {
        min-width: 120px;
    }

    .comparison-label-cell,
    .comparison-value-cell {
        padding: 10px 6px;
    }

    .comparison-controls {
        padding: 0 10px;
    }

    .comparison-selectors {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .download-btn {
        padding: 8px 16px;
        font-size: 13px;
        margin-top: 10px;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.5em;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #downloadChart {
        width: 100%;
        justify-content: center;
    }

    .bar-limit-group {
        width: 100%;
        text-align: left !important;
    }

    .bar-limit-group label {
        display: block;
        margin-bottom: 5px;
    }

    .bar-limit-group input {
        width: 100%;
    }
}
