* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(circle at top left, #1d2333, #0f1117 40%, #090b10);
  color: #f1f1f1;
}

body {
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
}

.panel {
  padding: 18px 18px 10px;
  background: rgba(20, 23, 30, 0.75);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.language-picker {
  position: relative;
  margin-bottom: 6px;
}

.language-toggle-btn {
  border-radius: 999px;
  padding: 6px 9px;
  min-width: 38px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(12, 16, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 25;
}

.language-menu[hidden] {
  display: none !important;
}

.language-option {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 40px;
  line-height: 1;
}

.language-option:hover {
  box-shadow: none;
  transform: none;
  background: rgba(85, 161, 255, 0.28);
}

.subtitle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.subtitle {
  margin: 0;
  color: #9ea0a6;
}

.subtitle-row .subtitle {
  line-height: 1.35;
  display: flex;
  align-items: center;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 26px;
  padding: 0 11px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
  border-radius: 999px;
  color: #e8fff2;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  background: linear-gradient(145deg, rgba(32, 86, 62, 0.95), rgba(16, 48, 36, 0.98));
  border: 1px solid rgba(116, 198, 157, 0.5);
  /* Halo vert (identique au début de l’animation — seules les ombres changent au cycle) */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(82, 183, 136, 0.3),
    0 0 12px rgba(74, 210, 150, 0.32),
    0 0 24px rgba(46, 190, 120, 0.22);
  animation: live-badge-breathe 2.5s ease-in-out infinite;
}

/* Seules les ombres respirent — pas d’opacité ni de scale sur le badge (texte stable). */
@keyframes live-badge-breathe {
  0%,
  100% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.45),
      0 0 0 1px rgba(82, 183, 136, 0.3),
      0 0 12px rgba(74, 210, 150, 0.32),
      0 0 24px rgba(46, 190, 120, 0.22);
  }

  50% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.45),
      0 0 0 2px rgba(116, 198, 157, 0.45),
      0 0 22px rgba(90, 235, 170, 0.55),
      0 0 40px rgba(52, 210, 130, 0.5),
      0 0 56px rgba(30, 180, 100, 0.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge {
    animation: none;
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.45),
      0 0 0 1px rgba(82, 183, 136, 0.32),
      0 0 16px rgba(74, 210, 150, 0.38),
      0 0 28px rgba(46, 190, 120, 0.26);
  }
}

.group {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.group h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

/* Actions : titre sur toute la largeur, boutons côte à côte */
.group:has(#actionsTitle) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 10px;
}

.group:has(#actionsTitle) h2 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.group:has(#actionsTitle) button {
  width: 100%;
  font-size: 0.74rem;
  padding: 7px 8px;
  line-height: 1.2;
}

.group:has(#actionsTitle) button + button {
  margin-top: 0;
}

.seo-copy p {
  margin: 0;
  color: #c5c9d4;
  line-height: 1.4;
  font-size: 0.9rem;
}

.seo-copy {
  margin-top: auto;
}

.panel-links a {
  display: inline-block;
  margin-right: 10px;
  margin-bottom: 6px;
  color: #9fc4ff;
  text-decoration: none;
  font-size: 0.9rem;
}

.panel-links a:hover {
  text-decoration: underline;
}

/* Bloc Statut : carte, titrage, filtres */
.group.status-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  padding: 14px 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  background: linear-gradient(
    165deg,
    rgba(38, 44, 62, 0.72) 0%,
    rgba(20, 24, 36, 0.88) 48%,
    rgba(10, 12, 20, 0.94) 100%
  );
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.group.status-filter-group h2 {
  margin: 0 0 10px 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8b97b3;
}

.status-filter-item {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(12, 15, 24, 0.65);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease,
    opacity 0.2s ease;
}

.status-filter-item:has(input:checked) {
  background: rgba(24, 30, 46, 0.75);
  border-color: rgba(255, 255, 255, 0.14);
}

.status-filter-item:has(input[value="CONFIRMED"]):has(input:checked) {
  border-color: rgba(255, 77, 109, 0.32);
  box-shadow: 0 0 32px -14px rgba(255, 77, 109, 0.45);
}

.status-filter-item:has(input[value="DECEASED"]):has(input:checked) {
  border-color: rgba(155, 93, 229, 0.34);
  box-shadow: 0 0 32px -14px rgba(155, 93, 229, 0.38);
}

.status-filter-item:has(input[value="SUSPECTED"]):has(input:checked) {
  border-color: rgba(255, 202, 58, 0.34);
  box-shadow: 0 0 32px -14px rgba(255, 186, 48, 0.32);
}

.status-filter-item:has(input[value="MONITORING"]):has(input:checked) {
  border-color: rgba(116, 198, 157, 0.36);
  box-shadow: 0 0 32px -14px rgba(82, 183, 136, 0.35);
}

.status-filter-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(26, 32, 48, 0.82);
  transform: translateX(2px);
}

