:root {
  --bg: #f9f9f9;
  --text: #222;
  --card: #fff;
  --accent: #0077ff;
}

body.dark {
  --bg: #121212;
  --text: #f0f0f0;
  --card: #1e1e1e;
  --accent: #3399ff;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 900px;
  margin: auto;
  padding: 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 5px;
  cursor: pointer;
}

button:hover {
  background: #005fcc;
}

.search-bar {
  display: flex;
  gap: 10px;
  margin: 1rem 0;
}

input {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.card {
  background: var(--card);
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.weather-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.temp {
  font-size: 2rem;
  font-weight: bold;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.forecast-grid div {
  background: var(--card);
  padding: 0.8rem;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#loader {
  text-align: center;
  margin: 1rem 0;
  font-size: 1.2rem;
}

.error {
  color: red;
  text-align: center;
  margin: 1rem 0;
}

.hidden {
  display: none;
}

@media (max-width: 600px) {
  .weather-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}