/* ============================================================
   Let's Play — NYC Playgrounds
   ============================================================ */

/* --- Layout: sidebar + map side-by-side --- */
html, body { height: 100%; margin: 0; overflow: hidden; background: #000; }
body {
  display: flex;
  color: #fff;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
}

#sidebar {
  width: 320px;
  min-width: 260px;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 8px;
  background-color: #000;
  border-right: 4px double #22c55e;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#map { flex: 1; height: 100vh; }

/* --- Sidebar header row --- */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #22c55e;
  flex-shrink: 0;
}
.gh-link { color: #a8a8a8; line-height: 0; }
.gh-link:hover { color: #fff; }
.info-btn {
  background: none;
  border: none;
  color: #a8a8a8;
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.9rem;
}
.info-btn:hover { color: #22c55e; }
.sidebar-header .info-btn { margin-left: auto; }

/* --- Search bar --- */
.search-wrap {
  display: flex;
  align-items: center;
  background: #000;
  border: 2px solid #a8a8a8;
}
.search-wrap:focus-within { border-color: #22c55e; }
#search-input, #search-input-mobile {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  border: none;
  background: transparent;
  color: #fff;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  width: auto;
}
#search-input:focus, #search-input-mobile:focus {
  background: transparent !important;
  color: #fff !important;
}
#search-input::placeholder, #search-input-mobile::placeholder { color: #555; }
#search-clear, #search-clear-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  line-height: 0;
  flex-shrink: 0;
}
#search-clear::after, #search-clear-mobile::after {
  content: '[x]';
  color: #a8a8a8;
  font-size: 0.8rem;
}
#search-clear:hover::after, #search-clear-mobile:hover::after { color: #22c55e; }
#apply-btn, #apply-btn-mobile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #22c55e;
  color: #000;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}
#apply-btn:hover, #apply-btn-mobile:hover { background: #16a34a; }
.apply-btn-style {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #22c55e;
  color: #000;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}
.apply-btn-style:hover { background: #16a34a; }

/* --- Divider --- */
.divider {
  border: none;
  border-bottom: 1px solid #333;
  margin: 4px 0;
}

/* --- Filter rows --- */
.filter-row { padding: 4px 0; }
.section-title {
  display: block;
  font-weight: 700;
  color: #22c55e;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
.filter-row label {
  display: block;
  padding: 2px 0;
  cursor: pointer;
  font-size: 0.85rem;
}
.filter-row input[type="radio"] {
  margin-right: 4px;
  accent-color: #22c55e;
}
.filter-count {
  color: #666;
  font-size: 0.8rem;
}
.filter-count::before { content: "("; }
.filter-count::after  { content: ")"; }

/* --- Sidebar footer --- */
.sidebar-updated {
  color: #555;
  font-size: 0.8rem;
  margin-top: auto;
  padding-top: 4px;
}
.source-note { margin-top: 2px; }
.source-note a { color: #22c55e; text-decoration: none; }
.source-note a:hover { text-decoration: underline; }

/* --- Popup --- */
.leaflet-popup-content-wrapper {
  background: #1a1a1a !important;
  color: #fff !important;
  border: 1px solid #22c55e;
  border-radius: 0 !important;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85rem;
}
.leaflet-popup-tip { background: #1a1a1a !important; }
.leaflet-popup-content { margin: 8px 12px !important; line-height: 1.5; }
.popup-location { color: #a8a8a8; }
.popup-borough { color: #22c55e; font-weight: 700; }
.popup-features { color: #fbbf24; }
.popup-tags { color: #888; font-size: 0.8rem; }
.popup-link { color: #60a5fa; text-decoration: none; font-size: 0.85rem; }
.popup-link:hover { text-decoration: underline; }

/* --- Supercluster markers --- */
.sc-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  color: #000;
  border: 2px solid rgba(255,255,255,0.6);
}
.sc-sm { background: rgba(34,197,94,0.7); font-size: 11px; }
.sc-md { background: rgba(251,191,36,0.7); font-size: 12px; }
.sc-lg { background: rgba(248,113,113,0.7); font-size: 13px; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay[hidden] { display: none; }
.modal-window {
  background: #111;
  border: 2px solid #22c55e;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  font-family: "Courier New", Courier, monospace;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #333;
}
.modal-title { color: #22c55e; font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  color: #a8a8a8;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
}
.modal-close:hover { color: #22c55e; }
.modal-body {
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #ccc;
}
.modal-body a { color: #22c55e; text-decoration: none; }
.modal-body a:hover { text-decoration: underline; }

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}
.info-table th, .info-table td {
  padding: 4px 8px;
  border: 1px solid #333;
  text-align: left;
}
.info-table th { color: #22c55e; background: #0a0a0a; }
.total-row td { border-top: 2px solid #22c55e; }

.modal-section { margin: 8px 0; }
.modal-section ul { margin: 4px 0 4px 16px; padding: 0; }
.modal-section li { margin: 2px 0; }
.modal-attrib { color: #555; font-size: 0.8rem; margin-top: 12px; }

/* --- Mobile top bar --- */
#top-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #000;
  border-bottom: 2px solid #22c55e;
  padding: 4px 8px;
  align-items: center;
  gap: 6px;
}
#top-bar .sidebar-title { font-size: 0.95rem; }
#top-bar .gh-link { flex-shrink: 0; }
#topbar-search { flex: 1; }

/* --- Mobile responsive --- */
@media (max-width: 768px) {
  body { flex-direction: column; }
  #sidebar { display: none; }
  #top-bar { display: flex; }
  #map {
    width: 100%;
    height: calc(100vh - 42px);
    margin-top: 42px;
  }
}

/* Leaflet z-index fix */
.leaflet-pane { z-index: 1; }
.leaflet-top, .leaflet-bottom { z-index: 999; }
