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

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

header {
  padding: 1.2rem 2rem 0.6rem;
  background: linear-gradient(135deg, #1a1d2e, #252840);
  border-bottom: 1px solid #333;
}
header h1 {
  font-size: 1.6rem;
  color: #7eb8ff;
  letter-spacing: 1px;
}
.subtitle {
  font-size: 0.85rem;
  color: #888;
  margin-top: 2px;
}

/* Controls */
.controls {
  padding: 1rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  background: #14161f;
  border-bottom: 1px solid #222;
}
.search-box {
  position: relative;
  flex: 0 0 300px;
}
.search-box input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1e2030;
  color: #e0e0e0;
  font-size: 0.9rem;
  outline: none;
}
.search-box input:focus { border-color: #7eb8ff; }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1e2030;
  border: 1px solid #444;
  border-radius: 0 0 6px 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}
.search-results.hidden { display: none; }
.search-result-item {
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 1px solid #2a2d3e;
}
.search-result-item:hover { background: #2a2d3e; }
.search-result-item .country {
  color: #888;
  font-size: 0.75rem;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.presets-label {
  font-size: 0.8rem;
  color: #888;
  margin-right: 0.3rem;
}
.preset-btn {
  padding: 0.35rem 0.7rem;
  border: 1px solid #444;
  border-radius: 4px;
  background: #1e2030;
  color: #c0c0c0;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.preset-btn:hover { background: #2a2d3e; border-color: #7eb8ff; color: #fff; }

/* Charts container */
#charts-container {
  padding: 1rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.location-card {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 10px;
  overflow: hidden;
}
.location-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background: #1e2136;
  border-bottom: 1px solid #2a2d3e;
}
.location-header h2 {
  font-size: 1.1rem;
  color: #7eb8ff;
}
.remove-btn {
  background: none;
  border: 1px solid #555;
  color: #999;
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  font-size: 0.75rem;
}
.remove-btn:hover { border-color: #e74c3c; color: #e74c3c; }

.chart-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.8rem;
}
.chart-scroll-wrapper::-webkit-scrollbar { height: 8px; }
.chart-scroll-wrapper::-webkit-scrollbar-track { background: #14161f; border-radius: 4px; }
.chart-scroll-wrapper::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
.chart-scroll-wrapper::-webkit-scrollbar-thumb:hover { background: #666; }

.chart-inner {
  position: relative;
}

.chart-section-label {
  font-size: 0.85rem;
  color: #7eb8ff;
  padding: 0.6rem 1.2rem 0.2rem;
  font-weight: 600;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: #666;
  font-size: 0.9rem;
}

/* Legend */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.4rem 1.2rem 0.6rem;
  font-size: 0.75rem;
  color: #aaa;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}
