/* ════════════════════════════════════════════════════════════
   donna — desktop-heatmap.css (v644)
   Page Carte de chaleur (desktop). Layout 2 colonnes : carte large +
   sidebar avec top zones. Mêmes couleurs que la version PWA mais
   adapté à un écran plus grand.
   ════════════════════════════════════════════════════════════ */

#page-heatmap .dh-wrap {
  /* [v651] padding-top retiré : c'est le shellv2-main qui gère le padding-top
     uniformément (32px) pour toutes les pages.
     [v1019] max-width: 1560px RETIRÉ.
     [v1020] Padding-x 14px ajouté pour aligner contenu sur intérieur .ph.
     [v1021] Anthony : "rajouter encore un peu" — passé à 28px, qui matche
     le padding-left de .cpt-content sur la page Compte (la référence
     d'alignement demandée). */
  padding: 0 28px 40px 28px;
}

/* Header */

/* Segmented control */

#page-heatmap .dh-segm button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
html[data-theme="noir"] #page-heatmap .dh-segm button.active {
  background: var(--s3);
}

/* Stats row [v1016] Anthony : remplacement du markup dh-stats par
   .kpi-strip-card (style Dossiers). Les anciennes règles .dh-stats /
   .dh-stat-cell / .dh-stat-val / .dh-stat-lbl ne matchent plus le nouveau
   markup. [v1017] margin-bottom déplacé sur .dh-controls-row qui wrap
   maintenant la strip + les toggles inline. */

/* Layout 2 colonnes */
#page-heatmap .dh-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px){
  #page-heatmap .dh-layout {
    grid-template-columns: 1fr;
  }
}

/* Carte */
#page-heatmap .dh-map-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#page-heatmap .dh-map-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
#page-heatmap .dh-map-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}
#page-heatmap .dh-map-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* [v646] pointer-events:auto pour capturer les clicks sur les cercles.
     Le fond du SVG est transparent donc seuls les <circle> reçoivent les events. */
  pointer-events: auto;
}
#page-heatmap .dh-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
#page-heatmap .dh-spin {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dh-spin 0.7s linear infinite;
}
@keyframes dh-spin {
  to { transform: rotate(360deg); }
}

/* Légende */
#page-heatmap .dh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
#page-heatmap .dh-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
#page-heatmap .dh-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

/* Sidebar zones */
#page-heatmap .dh-side-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
#page-heatmap .dh-zones-ttl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
#page-heatmap .dh-zones-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}
#page-heatmap .dh-zone-row {
  display: grid;
  /* [v649] Grid revu : la barre est en milieu flexible (1fr) avec un
     min-width 60px pour rester lisible. La colonne count s'adapte
     automatiquement à son contenu (auto au lieu de 80px fixe).
     Avant : la colonne count était trop courte pour "605 acq. · 11 biens"
     et écrasait la barre + débordait visuellement. */
  grid-template-columns: 22px minmax(0, 1fr) minmax(60px, 0.8fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
}
#page-heatmap .dh-zone-row + .dh-zone-row {
  border-top: 1px solid var(--border);
}
/* [v645] rows cliquables → ouvre la fiche zone */
#page-heatmap .dh-zone-row-clickable {
  cursor: pointer;
  margin: 0 -10px;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background .12s ease;
}
#page-heatmap .dh-zone-row-clickable:hover {
  background: var(--s2);
}
#page-heatmap .dh-zone-row-clickable + .dh-zone-row-clickable {
  border-top: none;
}

/* [v645] Cercles SVG de la carte cliquables */
#page-heatmap .dh-svg-circle {
  cursor: pointer;
  transition: filter .15s ease;
}
#page-heatmap .dh-svg-circle:hover {
  filter: brightness(1.15);
}
#page-heatmap .dh-zone-rank {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}
#page-heatmap .dh-zone-main {
  min-width: 0;
}
#page-heatmap .dh-zone-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#page-heatmap .dh-zone-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
#page-heatmap .dh-zone-bar-wrap {
  height: 6px;
  background: var(--s2);
  border-radius: 3px;
  overflow: hidden;
}
#page-heatmap .dh-zone-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}
#page-heatmap .dh-zone-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   [v645] Panneau brief de zone (desktop)
   Glisse depuis la droite, backdrop semi-transparent, slide-in 240ms.
   ════════════════════════════════════════════════════════════ */
