/**
 * css/views/chart_view.css
 * Version : V17.0.0 - Scorecards + Adjacent & Borderless
 * - Remplacement header select par scorecards cliquables
 * - Ajustement hauteurs header/body pour accommoder les scorecards
 */

/* ── 1. Carte Graphique — structure flex ──────────────────────── */
.chart-container-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    width: 100%;

    /* Hauteur verrouillée — inchangée */
    height: 550px;
    min-height: 550px;
    max-height: 550px;
    box-sizing: border-box;
    overflow: hidden;
}

/* ── 2. Header — conteneur des scorecards ─────────────────────── */
/* Avant : height: 44px (aligné select). Après : auto, les scorecards dictent. */
.chart-header {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    margin-bottom: 16px;
    height: auto;
    min-height: 100px;
}

/* ── 3. Canvas body — espace restant sous le header ──────────── */
/* Avant : height: calc(100% - 64px). Recalculé pour le nouveau header (~120px) + margin. */
.chart-body {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0; /* Permet à flex: 1 de fonctionner correctement dans un parent overflow:hidden */
}

/* ── 4. Scorecards container ──────────────────────────────────── */
.chart-scorecards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── 5. Scorecard individuelle ────────────────────────────────── */
.chart-scorecard {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--border); /* couleur écrasée inline en JS selon la métrique */
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-card);
    transition: background 0.15s ease, border-top-color 0.15s ease, opacity 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

.chart-scorecard:hover {
    background: var(--bg-hover, #f5f5f5);
}

/* État actif — border-top plus épaisse, fond teinté appliqué inline en JS */
.chart-scorecard--active {
    border-top-width: 4px;
}

/* ── 6. Contenu interne scorecard ─────────────────────────────── */
.scorecard-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scorecard-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

.scorecard-prev {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── 7. Scorecards inactives — atténuées ─────────────────────── */
.chart-scorecard:not(.chart-scorecard--active) .scorecard-value {
    opacity: 0.5;
}

.chart-scorecard:not(.chart-scorecard--active) .scorecard-prev {
    opacity: 0.4;
}

/* Note : .ui-select est géré par components.css (conservé pour compatibilité) */