/* ═══════════════════════════════════════════════════════════════
   Cartes PS
   ═══════════════════════════════════════════════════════════════ */

.psc {
  --psc-rouge: #e30613;
  --psc-rouge-fonce: #a30410;
  --psc-texte: #22262a;
  --psc-gris: #5c636a;
  --psc-bord: #d3d7db;
  --psc-fond: #ffffff;
  --psc-vert: #1d7a3e;
  --psc-focus: #1f5fbf;
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  color: var(--psc-texte);
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
.psc *, .psc *::before, .psc *::after { box-sizing: border-box; }

/* Les thèmes (Elementor & co) repeignent tous les <button>. Nos boutons
   « nus » — résultats, retour, fermer, bascule — reprennent la main :
   ni fond, ni majuscules forcées, ni coins arrondis. */
.psc-res, .psc-retour, .psc-fiche-fermer, .psc-basculer,
.psc-res:hover, .psc-retour:hover, .psc-fiche-fermer:hover, .psc-basculer:hover,
.psc-res:focus, .psc-retour:focus, .psc-fiche-fermer:focus, .psc-basculer:focus,
.psc-res:active, .psc-retour:active, .psc-fiche-fermer:active, .psc-basculer:active {
  -webkit-appearance: none !important; appearance: none !important;
  background: none !important; background-color: transparent !important;
  background-image: none !important; box-shadow: none !important;
  border: 0 !important; border-radius: 0 !important; text-shadow: none !important;
  font-family: inherit !important; font-size: inherit !important; line-height: 1.45 !important;
  font-weight: 400 !important; text-transform: none !important; letter-spacing: normal !important;
  text-decoration: none; min-height: 0 !important; min-width: 0 !important;
  width: auto; height: auto; cursor: pointer; transform: none !important;
}
/* et le texte des résultats et des fiches reste tel qu'il est saisi */
.psc-resultats, .psc-resultats *, .psc-fiche, .psc-fiche *,
.psc-fiche-debat, .psc-fiche-debat * { text-transform: none !important; }
.psc [hidden] { display: none !important; }

.psc-debats { max-width: 900px; }

/* fiche d'un débat, sous la carte */
.psc-fiche-debat {
  position: relative; margin-top: 10px; padding: 14px 44px 14px 16px;
  background: #fff; border: 1px solid var(--psc-bord); border-left: 4px solid var(--psc-rouge);
  border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.psc-fiche-debat .psc-fiche-titre { margin: 0 0 4px; font-size: 17px; }
.psc-fiche-debat p { margin: 2px 0; }
.psc-fiche-date { color: var(--psc-rouge-fonce); font-weight: 700; }
.psc-fiche-fermer {
  position: absolute; top: 6px; right: 6px; width: 36px !important; height: 36px !important;
  font-size: 24px !important; line-height: 1 !important; color: var(--psc-gris) !important;
}
.psc-fiche-fermer:hover { color: var(--psc-texte); }
.psc .psc-carte { width: 100%; height: var(--psc-hauteur, 700px); }

/* carte étroite : pas d'étiquettes (elles se chevauchent et débordent) */
.psc-compact .psc-carte svg text { display: none; }

/* régions = décor */
.psc .jvm-region { pointer-events: none; vector-effect: non-scaling-stroke; }
.psc .psc-colmatage { pointer-events: none; }

.psc-reset {
  position: absolute; left: 10px; bottom: 10px; z-index: 3;
  padding: 6px 12px; font: 600 12px/1.2 inherit;
  color: var(--psc-texte); background: #fff; border: 1px solid var(--psc-bord);
  border-radius: 4px; cursor: pointer;
}
.psc-reset:hover { background: #f4f5f6; }

.psc-erreur {
  margin: 12px 0 0; padding: 10px 14px;
  background: #fdecee; border-left: 4px solid var(--psc-rouge); border-radius: 3px;
}
.psc-erreur-titre { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.psc-erreur-detail { margin: 4px 0 0; padding-left: 18px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

/* focus visible partout */
.psc :focus-visible {
  outline: 3px solid var(--psc-focus);
  outline-offset: 2px;
}

/* ── infobulle (commune) ── */
.jvm-tooltip {
  background: #14171a; border: 0; border-radius: 6px;
  padding: 8px 11px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  max-width: min(280px, calc(100vw - 16px));
  white-space: normal; overflow-wrap: anywhere;
  /* purement informative : ne doit jamais intercepter un clic sur un marqueur voisin */
  pointer-events: none;
}
.jvm-tooltip span { display: block; }
.jvm-tooltip .psc-tt-titre { font-weight: 700; font-size: 14px; }
.jvm-tooltip .psc-tt-ligne { opacity: .7; }
.jvm-tooltip .psc-tt-date  { margin-top: 4px; color: #ff8a93; font-weight: 600; }
.jvm-tooltip .psc-tt-ouvert { margin-top: 4px; color: #7ee2a0; font-weight: 600; }
.jvm-tooltip .psc-tt-ferme  { margin-top: 4px; color: #c9ced3; }

/* ═══ carte des points de vote ═══ */

.psc-recherche {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px;
  margin-bottom: 8px;
}
.psc-recherche label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.psc-champ { position: relative; flex: 1 1 280px; min-width: 0; }
.psc-q, .psc-rayon-select {
  width: 100%; height: 44px; padding: 0 12px;
  font: inherit; color: var(--psc-texte); background: var(--psc-fond);
  border: 1px solid #8a9299; border-radius: 4px;
}
.psc-q::placeholder { color: #6b7278; opacity: 1; }
.psc-rayon { flex: 0 0 150px; }
.psc-aide { margin: 4px 0 0; font-size: 13px; color: var(--psc-gris); }
.psc-champ .psc-aide { position: absolute; }
.psc-boutons { display: flex; gap: 8px; flex-wrap: wrap; }

.psc-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 16px;
  font: 600 15px/1 inherit; border-radius: 4px; cursor: pointer;
  border: 2px solid var(--psc-rouge); background: #fff; color: var(--psc-rouge-fonce);
}
.psc-btn:hover { background: #fdecee; }
.psc-btn-principal { background: var(--psc-rouge); color: #fff; }
.psc-btn-principal:hover { background: var(--psc-rouge-fonce); border-color: var(--psc-rouge-fonce); }
.psc-btn[disabled] { opacity: .6; cursor: wait; }

.psc-suggestions {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  margin: 2px 0 0; padding: 4px 0; list-style: none;
  background: #fff; border: 1px solid #8a9299; border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  max-height: 300px; overflow: auto;
}
.psc-suggestions li { padding: 9px 12px; cursor: pointer; }
.psc-suggestions li:hover,
.psc-suggestions li[aria-selected="true"] { background: #fdecee; color: var(--psc-rouge-fonce); }

.psc-barre {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px;
  margin: 22px 0 8px;
}
.psc-statut { margin: 0; font-weight: 600; min-height: 1.45em; flex: 1 1 260px; }
.psc-basculer {
  flex: 0 0 auto; padding: 4px 0 !important; font-weight: 600 !important; font-size: 14px !important;
  color: var(--psc-rouge-fonce) !important; text-decoration: underline;
}
.psc-basculer:hover { color: var(--psc-texte) !important; }

.psc-corps { position: relative; }
.psc-carte-zone { position: relative; }

/* liste à gauche, carte à droite : la liste ne recouvre plus la carte.
   Sans liste affichée, la carte occupe toute la largeur : la deuxième
   colonne n'existe que quand la liste est là (sinon la carte se retrouve
   coincée dans une colonne étroite). */
.psc-vote .psc-corps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.psc-panneau {
  overflow: auto; max-height: var(--psc-hauteur, 640px);
  background: #fff; border: 1px solid var(--psc-bord); border-radius: 6px;
}
@media (min-width: 900px) {
  .psc-vote.psc-avec-panneau .psc-corps { grid-template-columns: 300px minmax(0, 1fr); }
}
.psc-vote .jvm-zoom-btn { left: auto; right: 10px; }
.psc-vote .psc-reset { left: auto; right: 10px; }
.psc-vote .jvm-zoomin  { top: 10px; }
.psc-vote .jvm-zoomout { top: 36px; }

.psc-resultats { margin: 0; padding: 6px 0; list-style: none; }
.psc-resultats li { margin: 0; border-bottom: 1px solid #eceef0; }
.psc-resultats li:last-child { border-bottom: 0; }
.psc-aucun > p { margin: 8px 14px 0; color: var(--psc-gris); }

.psc-res {
  display: block; width: 100% !important; padding: 10px 14px 10px 12px !important;
  text-align: left; color: var(--psc-texte) !important;
  border-left: 3px solid transparent !important;
}
.psc-res:hover, .psc-res:focus-visible { border-left-color: var(--psc-rouge) !important; }
.psc-res:hover .psc-res-nom, .psc-res:focus-visible .psc-res-nom {
  color: var(--psc-rouge-fonce); text-decoration: underline;
}
.psc-res > span { display: block; }
.psc-res-nom { font-weight: 700 !important; }
.psc-res-adr { color: var(--psc-gris); font-size: 14px; }
.psc-res-meta { margin-top: 3px; display: flex !important; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; }
.psc-res-km { font-weight: 600; }

.psc-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5;
}
.psc-ouvert { background: #e3f4e8; color: var(--psc-vert); }
.psc-ferme  { background: #eef0f2; color: #4a5157; }

.psc-fiche { padding: 12px 16px 16px; }
.psc-retour {
  margin: 0 0 8px; padding: 6px 0 !important; font-size: 14px !important;
  font-weight: 600 !important; color: var(--psc-rouge-fonce) !important;
}
.psc-fiche-titre { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.psc-fiche-titre:focus { outline: none; }
.psc-fiche-titre:focus-visible { outline: 3px solid var(--psc-focus); }
.psc-fiche p { margin: 8px 0; }
.psc-fiche-adr span { display: block; }
.psc-fiche-km { color: var(--psc-gris); font-size: 14px; }
.psc-fiche h4 { margin: 14px 0 6px; font-size: 15px; }
.psc-horaires { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.psc-horaires dt { font-weight: 600; }
.psc-horaires dd { margin: 0; }
.psc-creneau { white-space: nowrap; }
.psc-itineraire {
  display: inline-block; margin-top: 14px; font-weight: 600;
  color: var(--psc-rouge-fonce);
}

/* ── téléphone / petite tablette : la liste passe sous la carte ── */
@media (max-width: 719px) {
  .psc-vote .psc-carte { height: min(var(--psc-hauteur, 640px), 60vh); }
  .psc-vote .psc-carte-zone { order: 1; }
  .psc-vote .psc-panneau { order: 2; max-height: none; }
  /* la carte prend la forme de la France au lieu d'une hauteur fixe */
  .psc-debats .psc-carte { height: auto; aspect-ratio: 900 / 867; }
  .psc-panneau {
    position: static; width: auto; max-height: none;
    margin-top: 10px; box-shadow: none;
  }
  .psc-rayon { flex: 1 1 140px; }
  .psc-boutons { flex: 1 1 100%; }
  .psc-boutons .psc-btn { flex: 1 1 auto; justify-content: center; }
  .psc-champ .psc-aide { position: static; }
  .psc-statut { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .psc * { transition: none !important; }
}
