
:root {
  --primary: #8e44ad;
  --secondary: #9b59b6;
  --bg-light: #f5eafc;
  --bg-dark: #2c3e50;
  --text-light: #fff;
  --text-dark: #333;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  transition: background 0.3s, color 0.3s;
  text-align: center;
  padding: 2rem;
  margin: 0;
  position: relative;
}

body.dark {
  background-color: #1e1e2f;
  color: #f2f2f2;
}

body.dark input[type="text"],
body.dark button {
  background-color: #2d2d44;
  color: #f2f2f2;
  border: 1px solid #888;
}

body.dark .forecast-card {
  background-color: #2e2e3e;
  color: #f9f9f9;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

body.dark .forecast-card:hover {
  background-color: #5e5ef3;
}

body, input, button, .forecast-card {
  transition: background 0.4s ease, color 0.4s ease;
}

input[type="text"] {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  width: 60%;
  max-width: 300px;
  font-size: 16px;
}

button {
  padding: 10px 20px;
  border: none;
  background-color: var(--primary);
  color: white;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background-color: var(--secondary);
}

.hidden {
  display: none;
}

#weatherResult {
  margin-top: 20px;
  padding: 1rem;
  background: #ffffffaa;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#forecastCards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.forecast-card {
  background: #fff;
  color: #000;
  border-radius: 12px;
  padding: 1rem;
  width: 160px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  cursor: pointer;
  animation: fadeIn 0.6s ease-in-out;
  transition: transform 0.3s, background 0.3s, color 0.3s;
}

.forecast-card:hover {
  transform: scale(1.05);
  background: var(--primary);
  color: white;
}

.forecast-card:hover::after {
  content: attr(data-tooltip);
  display: block;
  margin-top: 0.5rem;
  font-size: 12px;
  color: #eee;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Toggle Switch */
.switch {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
}

.switch input {
  display: none;
}

.slider {
  width: 60px;
  height: 30px;
  background-color: #ccc;
  border-radius: 30px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.slider::before {
  content: "☀";
  position: absolute;
  width: 26px;
  height: 26px;
  background-color: white;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 5px rgba(0,0,0,0.3);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider::before {
  content: "🌙";
  transform: translateX(30px);
}

.slider.round {
  border-radius: 30px;
}

.slider.round::before {
  border-radius: 50%;
}
