/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(to right, #4e54c8, #8f94fb);
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

main {
  width: 100%;
  max-width: 500px;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #fff;
}

/* Glass Card Container */
.container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
  height: 100%;
}

/* Search */
.nav .search {
  display: flex;
  gap: 10px;
  width: 100%;
}

.nav input {
    text-transform: capitalize;
  flex: 1;
  padding: 10px 15px;
  border-radius: 30px;
  border: none;
  outline: none;
  font-size: 18px;
  background-color: rgba(255, 255, 255, 0.8);
  color: #333;
}

.nav button {
  width: 45px;
  height: 45px;
  border: none;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav button img {
  width: 22px;
}

/* Current Weather Display */
.place-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.place-name img.weather-icon {
  width: 100px;
}

.place-name .temp {
  font-size: 40px;
  font-weight: 600;
}

.place-name .city {
  font-size: 22px;
  font-weight: 400;
}

.loader {
  font-size: 14px;
  color: #ccc;
}

/* Current Weather Details */
.weather-details {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  overflow-x: auto;
}

/* For icon shimmer */
.icon-wrapper {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-wrapper.skeleton {
  background: linear-gradient(100deg, rgba(255,255,255,0.1) 30%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

.icon-wrapper.skeleton img {
  opacity: 0; /* hide actual icon while loading */
}


.humidity,
.wind-speed {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 12px;
  border-radius: 15px;
  flex: 1;
}

.humidity img,
.wind-speed img {
  width: 30px;
  height: 30px;
}

.humidity-details,
.wind-speed-details {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

/* Forecast */
.forecast-container {
  margin-top: 20px;
}

.forecast-container h3 {
  text-align: center;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
}

.forecast {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.forecast-day {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px;
  min-width: 90px;
  text-align: center;
  flex-shrink: 0;
}

.forecast-day img {
  width: 50px;
  margin: 0 auto;
}

.forecast-day h4 {
  font-size: 14px;
  font-weight: 500;
}

.forecast-day p {
  font-size: 12px;
}

/* Scrollbar hidden */
.forecast::-webkit-scrollbar,.weather-details::-webkit-scrollbar {
  display: none;
}



.weather-app {
  transition: background 0.5s ease-in-out;
  background-size: cover;
  background-position: center;
  min-height: 100vh;
  color: #fff;
}

/* Example background images or animated gifs */
.clear-bg {
  background-image: url('https://i.gifer.com/7efs.gif'); /* sunny gif */
}
.cloudy-bg {
  background-image: url('https://i.gifer.com/BQy7.gif'); /* clouds */
}
.rainy-bg {
  background-image: url('https://i.gifer.com/VAyR.gif'); /* rain */
}
.storm-bg {
  background-image: url('https://i.gifer.com/BJvL.gif'); /* thunderstorm */
}
.snow-bg {
  background-image: url('https://i.gifer.com/ZgA6.gif'); /* snow */
}
.mist-bg {
  background-image: url('https://i.gifer.com/VybJ.gif'); /* fog */
}



/* Skeleton Loader Base */
.skeleton {
  background: linear-gradient(100deg, rgba(255,255,255,0.1) 30%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}

/* Shimmer Effect */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}



/* Smooth transitions for all major components */
.temp,
.city,
.humidity-value,
.wind,
.humidity,
.wind-speed,
.forecast-day,
.place-name img.weather-icon,
.icon-wrapper,
.icon-wrapper img {
  transition: all 0.3s ease-in-out;
}

/* Fix min-height/min-width to prevent collapsing during loading */
.temp,
.city,
.humidity-value,
.wind {
  min-height: 28px;
}

.forecast-day {
  min-height: 120px;
  min-width: 90px;
}

.place-name img.weather-icon {
  min-height: 100px;
  min-width: 100px;
}

.icon-wrapper {
  min-width: 30px;
  min-height: 30px;
}
.fade-in {
  opacity: 0;
  animation: fadeIn 0.4s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}



/* Responsive for smaller screens */
@media (max-width: 768px) {
  main {
    padding: 15px;
  }

  .container {
    padding: 20px;
    gap: 20px;
  }

  .place-name img.weather-icon {
    width: 80px;
    min-width: 90px;
    min-height: 90px;
    padding: 0;
    padding: 0;
  }

  .place-name .temp {
    font-size: 32px;
  }

  .place-name .city {
    font-size: 20px;
  }



  .humidity img,
  .wind-speed img {
    width: 30px;
    height: 30px;
  }

  .humidity-details,
  .wind-speed-details {
    font-size: 12px;
  }

  .nav input {
    font-size: 16px;
    padding: 8px 12px;
  }

  .nav button {
    width: 40px;
    height: 40px;
  }

  .forecast-day {
    min-width: 80px;
    padding: 8px;
  }

  .forecast-day img {
    width: 40px;
  }

  .forecast-day h4 {
    font-size: 13px;
  }

  .forecast-day p {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .nav {
  padding: 0;
}

.search {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
  background: #ffffffd8;
  border-radius: 50px;
  overflow: hidden;
}

.search-input {
  width: 100%;
  padding: 12px 44px 12px 16px; /* right padding for button space */
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 1rem;
}

.search-button {
  position: absolute;
  background: transparent;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  
}

.search-button img {
  width: 20px;
  height: 20px;
}

  .weather-details {
   
    gap: 10px;
  }

  .humidity,
  .wind-speed {
    width: 100%;
  }

  .place-name .temp {
    font-size: 28px;
  }

  .place-name .city {
    font-size: 16px;
  }
}
