html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  /* ✅ bloque la barre de scroll globale */
  font-family: electrolize, sans-serif;
}

#map {
  position: fixed;
  /* ✅ map verrouillée au viewport */
  inset: 0;
  width: 100%;
  height: 100%;
}

.electrolize-regular {
  font-family: "Electrolize", sans-serif;
  font-weight: 400;
  font-style: normal;
}

#map {
  height: 100%;
  width: 100%;
}

:root {
  --ui-font-size: 14px;
}

body {
  font-size: var(--ui-font-size);
}

/* Classe utilitaire pour cacher un élément */
.hidden {
  display: none !important;
}

/* Déplacer les boutons de zoom Leaflet à droite */
.leaflet-control-container .leaflet-top.leaflet-left {
  left: auto;
  right: 10px;
}

.leaflet-control-container .leaflet-top {
  top: 10px;
}

/* === OVERLAY DE CHARGEMENT GLOBAL === */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #ffffff 0%, #f3f3f3 45%, #e7e7e7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  opacity: 1;
  visibility: visible;
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-box {
  max-width: 620px;
  padding: 32px 28px 26px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  text-align: center;
  backdrop-filter: blur(6px);
}

.loading-title {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
}

.loading-subtitle {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 500;
  color: #444;
}

.loading-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: #f3d4da;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.loading-bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #b20a2c, #e40046);
  border-radius: 999px;
  transition: width 0.4s ease-out;
}

.loading-subtext {
  margin: 0;
  font-size: 12px;
  color: #666;
}

@media (max-width: 600px) {
  .loading-box {
    margin: 0 16px;
    padding: 24px 18px 18px;
  }

  .loading-title {
    font-size: 22px;
  }

  .loading-subtitle {
    font-size: 13px;
  }
}

/* === TUTORIEL OVERLAY === */

#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#tutorial-overlay.tutorial-visible {
  opacity: 1;
  pointer-events: auto;
}

#tutorial-overlay.tutorial-hidden {
  opacity: 0;
  pointer-events: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.75));
}

.tutorial-card {
  position: relative;
  max-width: 520px;
  margin: 0 18px;
  padding: 20px 22px 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  z-index: 1;
  text-align: left;
}

#tutorial-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

#tutorial-body,
#tutorial-body-2 {
  margin: 0 0 16px;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-btn-main,
.tutorial-btn-ghost {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.tutorial-btn-main {
  background: #111;
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}

.tutorial-btn-main:hover {
  background: #e40046;
  transform: translateY(-1px);
}

.tutorial-btn-ghost {
  background: transparent;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.35);
  padding-inline: 12px;
}

.tutorial-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Petit highlight sur les panels pendant le tuto */
.tutorial-highlight-left,
.tutorial-highlight-right,
.tutorial-highlight-bottom {
  box-shadow: 0 0 0 2px #e40046, 0 0 18px rgba(228, 0, 70, 0.6);
}

#tutorial-replay-btn {
  border-radius: 999px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: #111;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}

#tutorial-replay-btn:hover {
  background: #dc143c;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

#tutorial-replay-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tutorial-btn-lang {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #e40046;
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.tutorial-btn-lang:hover {
  background: #b20a2c;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* === UKRAINE BORDER & OBLAST HIGHLIGHT === */

.ukraine-border,
.oblast-highlight {
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.oblast-highlight {
  filter: drop-shadow(0 0 2px rgba(220, 20, 60, 0.7));
  animation: oblast-border-blink 0.8s ease-in-out 2;
}

@keyframes oblast-border-blink {
  0% {
    stroke-width: 2px;
    stroke-opacity: 1;
    fill-opacity: 0.15;
  }

  50% {
    stroke-width: 4px;
    stroke-opacity: 0.2;
    fill-opacity: 0.25;
  }

  100% {
    stroke-width: 2px;
    stroke-opacity: 1;
    fill-opacity: 0.15;
  }
}

.ukraine-border {
  filter: drop-shadow(0 0 2px rgba(1, 92, 187, 0.3));
}

/* Calque permanent des statuts */
.oblast-status-layer {
  pointer-events: none;
  /* ne bloque pas les clics */
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.15));
}

/* === Statut dans le panneau oblast === */
.country-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
  font-size: 12px;
  color: #333;
}

.country-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

#right-panel-legend {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  padding: 6px 0;
}



/* === Clusters === */
.custom-cluster {
  background-color: black;
  opacity: 1;
  border: 1px solid black;
  border-radius: 50%;
  color: white;
  text-align: center;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-cluster:hover {
  transform: scale(1.25);
  opacity: 0.9;
  filter: brightness(1.15);
  box-shadow: 0 0 5px rgba(220, 20, 60, 0.8);
  background-color: black;
  z-index: 10;
  animation: hoverBounce 0.25s ease-out;
}

/* ================================
   ICONES DES EVENEMENTS (divIcon)
   ================================ */

.marker-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  cursor: pointer;
  z-index: 1;
  position: relative;
}

/* ✅ slugs = TYPE_CONFIG.slug (JS) */
.marker-blesse {
  background-image: url("icons/blesse.png");
}

.marker-agresse {
  background-image: url("icons/agression.png");
}

.marker-tue {
  background-image: url("icons/assassinat.png");
}

.marker-disparu {
  background-image: url("icons/disparu.png");
}

.marker-tentative-homicide {
  background-image: url("icons/tentative.png");
}

.marker-dommages-materiels {
  background-image: url("icons/materiel.png");
}

.marker-emprisonne {
  background-image: url("icons/emprisonne.png");
}

/* === Effet au survol === */
.marker-icon:hover {
  transform: scale(1.4);
  filter: brightness(1.55);
  box-shadow: 0 0 5px rgba(220, 20, 60, 0.8);
  z-index: 10;
  animation: hoverBounce 0.25s ease-out;
}

