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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #0f172a;
  color: #e2e8f0;
}

#sidebar {
  width: 380px;
  min-width: 380px;
  background: #1e293b;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #334155;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 24px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label,
.slider-header label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:hover, select:focus {
  border-color: #60a5fa;
  outline: none;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-value {
  font-size: 0.85rem;
  color: #60a5fa;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.dual-slider {
  position: relative;
  height: 36px;
}

.dual-slider input[type="range"] {
  position: absolute;
  width: 100%;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  top: 50%;
  transform: translateY(-50%);
}

.dual-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: #334155;
  border-radius: 2px;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #1e293b;
  cursor: pointer;
  pointer-events: all;
  margin-top: -8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background 0.2s, transform 0.1s;
}

.dual-slider input[type="range"]::-webkit-slider-thumb:hover {
  background: #60a5fa;
  transform: scale(1.15);
}

.dual-slider input[type="range"]::-moz-range-track {
  height: 4px;
  background: #334155;
  border-radius: 2px;
  border: none;
}

.dual-slider input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #1e293b;
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#reset-btn {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

#reset-btn:hover {
  background: #475569;
  border-color: #60a5fa;
}

#results-count {
  font-size: 0.9rem;
  color: #94a3b8;
  padding: 12px 0;
  border-top: 1px solid #334155;
  border-bottom: 1px solid #334155;
  font-weight: 500;
}

#results-count strong {
  color: #60a5fa;
}

#city-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
}

.city-item {
  padding: 10px 8px;
  border-bottom: 1px solid #1e293b44;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 6px;
}

.city-item:hover {
  background: #334155;
}

.city-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #f1f5f9;
}

.city-country {
  color: #64748b;
  font-size: 0.75rem;
  margin-left: 4px;
}

.city-stats {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 4px;
  flex-wrap: wrap;
}

.city-stat {
  display: flex;
  align-items: center;
  gap: 3px;
}

.city-stat .icon {
  font-size: 0.7rem;
}

#map {
  flex: 1;
  height: 100vh;
}

/* Custom Leaflet popup */
.leaflet-popup-content-wrapper {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border: 1px solid #334155;
}

.leaflet-popup-tip {
  background: #1e293b;
  border: 1px solid #334155;
}

.leaflet-popup-content {
  margin: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  line-height: 1.5;
}

.popup-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  color: #f1f5f9;
}

.popup-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.popup-stat-label {
  color: #94a3b8;
  font-size: 0.75rem;
}

.popup-stat-value {
  font-weight: 600;
  color: #60a5fa;
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-size: 1.2rem;
  color: #60a5fa;
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #334155;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

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

/* Scrollbar */
#sidebar::-webkit-scrollbar,
#city-list::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track,
#city-list::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb,
#city-list::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    min-width: auto;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid #334155;
  }
  #map {
    height: 50vh;
  }
}
