/* ============================================================
   FORTIS ECOLOGY — v2 page styles: UK invasive species map
   Loaded after styles-v2.css on uk-invasive-species-map.html only.
   Everything is prefixed .map- so nothing collides with the design system.
   ============================================================ */

/* Visually hidden (labels for screen readers) */
.map-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Hero extras ---------- */
.map-hero__title span { color: var(--gold-light); }
.map-hero__stats {
  display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 28px; padding: 0; list-style: none;
  font-family: var(--font-head); font-weight: 600; font-size: 13px; letter-spacing: 0.04em;
  color: var(--on-dark-75);
}
.map-hero__stats li { display: inline-flex; align-items: center; gap: 8px; }
.map-hero__stats li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-light); opacity: 0.85; }

/* ---------- Postcode search (on dark) ---------- */
.map-search { display: flex; gap: 10px; max-width: 560px; }
.map-search__input {
  flex: 1; min-width: 0; min-height: 52px; padding: 12px 18px;
  font-family: var(--font-body); font-size: 16px; color: var(--off-white);
  background: rgba(250,250,248,0.10); border: 1.5px solid rgba(250,250,248,0.35);
  border-radius: var(--r-btn);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.map-search__input::placeholder { color: rgba(250,250,248,0.6); }
.map-search__input:focus {
  outline: 3px solid rgba(201,169,106,0.45); outline-offset: 1px;
  border-color: var(--gold-light); background: rgba(250,250,248,0.16);
}
.map-search__btn { flex-shrink: 0; }
.map-search__error { color: #FFC9C2; font-size: 14px; margin-top: 10px; min-height: 22px; }

/* ---------- Attribution note ---------- */
.map-note { background: #fff; border-bottom: 1px solid var(--line); }
.map-note__inner { max-width: var(--maxw); margin: 0 auto; padding: 22px var(--gutter); }
.map__attribution {
  margin: 0; max-width: 92ch;
  font-size: 14px; line-height: 1.7; color: var(--body);
  border-left: 2px solid var(--gold-cta); padding-left: 14px;
}

/* ---------- Map container ---------- */
.map-wrap {
  position: relative; z-index: 1; isolation: isolate; /* keeps Leaflet + overlays under the sticky header */
  height: min(74vh, 760px); min-height: 460px;
  background: var(--mist);
}
#map { width: 100%; height: 100%; z-index: 1; font-family: var(--font-body); }

/* ---------- Species toggle panel ---------- */
.map-species-panel {
  position: absolute; top: 12px; left: 12px; z-index: 800;
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(250,250,248,0.96);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 12px; border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--e2);
}
.map-species-panel__title {
  font-family: var(--font-head); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted);
  margin: 0 0 4px 2px;
}
.map-species-btn {
  display: flex; align-items: center; gap: 9px;
  min-height: 40px; padding: 8px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  background: #fff; color: var(--body); cursor: pointer;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500; text-align: left;
  white-space: nowrap;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease,
              box-shadow 200ms ease, transform 160ms ease;
}
.map-species-btn:hover { border-color: var(--fern); box-shadow: var(--e1); transform: translateY(-1px); }
.map-species-btn:active { transform: scale(0.97); }
.map-species-btn.active { border-color: var(--moss); background: rgba(64,145,108,0.10); color: var(--forest); }
.map-species-btn.map-all-btn { font-family: var(--font-head); font-weight: 600; font-size: 13px; }
.map-species-dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  opacity: 0.35; transform: scale(0.8);
  transition: opacity 200ms ease, transform 200ms ease;
}
.map-species-btn.active .map-species-dot { opacity: 1; transform: scale(1); }

