/* Theme Toggle CSS */
/* Variables pour Dark Mode (actuelles) */
:root.theme-dark {
  --bg: #0d0d1a;
  --bg2: #13132a;
  --bg3: #1a1a3e;
  --text: #e0e0f0;
  --text2: #8888aa;
  --red: #ff4444;
  --orange: #ff8844;
  --yellow: #ffcc44;
  --green: #44cc88;
  --blue: #4488ff;
  --purple: #aa44ff;
  --border: #2a2a4a;
}

/* Variables pour Light Mode */
:root.theme-light {
  --bg: #fafafa;
  --bg2: #ffffff;
  --bg3: #f0f0f0;
  --text: #2d2d2d;
  --text2: #666666;
  --red: #cc3333;
  --orange: #cc6633;
  --yellow: #ccaa33;
  --green: #33aa66;
  --blue: #3366cc;
  --purple: #8833cc;
  --border: #e0e0e0;
}

/* Transitions pour les changements de thème */
body, .topbar, .detail-panel, .card, .nav button, .search-box input {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Bouton Toggle */
.theme-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--text2);
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  margin-left: 8px;
  transition: 0.2s;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg3);
  border-color: var(--border);
}

/* Ajustements spécifiques pour le light mode */
:root.theme-light .card .name {
  color: #2255aa;
}

:root.theme-light .btn {
  color: #ffffff !important;
}

:root.theme-light .theme-toggle:hover {
  background: var(--bg3);
}

:root.theme-light .tag-ftv {
  background: #ff444425;
  color: #cc3333;
  border-color: #cc333344;
}

:root.theme-light .tag-radio-france {
  background: #ff884425;
  color: #cc6633;
  border-color: #cc663344;
}

:root.theme-light .tag-mediawan {
  background: #4488ff25;
  color: #3366cc;
  border-color: #3366cc44;
}

:root.theme-light .tag-banijay {
  background: #aa44ff25;
  color: #8833cc;
  border-color: #8833cc44;
}

:root.theme-light .tag-together-media {
  background: #ff444425;
  color: #cc4444;
  border-color: #cc444444;
}

:root.theme-light .tag-politique {
  background: #4488ff25;
  color: #3366cc;
  border-color: #3366cc44;
}

:root.theme-light .tag-pantouflage {
  background: #ff444425;
  color: #cc3333;
  border-color: #cc333344;
}

:root.theme-light .tag-conflit-interets {
  background: #ff884425;
  color: #cc6633;
  border-color: #cc663344;
}

:root.theme-light .tag-trafic-influence {
  background: #ff444425;
  color: #cc3333;
  border-color: #cc333344;
}

:root.theme-light .tag-abus-biens-sociaux {
  background: #ff444425;
  color: #cc3333;
  border-color: #cc333344;
}

:root.theme-light .tag-menace {
  background: #ff444425;
  color: #cc3333;
  border-color: #cc333344;
}

:root.theme-light .tag-ena {
  background: #44cc8825;
  color: #33aa66;
  border-color: #33aa6644;
}

:root.theme-light .tag-sciences-po {
  background: #44cc8825;
  color: #33aa66;
  border-color: #33aa6644;
}

:root.theme-light .tag-le-siecle {
  background: #aa44ff25;
  color: #8833cc;
  border-color: #8833cc44;
}

:root.theme-light .tag-default {
  background: var(--bg3);
  color: var(--text2);
  border-color: var(--border);
}

:root.theme-light .suspect-item {
  background: #ff444420;
  border: 1px solid #cc333344;
}
/* Contact Tab - Fixed Side */
.contact-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-lr;
  background: var(--bg2);
  color: var(--text2);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 6px;
  font-size: 13px;
  text-decoration: none;
  z-index: 90;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 1px;
}
.contact-tab:hover {
  background: var(--bg3);
  color: var(--text);
  text-decoration: none;
}

/* Fix light mode contraste */
:root.theme-light {
  --yellow: #996600;
  --orange: #b85500;
  --green: #228855;
  --red: #bb2222;
  --blue: #2255bb;
  --purple: #7722bb;
}

:root.theme-light .stat-card {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

:root.theme-light .card {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

:root.theme-light .topbar {
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

:root.theme-light .mobile-nav {
  box-shadow: 0 -2px 4px rgba(0,0,0,0.08);
}

/* Fix search results light mode */
:root.theme-light .search-results {
  background: #ffffff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

:root.theme-light .search-result-item {
  border-bottom: 1px solid #eee;
}

:root.theme-light .search-result-item:hover {
  background: #f0f4ff;
}

:root.theme-light .search-box input {
  background: #ffffff;
  border: 1px solid #ccc;
  color: #2d2d2d;
}

/* Fix contact tab light mode */
:root.theme-light .contact-tab {
  background: #2255aa !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: -2px 0 8px rgba(0,0,0,0.15);
}

:root.theme-light .contact-tab:hover {
  background: #1a4488;
  color: #ffffff !important;
}

/* Fix timeline light mode */
:root.theme-light .timeline-item .date {
  color: #444444;
}

:root.theme-light .timeline-item .desc {
  color: #333333;
}

:root.theme-light .timeline-item {
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

:root.theme-light .timeline::before {
  background: #cccccc;
}

/* Fix search dropdown visibility both modes */
.search-results.active {
  display: block !important;
  z-index: 9999 !important;
}

:root.theme-light .search-results {
  background: #ffffff !important;
  border: 2px solid #2255aa !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
}

:root.theme-light .search-result-item {
  color: #2d2d2d !important;
  border-bottom: 1px solid #eee !important;
}

:root.theme-light .search-result-item:hover {
  background: #e8f0ff !important;
}

:root.theme-light .search-result-item .type {
  color: #666 !important;
}

/* Footer */
.site-footer {
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
  color: var(--text2);
}

.site-footer a {
  color: var(--blue);
  text-decoration: none;
  margin: 0 12px;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer .sep {
  color: var(--border);
}

/* Light mode: flux section backgrounds */
:root.theme-light .money-bar .amount {
  color: var(--text) !important;
}

/* Green/red section backgrounds for flux page */
:root.theme-dark {
  --green-bg-section: #1a3a1a;
  --green-border: #2a5a2a;
  --red-bg-section: #3a1a1a;
  --red-border: #5a2a2a;
}

:root.theme-light {
  --green-bg-section: #e8f5e9;
  --green-border: #a5d6a7;
  --red-bg-section: #fce4ec;
  --red-border: #ef9a9a;
}

/* Fix inline tag backgrounds in light mode (dynamic tags via getTagStyle) */
:root.theme-light {
  --red-bg: #bb222220;
  --orange-bg: #b8550020;
  --yellow-bg: #99660020;
  --green-bg: #22885520;
  --blue-bg: #2255bb20;
  --purple-bg: #7722bb20;
  --text2-bg: #66666620;
}

:root.theme-dark {
  --red-bg: #ff444433;
  --orange-bg: #ff884433;
  --yellow-bg: #ffcc4433;
  --green-bg: #44cc8833;
  --blue-bg: #4488ff33;
  --purple-bg: #aa44ff33;
  --text2-bg: #88888833;
}

/* Force graph node labels readable in light mode */
:root.theme-light .node-label {
  fill: #2d2d2d !important;
}
