/* ===========================================
   NEW MAP SECTION (prototype integration)
   ----------------------------------------------------------------
   All rules are scoped under #new-map-section so the prototype
   layout cannot leak into the rest of the page (no html/body
   resets, no global * box-sizing, no naked .logo / .map-container
   selectors). The Instructions popup uses position: fixed and is
   pinned by ID (#nm-instructions-*).
   =========================================== */

#new-map-section,
#new-map-section *,
#new-map-section *::before,
#new-map-section *::after {
  box-sizing: border-box;
}

#new-map-section {
  position: relative;
  width: 100%;
  height: 100vh;
  font-family: 'Helvetica', 'Arial', sans-serif;
  background: #fff;
  overflow: hidden;
}

/* ========== Logo (top-left of section) ========== */
#new-map-section .nm-logo {
  position: absolute;
  top: 28px;
  left: 38px;
  height: 48px;
  width: auto;
  z-index: 10;
}

@media (max-width: 768px) {
  #new-map-section .nm-logo {
    top: 20px;
    left: 20px;
    height: 32px;
  }
}

/* ========== Hamburger menu (top-right of section) ========== */
#new-map-section .nm-menu-dropdown {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 30;
}

#new-map-section .nm-menu-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #333;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

#new-map-section .nm-menu-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

#new-map-section .nm-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
}

#new-map-section .nm-menu-dropdown.open .nm-menu-list {
  display: block;
}

#new-map-section .nm-menu-list li {
  list-style: none;
}

#new-map-section .nm-menu-link {
  display: block;
  padding: 10px 14px;
  color: #222;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

#new-map-section .nm-menu-link:hover {
  background: #f2f2f2;
}

@media (max-width: 768px) {
  #new-map-section .nm-menu-btn {
    width: 32px;
    height: 32px;
  }
}

/* ========== Tagline (top 1/5 of section) ========== */
#new-map-section .nm-tagline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 90px 24px 16px;
  z-index: 5;
  pointer-events: none;
}

#new-map-section .nm-tagline h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  font-weight: 600;
  line-height: 1.3;
  color: #2B2D42;
  text-align: center;
  max-width: 900px;
}

#new-map-section .nm-map-sentence {
  margin: 0;
  font-size: clamp(0.85rem, 1.35vw, 1.05rem);
  font-weight: 400;
  line-height: 1.35;
  color: #5c5f7a;
  text-align: center;
  max-width: 900px;
}

/* ========== Main app container ========== */
#new-map-section .nm-app-container {
  position: absolute;
  top: 20vh;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 24px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#new-map-section .nm-app-map-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#new-map-section .nm-map-container {
  position: relative;
  flex-shrink: 0;
  width: min(max(340px, min(75vmin, 700px)), 100%);
  max-height: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%; /* always-circular porthole; Mapbox canvas inside is still square but clipped */
  background: transparent;
}

@supports (container-type: size) {
  #new-map-section .nm-app-map-stage {
    container-type: size;
    container-name: nm-map-stage;
  }

  #new-map-section .nm-map-container {
    width: min(max(340px, min(75vmin, 700px)), 100cqw, 100cqh);
  }
}

#new-map-section #new-map {
  width: 100%;
  height: 100%;
}

/* ========== Search button (top-left of app container) ========== */
#new-map-section .nm-search-btn {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 15;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #333;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

#new-map-section .nm-search-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

/* ========== Filter button (top-right of app container) ========== */
#new-map-section .nm-filter-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 15;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #333;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

#new-map-section .nm-filter-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

/* ========== Mobile sizing tweaks ========== */
@media (max-width: 500px) {
  #new-map-section .nm-app-container {
    padding: 16px 20px;
  }

  #new-map-section .nm-search-btn,
  #new-map-section .nm-filter-btn {
    width: 38px;
    height: 38px;
    top: 16px;
  }

  #new-map-section .nm-search-btn { left: 20px; }
  #new-map-section .nm-filter-btn { right: 20px; }

  #new-map-section .nm-app-bottom-bar {
    padding-top: 10px;
  }

  #new-map-section .nm-help-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  #new-map-section #nm-custom-zoom-controls .mapboxgl-ctrl-group button {
    width: 32px;
    height: 32px;
  }

  #new-map-section .nm-post-btn {
    padding: 8px 18px 8px 14px;
    font-size: 0.9rem;
  }
}

/* ========== Bottom bar (help | Post | zoom) ========== */
#new-map-section .nm-app-bottom-bar {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  z-index: 20;
  pointer-events: none;
  padding-top: 12px;
}

#new-map-section .nm-app-bottom-bar__slot {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  pointer-events: auto;
}

#new-map-section .nm-app-bottom-bar__slot--start  { justify-content: flex-start; }
#new-map-section .nm-app-bottom-bar__slot--center { justify-content: center; }
#new-map-section .nm-app-bottom-bar__slot--end    { justify-content: flex-end; }

/* ========== Help button (bottom-left) ========== */
#new-map-section .nm-help-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 18px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.2s ease;
  border: none;
}

#new-map-section .nm-help-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

/* ========== Custom zoom widget (bottom-right) ========== */
#new-map-section #nm-custom-zoom-controls {
  flex-shrink: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

/* ========== Post button (bottom-center) ========== */
#new-map-section .nm-post-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px 10px 18px;
  background: #eddcff;
  color: #8b00d1;
  border: none;
  border-radius: 40px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(139, 0, 209, 0.15);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

#new-map-section .nm-post-btn:hover {
  background: #e3cdff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139, 0, 209, 0.25);
}

#new-map-section .nm-post-btn-plus {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  color: #8b00d1;
}

#new-map-section .nm-post-btn-text {
  line-height: 1;
}

/* Strip Mapbox zoom control's native styling so it blends into our widget */
#new-map-section #nm-custom-zoom-controls .mapboxgl-ctrl-group {
  background: white;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  border: none !important;
}

#new-map-section #nm-custom-zoom-controls .mapboxgl-ctrl-group button {
  width: 36px;
  height: 36px;
  border: none !important;
}

#new-map-section #nm-custom-zoom-controls .mapboxgl-ctrl-group button:first-child {
  border-bottom: 1px solid #ddd !important;
}

/* Hide Mapbox's default control containers ONLY inside the new map.
   The existing #map-section keeps its own override in map_section.css. */
#new-map-section .mapboxgl-ctrl-top-left,
#new-map-section .mapboxgl-ctrl-top-right,
#new-map-section .mapboxgl-ctrl-bottom-left,
#new-map-section .mapboxgl-ctrl-bottom-right {
  display: none !important;
}

/* ========== Instructions popup (fixed, pinned by ID) ========== */
/* Anchored to #new-map-section (position: relative) so the overlay
   dims only the map section and scrolls with the page instead of
   staying pinned to the viewport. */
#nm-instructions-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
}

#nm-instructions-popup {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92%, 460px);
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  color: #222;
  border-radius: 12px;
  padding: 28px 32px;
  z-index: 101;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: 'Helvetica', 'Arial', sans-serif;
  box-sizing: border-box;
}

#nm-instructions-popup h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
  font-weight: 700;
}

#nm-instructions-popup .nm-instructions-section {
  margin-bottom: 16px;
}

#nm-instructions-popup .nm-instructions-section:last-child {
  margin-bottom: 0;
}

#nm-instructions-popup .nm-instructions-heading {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 1rem;
  color: #2B2D42;
}

#nm-instructions-popup ul {
  margin: 0;
  padding-left: 20px;
}

#nm-instructions-popup ul li {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #555;
  margin-bottom: 4px;
}