/* ---------- Legend ---------- */
.map-legend {
  position: absolute; bottom: 24px; right: 12px; z-index: 800;
  background: rgba(250,250,248,0.96);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-btn);
  box-shadow: var(--e2);
}
.map-legend__title {
  font-family: var(--font-head); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 6px;
}
.map-legend__bar {
  width: 160px; height: 12px; border-radius: 6px;
  background: linear-gradient(to right, #ffffb2, #fecc5c, #fd8d3c, #f03b20, #bd0026);
}
.map-legend__labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- Report FAB ---------- */
.map-report-fab {
  position: absolute; bottom: 24px; left: 12px; z-index: 800;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 12px 20px;
  background: var(--gold-cta); color: #fff; border: 0; border-radius: var(--r-pill);
  font-family: var(--font-head); font-weight: 600; font-size: 14px; cursor: pointer;
  box-shadow: var(--e3);
  transition: background var(--t-fast), transform var(--t-fast);
}
.map-report-fab:hover { background: var(--gold-cta-hover); transform: translateY(-2px); }
.map-report-fab:active { background: var(--gold-cta-active); transform: none; }

/* ---------- Report modal ---------- */
.map-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(20,41,31,0.55);
  justify-content: center; align-items: center; padding: 20px;
}
.map-modal-overlay.open { display: flex; }
.map-modal {
  background: #fff; border-radius: var(--r-panel); box-shadow: var(--e3);
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  animation: mapModalIn 0.25s ease;
}
@keyframes mapModalIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.map-modal__header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line);
}
.map-modal__header h2 { font-size: 22px; color: var(--forest); }
.map-modal__close {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.map-modal__close:hover { background: var(--mist); color: var(--charcoal); }
.map-modal__body { padding: 20px 24px 24px; }
.map-form-group { margin-bottom: 16px; }
.map-form-group label {
  display: block; margin-bottom: 6px;
  font-family: var(--font-head); font-weight: 600; font-size: 13.5px; color: var(--charcoal);
}
.map-form-group .required { color: var(--danger); }
.map-form-input {
  width: 100%; min-height: 48px; padding: 11px 14px;
  font-family: var(--font-body); font-size: 15px; color: var(--charcoal);
  background: #fff; border: 1.5px solid var(--field-border); border-radius: var(--r-btn);
  transition: border-color var(--t-fast);
}
.map-form-input:focus { border-color: var(--moss); outline: 3px solid rgba(45,106,79,0.25); outline-offset: 1px; }
textarea.map-form-input { min-height: 96px; line-height: 1.6; resize: vertical; }
.map-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.map-form-note { font-size: 13px; line-height: 1.55; color: var(--muted); margin-top: 6px; }
.map-form-submit { width: 100%; margin-top: 8px; }

/* Confirmation (injected by submitReport) */
.map-confirmation { text-align: center; padding: 28px 12px; }
.map-confirmation svg { margin: 0 auto 16px; }
.map-confirmation h3 { color: var(--forest); margin-bottom: 8px; }
.map-confirmation p { font-size: 15px; line-height: 1.6; color: var(--body); margin: 0; }
.map-confirmation a { color: var(--moss); font-weight: 600; }

/* ---------- Heat layer fade-in (canvas opacity, driven by inline JS) ---------- */
.map-heat-fading { transition: opacity 700ms ease-out; }

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .map-search { flex-direction: column; }
  .map-search__btn { width: 100%; }
  .map-wrap { height: 68vh; min-height: 420px; }
  /* Species filters become a horizontally scrolling chip row */
  .map-species-panel {
    top: 8px; left: 8px; right: 56px; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 6px; gap: 6px; scrollbar-width: none;
  }
  .map-species-panel::-webkit-scrollbar { display: none; }
  .map-species-panel__title { display: none; }
  .map-species-btn { flex-shrink: 0; min-height: 44px; padding: 8px 12px; font-size: 13px; }
  .map-legend { bottom: 16px; right: 8px; padding: 8px 10px; }
  .map-legend__bar { width: 110px; }
  .map-report-fab { bottom: 16px; left: 8px; padding: 10px 16px; font-size: 13.5px; }
  .map-form-row { grid-template-columns: 1fr; gap: 0; }
}