.status-filter-item:focus-within {
  border-color: rgba(85, 161, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(85, 161, 255, 0.12),
    0 4px 20px rgba(0, 0, 0, 0.2);
}

.status-filter-item:has(input[value="CONFIRMED"]):hover {
  border-color: rgba(255, 77, 109, 0.32);
}

.status-filter-item:has(input[value="DECEASED"]):hover {
  border-color: rgba(155, 93, 229, 0.35);
}

.status-filter-item:has(input[value="SUSPECTED"]):hover {
  border-color: rgba(255, 202, 58, 0.35);
}

.status-filter-item:has(input[value="MONITORING"]):hover {
  border-color: rgba(116, 198, 157, 0.38);
}

.status-filter-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  align-self: center;
  width: 1.2rem;
  height: 1.2rem;
  min-width: 1.2rem;
  min-height: 1.2rem;
  margin: 0;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 10, 16, 0.9);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s ease;
}

.status-filter-item:has(input[value="CONFIRMED"]) input[type="checkbox"] {
  border-color: rgba(255, 77, 109, 0.5);
}

.status-filter-item:has(input[value="DECEASED"]) input[type="checkbox"] {
  border-color: rgba(155, 93, 229, 0.5);
}

.status-filter-item:has(input[value="SUSPECTED"]) input[type="checkbox"] {
  border-color: rgba(255, 202, 58, 0.55);
}

.status-filter-item:has(input[value="MONITORING"]) input[type="checkbox"] {
  border-color: rgba(116, 198, 157, 0.55);
}

.status-filter-item input[type="checkbox"]:checked {
  border-color: transparent;
}

