/* ═══════════════════════════════════════════════
   Eritedge Footprint Map v3.0 – Baker Tilly style
   Fond sombre · Teal présence · Stats bas
   ═══════════════════════════════════════════════ */
:root {
  --ert-bg:        #16202E;
  --ert-bg-panel:  #0F1822;
  --ert-bg-stats:  #0D1520;
  --ert-teal:      #1C8AA2;
  --ert-teal-glow: rgba(28,138,162,.45);
  --ert-teal-dim:  rgba(28,138,162,.15);
  --ert-gold:      #D4614A;
  --ert-gold-glow: rgba(212,97,74,.45);
  --ert-inactive:  #ebf0f7;
  --ert-stroke:    #0D1A28;
  --ert-white:     #FFFFFF;
  --ert-white-60:  rgba(255,255,255,.60);
  --ert-white-30:  rgba(255,255,255,.28);
  --ert-white-10:  rgba(255,255,255,.08);
  --ert-border:    rgba(255,255,255,.10);
  --ert-teal-text: #1C8AA2;
}

/* ═══ Wrap global ════════════════════════════════ */
.ert-wrap {
  background:    var(--ert-bg);
  border-radius: 10px;
  overflow:      hidden;
  font-family:   'Segoe UI','Helvetica Neue',Arial,sans-serif;
  color:         var(--ert-white);
  box-shadow:    0 24px 64px rgba(0,0,0,.55);
}

/* ═══ Header ═════════════════════════════════════ */
.ert-header {
  background:    var(--ert-bg-panel);
  border-bottom: 1px solid var(--ert-border);
  padding:       14px 24px;
}
.ert-brand {
  display:     flex;
  align-items: center;
  gap:         10px;
}
.ert-brand-icon { color: var(--ert-teal); flex-shrink:0; }
.ert-brand-name {
  font-size:      18px;
  font-weight:    700;
  letter-spacing: .08em;
  color:          var(--ert-white);
}
.ert-brand-pipe {
  color:     var(--ert-white-30);
  font-size: 18px;
}
.ert-brand-sub {
  font-size: 13px;
  color:     var(--ert-white-60);
  font-weight: 400;
}

/* ═══ Corps (panneau + carte) ════════════════════ */
.ert-body {
  display:  flex;
  overflow: hidden;
}

/* ── Panneau gauche ── */
.ert-panel {
  width:           210px;
  flex-shrink:     0;
  background:      var(--ert-bg-panel);
  border-right:    1px solid var(--ert-border);
  padding:         20px 18px;
  display:         flex;
  flex-direction:  column;
  gap:             16px;
  overflow-y:      auto;
}
.ert-facts {
  list-style:  none;
  margin:      0;
  padding:     0;
  display:     flex;
  flex-direction: column;
  gap:         12px;
}
.ert-facts li {
  font-size:   13px;
  color:       var(--ert-white-60);
  line-height: 1.45;
  display:     flex;
  gap:         8px;
  align-items: flex-start;
}
.ert-arrow {
  color:      var(--ert-teal);
  flex-shrink: 0;
  font-size:  10px;
  margin-top:  3px;
}
.ert-panel-emphasis {
  font-size:   20px;
  font-weight: 700;
  color:       var(--ert-white);
  line-height: 1.25;
  border-left: 3px solid var(--ert-teal);
  padding-left: 12px;
}
.ert-panel-emphasis span {
  font-size:   12px;
  font-weight: 400;
  color:       var(--ert-white-60);
  display:     block;
  margin-top:  3px;
}
.ert-panel-tags {
  display:    flex;
  flex-wrap:  wrap;
  gap:        6px;
}
.ert-panel-tags span {
  font-size:     10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color:          var(--ert-teal);
  border:         1px solid rgba(28,138,162,.35);
  border-radius:  20px;
  padding:        3px 9px;
  background:     var(--ert-teal-dim);
}