@keyframes hoverBounce {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1.25);
  }
}

/* pulsation douce pour "Tué" */
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(220, 20, 60, 0.0);
  }

  50% {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(220, 20, 60, 0.5);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(220, 20, 60, 0.0);
  }
}

.marker-tue {
  animation: pulse 2s;
}

.marker-tue:hover {
  box-shadow: 0 0 14px rgba(220, 20, 60, 0.7);
}

/* === Effet radar (une fois à l’ajout) === */
.marker-icon.radar-once::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 1;
  pointer-events: none;
  animation: radar-pulse 2s ease-out 1;
}

@keyframes radar-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.8;
  }

  70% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.1;
  }

  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* radar par type (classes marker-*) */
.marker-blesse.radar-once::after {
  background: rgba(255, 152, 0, 0.35);
}

.marker-agresse.radar-once::after {
  background: rgba(96, 125, 139, 0.35);
}

.marker-tue.radar-once::after {
  background: rgba(220, 20, 60, 0.4);
}

.marker-disparu.radar-once::after {
  background: rgba(33, 150, 243, 0.4);
}

.marker-tentative-homicide.radar-once::after {
  background: rgba(156, 39, 176, 0.35);
}

.marker-dommages-materiels.radar-once::after {
  background: rgba(76, 175, 80, 0.35);
}

.marker-emprisonne.radar-once::after {
  background: rgb(0, 255, 255, 0.35);
}

/* Pattes de spiderfy */
.leaflet-cluster-spider-leg {
  stroke: #dc143c !important;
  stroke-width: 2px !important;
}

/* === Panneau latéral gauche === */
#event-panel {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 380px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: visible;
  backdrop-filter: blur(4px);
  border-right: 1px solid #ddd;
}

#event-panel.expanded {
  transform: translateX(0);
}



/* === Bouton du panneau === */
#toggle-panel {
  position: absolute;
  top: 50%;
  bottom: 50%;
  right: -40px;
  transform: translateY(-50%);
  width: 40px;
  height: 15%;
  border: none;
  border-radius: 0;
  background: #ffffff;
  color: #000000;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 1px 0 1px 1px rgba(0, 0, 0, 0.1);
  transition: background 0.25s, transform 0.25s;
  z-index: 1101;
}

#toggle-panel:hover {
  background: #000000;
  transform: translateY(-50%) scale(1);
  color: #ffffff;
}

#toggle-panel:hover::after {
  position: absolute;
  white-space: nowrap;
  background: #111;
  color: white;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  top: 50%;
  right: -4px;
  transform: translate(100%, 50%);
  pointer-events: none;
  z-index: 10;
}

/* === En-tête du panneau === */
#event-header {
  background: #ffffff;
  border-bottom: 1px solid #ccc;
  padding: 12px 16px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#event-header h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: bold;
  color: #111;
}

/* bloc search */
.event-header-search {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.event-header-search .search-box {
  max-width: 100%;
}

/* ✅ select villes (ajout pour le nouveau filtre secondaire) */
#ville-select {
  width: 100%;
  max-width: var(--search-open-width);
  margin: 6px auto 0;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
  color: #111;
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#ville-select:focus {
  border-color: #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
}

/* === Légende dans le header === */
#header-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  row-gap: 6px;
}

.header-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #222;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.header-legend-item:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

.header-legend-count {
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  background: #f0f0f0;
  color: #333;
}

.header-legend-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
}

.header-legend-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ✅ Couleurs par type (slug = normalizeType(libellé FR) côté JS) */
.header-legend-blesse .header-legend-count {
  background: rgba(255, 152, 0, 0.15);
  color: #EF6C00;
}

.header-legend-agresse .header-legend-count {
  background: rgba(96, 125, 139, 0.15);
  color: #455A64;
}

.header-legend-tue .header-legend-count {
  background: rgba(220, 20, 60, 0.15);
  color: #C2185B;
}

.header-legend-disparu .header-legend-count {
  background: rgba(33, 150, 243, 0.15);
  color: #1976D2;
}

.header-legend-tentative-dhomicide .header-legend-count {
  background: rgba(156, 39, 176, 0.15);
  color: #7B1FA2;
}

.header-legend-dommages-materiels .header-legend-count {
  background: rgba(76, 175, 80, 0.15);
  color: #2E7D32;
}

.header-legend-emprisonne .header-legend-count {
  background: rgb(0, 255, 255, 0.15);
  color: #00FFFF;
}



.header-legend-item.is-off {
  opacity: 0.4;
}

.header-legend-item.is-off .header-legend-count {
  background: #eee;
}

/* === Variables pour la search-box === */
:root {
  --search-font-size: 14px;
  --search-frame-thickness: 2px;
  --search-frame-color: #333;
  --search-size: 40px;
  --search-open-width: 220px;
  --search-open-padding: 0 10px;
  --search-open-trans-time: 0.35s;
  --search-close-trans-time: 0.25s;
  --search-handle-height: 18px;
}

/* Search-box générale */
.search-box {
  font-size: var(--search-font-size);
  border: solid var(--search-frame-thickness) var(--search-frame-color);
  display: inline-block;
  position: relative;
  border-radius: var(--search-size);
  background: #fff;
}

/* INPUT */
.search-box input[type="text"] {
  font-family: inherit;
  font-weight: bold;
  width: var(--search-size);
  height: var(--search-size);
  padding: var(--search-open-padding);
  border: none;
  box-sizing: border-box;
  border-radius: var(--search-size);
  transition:
    width var(--search-open-trans-time) cubic-bezier(0.68, -0.55, 0.27, 1.55) var(--search-close-trans-time);
}

.search-box input[type="text"]:focus {
  outline: none;
}

