/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body Styles */
body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background-color: #f4f4f4;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh; /* Ensure body covers the full viewport height */
  display: flex;
  flex-direction: column;
}

/* Dark Theme Styles */
body.dark-theme {
  background-color: #121212; /* Darker background for better contrast */
  color: #e0e0e0; /* Softer white for text */
}

/* Header Styles */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(to right, #ff7e5f, #feb47b); /* Gradient for header */
  color: #fff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Dark Theme Header */
header.dark-theme {
  background: linear-gradient(to right, #2c3e50, #1a252f); /* Adjusted dark gradient */
  color: #dcdcdc; /* Softer white for header text */
}

/* Button Styles */
header button {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: #ff6f61; /* Vibrant button color */
  color: #fff;
  border: none;
  border-radius: 20px;
  transition: background 0.3s, transform 0.3s;
}

header button:hover {
  background: #ff3d2e; /* Darker shade on hover */
  transform: scale(1.1);
}

header button.dark-theme {
  background: #37474f; /* Darker button background */
}

header button.dark-theme:hover {
  background: #263238; /* Slightly darker hover effect */
}

#clearDashboardBtn {
  background-color: #dc3545; /* Red color for clear button */
}

#clearDashboardBtn:hover {
  background-color: #c82333; /* Darker red on hover */
}

header .weather-dashboard {
  font-size: 1.5rem;
  font-weight: bold;
}

/* Main Content */
main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr; /* Divide into three columns */
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Left Column: Recent Searches */
.recent-searches-container {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Center Column: Weather Card */
.weather-card-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Right Column: 5-Day Forecast */
.forecast-container {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
  margin-top: 2rem;
}

.search-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 600px;
}

#cityInput {
  padding: 0.5rem;
  font-size: 1rem;
  width: 70%;
}

#getWeatherBtn {
  padding: 0.5rem 1rem;
  cursor: pointer;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
}

/* Improve Weather Card Layout */
.weather-card {
  background: linear-gradient(to bottom, #ffffff, #f8f9fa); /* Subtle gradient */
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
  width: 100%;
  max-width: 600px;
  text-align: center;
}

.weather-card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Dark Theme Weather Card */
.weather-card.dark-theme {
  background: linear-gradient(to bottom, #1e272e, #2f3e46); /* Adjusted dark gradient for weather card */
  color: #d3d3d3; /* Softer white for text */
}

/* Weather Conditions */
.weather-card.sunny {
  background: linear-gradient(to bottom, #ffeb3b, #ffc107); /* Sunny shades */
  color: #333;
}

.weather-card.rainy {
  background: linear-gradient(to bottom, #4fc3f7, #0288d1); /* Rainy shades */
  color: #fff;
}

.weather-card.cool {
  background: linear-gradient(to bottom, #b3e5fc, #81d4fa); /* Cool shades */
  color: #333;
}

#weatherInfo h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

#weatherInfo p {
  margin: 0.5rem 0;
}

#weatherIcon {
  width: 50px;
  height: 50px;
  justify-self: center;
}

.loading {
  text-align: center;
  font-style: italic;
  animation: pulse 1.5s infinite;
}

.error {
  color: red;
  text-align: center;
}

.forecast-container {
  margin-top: 2rem;
}

.forecast-list {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
}

/* Style Forecast Items */
.forecast-item {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  min-width: 150px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.forecast-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  background-color: #e3f2fd; /* Light blue shade */
}

/* Dark Theme Forecast Item */
.forecast-item.dark-theme {
  background-color: #1e272e; /* Darker background for forecast items */
  color: #b0bec5; /* Softer gray for text */
}

.forecast-item.dark-theme:hover {
  background-color: #2a3b45; /* Slightly lighter hover color */
}

.forecast-item.dark-theme p {
  color: #cfd8dc; /* Adjusted text color for better readability */
}

.recent-searches {
  margin-top: 2rem;
  width: 100%;
  max-width: 600px;
}

#searchHistory {
  list-style: none;
}

#searchHistory li {
  padding: 0.5rem;
  background: #e9ecef;
  margin: 0.5rem 0;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#searchHistory li:hover {
  transform: scale(1.05);
  background: #d3d9df;
}

#searchHistory li.dark-theme:hover {
  background-color: #333; /* Slightly lighter hover shade for search history items */
}

/* Footer */
footer {
  display: flex;
  justify-content: space-around;
  padding: 2rem;
  background: linear-gradient(to right, #ff7e5f, #feb47b); /* Gradient for footer */
  color: #fff;
  margin-top: 2rem;
  box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0; /* Ensure footer stays at the bottom */
}

footer.dark-theme {
  background: linear-gradient(to right, #1a252f, #2c3e50); /* Adjusted dark gradient for footer */
  color: #dcdcdc; /* Softer white for footer text */
}

.footer-column {
  text-align: center;
}

.footer-column a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.3s ease;
}

.footer-column a:hover {
  transform: scale(1.1);
  color: #ffcccb; /* Light pink */
}

.footer-column a.dark-theme:hover {
  color: #80d8ff; /* Brighter blue for hover effect */
}

/* Responsive Design */
@media (max-width: 768px) {
  header {
      flex-direction: column;
      gap: 1rem;
  }

  .search-container {
      flex-direction: column;
  }

  #cityInput {
      width: 100%;
  }

  footer {
      flex-direction: column;
      gap: 1rem;
  }

  .main-content {
    grid-template-columns: 1fr; /* Stack columns vertically */
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.weather-card, .forecast-container, .recent-searches {
  animation: fadeIn 0.5s ease-in;
}

/* Animations */
button, .weather-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

button:hover, .weather-card:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button:active, .weather-card:active {
  transform: scale(0.95);
}

/* Hover Animations for Buttons */
button {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  background-color: #ff3d2e; /* Slightly darker shade */
}

button:active {
  transform: scale(0.95);
}

/* Hover Animations for Weather Card */
.weather-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.weather-card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Hover Animations for Forecast Items */
.forecast-item {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.forecast-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  background-color: #e3f2fd; /* Light blue shade */
}

.forecast-item.dark-theme:hover {
  background-color: #2a3b45; /* Adjusted hover color for forecast items */
}

/* Hover Animations for Recent Search Items */
#searchHistory li {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#searchHistory li:hover {
  transform: scale(1.05);
  background-color: #d3d9df; /* Slightly darker shade */
}

#searchHistory li.dark-theme:hover {
  background-color: #333; /* Slightly lighter hover shade */
}

/* Hover Animations for Footer Links */
.footer-column a {
  transition: color 0.3s ease, transform 0.3s ease;
}

.footer-column a:hover {
  transform: scale(1.1);
  color: #ffcccb; /* Light pink */
}

.footer-column a.dark-theme:hover {
  color: #80d8ff; /* Brighter blue for hover effect */
}