/* =========================================================
   H2 – STYLE UNIFIÉ PREMIUM (gris clair)
   ========================================================= */

/* Style général de tous les H2 dans race-content */
.race-content h2 {
    position: relative;
    padding: 16px 24px;
    margin: 24px 0 24px 0;
    border-radius: 10px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #2d2d2d;
    background: rgba(0,0,0,0.04); /* Gris premium */
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* Réduire le premier H2 (Présentation générale) */
.race-content h2:first-of-type {
    margin-top: 8px !important;
}

/* Texte du H2 quand la note est injectée */
.race-content h2 .h2-text {
    flex: 1;
}

/* Bloc note moyenne (étoiles + valeur) */
.race-content h2 .section-note {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.race-content h2 .section-note .stars {
    font-size: 1.1rem;
    line-height: 1;
}

.race-content h2 .section-note .note-value {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .race-content h2 {
        font-size: 1.35rem;
        padding: 14px 18px;
    }
}

/* H2 avec note moyenne */
.race-content h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.race-content h2 .h2-text {
    flex: 1;
}

.race-content h2 .section-note {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.race-content h2 .section-note .stars {
    font-size: 1.1rem;
}

.race-content h2 .section-note .note-value {
    font-size: 0.9rem;
    opacity: 0.9;
}


/******************************************
 * BUDGET – Bloc 2 colonnes premium (centré)
 ******************************************/

.race-budget-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding: 28px 28px;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin: 30px 0 40px;
    text-align: center;
}

.budget-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.budget-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d2d2d;
    margin-bottom: 8px;
}

.budget-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #452D16;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .race-budget-box {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px 20px;
    }

    .budget-value {
        font-size: 1.2rem;
    }
}

.race-budget-table tbody td {
    text-align: center;
}

/* Réduit l'espace avant le premier H2 "Présentation générale" */
.race-content h2:first-of-type {
    margin-top: 8px !important;
}

/* =========================================================
   TABLEAUX AVEC BARRES ORANGES – race-rating-table
   ========================================================= */

.race-rating-table {
    display: block !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

/* Supprime les bordures internes */
.race-rating-table table {
    border: none !important;
    border-collapse: collapse !important;
}

/* Transforme les lignes en blocs */
.race-rating-table tbody {
    display: block;
}

.race-rating-table tr {
    display: block;
    margin-bottom: 14px;
    border: none !important;
    padding: 0 !important;
}

.race-rating-table tr:last-child {
    margin-bottom: 0;
}

/* Première cellule = Titre centré */
.race-rating-table td:first-child {
    display: block;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d2d2d;
    margin-bottom: 8px;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Deuxième cellule = Barre + labels */
.race-rating-table td:last-child {
    display: block;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* =========================================================
   BARRES ORANGE – VERSION CENTRÉE (max-width 720px)
   ========================================================= */

/* Container barre horizontale */
.race-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 720px;
    margin: 10px auto 6px auto; /* centre + marges verticales */
}

/* Barre neutre */
.race-bar {
    position: relative;
    height: 10px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    flex: 1;
    min-width: 150px;
}

/* Barre remplie ORANGE */
.race-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #EA7D1F;
    border-radius: 6px;
    transition: width 0.4s ease;
}

/* Labels gauche/droite */
.race-bar-labels {
    max-width: 720px;
    margin: 0 auto 14px auto;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #444;
    font-weight: 500;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .race-bar-container,
    .race-bar-labels {
        max-width: 92%; /* marges équilibrées */
    }

    .race-bar {
        height: 8px; /* barre plus fine en mobile */
    }
}


/* Valeurs dynamiques (ACF) */
.race-bar[data-level="1"] .race-bar-fill { width: 20%; }
.race-bar[data-level="2"] .race-bar-fill { width: 40%; }
.race-bar[data-level="3"] .race-bar-fill { width: 60%; }
.race-bar[data-level="4"] .race-bar-fill { width: 80%; }
.race-bar[data-level="5"] .race-bar-fill { width: 100%; }

/* Cache les en-têtes automatiquement */
.race-rating-table thead {
    display: none !important;
}

/* =========================================================
   TABLEAU BUDGET PREMIUM — race-budget-table (VERSION FINALE)
   ========================================================= */

/* Wrapper Gutenberg */
figure.wp-block-table.race-budget-table {
    max-width: 900px;
    margin: 30px auto 40px auto !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: 1px solid #e6e6e6 !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;
    overflow: hidden;
}

/* Tableau interne */
.race-budget-table table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: #ffffff !important;
    border: none !important;
}

/* En-têtes */
.race-budget-table thead th {
    background: #fafafa !important;
    padding: 16px 22px !important;
    font-size: 1rem;
    font-weight: 700;
    color: #523a1c;
    text-align: center;
    border-bottom: 1px solid #e5e5e5 !important;
    border-right: none !important;
}

/* Cellules */
.race-budget-table tbody td {
    padding: 16px 22px !important; /* Réduction = corrige le gros espace bas */
    text-align: center;
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    border: none !important;
}

/* Pas de séparateurs verticaux */
.race-budget-table thead th:not(:last-child),
.race-budget-table tbody td:not(:last-child) {
    border-right: none !important;
}

/* Hover */
.race-budget-table tbody tr:hover td {
    background: #fafafa !important;
}

/* Cleanup total des bordures Gutenberg */
figure.wp-block-table.race-budget-table table,
figure.wp-block-table.race-budget-table th,
figure.wp-block-table.race-budget-table td,
figure.wp-block-table.race-budget-table tr {
    border: none !important;
    box-shadow: none !important;
}
