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

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

:root {
  --header-height: 56px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  overflow: hidden;
  height: 100vh;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(226, 54, 54, 0.3);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1000;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e23636, transparent);
}

.home-btn {
  display: flex;
  align-items: center;
  color: #666;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

.home-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-logo .star {
  font-size: 1.5rem;
  color: #e23636;
  filter: drop-shadow(0 0 6px rgba(226, 54, 54, 0.5));
  line-height: 1;
}

header h1 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 3px;
}

.tab-btn {
  background: transparent;
  color: #888;
  border: none;
  padding: 0.4rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.25s ease;
  letter-spacing: 0.01em;
}

.tab-btn:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: #e23636;
  color: #fff;
  box-shadow: 0 2px 8px rgba(226, 54, 54, 0.4);
}

/* ── Burger button (hidden on desktop) ── */
.burger-btn {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #aaa;
  font-size: 1.2rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.burger-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* ── Mobile nav dropdown (hidden by default) ── */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: #1a1a2e;
  border-bottom: 1px solid rgba(226, 54, 54, 0.2);
  z-index: 999;
  position: sticky;
  top: var(--header-height);
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav-btn {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #888;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.85rem 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-nav-btn:last-child {
  border-bottom: none;
}

.mobile-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.mobile-nav-btn.active {
  color: #e23636;
  background: rgba(226, 54, 54, 0.05);
}

/* ── Map View ── */
#map-view {
  width: 100%;
  height: calc(100vh - var(--header-height));
}

#map {
  width: 100%;
  height: 100%;
  background: #1a1a2e;
}

/* Leaflet overrides for dark style */
.leaflet-tile-pane {
  filter: saturate(0.85) brightness(0.95);
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: #1a1a2e !important;
  color: #e0e0e0 !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  font-size: 16px !important;
  transition: background 0.2s;
}

.leaflet-control-zoom a:hover {
  background: #e23636 !important;
  color: #fff !important;
}

.leaflet-control-attribution {
  background: rgba(26, 26, 46, 0.85) !important;
  color: #666 !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
  border-radius: 4px 0 0 0 !important;
}

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

/* Custom marker */
.custom-marker {
  background: none !important;
  border: none !important;
}

/* ── Popup ── */
.leaflet-popup-content-wrapper {
  background: #1e1e36 !important;
  color: #e0e0e0 !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(226, 54, 54, 0.15) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-tip {
  background: #1e1e36 !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-popup-close-button {
  color: #666 !important;
  font-size: 20px !important;
  top: 6px !important;
  right: 8px !important;
  transition: color 0.2s;
}

.leaflet-popup-close-button:hover {
  color: #e23636 !important;
}

.popup-content {
  font-family: 'Inter', sans-serif;
  padding: 1rem 1.1rem;
  max-width: 280px;
}

.popup-content .popup-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.popup-content .popup-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.popup-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.popup-content .popup-location {
  color: #e23636;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.popup-content .popup-location::before {
  content: '\25CF';
  font-size: 0.5rem;
}

.popup-content .popup-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #aaa;
  margin-bottom: 0.7rem;
}

.popup-content .popup-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.popup-content .popup-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(226, 54, 54, 0.15);
  border: 1px solid rgba(226, 54, 54, 0.25);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.popup-content .popup-links a:hover {
  background: #e23636;
  border-color: #e23636;
  text-decoration: none;
}

