/* Charte graphique globale — palette bleue */
:root {
    --brand-blue-950: #061a33;
    --brand-blue-900: #0a2a52;
    --brand-blue-800: #0b3d78;
    --brand-blue-700: #0b57d0;
    --brand-blue-600: #1a73e8;
    --brand-blue-500: #3b82f6;
    --brand-blue-100: #dbeafe;
    --brand-blue-50: #f3f7ff;
    --md-primary: var(--brand-blue-600) !important;
    --md-primary-dark: var(--brand-blue-800) !important;
    --primary: var(--brand-blue-600) !important;
    --primary-dark: var(--brand-blue-800) !important;
    --background: var(--brand-blue-50) !important;
    --bg: var(--brand-blue-50) !important;
}

body {
    background-color: var(--brand-blue-50) !important;
}

.main-navbar,
.navbar.bg-dark {
    background: linear-gradient(100deg, var(--brand-blue-950), var(--brand-blue-900) 62%, var(--brand-blue-800)) !important;
    border-bottom: 1px solid rgba(147, 197, 253, .2);
}

.actions-hero,
.article-hero,
.articles-hero,
.best-hero,
.country-hero,
.dashboard-hero,
.glossary-hero,
.growth-hero,
.hero,
.hero-section,
.indices-hero,
.initiation-hero,
.news-hero,
.profile-hero,
.qcm-hero,
.sgi-hero {
    color: #fff !important;
    background: linear-gradient(135deg, var(--brand-blue-950) 0%, var(--brand-blue-700) 58%, var(--brand-blue-500) 125%) !important;
    box-shadow: 0 14px 32px rgba(11, 87, 208, .22) !important;
}

.material-card,
.card-md,
.filter-card,
.price-chart-card,
.retention-card,
.conclusions-card,
.evolution-card,
.news-card {
    border-color: rgba(59, 130, 246, .12) !important;
    box-shadow: 0 4px 16px rgba(30, 64, 175, .08) !important;
}

.section-header,
.section-title,
.filter-label {
    color: var(--brand-blue-700);
}

.material-card a:not(.btn),
.card-md a:not(.btn) {
    color: var(--brand-blue-700);
}

.btn-primary,
.bg-primary {
    background-color: var(--brand-blue-700) !important;
    border-color: var(--brand-blue-700) !important;
}

.btn-primary {
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-blue-800) !important;
    border-color: var(--brand-blue-800) !important;
}

.btn-outline-primary {
    color: var(--brand-blue-700) !important;
    border-color: var(--brand-blue-600) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff !important;
    background-color: var(--brand-blue-700) !important;
}

.text-primary {
    color: var(--brand-blue-700) !important;
}

.bg-primary-subtle,
.bg-primary.bg-opacity-10 {
    background-color: var(--brand-blue-100) !important;
}

/* Conserve la transparence demandée par Bootstrap au lieu de transformer les
   fonds translucides en aplats bleu foncé. */
.bg-primary.bg-opacity-25 {
    background-color: rgba(11, 87, 208, .25) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .16) !important;
}

.nav-pills .nav-link.active,
.pagination .page-item.active .page-link,
.chart-periods .period-btn.active {
    color: #fff !important;
    background-color: var(--brand-blue-700) !important;
    border-color: var(--brand-blue-700) !important;
}

table thead th,
#actionsTable thead th,
#indicesTable thead th,
#bonds thead th {
    color: #fff !important;
    background-color: var(--brand-blue-800) !important;
}

table thead th a,
#actionsTable thead th a,
#indicesTable thead th a,
#bonds thead th a {
    color: #fff !important;
}

footer.bg-dark {
    background: var(--brand-blue-950) !important;
    border-top: 1px solid rgba(147, 197, 253, .18);
}

