/* ==========================================================================
   Community Asset Map — Scoped styles
   All custom styles scoped under .community-map wrapper
   ========================================================================== */

/* --- Page Layout --- */
.community-map {
  background: #f8f8f6;
  min-height: 100vh;
}

/* --- Header Bar --- */
.community-map .map-header {
  background: #2c209b;
  box-shadow: 0 2px 12px rgba(44, 32, 155, 0.3);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.community-map .map-header-title {
  font-family: 'Permanent Marker', cursive;
  font-size: 32px;
  color: #fff;
  letter-spacing: 1px;
  line-height: 1.2;
}
.community-map .map-header-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}
.community-map .map-header-meta {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: right;
}

/* --- Layer Toggle Pills --- */
.community-map .layer-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
}
.community-map .layer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s ease;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #333;
  user-select: none;
}
.community-map .layer-pill:hover {
  opacity: 0.85;
}
.community-map .layer-pill.active {
  opacity: 1;
}
.community-map .layer-pill .pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.community-map .layer-pill .pill-count {
  opacity: 0.6;
}

/* --- Near Me Control --- */
.community-map .nearme-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #2c209b;
}
.community-map .nearme-control input[type="checkbox"] {
  accent-color: #2c209b;
}
.community-map .nearme-control select {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid #2c209b;
  border-radius: 4px;
  padding: 2px 6px;
  color: #2c209b;
  background: #fff;
}

/* --- Leaflet Map --- */
.community-map .map-container {
  margin: 0 24px;
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}
.community-map #asset-map {
  width: 100%;
  height: 480px;
  background: #eae6de;
  z-index: 0;
}
.community-map .map-overlay-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1000;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #2c209b;
  background: #fff;
  border: 1px solid rgba(44, 32, 155, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
}
.community-map .map-overlay-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 1000;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #666;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
}

/* --- Markers --- */
.asset-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1;
}
.asset-marker.selected {
  transform: scale(1.5);
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px currentcolor, 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 1000 !important;
}
.asset-marker.connected {
  transform: scale(1.2);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px currentcolor;
}
.asset-marker.dimmed {
  opacity: 0.25;
}

/* --- Popup --- */
.community-map .leaflet-popup-content-wrapper {
  border-radius: 8px !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  padding: 0 !important;
}
.community-map .leaflet-popup-content {
  margin: 0 !important;
  width: 310px !important;
  max-width: 310px !important;
}
.asset-popup {
  max-width: 310px;
}
.asset-popup .popup-color-bar {
  height: 4px;
  border-radius: 8px 8px 0 0;
}
.asset-popup .popup-inner {
  padding: 14px 16px 16px;
}
.asset-popup .popup-type-badge {
  display: inline-block;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.asset-popup .popup-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 20px;
  color: #000;
  margin: 0 0 6px 0;
  line-height: 1.2;
}
.asset-popup .popup-meta {
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.4;
}
.asset-popup .popup-story {
  font-family: 'Space Mono', monospace;
  font-size: 12.5px;
  color: #333;
  line-height: 1.65;
  margin-bottom: 10px;
}
.asset-popup .popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.asset-popup .popup-tag {
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
}
.asset-popup .popup-connections {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 10px;
  margin-bottom: 10px;
}
.asset-popup .popup-connections h4 {
  font-family: 'Archivo Black', sans-serif;
  font-size: 11px;
  color: #2c209b;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 6px 0;
}
.asset-popup .connection-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.asset-popup .connection-pill {
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid;
  transition: opacity 0.15s;
}
.asset-popup .connection-pill:hover {
  opacity: 0.8;
}
.asset-popup .popup-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 10px;
}
.asset-popup .btn-primary {
  flex: 1;
  text-align: center;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f44c27;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s;
}
.asset-popup .btn-primary:hover {
  background: #d63d1f;
}
.asset-popup .btn-secondary {
  flex: 1;
  text-align: center;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  color: #2c209b;
  border: 2px solid #2c209b;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.asset-popup .btn-secondary:hover {
  background: rgba(44, 32, 155, 0.05);
}

/* --- Search Bar --- */
.community-map .search-section {
  padding: 20px 24px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.community-map .search-input {
  flex: 1;
  min-width: 200px;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.community-map .search-input:focus {
  border-color: #2c209b;
}
.community-map .search-input::placeholder {
  color: rgba(0, 0, 0, 0.3);
}
.community-map .search-count {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* --- Asset Cards Grid --- */
.community-map .cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 16px 24px 32px;
}
.community-map .asset-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 16px;
  transition: all 0.2s ease;
}
.community-map .asset-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}
.community-map .card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.community-map .card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.community-map .card-name {
  font-family: 'Archivo Black', sans-serif;
  font-size: 16px;
  color: #000;
  line-height: 1.2;
  margin: 0;
}
.community-map .card-type {
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.community-map .card-description {
  font-family: 'Space Mono', monospace;
  font-size: 12.5px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.community-map .card-meta {
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
  line-height: 1.5;
}
.community-map .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.community-map .card-tag {
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
}
.community-map .card-connections {
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #2c209b;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* --- Suggest CTA --- */
.community-map .suggest-cta {
  max-width: 640px;
  margin: 0 auto 48px;
  padding: 0 24px;
}
.community-map .suggest-cta-inner {
  background: #fff;
  border-radius: 8px;
  border: 2px solid rgba(44, 32, 155, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 28px 32px;
  text-align: center;
}
.community-map .suggest-cta-title {
  font-family: 'Permanent Marker', cursive;
  font-size: 24px;
  color: #2c209b;
  letter-spacing: 0.5px;
  margin: 0 0 8px 0;
}
.community-map .suggest-cta-text {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  margin: 0 0 16px 0;
}
.community-map .suggest-cta-btn {
  display: inline-block;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: #f44c27;
  color: #fff;
  padding: 10px 24px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(244, 76, 39, 0.3);
  text-decoration: none;
  transition: background 0.15s;
}
.community-map .suggest-cta-btn:hover {
  background: #d63d1f;
}

/* --- Empty State --- */
.community-map .empty-state {
  text-align: center;
  padding: 48px 24px;
}
.community-map .empty-state-text {
  font-family: 'Archivo Black', sans-serif;
  font-size: 18px;
  color: rgba(0, 0, 0, 0.2);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .community-map .map-header {
    padding: 16px;
  }
  .community-map .map-header-title {
    font-size: 22px;
  }
  .community-map .map-container {
    margin: 0 12px;
  }
  .community-map #asset-map {
    height: 360px;
  }
  .community-map .layer-toggles {
    padding: 12px;
  }
  .community-map .search-section {
    padding: 16px 12px 8px;
  }
  .community-map .cards-grid {
    padding: 12px;
    grid-template-columns: 1fr;
  }
  .community-map .suggest-cta {
    padding: 0 12px;
  }
}

@media (max-width: 480px) {
  .community-map .map-header-title {
    font-size: 18px;
  }
  .community-map .map-header-meta {
    display: none;
  }
}
