/* Styles des pages Atténuation / Adaptation et Ressources
   (à charger après pages.css et mrv-pnb-cf.css, qui fournissent le hero,
   le fil d'Ariane, la mise en page, les listes de fichiers et le partage) */

/* ===== TYPO COMPLÉMENTAIRE ===== */
.content-main h3 {
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1.5rem 0 0.6rem;
    line-height: 1.5;
}
.content-main ul.bullets {
    margin: 0.5rem 0 1.5rem;
    list-style: none;
}
.content-main ul.bullets li {
    font-family: var(--font);
    font-size: 1rem;
    color: #2E3B34;
    line-height: 1.9;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.3rem;
}
.content-main ul.bullets li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--rouge);
    font-weight: 700;
}
.content-main .note {
    font-family: var(--font);
    font-size: 0.88rem;
    color: #4F5D55;
    background: #F6F9F7;
    padding: 0.9rem 1.3rem;
    border-radius: 8px;
    border-left: 4px solid var(--jaune);
    margin: 1rem 0 1.5rem;
    line-height: 1.7;
}
.content-main .note i {
    color: var(--rouge);
    margin-right: 0.5rem;
}
.content-main .section-title {
    border-bottom: 2px solid rgba(10, 107, 61, 0.15);
    padding-bottom: 0.5rem;
}