#dh-zone-panel {
  position: fixed;
  inset: 0;
  z-index: 5000;
}
#dh-zone-panel.open .dh-zone-panel-backdrop {
  opacity: 1;
}
#dh-zone-panel.open .dh-zone-panel-content {
  transform: translateX(0);
}
.dh-zone-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.dh-zone-panel-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dh-zone-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dh-zone-panel-title-wrap {
  flex: 1;
  min-width: 0;
}
.dh-zone-panel-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent, #6b5cf5);
  margin-bottom: 4px;
}
.dh-zone-panel-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -.5px;
  color: var(--text);
}
.dh-zone-panel-close {
  flex-shrink: 0;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: all .15s ease;
}
.dh-zone-panel-close:hover {
  background: var(--s3);
  color: var(--text);
}

.dh-zone-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 30px;
}

/* Bloc brief IA */
.dh-zone-brief {
  background: linear-gradient(135deg, rgba(107, 92, 245, .08), rgba(139, 123, 255, .04));
  border: 1px solid rgba(107, 92, 245, .25);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  position: relative;
}
html[data-theme="noir"] .dh-zone-brief {
  background: linear-gradient(135deg, rgba(107, 92, 245, .14), rgba(139, 123, 255, .06));
}
.dh-zone-brief-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent, #6b5cf5);
  margin-bottom: 10px;
}
.dh-zone-brief-icon {
  font-size: 14px;
}
.dh-zone-brief-content {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
}
.dh-zone-brief-soon {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
}

/* Stats grid */
.dh-zone-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}
.dh-zone-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.dh-zone-stat-lbl {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.dh-zone-stat-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* Sections (biens/acquéreurs) */
.dh-zone-section {
  margin-bottom: 22px;
}
.dh-zone-section-ttl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.dh-zone-section-count {
  background: var(--s2);
  color: var(--muted);
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.dh-zone-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all .15s ease;
}
.dh-zone-item:hover {
  border-color: var(--accent, #6b5cf5);
  background: var(--s2);
}
.dh-zone-item-av {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.dh-zone-item-av.bien {
  background: rgba(37, 99, 235, .15);
  color: #2563eb;
}
.dh-zone-item-av.acq {
  background: rgba(220, 38, 38, .15);
  color: #dc2626;
}
.dh-zone-item-body {
  flex: 1;
  min-width: 0;
}
.dh-zone-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dh-zone-item-detail {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dh-zone-item-arr {
  flex-shrink: 0;
  color: var(--muted);
}

.dh-zone-empty {
  text-align: center;
  padding: 16px 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  background: var(--s2);
  border-radius: 10px;
}

/* ════════════════════════════════════════════════════════════
   [v649] Mapbox GL JS interactive
   ════════════════════════════════════════════════════════════ */
#dh-map-gl {
  border-radius: 14px;
  overflow: hidden;
}
#dh-map-gl .mapboxgl-canvas {
  border-radius: 14px;
}
#dh-map-gl .mapboxgl-ctrl-attrib {
  font-size: 10px;
  background: rgba(255,255,255,.7);
}
.dh-gl-marker {
  /* base styles dans l'inline JS, juste les ajustements de cohérence */
  pointer-events: auto;
}
.dh-gl-marker-bien:hover {
  z-index: 100;
}

/* [v649] Style des controls Mapbox GL pour matcher l'UI donna */
#dh-map-gl .mapboxgl-ctrl-group {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border-radius: 8px;
  overflow: hidden;
}
#dh-map-gl .mapboxgl-ctrl-group button {
  width: 32px;
  height: 32px;
  background: transparent;
}
#dh-map-gl .mapboxgl-ctrl-group button:hover {
  background: var(--s2);
}
html[data-theme="noir"] #dh-map-gl .mapboxgl-ctrl-group button span {
  filter: invert(0.9);
}

/* [v1017] Anthony : KPI strip + toggles inline dans la même row, sous
   le .ph et au-dessus de la map. Espacement généreux avant la map.
   [v1018] Toggles passés en .page-view-switcher (style compact icon-only
   utilisé sur Biens), Anthony : "trop gros". */
.dh-controls-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
#page-heatmap .dh-controls-row > .kpi-strip-card{
  flex: 0 1 auto;
  width: auto;
  margin-bottom: 0;
}
#page-heatmap .dh-controls-row > .dh-view-switcher{
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
}
/* [v1018] Compat : le JS desktop-heatmap toggle la classe .active alors que
   page-view-switcher utilise [data-active="true"]. On match les 2 pour
   éviter d'avoir à modifier le JS. */
#page-heatmap .page-view-switcher .pvs-btn.active{
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* dh-header retiré (utilise pg-hero standard maintenant) */