/* Les couleurs sémantiques restent intactes pour les performances et alertes. */
.text-success { color: #137333 !important; }
.text-danger { color: #c5221f !important; }

/* Garde-fous de contraste WCAG pour les combinaisons de classes utilitaires. */
.bg-white.text-white:not([class*="bg-opacity-"]),
.bg-light.text-white:not([class*="bg-opacity-"]) {
    color: #1f2937 !important;
}

.bg-primary:not([class*="bg-opacity-"]),
.bg-success:not([class*="bg-opacity-"]),
.bg-danger:not([class*="bg-opacity-"]),
.bg-dark:not([class*="bg-opacity-"]) {
    color: #fff !important;
}

.bg-primary:not([class*="bg-opacity-"]) :is(.text-dark, .text-black, .text-primary),
.bg-success:not([class*="bg-opacity-"]) :is(.text-dark, .text-black, .text-primary),
.bg-danger:not([class*="bg-opacity-"]) :is(.text-dark, .text-black, .text-primary),
.bg-dark:not([class*="bg-opacity-"]) :is(.text-dark, .text-black, .text-primary) {
    color: #fff !important;
}

/* Thème sombre associé à la préférence du compte utilisateur. */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body {
    color: #e5e7eb !important;
    background-color: #0f172a !important;
    background-image: none !important;
}
html[data-theme="dark"] :is(.card, .material-card, .section-box, .modal-content, .dropdown-menu, .offcanvas, .list-group-item, .table-responsive) {
    color: #e5e7eb !important;
    background-color: #172033 !important;
    border-color: #334155 !important;
}
html[data-theme="dark"] :is(.asset-card, .detail-card, .price-chart-card, .filter-card, .news-card, .conclusions-card, .evolution-card, .retention-card, .profile-tabs, .accordion-item, dialog) {
    color:#e5e7eb !important;
    background:#172033 !important;
    border-color:#334155 !important;
}
html[data-theme="dark"] :is(.bg-white, .bg-light) {
    color: #e5e7eb !important;
    background-color: #1e293b !important;
}
html[data-theme="dark"] :is(.text-dark, .text-body) { color: #e5e7eb !important; }
html[data-theme="dark"] .text-muted { color: #aeb9c9 !important; }
html[data-theme="dark"] :is(.form-label, .form-check-label, .form-text, .section-box h5) { color:#dbeafe !important; }
html[data-theme="dark"] :is(.form-control, .form-select) {
    color: #f8fafc !important;
    background-color: #111827 !important;
    border-color: #475569 !important;
}
html[data-theme="dark"] :is(.form-control, .form-select)::placeholder { color: #94a3b8 !important; }
html[data-theme="dark"] .table { --bs-table-color:#e5e7eb; --bs-table-bg:transparent; --bs-table-border-color:#334155; color:#e5e7eb !important; }
html[data-theme="dark"] .table > :not(caption) > * > * { color:inherit; background-color:transparent; border-color:#334155; }
html[data-theme="dark"] :is(.border, .border-top, .border-bottom) { border-color:#334155 !important; }
html[data-theme="dark"] :is(.nav-tabs, .nav-pills) .nav-link:not(.active) { color:#bfdbfe !important; }
html[data-theme="dark"] :is(.accordion-button, .accordion-body) { color:#e5e7eb !important; background:#172033 !important; }
html[data-theme="dark"] .accordion-button::after { filter:invert(1) grayscale(1); }
html[data-theme="dark"] canvas { color-scheme:dark; }

/* Couverture des composants historiques qui définissent leur fond localement. */
html[data-theme="dark"] :is(
    .axis-card, .selection-card, .score-panel, .profile-selector label,
    .alphabet-btn, .glossary-item-card,
    .sidebar-card, .progress-box, .glossary-card, .glossary-example-box,
    .path-card, .pricing-card,
    .bank-summary-item, .availability-item, .availability-card, .bank-history-card, .bank-distribution-card,
    .account-dialog, .account-dialog-header, .account-detail-field, .real-estate-section, .account-data-badge,
    .dashboard-panel, .panel-toggle, .stat-tile, .status-card, .dashboard-ranking-filters, .asset-insight,
    .folio-card, .workspace-card, .diversification-row, .dividend-metric, .country-row,
    .dashboard-zoom-card.is-zoomed, .workspace-card.is-zoomed,
    .dividend-popover, .currency-popover, .account-help-popover,
    .kpi-card, .competitive-box, .suggestion-card, .swot-card
) {
    color:#e5e7eb !important;
    background:#172033 !important;
    background-image:none !important;
    border-color:#334155 !important;
}

html[data-theme="dark"] :is(
    .table tbody td:first-child,
    .table tbody tr.table-light td:first-child,
    .table tbody tr.table-success td:first-child,
    .table tbody tr.table-primary td:first-child
) { color:#e5e7eb !important; background:#172033 !important; box-shadow:2px 0 0 #334155; }

html[data-theme="dark"] .table-section-header td { color:#bfdbfe !important; background:#1e3a5f !important; border-color:#3b5f89 !important; }
html[data-theme="dark"] #bonds tbody tr:hover,
html[data-theme="dark"] .account-detail-row:hover > * { background:#1e3a5f !important; }

html[data-theme="dark"] :is(.profile-selector input:checked + label, .sidebar-link.active, .form-check-input:checked + .form-check-label, .rank-product) {
    color:#bfdbfe !important;
    background:#1e3a5f !important;
    border-color:#3b82f6 !important;
}
html[data-theme="dark"] :is(.sidebar-link:hover, .sidebar-link.locked) { color:#bfdbfe !important; background:#1e293b !important; }
html[data-theme="dark"] :is(.progress-bar-custom, .score-track, .availability-bar, .bank-distribution-bar, .progress) { background:#334155 !important; }
html[data-theme="dark"] :is(.term-title, .sidebar-link, .real-estate-section > summary, .statement-details summary, .kpi-value, .panel-toggle) { color:#e5e7eb !important; }
html[data-theme="dark"] :is(.filter-label, .small-label, .bank-summary-label, .availability-label, .account-data-title, .account-detail-field small, .statement-cell small, .kpi-title, .dividend-popover-note, .account-help-popover-text) { color:#aeb9c9 !important; }

html[data-theme="dark"] .glossary-item-card:target,
html[data-theme="dark"] .glossary-item-card.highlighted-term { background:#1e3a5f !important; }
@keyframes highlightPulseDark { 0% { background-color:#1e3a5f; } 100% { background-color:#172033; } }
html[data-theme="dark"] .glossary-item-card:target,
html[data-theme="dark"] .glossary-item-card.highlighted-term { animation-name:highlightPulseDark !important; }

/* Les fonds translucides des héros doivent rester translucides, pas devenir des cartes sombres. */
html[data-theme="dark"] :is(.hero, .hero-section, .dashboard-hero, .profile-hero, .pricing-hero, .paths-hero, .initiation-hero) .bg-white[class*="bg-opacity-"] {
    color:#fff !important;
    background-color:rgba(255,255,255,.16) !important;
}