/* ── Sections du panneau ── */
.ert-panel-section {
  display:        flex;
  flex-direction: column;
  gap:            10px;
}
.ert-panel-section-title {
  display:     flex;
  align-items: center;
  gap:         8px;
  font-size:   11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color:       var(--ert-white-60);
}
.ert-panel-count {
  font-size:   18px;
  font-weight: 700;
  line-height: 1;
  color:       var(--ert-white);
}
.ert-panel-count--presence  { color: var(--ert-teal); }
.ert-panel-count--couverture { color: #45c8e5; }

.ert-panel-list {
  list-style:     none;
  margin:         0;
  padding:        0;
  display:        flex;
  flex-direction: column;
  gap:            5px;
}
.ert-panel-list li {
  font-size:   12px;
  color:       var(--ert-white-60);
  padding:     3px 0 3px 10px;
  border-left: 2px solid rgba(28,138,162,.4);
  line-height: 1.3;
  transition:  color .15s, border-color .15s;
}
.ert-panel-list li:hover {
  color:        var(--ert-white);
  border-color: var(--ert-teal);
}
.ert-panel-list--couverture li {
  border-left-color: rgba(69,200,229,.4);
}
.ert-panel-list--couverture li:hover {
  border-left-color: #45c8e5;
}

.ert-panel-divider {
  height:     1px;
  background: var(--ert-border);
  margin:     4px 0;
}

/* ── Zone carte ── */
.ert-map-area {
  flex:     1;
  position: relative;
  overflow: hidden;
}
#ert-map-container {
  width:           100%;
  height:          100%;
  display:         flex;
  align-items:     center;
  justify-content: center;
}
#ert-map-container svg {
  display:  block;
  width:    100%;
  height:   100%;
  transition: transform .07s ease;
}

