/* Participant choropleth map + filter widget.
   Bulma (globally loaded) provides .button / .buttons / .table base styles;
   this file adds the widget layout, the pill filter bar and Poppins typography. */

.participant-map {
  --pm-accent: #1f6f6b;
  font-family: "Poppins", "Open Sans", system-ui, sans-serif;
  margin-block: 1.5rem;
}

.participant-map *,
.participant-map *::before,
.participant-map *::after {
  box-sizing: border-box;
}

/* ---- filter bar ---- */

.participant-map__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: flex-end;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  background: #f6f8f9;
  border: 1px solid #e6ebec;
  border-radius: 14px;
}

.participant-map__filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.participant-map__filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.participant-map__filter-buttons.buttons.has-addons {
  flex-wrap: wrap;
  gap: 0;
}

.participant-map__filter-buttons .button {
  font-family: inherit;
  font-weight: 500;
  border-color: #d7dee0;
  color: #334155;
  background: #fff;
}

.participant-map__filter-buttons .button:hover {
  border-color: var(--pm-accent);
  color: var(--pm-accent);
}

.participant-map__filter-buttons .button.is-active {
  background: var(--pm-accent);
  border-color: var(--pm-accent);
  color: #fff;
  z-index: 1;
}

/* ---- map stage ---- */

.participant-map__stage {
  position: relative;
}

.participant-map__canvas {
  width: 100%;
  height: clamp(360px, 58vh, 600px);
  border-radius: 12px;
  overflow: hidden;
  background: #eef3f6;
  border: 1px solid #e2e8f0;
}

.participant-map__canvas .maplibregl-canvas {
  outline: none;
}

.participant-map__legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.participant-map__legend-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  color: #475569;
}

.participant-map__legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.participant-map__legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.participant-map__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  flex: none;
}

/* ---- summary + table ---- */

.participant-map__summary {
  margin: 0.85rem 0 0.35rem;
  font-weight: 500;
  color: #475569;
}

.participant-map__table-wrap {
  overflow-x: auto;
}

.participant-map__table.table {
  font-family: inherit;
  font-size: 0.9rem;
}

.participant-map__table.table th {
  font-weight: 600;
  color: #334155;
  border-bottom-width: 2px;
}

.participant-map__table.table td {
  vertical-align: middle;
}

.participant-map__table td.has-text-right,
.participant-map__table th.has-text-right {
  font-variant-numeric: tabular-nums;
}

/* ---- popup ---- */

.participant-map__popup-wrap .maplibregl-popup-content {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-family: "Poppins", "Open Sans", sans-serif;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
}

.participant-map__popup-country {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.participant-map__popup-total {
  margin: 0.1rem 0 0.5rem;
  color: #475569;
  font-size: 0.85rem;
}

.participant-map__popup-group {
  border-top: 1px solid #eef2f6;
  padding-top: 0.35rem;
  margin-top: 0.35rem;
}

.participant-map__popup-group:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.participant-map__popup-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 0.82rem;
}

.participant-map__popup-row span:last-child {
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  font-weight: 600;
}

.participant-map__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  font-family: "Poppins", "Open Sans", sans-serif;
}

.participant-map-block__heading {
  margin-bottom: 0.5rem;
  font-family: "Poppins", "Open Sans", sans-serif;
}

.participant-map-block__intro {
  max-width: 60ch;
  color: #475569;
}

@media (max-width: 600px) {
  .participant-map__legend {
    position: static;
    margin-top: 0.75rem;
    box-shadow: none;
  }
}
