/* ── Google Font import (blocky condensed for header/labels) ─── */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300;400;700;900&family=Inter:wght@400;500;600&display=swap');

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #e2e2e2;
  background: #0d0d0d;
}

/* ── App shell ───────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 58px;
  flex-shrink: 0;
  background: #000000;
  color: #fff;
  border-bottom: 1px solid #1f1f1f;
  z-index: 1001;
}

#app-header h1 {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 8px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ffffff;
}

/* Accent dot in the title */
#app-header h1 span.accent {
  color: #4f8ef7;
}

#header-stats {
  margin-left: auto;
  font-family: 'Barlow Condensed', 'Arial Black', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #555;
  white-space: nowrap;
}

/* ── Error banner ────────────────────────────────────────────── */
#error-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: #7f1d1d;
  color: #fca5a5;
  font-size: 13px;
  flex-shrink: 0;
  border-bottom: 1px solid #991b1b;
}

#error-banner.hidden { display: none; }

#error-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}
#error-close:hover { opacity: 1; }

/* ── Loading overlay ─────────────────────────────────────────── */
#loading-overlay {
  display: none;
}

#loading-overlay.visible {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 2000;
  font-size: 15px;
  color: #888;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #222;
  border-top-color: #4f8ef7;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Two-panel layout ────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Map panel ───────────────────────────────────────────────── */
#map-container {
  flex: 65;
  min-width: 0;
  height: 100%;
}

/* ── Side panel ──────────────────────────────────────────────── */
#side-panel {
  flex: 35;
  min-width: 290px;
  max-width: 440px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #111111;
  border-left: 1px solid #1e1e1e;
  overflow: hidden;
}

/* ── Search bar ──────────────────────────────────────────────── */
#search-bar {
  padding: 14px 16px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid #1e1e1e;
  background: #111111;
}

#search {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  background: #1a1a1a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 11px center no-repeat;
  color: #d0d0d0;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search::placeholder { color: #444; }

#search:focus {
  border-color: #4f8ef7;
  background-color: #1e1e1e;
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.15);
}

/* ── Stats bar ───────────────────────────────────────────────── */
#stats-bar {
  display: flex;
  gap: 16px;
  padding: 6px 16px 8px;
  background: #0d0d0d;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

#active-count {
  font-family: 'Barlow Condensed', 'Arial Black', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #4f8ef7;
}

#eliminated-count {
  font-family: 'Barlow Condensed', 'Arial Black', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #555;
}

/* ── Neighborhood list (scrollable) ─────────────────────────── */
#neighborhood-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

#neighborhood-list::-webkit-scrollbar { width: 4px; }
#neighborhood-list::-webkit-scrollbar-track { background: transparent; }
#neighborhood-list::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 10px;
}

/* ── Section divider ─────────────────────────────────────────── */
.section-divider {
  padding: 10px 16px 6px;
  font-family: 'Barlow Condensed', 'Arial Black', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #3a3a3a;
  background: #0d0d0d;
  border-top: 1px solid #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  user-select: none;
}

/* ── Individual neighborhood item ────────────────────────────── */
.neighborhood-item {
  border-bottom: 1px solid #181818;
  transition: background 0.08s;
}

.neighborhood-item:last-child { border-bottom: none; }

.neighborhood-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.08s;
}

.neighborhood-row:hover { background: #191919; }

/* Selected */
.neighborhood-item.selected > .neighborhood-row {
  background: #081426;
  border-left: 3px solid #4f8ef7;
  padding-left: 13px;
}

/* Crossed-off */
.neighborhood-item.crossed-off > .neighborhood-row {
  background: #1a0808;
  border-left: 3px solid #5a1a1a;
  padding-left: 13px;
}

/* Name */
.neighborhood-name {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: #d0d0d0;
  line-height: 1.3;
}

.neighborhood-item.selected .neighborhood-name {
  color: #fff;
  font-weight: 600;
}

.neighborhood-item.crossed-off .neighborhood-name {
  text-decoration: line-through;
  color: #7a3030;
}

/* Notes dot */
.notes-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f8ef7;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.notes-dot.has-notes { opacity: 1; }

/* Cross-off button */
.crossoff-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid #2a2a2a;
  background: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3a3a3a;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 1;
}

.crossoff-btn:hover {
  border-color: #c0392b;
  color: #e74c3c;
  background: #1f0a0a;
}

.neighborhood-item.crossed-off .crossoff-btn {
  border-color: #5a1a1a;
  color: #7f2020;
  background: #160808;
}

.neighborhood-item.crossed-off .crossoff-btn:hover {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

/* ── Notes section ───────────────────────────────────────────── */
.notes-section {
  display: none;
  padding: 2px 16px 14px 16px;
}

.neighborhood-item.selected .notes-section { display: block; }

.notes-label {
  font-family: 'Barlow Condensed', 'Arial Black', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #3a3a3a;
  margin-bottom: 7px;
}

.notes-section textarea {
  width: 100%;
  min-height: 90px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  line-height: 1.55;
  border: 1px solid #252525;
  border-radius: 6px;
  resize: vertical;
  outline: none;
  color: #c8c8c8;
  background: #161616;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.notes-section textarea::placeholder { color: #333; }

.notes-section textarea:focus {
  border-color: #4f8ef7;
  background: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}

.notes-saved-indicator {
  font-size: 11px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #2d6a2d;
  height: 16px;
  margin-top: 5px;
}

/* ── No results ──────────────────────────────────────────────── */
#no-results {
  padding: 32px 16px;
  text-align: center;
  color: #333;
  font-size: 13px;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Leaflet overrides ───────────────────────────────────────── */
.leaflet-container {
  background: #111 !important;
}

.neighborhood-tooltip {
  background: rgba(0, 0, 0, 0.92) !important;
  border: 1px solid #2a2a2a !important;
  border-radius: 4px !important;
  color: #e8e8e8 !important;
  font-family: 'Barlow Condensed', 'Arial Black', sans-serif !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  padding: 5px 10px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
  white-space: nowrap;
}

.neighborhood-tooltip::before { display: none !important; }

/* Leaflet attribution dark */
.leaflet-control-attribution {
  background: rgba(0,0,0,0.7) !important;
  color: #555 !important;
}

.leaflet-control-attribution a { color: #666 !important; }

/* Leaflet zoom controls dark */
.leaflet-bar a {
  background: #1a1a1a !important;
  color: #aaa !important;
  border-color: #2a2a2a !important;
}

.leaflet-bar a:hover {
  background: #222 !important;
  color: #fff !important;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  #main { flex-direction: column; }

  #map-container {
    flex: none;
    height: 50vh;
  }

  #side-panel {
    flex: none;
    height: 50vh;
    max-width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid #1e1e1e;
  }
}
