/* sections/rescue/rescue.css */

/* ── Police SUSE sur toute la section ────────────────────────────── */
#rescue,
#rescue * {
  font-family: 'SUSE', sans-serif;
}

/* ── Layout général ──────────────────────────────────────────────── */
#rescue {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  background: #0a0a0a;
}

/* ── En-tête de section ──────────────────────────────────────────── */
#rescue-header {
  width: 100%;
  padding: 4rem 2rem 2rem;
  text-align: center;
  background: #0a0a0a;
}

#rescue-title {
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 3px solid #9333ea;
  display: inline-block;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

#rescue-subtitle {
  font-size: 1rem;
  color: #aaaaaa;
  margin-top: 0.5rem;
}

/* ── Conteneur carte ─────────────────────────────────────────────── */
#rescue-map-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ── Fond Mapbox ─────────────────────────────────────────────────── */
#mapbox-backdrop {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  filter: saturate(0.4) brightness(0.75);
}

/* ── SVG D3 overlay ──────────────────────────────────────────────── */
#d3-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}

#d3-overlay path,
#d3-overlay circle,
#d3-overlay g.rescue-badge-group {
  pointer-events: all;
}

/* ── Cantons ─────────────────────────────────────────────────────── */
.canton-path {
  stroke: #000000;
  stroke-width: 0.5;
  stroke-opacity: 0.8;
  cursor: pointer;
  transition: fill-opacity 0.2s;
}

.canton-path:hover { fill-opacity: 0.45 !important; }

.canton-valais {
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 2px;
  stroke-opacity: 0.8;
  cursor: pointer;
  transition: fill-opacity 0.2s;
}

.canton-valais:hover { fill-opacity: 0.6 !important; }

@keyframes rescue-pulse {
  0%,  100% { stroke-opacity: 0.8; stroke-width: 2px; }
  50%        { stroke-opacity: 0.4; stroke-width: 5px; }
}

.canton-valais-pulse {
  animation: rescue-pulse 2.2s ease-in-out infinite;
}

/* Badge SVG "Voir le détail →" */
.rescue-badge-group {
  cursor: pointer;
}

.rescue-badge-group rect {
  filter: drop-shadow(0 2px 6px rgba(147, 51, 234, 0.4));
}

.rescue-badge-group:hover rect {
  fill: rgba(147, 51, 234, 0.95) !important;
}

/* Bulles OCVS */
.base-bubble {
  cursor: pointer;
  transition: fill-opacity 0.2s;
}

.base-bubble:hover { fill-opacity: 0.6 !important; }

/* ── Overlays absolus communs aux deux vues ───────────────────────── */
#rescue-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.82);
  padding: 8px 14px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#rescue-controls h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f0f0f0;
}

/* Légende choroplèthe — Vue 1 */
#rescue-legend {
  position: absolute;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  border-radius: 8px;
  padding: 1rem;
  z-index: 10;
  min-width: 160px;
}

.rescue-legend-title {
  font-family: 'SUSE', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.4rem;
}

.rescue-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.rescue-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rescue-legend-label {
  font-family: 'SUSE', sans-serif;
  font-size: 0.75rem;
  color: #dddddd;
}

/* ── Vue 2 — Bouton retour ───────────────────────────────────────── */
.rescue-back-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 20px;
  background: #9333ea;
  backdrop-filter: blur(4px);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  transition: background 200ms ease;
}

.rescue-back-btn:hover {
  background: #c084fc;
}

.rescue-back-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Vue 2 — Panneau métriques OCVS ──────────────────────────────── */
.rescue-vue2-panel {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 38%;
  height: 100%;
  overflow-y: auto;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 12px 12px 0;
  box-sizing: border-box;
  z-index: 2;
  color: #f0f0f0;
}

.rescue-vue2-panel.is-open {
  display: block;
}

/* ── En-tête panneau ─────────────────────────────────────────────── */
.rescue-panel-header {
  margin-bottom: 1rem;
}

.rescue-panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f0f0f0;
}

/* ── Métriques ───────────────────────────────────────────────────── */
.rescue-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.rescue-metric {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}

.rescue-metric-val {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: #f0f0f0;
}

.rescue-metric-lbl {
  font-size: 10px;
  color: #aaaaaa;
  margin: 3px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.rescue-tab-row {
  display: flex;
  gap: 5px;
  margin-bottom: 0.875rem;
  flex-wrap: wrap;
}

.rescue-tab {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  cursor: pointer;
  color: #aaaaaa;
  transition: all 0.15s;
}

.rescue-tab:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #f0f0f0;
}

.rescue-tab.active {
  background: #9333ea;
  color: #fff;
  border-color: transparent;
}

/* ── Lignes de base ──────────────────────────────────────────────── */
.rescue-base-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 11px;
  margin-bottom: 4px;
  color: #cccccc;
}

/* ── Barres de progression ───────────────────────────────────────── */
.rescue-bar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  height: 5px;
  margin-top: 3px;
  overflow: hidden;
}

.rescue-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── Graphique SAS + éditorial ───────────────────────────────────── */
#rescue-chart-container {
  min-height: 60vh;
  padding: 3rem 2rem 4rem;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.rescue-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #f0f0f0;
  margin: 0 0 10px;
}

#rescue-chart-container svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* ── R4/R5 — Axes et grille ──────────────────────────────────────── */
.rescue-axis path,
.rescue-axis line,
.rescue-axis-x path,
.rescue-axis-x line,
.rescue-axis-y path,
.rescue-axis-y line {
  stroke: rgba(255, 255, 255, 0.15);
}

.rescue-axis text,
.rescue-axis-x text,
.rescue-axis-y text {
  fill: #aaaaaa;
  font-family: 'SUSE', sans-serif;
  font-size: 0.7rem;
}

.rescue-grid line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-dasharray: 3, 3;
}

.rescue-grid path {
  stroke: none;
}

.rescue-bar-label {
  fill: #e9d5ff;
  font-family: 'SUSE', sans-serif;
  font-size: 0.68rem;
}

/* ── R3 — Couleurs par type de service ───────────────────────────── */
.rescue-type-ambulance   { color: #60a5fa; border-color: #60a5fa; }
.rescue-type-smur        { color: #34d399; border-color: #34d399; }
.rescue-type-helicoptere { color: #f472b6; border-color: #f472b6; }

.rescue-type-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── R4 — Bloc éditorial storytelling ───────────────────────────── */
#rescue-editorial {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.rescue-story-lead {
  font-family: 'SUSE', sans-serif;
  font-size: 1.2rem;
  font-style: italic;
  color: #e9d5ff;
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

#rescue-editorial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.rescue-editorial-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rescue-editorial-num {
  font-family: 'SUSE', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: #9333ea;
  line-height: 1;
}

.rescue-editorial-item p {
  font-family: 'SUSE', sans-serif;
  font-size: 0.82rem;
  color: #cccccc;
  line-height: 1.7;
  margin: 0 0 0.5rem 0;
}

.rescue-editorial-src {
  font-family: 'SUSE', sans-serif;
  font-size: 0.68rem;
  color: #555555;
  font-style: italic;
}

/* ── Tooltip ─────────────────────────────────────────────────────── */
#rescue-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.85);
  border: none;
  border-left: 3px solid #9333ea;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 9999;
  max-width: 240px;
  line-height: 1.6;
  color: #f0f0f0;
}
