/* Road Watch — shared design tokens */
:root {
  --brand:       #1a3a5c;
  --brand-lt:    #2a5a8c;
  --sidebar-bg:  #f8f9fa;
  --sidebar-w:   300px;
  --border:      #e0e3e7;
  --text:        #1f2937;
  --muted:       #6b7280;
  --label:       #374151;

  /* Status */
  --green:       #22a855;
  --orange:      #f59e0b;
  --red:         #ef4444;
  --gray-dot:    #9ca3af;

  /* Drainage year colors */
  --yr-2024:     #64748b;
  --yr-2025:     #2563eb;
  --yr-2026:     #059669;

  /* Badges */
  --badge-active-bg:   #dcfce7;
  --badge-active-fg:   #166534;
  --badge-beta-bg:     #dbeafe;
  --badge-beta-fg:     #1e40af;
  --badge-soon-bg:     #f3f4f6;
  --badge-soon-fg:     #6b7280;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ── */
.hoa-header {
  background: var(--brand);
  color: #fff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 1000;
}
.hoa-header h1 { font-size: 18px; font-weight: 600; }
.hoa-header .subtitle { font-size: 12px; opacity: 0.75; }
.hoa-header .spacer { flex: 1; }
.hoa-header button, .hoa-header a.hdr-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}
.hoa-header button:hover, .hoa-header a.hdr-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Layout ── */
#app { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s;
}
#sidebar.collapsed { width: 0; }
#sidebar-inner { padding: 12px; overflow-y: auto; flex: 1; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 14px 0 6px;
}
.section-title:first-child { margin-top: 0; }

/* ── Badges ── */
.badge {
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-active  { background: var(--badge-active-bg); color: var(--badge-active-fg); }
.badge-beta    { background: var(--badge-beta-bg);   color: var(--badge-beta-fg); }
.badge-soon    { background: var(--badge-soon-bg);   color: var(--badge-soon-fg); }
.badge-new     { background: #ede9fe; color: #5b21b6; }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-orange  { background: #fef3c7; color: #92400e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: #f3f4f6; color: var(--label); }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-2024    { background: #f1f5f9; color: #334155; }
.badge-2025    { background: #dbeafe; color: #1e40af; }
.badge-2026    { background: #d1fae5; color: #065f46; }

/* ── Filter buttons ── */
.filter-group { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.filter-btn {
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.filter-btn:hover:not(.active) { background: #e8edf2; }

/* ── Map ── */
#map { flex: 1; }

/* ── Popup ── */
.leaflet-popup-content { width: 370px !important; max-width: 90vw; }
.leaflet-popup-content-wrapper { border-radius: 8px; }

.popup-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.popup-id   { font-size: 20px; font-weight: 700; color: var(--brand); }
.popup-name { color: var(--muted); font-size: 13px; }

.popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.popup-notes {
  background: #f9fafb;
  border-left: 3px solid #cbd5e1;
  padding: 6px 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--label);
  border-radius: 0 4px 4px 0;
}

/* ── Photo tabs ── */
.photo-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}
.tab-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-btn:hover:not(.active) { color: var(--label); }

.photo-panel { display: none; }
.photo-panel.active { display: block; }

.photo-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 4px;
  letter-spacing: 0.4px;
}

.photo-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-thumb {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.photo-thumb:hover { border-color: var(--brand); transform: scale(1.03); }
.photo-item { display: flex; flex-direction: column; align-items: center; }
.photo-caption { font-size: 10px; color: var(--muted); text-align: center; margin-top: 2px; }
.no-photos { color: var(--muted); font-size: 12px; font-style: italic; }

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 95vw; max-height: 88vh; object-fit: contain; border-radius: 4px; }
#lightbox-caption { color: #fff; margin-top: 10px; font-size: 13px; opacity: 0.85; }
#lightbox-close {
  position: absolute; top: 16px; right: 20px;
  color: #fff; font-size: 28px; cursor: pointer;
  line-height: 1; background: none; border: none;
}
#lightbox-prev, #lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #fff; font-size: 36px; cursor: pointer;
  background: none; border: none; padding: 0 12px; opacity: 0.8;
}
#lightbox-prev { left: 8px; }
#lightbox-next { right: 8px; }
#lightbox-prev:hover, #lightbox-next:hover { opacity: 1; }

/* ── Scrollbar ── */
#sidebar-inner::-webkit-scrollbar { width: 6px; }
#sidebar-inner::-webkit-scrollbar-track { background: transparent; }
#sidebar-inner::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
