/* ==========================================================
   MAP — Le Marché Local (V2 stable & clean)
========================================================== */

:root{
  --map-primary:#2F855A;
  --map-fill: rgba(47,133,90,0.12);
  --map-hover: rgba(47,133,90,0.22);
  --map-stroke: rgba(0,0,0,0.16);
  --map-dim: 0.14;
}

[data-theme="dark"]{
  --map-stroke: rgba(255,255,255,0.18);
}

.map-container{
  width:100%;
  height: calc(100vh - 220px); /* ajuste si besoin */
  min-height: 420px;
  max-height: none;
  position:relative;
  background:var(--card);
  border-radius:18px;
  overflow:hidden;
  box-shadow:var(--shadow);
}

.map-container svg{
  width:100%;
  height:100%;
  display:block;
}

/* toolbar/footer */
.map-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  border-bottom:1px solid rgba(0,0,0,0.06);
}

[data-theme="dark"] .map-toolbar{
  border-bottom:1px solid rgba(255,255,255,0.08);
}

.map-actions{ display:flex; gap:10px; align-items:center; }
.map-breadcrumb{ font-weight:700; font-size:14px; }

.map-footer{
  padding:12px 18px;
  font-size:13px;
  color:var(--muted);
  border-top:1px solid rgba(0,0,0,0.06);
}

[data-theme="dark"] .map-footer{
  border-top:1px solid rgba(255,255,255,0.08);
}

/* shapes */
.shape{
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 0.45;
  cursor:pointer;
  transition: fill .2s ease, opacity .2s ease, stroke .2s ease, stroke-width .2s ease;
}

.shape:hover{ fill: var(--map-hover); }

.shape.active{
  fill: var(--map-primary);
  stroke: var(--map-primary);
  stroke-width: 0.9;
}

.shape.dimmed{ opacity: var(--map-dim); }

/* clusters */

.cluster-point{
  fill: var(--map-primary);
  opacity: 0.55; /* 🔥 beaucoup plus discret */
  stroke: rgba(255,255,255,0.9);
  stroke-width: 1.2;
  cursor: pointer;
  transition: opacity .2s ease, transform .15s ease;
}

.cluster-point:hover{
  opacity: 0.9;
}

.commune-point{
  fill: var(--map-primary);
  opacity: 0.75;
  stroke: none;
  transition: opacity .15s ease;
}

.commune-point:hover{
  opacity: 1;
}

/* Focus cluster: communes sélectionnées vs autres */
.commune-point.focus { opacity: 0.95; }
.commune-point.dimmed { opacity: 0.10; }

.cluster-point { transform: none !important; }

/* tooltip */
.map-tooltip{
  position:fixed;
  pointer-events:none;
  background:var(--card);
  color:var(--text);
  padding:8px 12px;
  font-size:13px;
  border-radius:12px;
  box-shadow:var(--shadow);
  border:1px solid var(--map-stroke);
  display:none;
  z-index:9999;
}

@media (max-width:900px){
  .map-container{ height:62vh; min-height:460px; }
}
@media (max-width:600px){
  .map-container{ height:56vh; min-height:400px; }
}

.commune-label {
  font-size: 10px;
  fill: var(--text);
  opacity: 0.85;
  font-weight: 500;
}

@media (max-width: 768px){
  .commune-label {
    font-size: 12px;
  }
}

.map-hero{
  text-align:center;
  padding: 8px 18px 4px;
  margin-bottom: 6px;
}

.map-hero h1{
  margin:0 0 2px;
  font-size: 22px;
}

.map-hero p{
  font-size:13px;
  opacity:.75;
}

.map-search{
  position: relative;
  width: 240px;
}

.map-search input{
  width:100%;
  padding:8px 12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.08);
  background:var(--card);
  color:var(--text);
  font-size:13px;
  outline:none;
  transition:border .2s ease, box-shadow .2s ease;
}

.map-search input:focus{
  border-color: var(--map-primary);
  box-shadow: 0 0 0 3px rgba(47,133,90,.15);
}

.search-results{
  position:absolute;
  top:110%;
  left:0;
  right:0;
  background:var(--card);
  border:1px solid rgba(0,0,0,.08);
  border-radius:14px;
  max-height:260px;
  overflow:auto;
  display:none;
  z-index:1000;
  box-shadow:var(--shadow);
}

.search-results div{
  padding:8px 12px;
  font-size:13px;
  cursor:pointer;
  transition: background .15s ease;
}

.search-results div:hover{
  background: rgba(47,133,90,.08);
}

/* ==========================================
   MOBILE FIX — Map Toolbar
========================================== */

@media (max-width: 768px){

  .map-toolbar{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* Breadcrumb en haut */
  .map-breadcrumb{
    text-align: center;
    font-size: 13px;
  }

  /* Barre recherche prend toute la largeur */
  .map-search{
    width: 100%;
  }

  .map-search input{
    width: 100%;
    font-size: 14px;
  }

  /* Boutons côte à côte en bas */
  .map-actions{
    width: 100%;
    justify-content: space-between;
  }

  .map-actions .btn{
    flex: 1;
  }

  .map-actions .btn + .btn{
    margin-left: 8px;
  }

}