/* Thème sombre. Bootstrap reçoit aussi data-bs-theme="dark" (base.html) : formulaires, tableaux, menus, fenêtres et
   accordéons s'adaptent seuls. Cette feuille traite le reste : textes gris, verts foncés et fonds blancs écrits en dur.
   Toute règle est sous [data-theme="dark"] : le thème clair n'est pas touché. */
[data-theme="dark"] {
    color-scheme: dark;
    --bs-body-color: #e2e8f0;
    --bs-body-color-rgb: 226, 232, 240;
    --bs-body-bg: #131d2b;
    --bs-body-bg-rgb: 19, 29, 43;
    --bs-emphasis-color: #f1f5f9;
    --bs-emphasis-color-rgb: 241, 245, 249;
    --bs-secondary-color: #a9b7c8;
    --bs-secondary-color-rgb: 169, 183, 200;
    --bs-tertiary-color: #94a3b8;
    --bs-secondary-bg: #1f2c3f;
    --bs-tertiary-bg: #1b2738;
    --bs-tertiary-bg-rgb: 27, 39, 56;
    --bs-border-color: rgba(255, 255, 255, 0.16);
    --bs-border-color-translucent: rgba(255, 255, 255, 0.16);
    --bs-link-color: #7cc0ff;
    --bs-link-color-rgb: 124, 192, 255;
    --bs-link-hover-color: #a9d6ff;
    --bs-link-hover-color-rgb: 169, 214, 255;
    --bs-code-color: #ff9ecb;
    --dark-green-text: #86d9a5;
}