/* ===== CHIFFRES CLÉS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}
.kpi {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border-top: 3px solid var(--vert);
}
.kpi:nth-child(2) { border-top-color: var(--jaune); }
.kpi:nth-child(3) { border-top-color: var(--rouge); }
.kpi:nth-child(4) { border-top-color: var(--primary-color); }
.kpi .kpi-value {
    font-family: var(--font);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.kpi .kpi-label {
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    color: #6A7870;
    margin-top: 0.3rem;
    line-height: 1.4;
}

/* ===== TABLEAUX DE DONNÉES ===== */
.data-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    padding: 1.2rem;
    margin: 1rem 0 2rem;
}
.table-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}
.table-tools .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.table-tools select,
.table-tools input[type="search"] {
    font-family: var(--font);
    font-size: 0.85rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid #D3DED7;
    border-radius: 8px;
    background: #fff;
    color: var(--primary-color);
    min-width: 0;
}
.table-tools input[type="search"] { width: 220px; max-width: 100%; }
.table-tools select:focus,
.table-tools input:focus {
    outline: 2px solid rgba(10, 107, 61, 0.35);
    border-color: var(--vert);
}
.data-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font);
    font-size: 0.86rem;
}
table.data-table thead th {
    background: var(--vert);
    color: #fff;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 0.9rem;
    white-space: nowrap;
}
table.data-table thead th[data-sort] {
    cursor: pointer;
    user-select: none;
}
table.data-table thead th[data-sort]::after {
    content: ' ⇅';
    opacity: 0.55;
    font-size: 0.75rem;
}
table.data-table thead th.asc::after { content: ' ↑'; opacity: 1; }
table.data-table thead th.desc::after { content: ' ↓'; opacity: 1; }
table.data-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid #ECF1EE;
    color: #2E3B34;
    vertical-align: top;
}
table.data-table tbody tr:nth-child(even):not(.details-row) { background: #f9fbfd; }
table.data-table tbody tr:hover:not(.details-row) { background: #eef6f1; }
table.data-table td.num,
table.data-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.data-table tfoot td {
    font-weight: 700;
    color: var(--primary-color);
    background: #f0f6f2;
    border-top: 2px solid var(--vert);
}
table.data-table .empty-row td {
    text-align: center;
    color: #6A7870;
    font-style: italic;
}

/* Barre de progression dans un tableau */
.progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 110px;
}
.progress .bar {
    flex: 1;
    height: 6px;
    background: #E4ECE6;
    border-radius: 3px;
    overflow: hidden;
}
.progress .bar span {
    display: block;
    height: 100%;
    background: var(--vert);
    border-radius: 3px;
}
.progress .pct {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 2.8rem;
    text-align: right;
}

/* Badges */
.badge {
    display: inline-block;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}
.badge.realise { background: rgba(10, 107, 61, 0.12); color: #00753a; }
.badge.en_cours { background: rgba(201, 154, 30, 0.25); color: #7a6200; }
.badge.planifie { background: rgba(11, 61, 42, 0.08); color: var(--primary-color); }
.badge.attenuation { background: rgba(11, 61, 42, 0.08); color: var(--primary-color); }
.badge.adaptation { background: rgba(10, 107, 61, 0.12); color: #00753a; }
.badge.transversal { background: rgba(179, 18, 27, 0.08); color: var(--rouge); }

/* Ligne dépliable (cartographie) */
.row-toggle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: var(--vert);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    line-height: 24px;
    font-size: 0.9rem;
}
.row-toggle[aria-expanded="true"] { background: var(--rouge); }
tr.details-row td {
    background: #F6F9F7;
    font-size: 0.84rem;
    line-height: 1.7;
}
tr.details-row dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.2rem 1rem;
}
tr.details-row dt { font-weight: 600; color: var(--primary-color); }

/* ===== GRAPHIQUES ===== */
.chart-box {
    position: relative;
    height: 320px;
    width: 100%;
}
.chart-legend {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #4F5D55;
    margin-bottom: 0.6rem;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

/* ===== CARTE ===== */
#actions-map {
    height: 460px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 0;
}
.map-popup h4 {
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    line-height: 1.4;
}
.map-popup p { margin: 0.15rem 0 !important; font-size: 0.8rem; line-height: 1.5 !important; }
.map-count {
    font-size: 0.82rem;
    color: #6A7870;
    margin-top: 0.6rem;
}

/* ===== ONGLETS (Ressources) ===== */
.res-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #E3E9E5;
    padding-bottom: 0.8rem;
}
.res-tabs .tab-btn {
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid #D3DED7;
    background: #fff;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}
.res-tabs .tab-btn:hover { border-color: var(--vert); color: var(--vert); }
.res-tabs .tab-btn.active {
    background: var(--vert);
    border-color: var(--vert);
    color: #fff;
}
.res-tabs .tab-btn i { margin-right: 0.4rem; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Liste de documents (lois, politiques...) */
.doc-list { display: grid; gap: 0.8rem; margin: 1rem 0 2rem; }
.doc-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    transition: var(--transition);
}
.doc-item:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05); transform: translateY(-1px); }
.doc-item .doc-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(179, 18, 27, 0.08);
    color: var(--rouge);
    font-size: 1.2rem;
}
.doc-item .doc-icon.link { background: rgba(10, 107, 61, 0.1); color: var(--vert); }
.doc-item .doc-body { flex: 1; min-width: 0; }
.doc-item .doc-title {
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.5;
    display: block;
}
a.doc-item:hover .doc-title { color: var(--rouge); }
.doc-item .doc-meta {
    font-size: 0.78rem;
    color: #6A7870;
    margin-top: 0.15rem;
    display: block;
}
.doc-item .doc-desc {
    font-size: 0.85rem;
    color: #4F5D55;
    line-height: 1.6;
    margin-top: 0.2rem;
    display: block;
}
.doc-item .doc-url {
    font-size: 0.78rem;
    color: var(--vert);
    word-break: break-all;
}

/* Glossaire */
.glossary { display: grid; gap: 0.7rem; margin: 1rem 0 2rem; }
.glossary details {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 0.8rem 1.1rem;
}
.glossary summary {
    font-family: var(--font);
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.92rem;
}
.glossary details[open] summary { color: var(--vert); margin-bottom: 0.4rem; }
.glossary details p { margin: 0 !important; font-size: 0.9rem !important; line-height: 1.7 !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .chart-box { height: 260px; }
    #actions-map { height: 340px; }
    .table-tools { flex-direction: column; align-items: stretch; }
    .table-tools .filters select { flex: 1; }
    .table-tools input[type="search"] { width: 100%; }
    .kpi .kpi-value { font-size: 1.4rem; }
}

