/* =========================
   Per-chart platform filter
   -------------------------
   Lives inline in a chart card's header (only rating-trend and
   review-volume have one — see the comment on their markup) rather than
   the shared sidebar, so it's obvious at a glance which chart it applies
   to instead of looking like a global filter that silently does nothing
   to the other five cards.
========================= */
.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;

    margin-bottom: 10px;
}

.chart-card-header h3 {
    margin-bottom: 0;
}

.platform-checkboxes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;

    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.platform-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.platform-checkboxes input[type="checkbox"] {
    height: auto;
    width: auto;
}

#backToFeedbacks {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 38px;
    padding: 0 12px;

    border-radius: 8px;
    border: 1px solid var(--border);

    color: var(--foreground);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;

    transition: 0.15s ease;
}

#backToFeedbacks:hover {
    background: var(--muted);
}

/* =========================
   Analytics content
========================= */
.analytics-content {
    flex: 1;
    min-width: 0;
}

.analytics-error {
    padding: 10px 14px;
    margin-bottom: 16px;

    border-radius: 8px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;

    font-size: 13px;
}

body.dark .analytics-error {
    border-color: #7f1d1d;
    background: #2a1414;
    color: #fca5a5;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;

    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-foreground);
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;

    min-width: 0;
    /* Chart.js sizes its canvas to this box's height — without a fixed
       height a responsive canvas has nothing to bound it and grows
       unbounded on every redraw. */
    height: 320px;
    display: flex;
    flex-direction: column;
}

.chart-card--wide {
    grid-column: 1 / -1;
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.chart-card canvas {
    flex: 1;
    min-height: 0;
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted-foreground);
    font-size: 13px;
}

/* =========================
   Dark mode
========================= */
body.dark .stat-card,
body.dark .chart-card {
    background: #111;
    border-color: #27272a;
}

body.dark .platform-checkboxes {
    border-color: #27272a;
}

/* =========================
   Responsive
========================= */
@media (max-width: 900px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }
}

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

    .chart-card {
        height: 280px;
    }
}