/* Textes */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary { color: #a9b7c8 !important; }
[data-theme="dark"] .text-dark:not(.bg-warning):not(.bg-info):not(.bg-yellow):not(.btn-warning):not(.btn-yellow):not(.btn-light),
[data-theme="dark"] .text-black,
[data-theme="dark"] .text-body { color: #e2e8f0 !important; }
[data-theme="dark"] .bg-warning:not([class*="bg-opacity"]) .text-dark,
[data-theme="dark"] .btn-warning .text-dark,
[data-theme="dark"] .bg-yellow .text-dark { color: #212529 !important; }
[data-theme="dark"] .text-success { color: #63d297 !important; }
[data-theme="dark"] .text-primary { color: #85bbff !important; }
[data-theme="dark"] .text-danger { color: #ff8f8f !important; }
[data-theme="dark"] .text-info { color: #6edff6 !important; }
[data-theme="dark"] .btn-success .text-success,
[data-theme="dark"] .bg-success:not([class*="bg-opacity"]) .text-success { color: #fff !important; }

/* Vert foncé de la marque utilisé comme couleur de texte */
[data-theme="dark"] [style^="color: var(--color-dark-green)"],
[data-theme="dark"] [style^="color:var(--color-dark-green)"],
[data-theme="dark"] [style*="; color: var(--color-dark-green)"],
[data-theme="dark"] [style*=";color:var(--color-dark-green)"],
[data-theme="dark"] [style*="; color:var(--color-dark-green)"],
[data-theme="dark"] [style^="color: #0b4629"],
[data-theme="dark"] [style*="; color: #0b4629"]:not([style*="#7fd47d"]),
[data-theme="dark"] [style^="color: #0d4428"],
[data-theme="dark"] [style*="; color: #0d4428"] { color: var(--dark-green-text) !important; }
[data-theme="dark"] .pc-price strong,
[data-theme="dark"] .stat-number,
[data-theme="dark"] .pc-avatar { color: var(--dark-green-text); }

/* Fonds blancs ou clairs */
[data-theme="dark"] .bg-white:not([class*="bg-opacity"]) { background-color: #1b2738 !important; }
[data-theme="dark"] .bg-light:not([class*="bg-opacity"]),
[data-theme="dark"] .bg-body-tertiary { background-color: #1b2738 !important; }
[data-theme="dark"] .border-light { border-color: rgba(255, 255, 255, 0.12) !important; }
[data-theme="dark"] .card { --bs-card-bg: var(--bg-card); --bs-card-cap-bg: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .step-card { background: var(--bg-card); }

/* Boutons contour */
[data-theme="dark"] .btn-outline-success { --bs-btn-color: #7fdcab; --bs-btn-border-color: #3f9a6c; }
[data-theme="dark"] .btn-outline-secondary { --bs-btn-color: #b9c5d3; --bs-btn-border-color: #5b6b80; }
[data-theme="dark"] .btn-outline-dark { --bs-btn-color: #e2e8f0; --bs-btn-border-color: #5b6b80; --bs-btn-hover-color: #0a111a; --bs-btn-hover-bg: #e2e8f0; --bs-btn-hover-border-color: #e2e8f0; }
[data-theme="dark"] .btn-outline-primary { --bs-btn-color: #85bbff; --bs-btn-border-color: #3d7dd1; }
[data-theme="dark"] .btn-outline-danger { --bs-btn-color: #ff8f8f; --bs-btn-border-color: #b4505a; }

/* Dégradés allant vers le vert clair : le blanc n'y est plus lisible en thème sombre */
[data-theme="dark"] [style*="linear-gradient(135deg, var(--color-dark-green)"][style*="var(--color-light-green)"],
[data-theme="dark"] .premium-badge { background: linear-gradient(135deg, #0b4629, #157347) !important; }

/* Cas particuliers : fonds clairs écrits dans les pages */
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] .desktop-map-switcher,
[data-theme="dark"] .mobile-sticky-actions { background: #1b2738 !important; }
[data-theme="dark"] [style*="background-color: #fff9e6"],
[data-theme="dark"] .payment-box { background: #2a2515 !important; border-color: #6b5a1e !important; }
[data-theme="dark"] [style*="background-color: #e9f7ef"],
[data-theme="dark"] [style*="background-color: #f8fff8"],
[data-theme="dark"] .developer-box { background: #14281f !important; border-color: #2c5a43 !important; }
[data-theme="dark"] [style*="background-color: #f0f7ff"] { background: #152437 !important; }
[data-theme="dark"] [style*="background-color: #fff5f5"] { background: #2e1a1e !important; }
[data-theme="dark"] [style*="background: rgba(255, 255, 255, 0.7)"] { background: rgba(255, 255, 255, 0.05) !important; }
[data-theme="dark"] [style*="linear-gradient(135deg, #f6fbf7"] { background: transparent !important; }
[data-theme="dark"] [style*="color: #664d03"] { color: #ffda6a !important; }
[data-theme="dark"] .boosted-section { background: rgba(255, 255, 255, 0.04) !important; }

/* Pastilles et boutons restés clairs : leur texte garde sa couleur d'origine */
[data-theme="dark"] [style*="background: rgba(255, 255, 255, 0.9"][style*="color: #0b4629"],
[data-theme="dark"] [style*="background-color: #f8fafc"][style*="color: #0b4629"],
[data-theme="dark"] [style*="background-color: var(--color-light-green)"][style*="color: var(--color-dark-green)"],
[data-theme="dark"] .btn-warning[style*="color: var(--color-dark-green)"],
[data-theme="dark"] .btn-light[style*="color: var(--color-dark-green)"],
[data-theme="dark"] .btn-light [style*="color: var(--color-dark-green)"] { color: #0b4629 !important; }
[data-theme="dark"] [style*="background: rgba(255, 255, 255, 0.9"] .text-warning { color: #b45309 !important; }
[data-theme="dark"] .btn-light.text-success,
[data-theme="dark"] .btn-light .text-success { color: #157347 !important; }

/* Éléments propres à une page */
[data-theme="dark"] .project-header-badge,
[data-theme="dark"] .job-chip,
[data-theme="dark"] .job-side a.active,
[data-theme="dark"] .info-icon { color: var(--dark-green-text); }
[data-theme="dark"] .btn-msg-profile { color: var(--dark-green-text) !important; }
[data-theme="dark"] .step-number { color: rgba(127, 212, 125, 0.3); }
[data-theme="dark"] .filter-chip.active { background: #157347; color: #fff; }
[data-theme="dark"] .btn-account-nav { background: linear-gradient(135deg, #b45309, #92400e); }
[data-theme="dark"] .btn-call-profile { background: linear-gradient(135deg, #047857, #065f46); }
[data-theme="dark"] .chat-filter-tabs .filter-tab-btn.active { background: #047857; }
[data-theme="dark"] .text-white-50 { color: rgba(255, 255, 255, 0.72) !important; }
[data-theme="dark"] .chat-search-input::placeholder { color: #a9b7c8; }

/* Assistant NOHAN */
[data-theme="dark"] #nohan-chat .card-body { background-color: #0f1826 !important; }
[data-theme="dark"] #nohan-chat [style*="color: #2d3748"] { color: #e2e8f0 !important; }
[data-theme="dark"] .nohan-msg-ai,
[data-theme="dark"] .nohan-property-card { background: #1b2738; color: #e2e8f0; border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .nohan-quick-btn { background: transparent; color: var(--dark-green-text); border-color: #3f9a6c; }
[data-theme="dark"] [style*="linear-gradient(135deg, #f8fdf9"] { background: #14281f !important; border-color: #2c5a43 !important; }
[data-theme="dark"] [style*="color: #495057"],
[data-theme="dark"] [style*="color: #7f8c8d"] { color: #cbd5e1 !important; }

/* Cartes : bulles d'information */
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip { background: #1b2738; color: #e2e8f0; }
[data-theme="dark"] .leaflet-popup-content [style*="color: #1e293b"] { color: #f1f5f9 !important; }
[data-theme="dark"] .bg-warning[class*="bg-opacity"] { color: #ffd05a !important; }
[data-theme="dark"] .bg-info[class*="bg-opacity"] { color: #6edff6 !important; }
[data-theme="dark"] .bg-warning:not([class*="bg-opacity"]) h2,
[data-theme="dark"] .bg-warning:not([class*="bg-opacity"]) p { color: #212529; }
