@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Open Sans', sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: #333;
  background: #f5f0eb;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #3b3f51;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo { height: 36px; }

#header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

main { flex: 1; position: relative; }

#map { width: 100%; height: 100%; }

#status-bar {
  padding: 6px 16px;
  background: #f5f0eb;
  font-size: 0.85rem;
  color: #6e7488;
  border-top: 1px solid #ddd;
  z-index: 1000;
  position: relative;
}

/* Popup */
.popup-container { width: 280px; }

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0dbd5;
  margin-bottom: 8px;
}

.popup-header strong { font-size: 1rem; color: #3b3f51; }
.popup-header span { font-size: 0.8rem; color: #6e7488; }

.popup-list {
  max-height: 250px;
  overflow-y: scroll;
}

.popup-article {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0ebe5;
}

.popup-author-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

.popup-article-body {
  flex: 1;
  min-width: 0;
}

.popup-article:last-child { border-bottom: none; }

.popup-article-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 3px;
}

.popup-article-meta {
  font-size: 0.78rem;
  color: #6e7488;
  margin-bottom: 4px;
}

.popup-article-link {
  font-size: 0.78rem;
  color: #5b6abf;
  text-decoration: none;
}

.popup-article-link:hover { text-decoration: underline; }

/* Type badges */
.type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
}

.type-viewpoint { background: #e8e0f0; color: #6b4c9a; }
.type-from-the-word { background: #dce8dc; color: #3d6b3d; }
.type-witness { background: #e0e8f0; color: #4a6b8a; }
.type-world-report { background: #f0e8dc; color: #8a6b3d; }
.type-our-classics { background: #f0dce0; color: #8a3d4a; }

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.15);
}

.leaflet-popup-content { margin: 12px; }

/* Sort buttons */
.popup-sort {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.sort-btn {
  background: #f5f0eb;
  border: 1px solid #ddd;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
  color: #6e7488;
}

.sort-btn.active {
  background: #3b3f51;
  color: #fff;
  border-color: #3b3f51;
}

/* Filter dropdowns */
.header-right {
  display: flex;
  gap: 8px;
}

.filter-select {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #6e7488;
  background: #2e3243;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.filter-select:focus { outline: 1px solid #8890a8; }
