/**
 * RR Scripts — Chart (tableau comparatif + histogramme horizontal).
 * Rendu 100 % serveur, aucune dépendance. Palette RR : teal / or.
 *
 * @package RR_Scripts
 */

.rr-chart {
    max-width: 1000px;
    margin: 0 auto;
}

.rr-chart__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--rr-script-text);
    margin: 0 0 1.25rem;
    text-align: center;
}

.rr-chart__note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--rr-script-text-soft);
    text-align: center;
    font-style: italic;
}

/* ==========================================================================
   TABLEAU
   ========================================================================== */

.rr-chart__table-wrap {
    overflow-x: auto;
    border: 1px solid var(--rr-script-border);
    border-radius: var(--rr-script-radius);
}

.rr-chart__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    color: var(--rr-script-text);
}

.rr-chart__table thead th {
    background: var(--rr-script-primary);
    color: #fff;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.rr-chart__table thead th.is-highlight {
    background: var(--rr-script-primary-hover);
}

.rr-chart__table tbody td {
    padding: 0.7rem 1rem;
    border-top: 1px solid var(--rr-script-border);
    vertical-align: top;
}

.rr-chart__table tbody tr:nth-child(even) {
    background: var(--rr-script-bg-alt);
}

.rr-chart__table tbody td.is-highlight {
    background: rgba(218, 180, 85, 0.15);
    font-weight: 600;
    color: var(--rr-script-primary);
}

.rr-chart__table tbody td:first-child {
    font-weight: 600;
}

/* ==========================================================================
   HISTOGRAMME HORIZONTAL
   ========================================================================== */

.rr-chart__bars {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.rr-chart__bar-row {
    display: grid;
    grid-template-columns: minmax(90px, 26%) 1fr;
    align-items: center;
    gap: 1rem;
}

.rr-chart__bar-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--rr-script-text);
    line-height: 1.3;
    text-align: right;
}

.rr-chart__bar-track {
    background: var(--rr-script-bg-alt);
    border-radius: 6px;
    overflow: hidden;
    height: 30px;
}

.rr-chart__bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.6rem;
    border-radius: 6px;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    transition: width 0.5s ease;
    min-width: 2.5rem;
}

.rr-chart__bar-fill--primary { background: linear-gradient(90deg, var(--rr-script-primary), var(--brand-green-light, #2b2b2b)); }
.rr-chart__bar-fill--accent  { background: linear-gradient(90deg, var(--color-accent-dark, #896a1e), var(--rr-script-accent)); color: #1b1b1b; }
.rr-chart__bar-fill--optimal { background: linear-gradient(90deg, #14685a, #1a7f5a); }
.rr-chart__bar-fill--warning { background: linear-gradient(90deg, #a8790a, #b8860b); }
.rr-chart__bar-fill--danger  { background: linear-gradient(90deg, #a5342a, #c0392b); }

.rr-chart__bar-value { pointer-events: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 600px) {
    .rr-chart__bar-row { grid-template-columns: 1fr; gap: 0.3rem; }
    .rr-chart__bar-label { text-align: left; }
    .rr-chart__table thead th,
    .rr-chart__table tbody td { padding: 0.6rem 0.75rem; font-size: 0.85rem; }
}