.search-box input[type="text"]:focus,
.search-box input[type="text"]:not(:placeholder-shown) {
  width: var(--search-open-width);
  transition:
    width var(--search-open-trans-time) cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.search-box input[type="text"]:focus+button[type="reset"],
.search-box input[type="text"]:not(:placeholder-shown)+button[type="reset"] {
  transform: rotate(-45deg) translateY(0);
  transition:
    transform var(--search-close-trans-time) ease-out var(--search-open-trans-time);
}

.search-box input[type="text"]:focus+button[type="reset"]::after,
.search-box input[type="text"]:not(:placeholder-shown)+button[type="reset"]::after {
  opacity: 1;
  transition:
    top var(--search-close-trans-time) ease-out calc(var(--search-open-trans-time) + var(--search-close-trans-time)),
    right var(--search-close-trans-time) ease-out calc(var(--search-open-trans-time) + var(--search-close-trans-time)),
    opacity var(--search-close-trans-time) ease calc(var(--search-open-trans-time) + var(--search-close-trans-time));
}

/* BOUTON RESET (loupe) */
.search-box button[type="reset"] {
  background-color: transparent;
  width: var(--search-handle-height);
  height: var(--search-handle-height);
  border: 0;
  padding: 0;
  outline: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: calc(var(--search-size) / 2 - var(--search-handle-height) / 2);
  right: calc(var(--search-size) / 2 - var(--search-handle-height) / 2);
  transform: rotate(-45deg) translateY(calc(var(--search-size) - var(--search-frame-thickness)));
  transition:
    transform var(--search-close-trans-time) ease-out var(--search-close-trans-time);
}

.search-box button[type="reset"]::before,
.search-box button[type="reset"]::after {
  content: "";
  background-color: var(--search-frame-color);
  width: var(--search-frame-thickness);
  height: var(--search-handle-height);
  position: absolute;
}

.search-box button[type="reset"]::after {
  transform: rotate(90deg);
  opacity: 0;
  transition:
    transform var(--search-close-trans-time) ease-out,
    opacity var(--search-close-trans-time) ease-out;
}

/* WRAPPER & DROPDOWN DU LIEU */
.lieu-filter-wrapper {
  position: relative;
}

.lieu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.lieu-option {
  display: block;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.lieu-option:hover {
  background: #f0f0f0;
}

/* === Liste des événements === */
#event-list {
  flex: 1;
  overflow-y: auto;
}

#event-list::-webkit-scrollbar {
  width: 1px;
}

#event-list::-webkit-scrollbar-track {
  /* create an 80% opacity variant of the theme color */
  background: rgba(211, 206, 206, 0.95);

  /* so we can push away from the edge/border */
  background-clip: padding-box;
}

#event-list::-webkit-scrollbar-thumb {
  /* create a 25% opacity variant of the theme color */
  background: rgba(27, 26, 26, 0.95);
  height: 50px;
}

.event-item {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  margin-bottom: 10px;
  padding: 10px 12px;
  border-left: 4px solid #111;
  transition: transform 0.2s, box-shadow 0.2s;
}

.event-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.event-item h4 {
  margin: 0;
  font-size: 14px;
  color: #111;
}

.event-item p {
  margin: 4px 0;
  font-size: 12px;
  color: #333;
}

.event-item .date {
  font-size: 11px;
  color: #666;
}

.event-blesse {
  border-left-color: #FF9800;
}

.event-agresse {
  border-left-color: #607D8B;
}

.event-tue {
  border-left-color: #dc143c;
}

.event-disparu {
  border-left-color: #2196F3;
}

.event-tentative-dhomicide {
  border-left-color: #9C27B0;
}

.event-dommages-materiels {
  border-left-color: #4CAF50;
}

.event-emprisonne {
  border-left-color: #00FFFF;
}

.event-item.highlighted {
  animation: event-card-blink 1s ease-in-out 2;
}

@keyframes event-card-blink {
  0% {
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
    background-color: #ffffff;
  }

  25% {
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.5);
    background-color: #fff5f7;
  }

  50% {
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
    background-color: #ffffff;
  }

  75% {
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.5);
    background-color: #fff5f7;
  }

  100% {
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
    background-color: #ffffff;
  }
}

/* === Cards d'événements === */
.event-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.event-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
}

.event-content h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.event-content p {
  margin: 2px 0;
  font-size: 12px;
  color: #333;
}

.event-content .date {
  font-style: italic;
  color: #666;
  font-size: 11px;
}

/* === Footer : mode lecture (panel gauche) === */
#event-footer {
  border-top: 1px solid #eee;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.95);
}

#floating-controls {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1099;

  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);

  /* ✅ taille stable (desktop + mobile) */
  width: 320px;
  min-width: 320px;
  max-width: 320px;

  padding: 10px;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== HEADER : LOGO + TITRE ===== */
.floating-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* rail logo */
.floating-logo {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* titre */
.floating-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.floating-subtitle {
  font-size: 14px;
  font-weight: 400;
  margin: 0;
  line-height: 1.2;
  text-align: center;
}

.floating-separator {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 2px 0 4px;
}

/* ===== CONTENU ===== */
.floating-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ✅ ligne playback : boutons + speed sur la même ligne */
.floating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* ✅ bloc speed/date à droite de la ligne */
.floating-speed {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  /* ✅ peut rétrécir */
  min-width: 0;
  /* ✅ autorise ellipsis sur la date */
  justify-content: flex-end;
}

/* select speed compact */
#playback-speed {
  flex: 0 0 auto;
  max-width: 72px;
}

#playback-date {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

