/*
 * Onglizy — ZONE ANNUAIRE — carte interactive de France (components/directory-map + public/map.js)
 * Incluse par @push('styles') via @asset('map.css'). Couleurs : tokens du socle (public/app.css).
 * Classes historiques conservées car utilisées par map.js : .map-* , .france-map, .legend-*, .pin-*.
 */

/* Section ----------------------------------------------------------------- */
.directory-map { display: flex; flex-direction: column; gap: 16px; }
.map-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.map-heading-text { display: flex; flex-direction: column; gap: 6px; max-width: 640px; min-width: 0; }
.map-title { font-family: var(--font-ui); font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: 0; color: var(--plum-900); }
.map-lead { font-size: 14px; line-height: 1.5; color: var(--muted); }
.map-toggle { flex-shrink: 0; }
.map-body {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-card);
}
.map-body[hidden] { display: none; }
.map-noscript { font-size: 14px; color: var(--muted); }

/* Bascule et barre d'outils ------------------------------------------------ */
.map-kind-switch { margin: 16px 20px 0; }
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.map-zone { flex: 0 1 300px; }
.map-zone select { min-height: 44px; }
.map-location-label { margin-left: auto; align-self: center; }

/* Canevas ----------------------------------------------------------------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.map-canvas { position: relative; min-width: 0; overflow: hidden; background: var(--sage-100); }
.france-map { display: block; width: 100%; height: clamp(420px, 52vw, 600px); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.france-map:focus-visible { outline: 3px solid var(--plum-700); outline-offset: -3px; }
.map-department { fill: var(--ivory); stroke: var(--line-strong); stroke-width: 1; fill-rule: evenodd; cursor: pointer; }
.map-department.has-profiles { fill: var(--rose-200); }
.map-department:hover, .map-department:focus { fill: var(--rose-300); stroke: var(--plum-700); stroke-width: 1.8; outline: none; }
.map-department.selected { fill: var(--rose-300); stroke: var(--plum-700); stroke-width: 2; }
.map-city-labels { pointer-events: none; fill: var(--muted); }
.map-city-labels text {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  paint-order: stroke;
  stroke: var(--ivory);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.map-marker { cursor: pointer; outline: none; }
.map-marker .pin-halo { fill: rgba(86, 60, 73, .16); }
.map-marker .pin-fill { fill: var(--plum-700); stroke: var(--white); stroke-width: 3; }
.map-marker text {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  fill: var(--white);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.map-marker:hover .pin-fill, .map-marker:focus .pin-fill { fill: var(--plum-900); stroke: var(--rose-200); stroke-width: 4; }
.map-marker:focus .pin-halo { fill: rgba(86, 60, 73, .32); }
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--shadow-card);
}
.map-controls button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: var(--white);
  color: var(--plum-700);
}
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover { background: var(--blush-100); }
.map-controls button:focus-visible { outline-offset: -3px; }
.map-hover-label {
  position: absolute;
  top: 16px;
  left: 16px;
  max-width: calc(100% - 96px);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .94);
  font-size: 13px;
  font-weight: 600;
  color: var(--plum-900);
  pointer-events: none;
  box-shadow: var(--shadow-card);
}
.map-legend {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .94);
  font-size: 13px;
  color: var(--plum-900);
}
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: var(--radius-pill); }
.legend-pin { background: var(--plum-700); box-shadow: 0 0 0 2px var(--white); }
.map-legend .legend-area { border-radius: 3px; background: var(--rose-200); border: 1px solid var(--line-strong); }

/* Panneau de détail --------------------------------------------------------- */
.map-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: clamp(420px, 52vw, 600px);
  padding: 20px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--white);
  scrollbar-width: thin;
}
.map-detail-title { font-family: var(--font-display); font-size: 30px; font-weight: 400; line-height: 1.12; }
.map-status { font-size: 14px; line-height: 1.5; color: var(--muted); }
.directory-map[aria-busy="true"] .map-status { opacity: .7; }
.map-profile-list { display: flex; flex-direction: column; gap: 8px; }
.map-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--plum-900);
  text-decoration: none;
  transition: background-color var(--transition), border-color var(--transition);
}
.map-profile:hover { border-color: var(--mauve-500); background: var(--blush-50); color: var(--plum-900); }
.map-profile img, .map-profile-placeholder {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  min-height: 0;
  border-radius: 10px;
  object-fit: cover;
}
.map-profile-placeholder > span { width: 16%; }
.map-profile-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.map-profile-copy strong { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.map-profile-copy > span { font-size: 13px; color: var(--muted); }
.map-profile-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.map-empty-note { padding: 16px; border-radius: var(--radius-sm); background: var(--blush-50); font-size: 14px; color: var(--muted); }
.map-results-link { margin-top: auto; }

/* Pied ------------------------------------------------------------------- */
.map-footnote {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.map-footnote a { color: var(--plum-700); }
.map-skip:focus { top: 12px; }

/* Téléphone ---------------------------------------------------------------- */
@media (max-width: 1000px) {
  .map-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .map-location-label { display: none; }
}
@media (max-width: 860px) {
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .france-map { height: 400px; }
  .map-detail { max-height: none; border-left: 0; border-top: 1px solid var(--line); padding: 16px; }
  .map-detail-title { font-size: 26px; }
  .map-toolbar { padding: 12px 16px; }
  .map-zone { flex: 1 1 100%; }
  .map-kind-switch { margin: 12px 16px 0; display: flex; }
  .map-kind-switch .segment { flex: 1 1 0; }
  .map-legend { bottom: 10px; left: 10px; right: 10px; }
  .map-footnote { padding: 12px 16px; }
}
@media (max-width: 420px) {
  .france-map { height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  .map-profile { transition: none; }
}
