/* Global Colors & Transition Speed */
:root {
  --bg-light: #eef7ff;
  --bg-dark: #121212;
  --card-light: #fff;
  --card-dark: #1e1e1e;
  --text-light: #000;
  --text-dark: #eee;
  --primary-light: #007BFF;
  --primary-dark: #2978b5;
  --orange-btn: #ff8000;
  --transition-speed: 1s; /* Light mode transition speed */
}

/* Base Setup */
html,
body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  color: var(--text-light);
  height: 100%;
  width: 100%;
  transition: background var(--transition-speed), color var(--transition-speed);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Escape the apostrophe or rename the file if needed */
  background: url("Earth's Illuminated Network in Space.png") center/cover no-repeat;
  filter: blur(8px);
  transform: scale(1.1);
  z-index: -1;
  animation: bgZoom 30s linear infinite;
}

@keyframes bgZoom {
  0%, 100% {
    transform: scale(1.1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* Dark mode overrides */
body.dark {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  --transition-speed: 0.5s; /* Override transition speed for dark mode */
}

body.dark::before {
  filter: blur(8px) brightness(0.3);
}

/* Weather App Container */
.weather-app {
  max-width: 320px;
  margin: 2rem auto;
  padding: 16px;
  text-align: center;
  position: relative;
  background: var(--card-light);
  border-radius: 1rem;
  width: 100%;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: background var(--transition-speed), color var(--transition-speed);
  height: auto;
}

body.dark .weather-app {
  background: var(--card-dark);
  transition: background 0.5s;
}

/* Weather Info Card */
.weather-info {
  background-color: var(--card-light);
  color: var(--text-light);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0);
  text-align: center;
  margin: -10px auto;  /* reduced from 8px auto to move up */
  width: auto;
  transition: background var(--transition-speed);
  overflow-y: auto;
  height: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
body.dark .weather-info {
  background-color: var(--card-dark);
  color: var(--text-dark);
}

/* Weather Icon */
.weather-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
}

/* City and Description */
.city-name {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.weather-desc {
  font-size: 18px;
  color: var(--primary-light);
  margin-bottom: 16px;
  transition: color var(--transition-speed);
}

body.dark .weather-desc {
  color: var(--primary-dark);
}

/* Weather Table (using Tailwind-inspired utilities) */
.weather-table {
  width: 100%;
  border-collapse: separate; /* allows border-radius */
  border-spacing: 0;
  margin-top: 16px;
  border: 2px solid #999; /* Darker border for light mode */
  border-radius: 8px;
  overflow: hidden;
}

.weather-table th,
.weather-table td {
  padding: 0.5rem;
  text-align: center;
  border: 2px solid #999; /* Darker border for light mode */
}

.weather-table .feels-like th {
  font-size: 1.4rem;
  font-weight: bold;
  background-color: var(--primary-light);
  color: #fff;
  padding: 0.75rem;
}

body.dark .weather-table .feels-like th {
  background-color: var(--primary-dark);
}

.weather-table tbody td {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Input Field */
input {
  width: 100%;
  max-width: 295px;
  padding: 0.75rem;
  font-size: 1rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: background 0.3s;
}

body.dark input {
  background: rgba(255, 255, 255, 0.05);
}

input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
}

/* Button Styles */
button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--primary-light);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-speed), transform 0.1s;
}

body.dark button {
  background: var(--primary-dark);
}

button:hover {
  background: #3a8dde;
  transform: translateY(-1px);
}

body.dark button:hover {
  background: #1d6690;
}

/* Toggle Dark Button */
.toggle-dark {
  margin-top: 1rem;
  background: var(--orange-btn);
  padding: 0.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.toggle-dark img {
  width: 20px;
  height: 20px;
}

/* Output Panel */
.output {
  margin-top: 1.5rem;
  font-size: 1.2rem;
  line-height: 1.4;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-speed), opacity var(--transition-speed);
  opacity: 0;
}

.output img {
  display: block;
  margin: 0 auto 0.5rem;
  width: 48px;
  height: 48px;
}

.output p:last-child {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Output Panel Animation */
.output.animate-output {
  max-height: 500px; /* adjust as needed */
  opacity: 1;
}

/* Loading Bar Style */
.loading {
  display: none;
  width: 80%;
  max-width: 280px;
  height: 4px;
  margin: 1rem auto;
  background: var(--primary-light);
  position: relative;
  overflow: hidden;
  transition: background var(--transition-speed);
}

.loading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: #fff;
  animation: loadAnimation 2s linear infinite;
}

@keyframes loadAnimation {
  0% { width: 0%; }
  50% { width: 100%; }
  100% { width: 0%; }
}

/* Additional Example Styles */
/* Increase primary (feels like) data size */
.weather-stats .stat.primary {
  font-size: 1.2rem;
  font-weight: bold;
}

/* Reduce font-size for small stats */
.weather-stats .stat.small {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Optional: Animation for output panel expansion */
.animate-output {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
  /* Make the weather app container use a wider percentage so it centers properly */
  .weather-app {
    margin: 1rem auto;
    width: 90%;
    max-width: none;
  }
}

/* Footer adjustments */
p.copyright {
  position: fixed;
  bottom: 0rem; /* Lower the footer as needed */
  right: 10px;   /* Place footer in the right corner */
  z-index: -1;   /* Sends it behind other content */
  white-space: nowrap;
}

@media screen and (max-width: 600px) and (orientation: landscape) {
  html, body {
    overflow-y: auto;
  }
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.info {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
  border-radius: 0.5rem;
}
body.dark .info {
  background: rgba(255, 255, 255, 0.1);
}
.weather-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.info.wide {
  grid-column: span 2;
}

#forecastBtn {
  margin-top: 5px !important;
}

/* Forecast container adjusts size and animates in */
.forecast-container {
  
  max-height: none; /* remove any fixed max-height */
  overflow: visible;
  transition: max-height var(--transition-speed) ease, opacity var(--transition-speed) ease; /* Added transition */
}

/* Arrange forecast items side by side */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center; /* centers items in incomplete rows */
}

/* Optional: Add a hover scale effect on forecast items */
.forecast-item {
  text-align: center;
  transition: transform 0.3s ease;
}
.forecast-item:hover {
  transform: scale(1.05);
}

/* Add these rules to your style.css */
.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.fade-in {
  opacity: 1;
  transition: opacity 0.5s ease-in;
}