/* ===== MOBILE : on garde la même largeur, on réduit juste l'intérieur ===== */
@media (max-width: 768px) {
  #floating-controls {
    width: min(340px, calc(100vw - 20px));
    /* garde une taille lisible, sans "gonfler" */
    min-width: 0;
    padding: 8px;
  }

  .playback-btn {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .playback-btn.playback-main {
    width: 34px;
  }

  #playback-speed {
    max-width: 64px;
  }

  #playback-date {
    font-size: 11px;
  }
}





/* === MODE LECTURE === */

.playback-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* 🔹 Style commun à TOUS les boutons */
.playback-btn {
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 16px;
  padding: 0;
  transition:
    transform 0.1s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.playback-btn:hover {
  background: #f6f6f6;
  transform: translateY(-1px);
}

.playback-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  background: rgba(228, 49, 42, 0.7);
  border-color: rgba(228, 49, 42, 1);
}

/* 🔸 Bouton principal (Play / Pause uniquement) */
.playback-main {
  border-color: #111;
  font-weight: 700;
}

/* 🔹 État désactivé (optionnel mais recommandé) */
.playback-btn[disabled] {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* === Vitesse === */

.playback-speed {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.playback-speed label {
  font-size: 12px;
  color: #444;
}

#playback-speed {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
}

/* === Date affichée === */

.playback-date {
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  color: #666;
  font-variant-numeric: tabular-nums;
}

.playback-toast {
  position: fixed;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 24px));
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.playback-toast.hidden {
  display: none;
}

.playback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

.playback-toast-inner {
  background: rgba(20, 20, 20, .90);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

.playback-toast-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.playback-toast-title {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.playback-toast-date {
  color: rgba(228, 49, 42, 1);
  font-weight: 600;
  font-size: 0.9em;
  display: block;
}

.playback-toast-body {
  font-size: 13px;
  line-height: 1.35;
}

/* === Modal des crédits === */

.credits-modal.hidden {
  display: none;
}

.credits-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.credits-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.credits-card {
  position: relative;
  max-width: 720px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.credits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.credits-body {
  padding: 12px 14px;
  overflow: auto;
  max-height: calc(100vh - 120px);
  font-size: 13px;
  line-height: 1.45;
}

.credits-body a {
  color: #e30044;
  text-decoration: underline;
}

.credits-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
}

.credits-close:hover {
  opacity: 1;
}

.credits-link {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  color: #e30044;
}

.credits-list {
  padding-left: 1.2em;
  line-height: 1.5;
}

.credits-list li {
  margin-bottom: 6px;
}

.credits-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.credits-list li {
  margin: 6px 0;
}



.event-day-separator {
  top: 0;
  z-index: 5;

  padding: 6px 10px;
  margin: 8px 0 10px;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #de302a;

  background: rgba(255, 255, 255, 0.05);

  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
}



/* === Panel droit (OBLAST) : on garde l'id country-panel === */
#country-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 380px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: visible;
  backdrop-filter: blur(4px);
  border-left: 1px solid #ddd;
}

#country-panel.expanded {
  transform: translateX(0);
}

#toggle-country-panel {
  position: absolute;
  top: 50%;
  left: -40px;
  transform: translateY(-50%);
  width: 40px;
  height: 15%;
  border: none;
  border-radius: 0;
  background: #ffffff;
  color: #000000;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  box-shadow: -1px 0 1px 1px rgba(0, 0, 0, 0.1);
  transition: background 0.25s, transform 0.25s, color 0.25s;
  z-index: 1300;
}

#toggle-country-panel:hover {
  background: #000000;
  transform: translateY(-50%) scale(1);
  color: #ffffff;
}

#toggle-country-panel:hover::after {
  position: absolute;
  white-space: nowrap;
  background: #111;
  color: white;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  top: 50%;
  left: -4px;
  transform: translate(-100%, -50%);
  pointer-events: none;
  z-index: 10;
}

@keyframes panelPulse {
  0% {
    transform: translateY(-50%) scale(1);
  }

  70% {
    transform: translateY(-50%) scale(1.1);
    background-color: #e40046;
  }

  100% {
    transform: translateY(-50%) scale(1);
  }
}

#toggle-country-panel.attention {
  animation: panelPulse 1s ease-out 2;
}

#country-header {
  background: #ffffff;
  border-bottom: 1px solid #ccc;
  padding: 12px 16px 10px;
}

#country-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  color: #111;
}

#country-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  gap: 16px;
  overflow-y: auto;
}

#country-content::-webkit-scrollbar {
  width: 1px;
}

#country-content::-webkit-scrollbar-track {
  /* create an 80% opacity variant of the theme color */
  background: rgba(211, 206, 206, 0.95);

  /* so we can push away from the edge/border */
  background-clip: padding-box;
}

#country-content::-webkit-scrollbar-thumb {
  /* create a 25% opacity variant of the theme color */
  background: rgba(27, 26, 26, 0.95);
  height: 50px;
}

#country-footer {
  border-top: 1px solid #eee;
  padding: 8px 12px 10px;
  font-size: 11px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-footer-note {
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.country-clear-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
}

.country-clear-btn:hover {
  opacity: 1;
  transform: rotate(90deg);
  transition: transform 0.3s ease;
}


/* Charts */
#country-charts {
  border-top: 1px solid #eee;
  padding: 8px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#country-chart-tabs {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  z-index: 2;
}

.chart-tab-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chart-tab-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.chart-tab-btn.disabled {
  opacity: 0.5;
  cursor: default;
}

#country-chart-container {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-placeholder {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin: 0;
}

/* === Bar chart (comparaison d’oblasts) === */

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.chart-bar-row {
  display: grid;
  grid-template-columns: 1fr 3fr auto;
  align-items: center;
  gap: 6px;
}

.chart-bar-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0 0 0 0;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
}

.chart-bar-label:hover {
  text-decoration: underline;
}

.chart-bar-label:active {
  color: rgba(222, 48, 42, 0.95);
  font-weight: 700;
}

