/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #1a1a2e; color: #fff; }

/* === Banner === */
#banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(90deg, #ff0844, #ffb199);
  z-index: 10;
}
.banner-left { display: flex; align-items: center; gap: 12px; }
.site-name { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; }
.tagline { color: rgba(255,255,255,0.8); font-size: 13px; }
.banner-right { font-size: 12px; color: rgba(255,255,255,0.7); }
.threat-label { margin-right: 4px; }
.threat-value { font-weight: bold; }
.threat-MILD { color: #2ecc71; }
.threat-ELEVATED { color: #ffd93d; }
.threat-SEVERE { color: #ff6b35; }
.threat-CRITICAL { color: #ff0; }
.threat-value { color: #ff0; }

/* === Layout === */
#content { display: flex; height: calc(100vh - 44px); position: relative; }

/* === Sidebar === */
#sidebar {
  width: 300px;
  min-width: 300px;
  background: #16213e;
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid #0f3460;
  z-index: 5;
  transition: transform 0.3s ease;
}
#sidebar.collapsed { transform: translateX(-100%); position: absolute; left: 0; top: 0; bottom: 0; }
#sidebar-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  display: none;
}
.sidebar-open-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  background: #16213e;
  border: 1px solid #0f3460;
  color: #fff;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.sidebar-heading {
  color: #ff6b6b;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.sidebar-section { margin-bottom: 20px; }

/* === Chain List === */
.chain-item {
  background: #1a1a3e;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-left: 3px solid var(--chain-color);
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chain-item:hover { background: #22224e; }
.chain-item.active { background: #2a2a5e; outline: 1px solid var(--chain-color); }
.chain-item-left { display: flex; flex-direction: column; min-width: 0; }
.chain-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chain-meta { color: #888; font-size: 10px; margin-top: 1px; }
.chain-score {
  font-weight: 900;
  font-size: 16px;
  min-width: 36px;
  text-align: right;
}
.chain-rip {
  background: #e74c3c;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.show-all-button {
  width: 100%;
  padding: 6px;
  margin-bottom: 10px;
  background: transparent;
  border: 1px solid #0f3460;
  border-radius: 6px;
  color: #ff6b6b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.show-all-button:hover { background: #1a1a3e; }

/* === Slop Stats === */
.stats-placeholder { color: #888; font-size: 13px; font-style: italic; }
.stat-row { font-size: 13px; margin-bottom: 6px; }
.stat-value { font-weight: bold; }
.stat-value-red { color: #ff0844; }

/* === Share Button === */
.share-button {
  width: 100%;
  padding: 10px;
  background: linear-gradient(90deg, #ff0844, #ff6b35);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.share-button:hover { opacity: 0.9; }

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

/* === Popups === */
.maplibregl-popup-content {
  background: #1a1a2e !important;
  border: 1px solid #ff0844;
  border-radius: 8px !important;
  padding: 12px !important;
  color: #fff;
  font-size: 12px;
  max-width: 240px;
}
.maplibregl-popup-tip { border-top-color: #1a1a2e !important; }
.maplibregl-popup-close-button { color: #888; font-size: 16px; }
.popup-chain { font-weight: 900; font-size: 14px; margin-bottom: 2px; }
.popup-address { color: #888; font-size: 11px; margin-bottom: 6px; }
.popup-score { margin-bottom: 4px; }
.popup-owner { color: #aaa; font-size: 11px; }
.popup-tagline { color: #888; font-size: 11px; margin-top: 6px; font-style: italic; }
.popup-rip { background: #e74c3c; color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px; margin-left: 6px; display: inline-block; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2ecc71;
  color: #000;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
}

/* === Mobile === */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: unset;
    height: 60vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-right: none;
    border-top: 2px solid #ff0844;
    border-radius: 16px 16px 0 0;
    z-index: 20;
  }
  #sidebar.open { transform: translateY(0); }
  #sidebar-toggle { display: block; }
  .sidebar-open-btn { display: block !important; }
  #content { flex-direction: column; }
  #map { height: 100%; }
}
