:root {
    --page-bg: #f6f7fb;
    --panel-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-main: #14171f;
    --text-muted: #4b5563;
    --text-light: #94a3b8;
    --brand-color: #0f62fe;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.comparison-page {
    background-color: var(--page-bg);
    color: var(--text-main);
    font-family: "Inter", "Pretendard", sans-serif;
}

.comparison-surface {
    max-width: 1600px;
    margin: 0 auto;
    padding: clamp(24px, 6vw, 40px) clamp(16px, 4vw, 28px) 48px;
}

.comparison-header {
    margin-bottom: 2rem;
}

.breadcrumbs {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

.title {
    margin: 0.25rem 0 0;
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 800;
}

.subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.control-panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: -0.5rem; /* Reduce gap before search */
}

.checklist-actions {
    display: flex;
    gap: 0.5rem;
}

.checklist-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-color);
    cursor: pointer;
}

.checklist-btn:hover {
    text-decoration: underline;
}

.control-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.camera-search input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 1rem;
}

.camera-checklist {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
}

.camera-checklist label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.camera-checklist label:hover {
    background-color: #f6f7fb;
}

.camera-checklist input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-color);
}

#dateRangeSelector {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.run-button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background-color: var(--brand-color);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.run-button:hover {
    background-color: #0043ce;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    flex-shrink: 0; /* Do not shrink when legend grows */
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

.chart-body {
    height: 450px;
    position: relative; /* For positioning the placeholder */
}

.chart-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.6;
    background-color: #fdfdfd;
    border-radius: 8px;
}

#comparisonChart {
    display: none; /* Initially hidden */
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: flex-end;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
    font-weight: 600;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.ranked-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ranked-list li {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    font-weight: 600;
}

.rank {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-light);
    width: 20px;
    text-align: center;
}

.item-name {
    flex-grow: 1;
}

.item-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--brand-color);
}

@media (max-width: 1200px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    .control-panel {
        position: static;
    }
}