.chart-bar {
  position: relative;
  height: 12px;
  border-radius: 0px;
  background: #f0f0f0;
  overflow: hidden;
  display: flex;
  border-radius: 999px;
}

.chart-bar-fill {
  height: 100%;

  transition: width 0.3s ease;
}

.chart-bar-value {
  font-weight: 600;
  font-size: 11px;
  opacity: 0.5;
}

/* ✅ Couleurs par type (slug = TYPE_CONFIG[type].slug) */
.chart-bar-fill-blesse {
  background: #FF9800;
}

.chart-bar-fill-agresse {
  background: #607D8B;
}

.chart-bar-fill-tue {
  background: #dc143c;
}

.chart-bar-fill-disparu {
  background: #2196F3;
}

.chart-bar-fill-tentative-homicide {
  background: #9C27B0;
}

.chart-bar-fill-dommages-materiels {
  background: #4CAF50;
}

.chart-bar-fill-emprisonne {
  background: #00FFFF;
}

.chart-bar-row.is-current-country .chart-bar-label {
  font-weight: 700;
  color: #e40046;
}

.chart-bar-row.is-current-country .chart-bar-value {
  color: #e40046;
  opacity: 1;
}

.chart-bar-segment {
  height: 100%;
}


/* bouton switch langue */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: 11px;
}

.lang-sep {
  opacity: 0.6;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.6;
}

.lang-btn.lang-active {
  font-weight: 700;
  opacity: 1;
  text-decoration: underline;
}

/* Poignée swipe */
.panel-swipe-handle {
  width: 100%;
  height: 16px;
  display: none;
}

@media (max-width: 768px) {
  .panel-swipe-handle {
    display: block;
    padding-top: 6px;
  }

  .panel-swipe-handle::before {
    content: "";
    display: block;
    margin: 0 auto;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.18);
  }
}


/* === Bottom chart panel === */
.bottom-chart {
  position: fixed;
  left: 0px;
  right: 0px;
  bottom: 0px;
  z-index: 1101;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  height: 50vh;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
}

.bottom-chart.open {
  transform: translateY(0);
}

.bottom-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}

.bottom-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #111;
}

.bottom-chart-body {
  padding: 0 25px 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bottom-chart-canvas-wrap {
  flex: 1;
  min-height: 0;
}

#bottom-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.bottom-chart-legend {
  display: flex;
  flex-wrap: wrap;
  left: 50%;
  right: 50%;
  gap: 8px 10px;
  margin-top: 10px;
}

.bottom-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.bottom-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.bottom-chart-legend-item.off {
  opacity: 0.35;
}


#toggle-bottom-chart {
  position: absolute;
  top: -40px;
  right: 55%;
  left: 45%;
  width: 15%;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  z-index: 1201;
}

#toggle-bottom-chart:hover {
  background: #000000;
  color: #ffffff;
}

/* icône quand panel ouvert */
#bottom-chart-panel.open #toggle-bottom-chart {
  content: "";
  background: rgba(255, 255, 255, 0.5);
}

#bottom-chart-panel.open #toggle-bottom-chart {
  /* flèche vers le bas quand ouvert */
  transform: rotate(180deg);
}

#bottom-chart-panel.open #toggle-bottom-chart:hover {
  background: rgb(0, 0, 0, 0.95);
  color: rgba(255, 255, 255, 0.95);
}

.bottom-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(20, 20, 20, .92);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
  pointer-events: none;
  max-width: 260px;
}

.bottom-tooltip.hidden {
  display: none;
}

.bottom-tooltip-date {
  font-weight: 700;
  margin-bottom: 6px;
  color: #E4312A;
  /* rouge RSF */
}

.bottom-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bottom-tooltip-type {
  opacity: .95;
}

.bottom-tooltip-val {
  font-weight: 700;
}


/* =========================
   HEATMAP TOGGLE (bottom chart)
   ========================= */

.bottom-chart-toolbar {
  display: flex;
  justify-content: flex-start;
  margin: 4px 0 6px;
}

/* === Heatmap switch (horizontal) === */

.heatmap-switch {
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: left;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: #111;
}

.heatmap-switch-track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  position: relative;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.18);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.heatmap-switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translate(0, -50%);
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

/* ON state */
.heatmap-switch.active .heatmap-switch-track {
  background: linear-gradient(90deg, #fed501, #e4312a);
  border-color: rgba(0, 0, 0, 0.30);
}

.heatmap-switch.active .heatmap-switch-thumb {
  transform: translate(20px, -50%);
}

/* =========================================================
   DARK MODE
   ========================================================= */

body.theme-dark {
  /* --- Theme tokens --- */
  --bg-0: #0b0b0f;
  --bg-1: #111117;
  --bg-2: #171723;
  --bg-3: rgba(17, 17, 23, 0.92);

  --text-0: #f2f2f6;
  --text-1: #cfcfda;
  --text-2: #a3a3b3;

  --border-0: rgba(255, 255, 255, 0.10);
  --border-1: rgba(255, 255, 255, 0.16);

  --shadow-0: 0 10px 28px rgba(0, 0, 0, 0.55);
  --shadow-1: 0 14px 40px rgba(0, 0, 0, 0.65);

  --panel-blur: blur(6px);

  --accent: #e40046;
  /* ton accent actuel */
  --accent-soft: rgba(228, 0, 70, 0.45);

  color-scheme: dark;
}

/* Base */
body.theme-dark,
body.theme-dark html {
  background: var(--bg-0);
  color: var(--text-0);
}

body.theme-dark .chart-bar-label:active {
  color: rgba(222, 48, 42, 0.95);
  font-weight: 700;
}

/* =========================
   LOADING OVERLAY
   ========================= */
body.theme-dark #loading-overlay {
  background: radial-gradient(circle at top, #0f0f14 0%, #0b0b0f 45%, #07070a 100%);
}

body.theme-dark .loading-box {
  background: rgba(17, 17, 23, 0.92);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark .loading-title {
  color: var(--text-0);
}

body.theme-dark .loading-subtitle {
  color: var(--text-1);
}

body.theme-dark .loading-subtext {
  color: var(--text-2);
}

body.theme-dark .loading-bar {
  background: rgba(228, 0, 70, 0.18);
}

body.theme-dark .loading-bar-fill {
  background: linear-gradient(90deg, #b20a2c, #e40046);
}

/* =========================
   TUTORIAL OVERLAY
   ========================= */
body.theme-dark .tutorial-card {
  background: rgba(17, 17, 23, 0.96);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-1);
}

body.theme-dark #tutorial-title {
  color: var(--text-0);
}

body.theme-dark #tutorial-body,
body.theme-dark #tutorial-body-2 {
  color: var(--text-1);
}