.status-filter-item:has(input[value="CONFIRMED"]) input[type="checkbox"]:checked {
  background: linear-gradient(145deg, #ff6b86, #ff3558);
  box-shadow:
    0 0 0 1px rgba(255, 77, 109, 0.35),
    0 4px 12px rgba(255, 77, 109, 0.25);
}

.status-filter-item:has(input[value="DECEASED"]) input[type="checkbox"]:checked {
  background: linear-gradient(145deg, #b06ef0, #8b4fd4);
  box-shadow:
    0 0 0 1px rgba(155, 93, 229, 0.35),
    0 4px 12px rgba(155, 93, 229, 0.25);
}

.status-filter-item:has(input[value="SUSPECTED"]) input[type="checkbox"]:checked {
  background: linear-gradient(145deg, #ffd45c, #f0b429);
  box-shadow:
    0 0 0 1px rgba(255, 202, 58, 0.35),
    0 4px 12px rgba(255, 202, 58, 0.22);
}

.status-filter-item:has(input[value="MONITORING"]) input[type="checkbox"]:checked {
  background: linear-gradient(145deg, #8ed4ae, #5cb87e);
  box-shadow:
    0 0 0 1px rgba(116, 198, 157, 0.35),
    0 4px 12px rgba(116, 198, 157, 0.22);
}

.status-filter-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.28rem;
  height: 0.52rem;
  border: solid rgba(255, 255, 255, 0.95);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.status-filter-item:has(input[value="SUSPECTED"]) input[type="checkbox"]:checked::after {
  border-color: rgba(35, 28, 8, 0.88);
}

.status-filter-item input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(85, 161, 255, 0.4);
}

.status-filter-item input[type="checkbox"]:active {
  transform: scale(0.92);
}

.status-filter-text {
  flex: 1;
  min-width: 0;
  align-self: center;
  font-size: 0.94rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #e8ecf4;
  line-height: 1.2;
}

.status-filter-item:has(input:checked) .status-filter-text {
  font-weight: 600;
  color: #f4f6fb;
}

.status-filter-item:has(input:not(:checked)) .status-filter-text {
  color: #8b919d;
  font-weight: 500;
}

.status-filter-item:has(input:not(:checked)) {
  opacity: 0.9;
}

.status-filter-item:has(input:not(:checked)) .status-dot {
  opacity: 0.5;
}

.status-filter-item .status-dot {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  align-self: center;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 2px 10px rgba(0, 0, 0, 0.35);
}

input[type="text"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(14, 16, 22, 0.75);
  color: #eee;
  padding: 10px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

input[type="text"]:focus {
  border-color: #55a1ff;
  box-shadow: 0 0 0 3px rgba(85, 161, 255, 0.2);
  outline: none;
}

button {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #2f71ff, #49a0ff);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.group button + button {
  margin-top: 8px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(47, 113, 255, 0.35);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.secondary-btn:hover {
  box-shadow: 0 8px 20px rgba(120, 140, 180, 0.2);
}

#viewDiv {
  width: 100%;
  height: 100%;
}

/* Supprime le contour bleu de focus ArcGIS sur la MapView */
.esri-view {
  --esri-view-outline-color: transparent;
}

.esri-view-surface,
.esri-view-surface--inset-outline,
.esri-view-surface--touch-none,
#viewDiv,
#viewDiv canvas {
  outline: none !important;
}

.esri-view-surface:focus,
.esri-view-surface:focus-visible,
.esri-view-surface--inset-outline:focus,
.esri-view-surface--inset-outline:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.esri-view-surface:focus::after,
.esri-view-surface:focus-visible::after,
.esri-view-surface--inset-outline:focus::after,
.esri-view-surface--inset-outline:focus-visible::after {
  content: none !important;
  outline: none !important;
  border: none !important;
  display: none !important;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at center, rgba(19, 24, 36, 0.96), rgba(10, 13, 20, 0.98));
  color: #e8ecf7;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: #6fa8ff;
  animation: spin 0.9s linear infinite;
}

.page-loader p {
  margin: 0;
  font-size: 0.92rem;
  color: #cbd5e6;
}

.page-loader.error {
  gap: 14px;
  padding: 0 24px;
}

.page-loader.error #loaderText {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffb1b1;
}

.page-loader-detail {
  max-width: 460px;
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #c5cad6;
}

.page-loader-retry {
  margin-top: 4px;
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 999px;
  background: linear-gradient(135deg, #2f71ff, #49a0ff);
}

.legend-with-close {
  position: relative;
}

.legend-quick-toggle {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 16, 24, 0.62);
  color: rgba(235, 241, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.legend-with-close .legend-quick-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 2;
}

.legend-quick-toggle:hover {
  transform: translateY(-0.5px);
  background: rgba(32, 40, 56, 0.72);
  border-color: rgba(140, 175, 255, 0.32);
  box-shadow: 0 6px 12px rgba(40, 70, 130, 0.22);
}

.result-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(85, 161, 255, 0.18);
  border: 1px solid rgba(85, 161, 255, 0.35);
  padding: 6px 12px;
  font-weight: 600;
}

.result-pill.loading {
  animation: pulse 1.6s infinite;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

.status-dot.confirmed {
  background: #ff4d6d;
}

.status-dot.deceased {
  background: #9b5de5;
}

.status-dot.suspected {
  background: #ffca3a;
}

.status-dot.monitoring {
  background: #74c69d;
}

.mobile-filter-toggle {
  display: none;
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 5;
  border-radius: 999px;
  padding: 10px 14px;
}

.cookie-consent {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12, 16, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #dce1eb;
  font-size: 0.8rem;
  max-width: min(380px, calc(100vw - 24px));
  text-align: center;
  pointer-events: auto;
  isolation: isolate;
}

.cookie-consent[hidden] {
  display: none !important;
}

.cookie-consent button {
  padding: 6px 9px;
  font-size: 0.78rem;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  body {
    grid-template-columns: 1fr;
  }

  .mobile-filter-toggle {
    display: inline-flex;
  }

  .panel {
    --panel-top: calc(56px + env(safe-area-inset-top, 0px));
    --panel-bottom-space: calc(12px + env(safe-area-inset-bottom, 0px));
    position: fixed;
    top: var(--panel-top);
    left: max(12px, env(safe-area-inset-left, 0px));
    right: auto;
    bottom: auto;
    width: min(360px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    /* Annule le min-height:100vh desktop (sinon le panneau dépasse l’écran) */
    min-height: 0 !important;
    /* Hauteur explicite = viewport visible − marges (svh évite la barre d’adresse mobile) */
    height: calc(100vh - var(--panel-top) - var(--panel-bottom-space));
    max-height: calc(100vh - var(--panel-top) - var(--panel-bottom-space));
    height: calc(100dvh - var(--panel-top) - var(--panel-bottom-space));
    max-height: calc(100dvh - var(--panel-top) - var(--panel-bottom-space));
    height: calc(100svh - var(--panel-top) - var(--panel-bottom-space));
    max-height: calc(100svh - var(--panel-top) - var(--panel-bottom-space));
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateX(calc(-100% - 20px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: stretch;
  }

  .panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .cookie-consent {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    justify-content: space-between;
    padding: 10px 12px;
  }

  /* Sur mobile, on masque le bouton de zoom arriere */
  .esri-ui .esri-zoom .esri-widget--button:last-child {
    display: none !important;
  }
}