/* ===== ARABE (RTL) ===== */
html[dir="rtl"] table.data-table thead th,
html[dir="rtl"] table.data-table td { text-align: right; }
html[dir="rtl"] table.data-table td.num,
html[dir="rtl"] table.data-table th.num { text-align: left; }
html[dir="rtl"] .content-main ul.bullets li { padding-left: 0; padding-right: 1.5rem; }
html[dir="rtl"] .content-main ul.bullets li::before { left: auto; right: 0; content: '◂'; }
html[dir="rtl"] .content-main .note { border-left: none; border-right: 4px solid var(--jaune); }
html[dir="rtl"] .content-main .note i,
html[dir="rtl"] .res-tabs .tab-btn i { margin-right: 0; margin-left: 0.4rem; }
html[dir="rtl"] .progress .pct { text-align: left; }

/* ===== PILIERS / ÉTUDE DE CAS (Soutiens) ===== */
.pillar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}
.pillar {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.1rem 1.3rem 0.4rem;
    border-top: 3px solid var(--vert);
}
.pillar h3 { margin-top: 0 !important; }
.pillar ul.bullets li { font-size: 0.9rem; line-height: 1.7; }
.case-study {
    background: var(--vert-pale);
    border: 1px solid rgba(10, 107, 61, 0.15);
    border-radius: 10px;
    padding: 1.2rem 1.4rem 0.4rem;
    margin: 1rem 0 2rem;
}
.case-study h3 { margin-top: 0 !important; color: var(--vert-fonce) !important; }
.case-study h3 i { color: var(--or); margin-inline-end: 0.4rem; }

/* Formule mise en avant */
.content-main p.formula {
    display: inline-block;
    font-weight: 700;
    color: var(--vert-fonce);
    background: var(--vert-pale);
    border-inline-start: 4px solid var(--or);
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
}

/* Cartes d'acteurs (Parties prenantes) */
.actor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.9rem;
    margin: 1rem 0 2rem;
}
.actor {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem 1.1rem;
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}
.actor .actor-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--vert-pale);
    color: var(--vert);
    display: flex;
    align-items: center;
    justify-content: center;
}
.actor strong { display: block; color: var(--vert-fonce); font-size: 0.9rem; line-height: 1.4; }
.actor span { display: block; font-size: 0.8rem; color: #4F5D55; line-height: 1.55; margin-top: 0.2rem; }

/* Schéma en étapes (cycle des données) */
.flow-steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
    margin: 1rem 0 2rem;
    counter-reset: none;
}
.flow-steps li {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 3px solid var(--vert);
    border-radius: 8px;
    padding: 1rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.flow-steps li:nth-child(even) { border-top-color: var(--or); }
.flow-steps li:not(:last-child)::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    inset-inline-end: -0.75rem;
    transform: translateY(-50%);
    color: var(--or);
    font-size: 0.8rem;
    z-index: 1;
}
.flow-steps .flow-num {
    position: absolute;
    top: 0.6rem;
    inset-inline-end: 0.7rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: #9DBBA9;
}
.flow-steps i { color: var(--vert); font-size: 1.2rem; }
.flow-steps strong { color: var(--vert-fonce); font-size: 0.92rem; }
.flow-steps span:not(.flow-num) { font-size: 0.8rem; color: #4F5D55; line-height: 1.55; }
html[dir="rtl"] .flow-steps li:not(:last-child)::after { content: '\f053'; }
@media (max-width: 1100px) { .flow-steps { grid-template-columns: repeat(3, 1fr); } .flow-steps li::after { display: none; } }
@media (max-width: 600px) { .flow-steps { grid-template-columns: 1fr; } }

/* Figure à fournir (remplace les anciennes images d'attente) */
.figure-todo {
    margin: 1rem 0 1.5rem;
    border: 2px dashed #C9DACF;
    border-radius: 10px;
    background: var(--vert-pale);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 1.5rem;
    text-align: center;
}
.figure-todo i { font-size: 2.2rem; color: #9DBBA9; }
.figure-todo figcaption { font-size: 0.85rem; color: #4F5D55; font-weight: 500; }
.flow-steps.mrv-trio { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) { .flow-steps.mrv-trio { grid-template-columns: 1fr; } }