body.theme-dark .tutorial-btn-main {
  background: #0d0d12;
  color: var(--text-0);
  border: 1px solid var(--border-0);
}

body.theme-dark .tutorial-btn-main:hover {
  background: var(--accent);
}

body.theme-dark .tutorial-btn-ghost {
  color: var(--text-0);
  border: 1px solid var(--border-1);
}

body.theme-dark #tutorial-replay-btn {
  background: #0d0d12;
  color: var(--text-0);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
}

body.theme-dark #tutorial-replay-btn:hover {
  background: var(--accent);
}

/* =========================
   CLUSTERS
   ========================= */
body.theme-dark .custom-cluster {
  background-color: #0d0d12;
  border: 1px solid var(--border-1);
  color: var(--text-0);
}

body.theme-dark .custom-cluster:hover {
  background-color: #12121a;
  box-shadow: 0 0 8px rgba(228, 0, 70, 0.55);
}

/* =========================
   STATUS (panneau oblast)
   ========================= */
body.theme-dark .country-status {
  color: var(--text-1);
}

body.theme-dark .country-status-dot {
  border: 1px solid var(--border-1);
}

/* =========================
   LEFT PANEL
   ========================= */
body.theme-dark #event-panel {
  background: rgba(17, 17, 23, 0.92);
  border-right: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark #toggle-panel {
  background: rgba(17, 17, 23, 0.96);
  color: var(--text-0);
  box-shadow: 1px 0 1px 1px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-0);
  border-left: none;
}

body.theme-dark #toggle-panel:hover {
  background: #000;
  color: var(--text-0);
}

body.theme-dark #toggle-panel:hover::after {
  background: #000;
  color: var(--text-0);
  border: 1px solid var(--border-0);
}

body.theme-dark #event-header {
  background: rgba(17, 17, 23, 0.96);
  border-bottom: 1px solid var(--border-0);
}

body.theme-dark #event-header h3 {
  color: var(--text-0);
}

/* select villes */
body.theme-dark #ville-select {
  background: #0f0f14;
  color: var(--text-0);
  border: 1px solid var(--border-1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

body.theme-dark #ville-select:focus {
  border-color: rgba(242, 242, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(228, 0, 70, 0.18);
}

/* Header legend */
body.theme-dark .header-legend-item {
  color: var(--text-1);
}

body.theme-dark .header-legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .header-legend-count {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-0);
}

/* Keep your per-type count colors but slightly adjust fallback */
body.theme-dark .header-legend-item.is-off .header-legend-count {
  background: rgba(255, 255, 255, 0.05);
}

/* Search box */
body.theme-dark :root,
body.theme-dark {
  --search-frame-color: rgba(255, 255, 255, 0.55);
}

body.theme-dark .search-box {
  background: #0f0f14;
  border-color: rgba(255, 255, 255, 0.18);
}

body.theme-dark .search-box input[type="text"] {
  background: transparent;
  color: var(--text-0);
}

body.theme-dark .search-box input[type="text"]::placeholder {
  color: rgba(242, 242, 246, 0.45);
}

body.theme-dark .search-box button[type="reset"]::before,
body.theme-dark .search-box button[type="reset"]::after {
  background-color: rgba(242, 242, 246, 0.65);
}

/* Dropdown lieu */
body.theme-dark .lieu-dropdown {
  background: #0f0f14;
  border: 1px solid var(--border-1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

body.theme-dark .lieu-option {
  color: var(--text-0);
}

body.theme-dark .lieu-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Event list + cards */
body.theme-dark #event-list {
  color: var(--text-0);
}

body.theme-dark #event-list::-webkit-scrollbar {
  width: 1px;
}

body.theme-dark #event-list::-webkit-scrollbar-track {
  /* create an 80% opacity variant of the theme color */
  background: rgba(83, 81, 81, 0.95);

  /* so we can push away from the edge/border */
  background-clip: padding-box;
}

body.theme-dark #event-list::-webkit-scrollbar-thumb {
  /* create a 25% opacity variant of the theme color */
  background: rgba(222, 48, 42, 0.95);
  height: 50px;
}

body.theme-dark .event-item {
  background: rgba(15, 15, 20, 0.92);
  border: 1px solid var(--border-0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

body.theme-dark .event-item:hover {
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.55);
}

body.theme-dark .event-item h4 {
  color: var(--text-0);
}

body.theme-dark .event-item p {
  color: var(--text-1);
}

body.theme-dark .event-item .date {
  color: var(--text-2);
}

/* Event-card variant */
body.theme-dark .event-card {
  background: rgba(15, 15, 20, 0.92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-0);
}

body.theme-dark .event-content p {
  color: var(--text-1);
}

body.theme-dark .event-content .date {
  color: var(--text-2);
}

/* Sticky day separator */
body.theme-dark .event-day-separator {
  color: #de302a;
  background: rgba(17, 17, 23, 0.05);
  border: 1px solid var(--border-0);
}

/* Footer left */
body.theme-dark #event-footer {
  background: rgba(17, 17, 23, 0.96);
  border-top: 1px solid var(--border-0);
}