/* ── Table View ── */
#table-view {
  display: none;
  padding: 1.5rem 2rem;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.filter-bar {
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-bar label {
  font-size: 0.82rem;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-bar select,
.search-input {
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
}

.filter-bar select:focus,
.search-input:focus {
  outline: none;
  border-color: rgba(226, 54, 54, 0.5);
  box-shadow: 0 0 0 3px rgba(226, 54, 54, 0.1);
}

.filter-bar select {
  cursor: pointer;
  min-width: 180px;
}

.search-input {
  width: 100%;
  max-width: 260px;
}

.search-input::placeholder {
  color: #555;
}

/* Table */
.table-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}

.community-table {
  width: 100%;
  border-collapse: collapse;
}

.community-table th {
  text-align: left;
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  color: #666;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.community-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  font-size: 0.88rem;
}

.community-table tbody tr {
  transition: background 0.15s;
}

.community-table tbody tr:hover td {
  background: rgba(226, 54, 54, 0.04);
}

.community-table tbody tr:last-child td {
  border-bottom: none;
}

.community-table .logo-cell img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.community-table .name-cell {
  font-weight: 600;
  color: #fff;
}

.community-table .location-cell {
  color: #e23636;
  font-weight: 500;
  font-size: 0.84rem;
}

.community-table .desc-cell {
  color: #999;
  font-size: 0.84rem;
  line-height: 1.4;
  max-width: 350px;
}

.community-table .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.community-table .links a {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(226, 54, 54, 0.12);
  border: 1px solid rgba(226, 54, 54, 0.2);
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  transition: all 0.2s;
  white-space: nowrap;
}

.community-table .links a:hover {
  background: #e23636;
  border-color: #e23636;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #444;
  font-size: 0.9rem;
}

/* ── About View ── */
#about-view {
  display: none;
  padding: 4rem 2rem;
  min-height: calc(100vh - var(--header-height));
  align-items: flex-start;
  justify-content: center;
}

.about-content {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.about-content p {
  font-size: 1rem;
  line-height: 1.7;
  color: #c0c0d0;
}

.about-content a {
  color: #e23636;
  text-decoration: none;
  border-bottom: 1px solid rgba(226, 54, 54, 0.3);
  transition: border-color 0.2s, color 0.2s;
}

.about-content a:hover {
  color: #ff6b6b;
  border-bottom-color: rgba(255, 107, 107, 0.6);
}

/* ── Scrollbar ── */
#table-view::-webkit-scrollbar {
  width: 6px;
}

#table-view::-webkit-scrollbar-track {
  background: transparent;
}

#table-view::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#table-view::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-left: 1.5rem;
  padding-left: 1.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #666;
}

.stat-item .stat-value {
  color: #e23636;
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  :root {
    --header-height: 48px;
  }

  body {
    overflow-y: auto;
    height: auto;
  }

  header {
    padding: 0 0.75rem;
    gap: 0.5rem;
    height: var(--header-height);
    position: sticky;
    top: 0;
  }

  header h1 {
    display: none;
  }

  .home-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
  }

  .stats-bar {
    display: none;
  }

  .tabs {
    display: none;
  }

  .burger-btn {
    display: flex;
    align-items: center;
  }

  #map-view {
    height: 60vh;
  }

  #table-view {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    padding: 1rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .filter-bar label {
    display: none;
  }

  .filter-bar select,
  .search-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Card layout for table entries on mobile */
  .table-wrapper {
    border-radius: 10px;
    overflow: hidden;
  }

  .community-table thead {
    display: none;
  }

  .community-table tbody tr {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .community-table tbody tr:last-child {
    border-bottom: none;
  }

  .community-table td {
    display: block;
    padding: 0;
    border: none;
    font-size: 0.88rem;
  }

  .community-table .logo-cell {
    display: none;
  }

  .community-table .name-cell {
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }

  .community-table .location-cell {
    font-size: 0.82rem;
    margin-bottom: 0.5rem;
  }

  .community-table .desc-cell {
    display: block !important;
    margin-bottom: 0.5rem;
    color: #777;
    font-size: 0.82rem;
    line-height: 1.5;
  }

  .community-table tbody tr:hover td {
    background: transparent;
  }

  .community-table .links {
    margin-top: 0.4rem;
  }

  #about-view {
    min-height: auto;
    padding: 2rem 1rem;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  header h1 {
    font-size: 0.95rem;
  }

  .stats-bar {
    display: none;
  }

  #table-view {
    padding: 1rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }

  .filter-bar select {
    min-width: 0;
    width: 100%;
  }

  .community-table .desc-cell {
    display: none;
  }
}