/* ── Pays sans bureau ── */
.ert-country--none,
g.ert-country--none path,
g.ert-country--none polygon,
g.ert-country--none circle {
  fill:        var(--ert-inactive) !important;
  stroke:      var(--ert-stroke);
  stroke-width: .5px;
  transition:  fill .18s;
  cursor:      default;
}
.ert-country--none.ert-country--hover,
g.ert-country--none.ert-country--hover path,
g.ert-country--none.ert-country--hover polygon { fill: #b0bac6 !important; }

/* ── Pays présents – siège & bureau → #1C8AA2 ── */
.ert-country--bureau,
.ert-country--siege,
g.ert-country--bureau path,
g.ert-country--bureau polygon,
g.ert-country--bureau circle,
g.ert-country--siege path,
g.ert-country--siege polygon,
g.ert-country--siege circle {
  fill:        var(--ert-teal) !important;
  stroke:      var(--ert-stroke) !important;
  stroke-width: .7px;
  cursor:      pointer;
  transition:  fill .18s, filter .2s;
}
.ert-country--bureau,
.ert-country--siege {
  filter: drop-shadow(0 0 7px var(--ert-teal-glow));
}
.ert-country--bureau.ert-country--hover,
.ert-country--siege.ert-country--hover {
  filter: drop-shadow(0 0 16px var(--ert-teal-glow));
}
.ert-country--bureau.ert-country--hover path,
.ert-country--bureau.ert-country--hover polygon,
.ert-country--siege.ert-country--hover path,
.ert-country--siege.ert-country--hover polygon { fill: #25A3BF !important; }

/* ── Pays de couverture → #45c8e5 ── */
.ert-country--couverture,
g.ert-country--couverture path,
g.ert-country--couverture polygon,
g.ert-country--couverture circle {
  fill:        #45c8e5 !important;
  stroke:      var(--ert-stroke) !important;
  stroke-width: .7px;
  cursor:      pointer;
  transition:  fill .18s, filter .2s;
}
.ert-country--couverture {
  filter: drop-shadow(0 0 5px rgba(69,200,229,.35));
}
.ert-country--couverture.ert-country--hover,
g.ert-country--couverture.ert-country--hover path,
g.ert-country--couverture.ert-country--hover polygon { fill: #6fd8ee !important; }

/* ── Pins SVG ──────────────────────────────────────
   Bureau  : point blanc clignotant
   Siège   : point #D4614A clignotant (plus grand)
   ─────────────────────────────────────────────── */

/* Points clignotants */
.ert-pin-dot {
  fill:          #FFFFFF;
  stroke:        none;
  pointer-events:none;
  animation:     ert-blink-bureau 1.4s ease-in-out infinite;
}
.ert-pin-dot--siege {
  fill:      #D4614A;
  animation: ert-blink-siege 1.1s ease-in-out infinite;
}

@keyframes ert-blink-bureau {
  0%,100% { opacity:1;   filter:drop-shadow(0 0 6px rgba(255,255,255,.95)); }
  50%     { opacity:.12; filter:drop-shadow(0 0 1px rgba(255,255,255,.1));  }
}
@keyframes ert-blink-siege {
  0%,100% { opacity:1;   filter:drop-shadow(0 0 9px rgba(212,97,74,1));   }
  50%     { opacity:.15; filter:drop-shadow(0 0 1px rgba(212,97,74,.15)); }
}

/* Halos pulsés (anneau extérieur) */
.ert-pin-pulse {
  fill:    none;
  stroke:  rgba(255,255,255,.5);
  opacity: 0;
  animation: ert-pulse-bureau 2.4s ease-out infinite;
  pointer-events: none;
}
.ert-pin-pulse--siege {
  stroke: rgba(212,97,74,.75);
  animation: ert-pulse-siege 2s ease-out infinite;
}

@keyframes ert-pulse-bureau {
  0%   { r:5px;  opacity:.8; }
  100% { r:20px; opacity:0;  }
}
@keyframes ert-pulse-siege {
  0%   { r:7px;  opacity:.9; }
  100% { r:22px; opacity:0;  }
}

/* ── Loader ── */
.ert-loader {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            14px;
  color:          var(--ert-white-60);
  font-size:      13px;
}
.ert-spin {
  display:       block;
  width:         32px;
  height:        32px;
  border:        2px solid var(--ert-white-10);
  border-top-color: var(--ert-teal);
  border-radius: 50%;
  animation:     ert-spin .8s linear infinite;
}
@keyframes ert-spin { to { transform:rotate(360deg); } }

/* ── Légende ── */
.ert-legend {
  position:   absolute;
  bottom:     16px;
  right:      16px;
  background: rgba(10,18,30,.88);
  border:     1px solid var(--ert-border);
  border-radius: 7px;
  padding:    10px 14px;
  display:    flex;
  flex-direction: column;
  gap:        7px;
  backdrop-filter: blur(6px);
}
.ert-leg-item {
  display:     flex;
  align-items: center;
  gap:         8px;
  font-size:   11px;
  color:       var(--ert-white-60);
}
.ert-leg-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.ert-leg-siege      { background: var(--ert-gold);  box-shadow:0 0 5px var(--ert-gold-glow); }
.ert-leg-bureau     { background: var(--ert-teal);  box-shadow:0 0 5px var(--ert-teal-glow); }
.ert-leg-couverture { background: #45c8e5;           box-shadow:0 0 5px rgba(69,200,229,.55); }

/* ═══ Tooltip ════════════════════════════════════ */
#ert-tooltip {
  position:       absolute;
  z-index:        300;
  max-width:      300px;
  min-width:      210px;
  pointer-events: none;
  background:     rgba(8,14,24,.97);
  border:         1px solid rgba(28,138,162,.3);
  border-radius:  9px;
  padding:        14px 16px;
  color:          var(--ert-white);
  font-size:      12px;
  line-height:    1.5;
  box-shadow:     0 10px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
  backdrop-filter:blur(10px);
  animation:      ert-tip .12s ease;
}
@keyframes ert-tip { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

.ert-tip-head {
  display:       flex;
  align-items:   center;
  gap:           10px;
  margin-bottom: 10px;
  padding-bottom:10px;
  border-bottom: 1px solid rgba(28,138,162,.2);
}
.ert-tip-flag  { font-size:26px; line-height:1; flex-shrink:0; }
.ert-tip-country { font-size:15px; font-weight:700; color:var(--ert-teal); }
.ert-tip-city    { font-size:11px; color:var(--ert-white-60); margin-top:1px; }
.ert-tip-badge {
  margin-left:auto; font-size:9px; font-weight:600;
  letter-spacing:.08em; text-transform:uppercase;
  padding:3px 8px; border-radius:20px; flex-shrink:0;
}
.ert-tip-badge--siege      { background:rgba(212,97,74,.18);  color:var(--ert-gold); border:1px solid rgba(212,97,74,.4); }
.ert-tip-badge--bureau     { background:rgba(28,138,162,.12);  color:var(--ert-teal); border:1px solid rgba(28,138,162,.3); }
.ert-tip-badge--couverture { background:rgba(69,200,229,.12);  color:#45c8e5;         border:1px solid rgba(69,200,229,.4); }
.ert-tip-sep    { border:none; border-top:1px solid var(--ert-white-10); margin:10px 0; }
.ert-tip-entity { font-size:12px; font-weight:600; color:var(--ert-white); margin-bottom:5px; }
.ert-tip-row    { display:flex; align-items:flex-start; gap:5px; color:var(--ert-white-60); font-size:11px; line-height:1.45; margin-top:4px; }
.ert-tip-row svg { flex-shrink:0; margin-top:2px; color:var(--ert-teal); }
.ert-tip-muted  { color:rgba(255,255,255,.38); }
.ert-tip-muted svg { color:rgba(28,138,162,.45); }
.ert-tip-none   { font-size:11px; color:rgba(255,255,255,.38); font-style:italic; margin-top:2px; }

/* ═══ Barre stats bas (Baker Tilly style) ════════ */
.ert-stats {
  background:  var(--ert-bg-stats);
  border-top:  1px solid var(--ert-border);
  display:     flex;
  align-items: center;
}
.ert-stat {
  flex:            1;
  padding:         16px 0;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             3px;
}
.ert-n {
  font-size:   28px;
  font-weight: 700;
  color:       var(--ert-white);
  line-height: 1;
}
.ert-n small { font-size:18px; }
.ert-label {
  font-size:      11px;
  color:          var(--ert-white-60);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.ert-stat-sep {
  width:      1px;
  height:     36px;
  background: var(--ert-border);
  flex-shrink:0;
}

/* ═══ Erreur ═════════════════════════════════════ */
.ert-error { color:#ff8888; font-size:13px; text-align:center; padding:20px; }

/* ═══ Responsive ═════════════════════════════════ */

/* ── Tablette ≤ 860px ── */
@media(max-width:860px) {
  .ert-body { flex-direction: column; height: auto !important; }

  .ert-panel {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    padding: 14px 16px;
    border-right: none;
    border-bottom: 1px solid var(--ert-border);
    overflow-x: auto;
    max-height: none;
  }
  .ert-panel-section {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 160px;
  }
  .ert-panel-section-title { margin-bottom: 0; flex-shrink: 0; }
  .ert-panel-list { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; }
  .ert-panel-list li { border-left: none; border-bottom: 1.5px solid rgba(28,138,162,.35); padding: 0 0 2px; font-size: 11px; }
  .ert-panel-divider { width: 1px; height: auto; margin: 0 8px; align-self: stretch; background: var(--ert-border); }

  .ert-map-area { min-height: 340px; }

  .ert-stats { flex-wrap: wrap; }
  .ert-stat  { flex: 1; min-width: 100px; padding: 12px 8px; }
  .ert-stat-sep { display: none; }
  .ert-n { font-size: 22px; }

  .ert-legend { bottom: 10px; right: 10px; padding: 8px 10px; gap: 5px; }
  .ert-leg-item { font-size: 10px; }
}

/* ── Mobile ≤ 520px ── */
@media(max-width:520px) {
  .ert-header { padding: 10px 16px; }
  .ert-brand-name { font-size: 15px; }

  .ert-panel { padding: 10px 12px; gap: 6px; }
  .ert-panel-section { min-width: 140px; }
  .ert-panel-count { font-size: 15px; }

  .ert-map-area { min-height: 280px; }

  #ert-tooltip { max-width: calc(100vw - 32px); min-width: 0; font-size: 11px; }
  .ert-tip-country { font-size: 13px; }
  .ert-tip-flag { font-size: 20px; }

  .ert-stats { display: grid; grid-template-columns: 1fr 1fr; }
  .ert-stat { border-right: 1px solid var(--ert-border); border-bottom: 1px solid var(--ert-border); padding: 10px 8px; }
  .ert-n { font-size: 20px; }
  .ert-label { font-size: 10px; }

  .ert-legend { display: none; }
}

/* ── Pins SVG ── */
.ert-pin-dot {
  fill:   var(--ert-white);
  stroke: none;
  pointer-events: none;
  animation: ert-blink-bureau 1.4s ease-in-out infinite;
}
.ert-pin-dot--siege {
  animation: ert-blink-siege 1.2s ease-in-out infinite;
}
@keyframes ert-blink-bureau {
  0%,100% { opacity:1; r:4.5px; filter:drop-shadow(0 0 5px rgba(28,138,162,.9)); }
  50%     { opacity:.25; r:3.5px; filter:drop-shadow(0 0 2px rgba(28,138,162,.3)); }
}
@keyframes ert-blink-siege {
  0%,100% { opacity:1; r:5.5px; fill:#D4614A; filter:drop-shadow(0 0 7px rgba(212,97,74,.95)); }
  50%     { opacity:.25; r:4px;  fill:#D4614A; filter:drop-shadow(0 0 2px rgba(212,97,74,.3)); }
}
.ert-pin-pulse {
  fill:    none;
  stroke:  rgba(28,138,162,.6);
  opacity: 0;
  animation: ert-pulse 2.4s ease-out infinite;
}
.ert-pin-pulse--siege {
  stroke: rgba(212,97,74,.7);
  animation: ert-pulse 2s ease-out infinite;
}
@keyframes ert-pulse {
  0%   { r:6px;  opacity:.8; }
  100% { r:18px; opacity:0; }
}