/* Floating controls */
body.theme-dark #floating-controls {
  background: rgba(17, 17, 23, 0.92);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-1);
  backdrop-filter: var(--panel-blur);
}

/* Playback controls */
body.theme-dark .playback-btn {
  background: #0f0f14;
  border: 1px solid var(--border-1);
  color: var(--text-0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

body.theme-dark .playback-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .playback-main {
  border-color: rgba(242, 242, 246, 0.5);
}

body.theme-dark .playback-speed label {
  color: var(--text-1);
}

body.theme-dark #playback-speed {
  background: #0f0f14;
  color: var(--text-0);
  border: 1px solid var(--border-1);
}

body.theme-dark .playback-date {
  color: var(--text-2);
}

/* =========================
   RIGHT PANEL (country/oblast)
   ========================= */
body.theme-dark #country-panel {
  background: rgba(17, 17, 23, 0.92);
  border-left: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark #toggle-country-panel {
  background: rgba(17, 17, 23, 0.96);
  color: var(--text-0);
  box-shadow: -1px 0 1px 1px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-0);
  border-right: none;
}

body.theme-dark #toggle-country-panel:hover {
  background: #000;
  color: var(--text-0);
}

body.theme-dark #toggle-country-panel:hover::after {
  background: #000;
  color: var(--text-0);
  border: 1px solid var(--border-0);
}

body.theme-dark #country-content::-webkit-scrollbar {
  width: 1px;
}

body.theme-dark #country-content::-webkit-scrollbar-track {
  /* create an 80% opacity variant of the theme color */
  background: rgba(83, 81, 81, 0.95);

  /* so we can push away from the edge/border */
  background-clip: padding-box;
}

body.theme-dark #country-content::-webkit-scrollbar-thumb {
  /* create a 25% opacity variant of the theme color */
  background: rgba(222, 48, 42, 0.95);
  height: 50px;
}

body.theme-dark #country-header {
  background: rgba(17, 17, 23, 0.96);
  border-bottom: 1px solid var(--border-0);
}

body.theme-dark #country-header h3 {
  color: var(--text-0);
}

body.theme-dark #country-footer {
  border-top: 1px solid var(--border-0);
  color: var(--text-2);
}

body.theme-dark #country-charts {
  border-top: 1px solid var(--border-0);
}

body.theme-dark #country-chart-tabs {
  background: rgba(17, 17, 23, 0.65);
}

body.theme-dark .chart-tab-btn {
  border: 1px solid var(--border-1);
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.04);
}

body.theme-dark .chart-tab-btn.active {
  background: #000;
  color: var(--text-0);
  border-color: rgba(242, 242, 246, 0.45);
}

body.theme-dark .chart-placeholder {
  color: var(--text-2);
}

/* Bar chart */
body.theme-dark .chart-bar {
  background: rgba(255, 255, 255, 0.07);
}

body.theme-dark .chart-bar-label {
  color: var(--text-1);
}

body.theme-dark .chart-bar-value {
  color: var(--text-2);
  opacity: 0.8;
}

/* =========================
   BOTTOM CHART PANEL
   ========================= */
body.theme-dark .bottom-chart {
  background: rgba(17, 17, 23, 0.1);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-1);
  backdrop-filter: var(--panel-blur);
  color: #fff;
}

body.theme-dark .bottom-chart-title {
  color: var(--text-0);
}

body.theme-dark .bottom-chart-legend-item {
  border: 1px solid var(--border-0);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
}

body.theme-dark .bottom-chart-swatch {
  border: 1px solid var(--border-1);
}

body.theme-dark .bottom-chart-legend-item.off {
  opacity: 0.35;
}

body.theme-dark #toggle-bottom-chart {
  background: rgba(17, 17, 23, 0.96);
  color: var(--text-0);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
}

body.theme-dark #toggle-bottom-chart:hover {
  background: #000;
  color: var(--text-0);
}

body.theme-dark #bottom-chart-panel.open #toggle-bottom-chart {
  content: "";
  background: rgba(17, 17, 23, 0.96);
}

body.theme-dark #bottom-chart-panel.open #toggle-bottom-chart:hover {
  background: #000;
  color: var(--text-0);
}

body.theme-dark .heatmap-switch {
  color: #fff;
}

body.theme-dark .heatmap-switch-track {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.18);
}

