/**
 * Mapa del cercador (/cerca).
 *
 * Reutilitza el llenguatge visual del mapa de la fitxa de brigadista
 * (.brigadista-marker i .brigadista-cluster, definits al tema): cercle
 * porpra #A237B5 amb la icona blanca s-naixement/s-mort. Aquí només s'hi
 * afegeixen les variants (defunció en fosc), la mida compacta i els
 * elements propis del cercador (arc, extrems, fitxa, eines).
 */

/* --- Markers: mida compacta (n'hi pot haver milers) ------------------ */
#search-map .sm-marker,
#search-map .sm-marker:before {
  width: 26px !important;
  height: 26px !important;
}

#search-map .sm-marker:before {
  background-size: 14px;
  padding: 0;
}

#search-map .sm-marker--mort:before {
  background-color: #33323a;
  background-size: 13px;
}

/* Registres amb naixement i defunció: anell que convida a clicar-los. */
#search-map .sm-marker--path:before {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #ffb300, 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* --- Selecció: la resta de punts passa a segon pla ------------------- */
#search-map .leaflet-marker-pane,
#search-map .leaflet-overlay-pane {
  transition: opacity 0.3s ease, filter 0.3s ease;
}

#search-map.sm-focus .leaflet-marker-pane,
#search-map.sm-focus .leaflet-overlay-pane {
  opacity: 0.28;
  filter: grayscale(0.85);
}

/* --- Extrems de la trajectòria (pane superior, sempre nítids) -------- */
.sm-endpoint {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sm-endpoint .sm-marker {
  position: relative;
  z-index: 2;
}

.sm-endpoint-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: rgba(162, 55, 181, 0.45);
  animation: sm-pulse 1.8s ease-out infinite;
}

.sm-endpoint--mort .sm-endpoint-pulse {
  background: rgba(51, 50, 58, 0.45);
}

@keyframes sm-pulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* L'arc, l'espurna i els botons .sm-tool els aporta la llibreria
   compartida geo_arc, que també fa servir el mapa de la fitxa. */

/* --- Xips de llegenda (control de capes, popup i fitxa) -------------- */
.sm-legend-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #A237B5;
  vertical-align: -1px;
}

.sm-legend-chip--mort {
  background: #33323a;
}

/* --- Popup i fitxa de selecció --------------------------------------- */
#search-map .sm-popup .leaflet-popup-content-wrapper,
.sidbrint-map-card {
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

#search-map .sm-popup .leaflet-popup-content {
  margin: 14px 16px;
}

#search-map .sm-popup .leaflet-popup-content,
.sidbrint-map-card {
  font-family: "Albert Sans", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #222;
}

.sidbrint-map-card {
  display: none;
  position: relative;
  background: #fff;
  padding: 14px 34px 14px 16px;
  margin-bottom: 8px;
  max-width: 320px;
}

.sidbrint-map-card.is-visible {
  display: block;
}

.sm-card-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #767680;
  cursor: pointer;
}

.sm-card-close:hover {
  color: #A237B5;
}

.sm-popup-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}

#search-map .sm-popup-title a,
.sidbrint-map-card .sm-popup-title a {
  color: #222 !important;
  text-decoration: none !important;
}

#search-map .sm-popup-title a:hover,
.sidbrint-map-card .sm-popup-title a:hover {
  color: #A237B5 !important;
}

.sm-popup-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 3px 0;
}

.sm-popup-row .sm-legend-chip {
  flex: none;
  width: 10px;
  height: 10px;
}

.sm-popup-row.is-current .sm-popup-value {
  font-weight: 700;
}

.sm-popup-label {
  color: #767680;
  flex: none;
}

.sm-popup-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #A237B5;
}

/* --- Targeta d'estat (baix a l'esquerra) ----------------------------- */
.sidbrint-map-status {
  background: rgba(255, 255, 255, 0.94);
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-family: "Albert Sans", sans-serif;
  max-width: 320px;
}

.sidbrint-map-status:empty {
  display: none;
}

.sm-status-count {
  font-size: 14px;
  font-weight: 700;
  color: #222;
}

.sm-status-hint {
  font-size: 12px;
  color: #767680;
  margin-top: 2px;
}

/* --- Eines (a dalt a l'esquerra) ------------------------------------- */
.sidbrint-map-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

/* --- Control de capes ------------------------------------------------ */
#search-map .leaflet-control-layers {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  border: none;
  font-family: "Albert Sans", sans-serif;
  font-size: 13px;
  padding: 6px 10px;
}

#search-map .leaflet-control-layers label {
  margin: 2px 0;
}

@media (prefers-reduced-motion: reduce) {
  .sm-endpoint-pulse {
    animation: none;
  }
}
