*{
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  box-sizing: border-box;
}

body{
  background: #222;
}

/* Card */
.card{
  position: relative;              /* so toggle can sit inside card corner */
  width: 90%;
  max-width: 470px;
  background: linear-gradient(135deg, #00feba, #5b548a);
  color: #fff;
  margin: 100px auto 40px;
  border-radius: 20px;
  padding: 40px 35px;
  text-align: center;
  transition: background 0.3s ease, color 0.3s ease;
  /* transition: background 5s ease, color 5.4s ease; */
}

/* Light theme only affects the CARD */
.card.dark {
  background: linear-gradient(135deg, #2a2a2a, #0e0e0e, #2d2d2d);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}




/* Toggle inside card (top-right, small) */
#theme-toggle{
  position: absolute;
  top: 2px;
  right: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 999px;
}
#theme-toggle img{
  width: 22px;
  height: 22px;
  display: block;
}

.search{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search input{
  border: 0;
  outline: 0;
  background: #ebfffc;
  color: #555;
  padding: 10px 25px;
  height: 60px;
  border-radius: 30px;
  flex: 1;
  margin-right: 16px;
  font-size: 18px;
}

.search button{
  border: 0;
  outline: 0;
  background: #ebfffc;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
}

.search button img{
  width: 16px;
}

.weather-icon{
  width: 170px;
  margin-top: 30px;
}

.weather h1{
  font-size: 80px;
  font-weight: 500;
}
.weather h2{
  font-size: 45px;
  font-weight: 400;
  margin-top: -10px;
}

.details{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  margin-top: 50px;
}

.col{
  display: flex;
  align-items: center;
  text-align: left;
}

.col img{
  width: 40px;
  margin-right: 10px;
}

.humidity, .wind{
  font-size: 20px;
  margin-top: -6px;
}

.error{
  text-align: left;
  margin-left: 10px;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}

/* Loader spinner */
.loader{
  border: 4px solid #f3f3f3;
  border-top: 4px solid #00feba;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 18px auto;
}

@keyframes spin{ 100%{ transform: rotate(360deg); } }

/* Unit toggle button */
.unit-btn{
  margin-top: 15px;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  background: #ffffff;
  color: #333;
  cursor: pointer;
}

/* Forecast */
.forecast{
  margin-top: 30px;
}
.forecast h3{
  margin-bottom: 12px;
  font-weight: 600;
}
.forecast-cards{
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.forecast-card{
  flex: 0 0 95px;
  background: rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  font-size: 14px;
}
.forecast-card img{
  width: 42px;
  height: 42px;
  margin: 6px auto;
}

/* Light card tweaks */
.card.light .forecast-card{
  background: rgba(0,0,0,0.08);
}






/* Default scrollbar (Light mode) */
.forecast-cards::-webkit-scrollbar {
  height: 8px;                    /* slim height for horizontal scroll */
}

.forecast-cards::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.2); /* subtle track */
  border-radius: 10px;
}

.forecast-cards::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #00feba, #5b548a); /* matches card gradient */
  border-radius: 10px;
  transition: background 0.3s ease;
}

.forecast-cards::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5b548a, #00feba);
}

/* Dark Mode Scrollbar */
.card.dark .forecast-cards::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.card.dark .forecast-cards::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3a3a3a, #1a1a1a);
}

.card.dark .forecast-cards::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #555, #222);
}






/* Toggle inside card (top-right, small) */
#theme-toggle{
  position: absolute;
  top: 2px;
  right: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 999px;
  overflow: hidden;
  width: 32px;
  height: 32px;
}

#theme-toggle img{
  width: 22px;
  height: 22px;
  display: block;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

/* Animate sun → moon slide */
#theme-toggle img.slide-out {
  transform: translateX(40px);
  opacity: 0;
}

#theme-toggle img.slide-in {
  transform: translateX(-40px);
  opacity: 0;
}

#theme-toggle img.active {
  transform: translateX(0);
  opacity: 1;
}

@media (max-width: 480px) {
  .card {
    padding: 20px 15px;
  }
  .card h1 {
    font-size: 1.6rem;
  }
  .card p {
    font-size: 0.9rem;
  }
}