body.theme-dark .heatmap-switch-thumb {
  background: rgba(17, 17, 23, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

body.theme-dark .heatmap-switch.active .heatmap-switch-thumb {
  background: #0b0b0f;
}

/* =========================
   MOBILE SWIPE HANDLE
   ========================= */
body.theme-dark .panel-swipe-handle::before {
  background: rgba(255, 255, 255, 0.22);
}

/* =========================
   LEAFLET CONTROLS (optional)
   ========================= */
body.theme-dark .leaflet-control-layers {
  background: rgba(17, 17, 23, 0.92);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  color: var(--text-0);
}

body.theme-dark .leaflet-control-layers label {
  color: var(--text-1);
}

body.theme-dark .leaflet-bar a,
body.theme-dark .leaflet-control-zoom a {
  background: rgba(17, 17, 23, 0.92);
  color: var(--text-0);
  border-bottom: 1px solid var(--border-0);
}

body.theme-dark .leaflet-bar a:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* =========================
   ANIMATIONS OVERRIDES 
   ========================= */

@keyframes event-card-blink-dark {
  0% {
    box-shadow: 0 0 0 rgba(228, 0, 70, 0);
    background-color: rgba(15, 15, 20, 0.92);
  }

  25% {
    box-shadow: 0 0 14px rgba(228, 0, 70, 0.45);
    background-color: rgba(228, 0, 70, 0.10);
  }

  50% {
    box-shadow: 0 0 0 rgba(228, 0, 70, 0);
    background-color: rgba(15, 15, 20, 0.92);
  }

  75% {
    box-shadow: 0 0 14px rgba(228, 0, 70, 0.45);
    background-color: rgba(228, 0, 70, 0.10);
  }

  100% {
    box-shadow: 0 0 0 rgba(228, 0, 70, 0);
    background-color: rgba(15, 15, 20, 0.92);
  }
}

body.theme-dark .event-item.highlighted {
  animation: event-card-blink-dark 0.8s ease-in-out 2;
}

body.theme-dark .marker-icon:hover {
  filter: brightness(1.35);
  box-shadow: 0 0 8px rgba(228, 0, 70, 0.55);
}

body.theme-dark .oblast-highlight {
  filter: drop-shadow(0 0 2px rgba(228, 0, 70, 0.55));
}

body.theme-dark .chart-bar-row.is-current-country .chart-bar-label,
body.theme-dark .chart-bar-row.is-current-country .chart-bar-value {
  color: var(--accent);
}


body.theme-dark .event-blesse {
  border-left-color: #FF9800;
}

body.theme-dark .event-agresse {
  border-left-color: #607D8B;
}

body.theme-dark .event-tue {
  border-left-color: #dc143c;
}

body.theme-dark .event-disparu {
  border-left-color: #2196F3;
}

body.theme-dark .event-tentative-dhomicide {
  border-left-color: #9C27B0;
}

body.theme-dark .event-dommages-materiels {
  border-left-color: #4CAF50;
}

body.theme-dark .event-emprisonne {
  border-left-color: #00FFFF;
}

body.theme-dark .header-legend-blesse .header-legend-count {
  background: rgba(255, 152, 0, 0.15);
  color: #EF6C00;
}

body.theme-dark .header-legend-agresse .header-legend-count {
  background: rgba(96, 125, 139, 0.15);
  color: #455A64;
}

body.theme-dark .header-legend-tue .header-legend-count {
  background: rgba(220, 20, 60, 0.15);
  color: #C2185B;
}

body.theme-dark .header-legend-disparu .header-legend-count {
  background: rgba(33, 150, 243, 0.15);
  color: #1976D2;
}

body.theme-dark .header-legend-tentative-dhomicide .header-legend-count {
  background: rgba(156, 39, 176, 0.15);
  color: #7B1FA2;
}

body.theme-dark .header-legend-dommages-materiels .header-legend-count {
  background: rgba(76, 175, 80, 0.15);
  color: #2E7D32;
}

body.theme-dark .header-legend-emprisonne .header-legend-count {
  background: rgb(0, 255, 255, 0.15);
  color: #00FFFF;
}

body.theme-dark .marker-icon {
  background: rgba(255, 255, 255, 0.95);
}

body.theme-dark .header-legend-icon {
  background: rgba(255, 255, 255, 0.95);
}

body.theme-dark .event-icon {
  background: rgba(255, 255, 255, 0.95);
}

body.theme-dark .credits-card {
  background: rgba(17, 17, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-1);
}

body.theme-dark .credits-header {
  background: rgba(17, 17, 23, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

body.theme-dark .credits-body {
  color: #ffffff;
  background: rgba(17, 17, 23, 0.96);
}

body.theme-dark .credits-close {
  color: #ffffff;
}

/* =========================================================
   MOBILE PORTRAIT
   ========================================================= */
@media (orientation: portrait) {

  #header-legend {
    grid-template-columns: 1fr;
  }

  .chart-bar-row {
    grid-template-columns: 1.8fr 2.8fr auto;
    gap: 4px;
  }

  #event-panel {
    width: 300px;
  }

  #country-panel {
    width: 300px;
  }

  .country-clear-btn {
    font-size: 20px;
  }

  .tutorial-card {
    font-size: 15px;
  }

  :root {
    --ui-font-size: 19px;
    --search-font-size: 16px;
  }

  body {
    font-size: var(--ui-font-size);
    line-height: 1.35;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .chart-bar-label {
    font-size: 15px;
  }

  .chart-tab-btn {
    font-size: 15px;
    padding: 6px 10px;
  }


  .event-item h4,
  .event-card h4,
  .event-content h4 {
    font-size: 19px;
  }

  .event-item p,
  .event-card p,
  .event-content p {
    font-size: 15px;
    line-height: 1.4;
  }

  .event-item .date,
  .event-content .date {
    font-size: 12px;
  }

  #event-header h3,
  #country-header h3 {
    font-size: 18px;
  }

  .header-legend-item {
    font-size: 15px;
    padding: 6px 8px;
  }

  .header-legend-count {
    font-size: 15px;
    min-width: 30px;
  }


  #ville-select {
    font-size: 15px;
    padding: 10px 12px;
    max-width: 100%;

  }

  .search-box input[type="text"] {
    font-size: 15px;
  }


  .playback-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  #playback-speed {
    flex: 0 0 auto;
    max-width: 50px;
  }

  .bottom-chart {
    height: 30vh;
    max-height: 30vh;
  }


  .bottom-chart-title {
    font-size: 19px;
  }

  .bottom-chart-legend-item {
    font-size: 16px;
    padding: 6px 10px;
  }

  #toggle-country-panel {
    left: -50px;
    transform: translateY(-50%);
    width: 50px;
    height: 20%;
  }

  #toggle-panel {
    right: -50px;
    transform: translateY(-50%);
    width: 50px;
    height: 20%;
  }

  #toggle-bottom-chart {
    top: -50px;
    right: 40%;
    left: 40%;
    width: 20%;
    height: 50px;
  }
}