:root {
  --bg-color: #f5f7fa;
  --text-color: #333;
  --card-bg: #ffffff;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --primary: #4a6fa5;
  --alert: #ff6b6b;
  --good-aqi: #2ecc71;
  --moderate-aqi: #f1c40f;
  --unhealthy-aqi: #e67e22;
  --very-unhealthy-aqi: #e74c3c;
  --hazardous-aqi: #8e44ad;
}

.dark-mode {
  --bg-color: #1a1a2e;
  --text-color: #f0f0f0;
  --card-bg: #16213e;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  --primary: #6a8fd8;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: all 0.3s ease;
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.header h1 {
  font-size: 1.8rem;
  color: var(--primary);
}

.header-controls {
  display: flex;
  gap: 15px;
}

button {
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#city-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 1rem;
}

#search-btn, #location-btn {
  padding: 12px 15px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  font-size: 1rem;
}

#search-btn:hover, #location-btn:hover {
  opacity: 0.9;
}

.unit-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.unit-toggle button {
  padding: 8px 15px;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-color);
  font-weight: 600;
}

.unit-toggle .active {
  background: var(--primary);
  color: white;
}

.alert-container {
  margin-bottom: 20px;
}

.alert {
  background: var(--alert);
  color: white;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.weather-icon i {
  font-size: 4rem;
  margin-bottom: 15px;
  color: var(--primary);
}

.weather-info h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.weather-info #temperature {
  font-size: 2.5rem;
  font-weight: bold;
  margin: 10px 0;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 15px 0;
  width: 100%;
}

.weather-details p {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sun-times {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
}

.section-title {
  font-size: 1.3rem;
  margin: 25px 0 15px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hourly-container {
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding: 15px 0;
  margin-bottom: 25px;
  scrollbar-width: thin;
}

.hourly-card {
  min-width: 100px;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.hourly-card p:first-child {
  font-weight: bold;
}

.forecast-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.forecast-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  box-shadow: var(--shadow);
}

.forecast-card p:first-child {
  font-weight: bold;
  margin-bottom: 8px;
}

#weather-map {
  height: 350px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
  z-index: 1;
}

.history-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.history-item {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 8px 15px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.history-item:hover {
  transform: translateY(-3px);
}

/* AQI Colors */
.aqi-good { color: var(--good-aqi); }
.aqi-moderate { color: var(--moderate-aqi); }
.aqi-unhealthy { color: var(--unhealthy-aqi); }
.aqi-very-unhealthy { color: var(--very-unhealthy-aqi); }
.aqi-hazardous { color: var(--hazardous-aqi); }


/* Responsive Design */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .weather-details {
    grid-template-columns: 1fr;
  }
  
  .forecast-container {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 480px) {
  .search-box {
    flex-direction: column;
  }
  
  #city-input {
    width: 100%;
  }
  
  #search-btn, #location-btn {
    width: 100%;
  }
}