@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: #1e1e1e;
  color: #171717;
}

.container {
  background-color: #fff;
  color: #171717;
  padding: 2rem;
  width: 40%;
  margin: 4rem auto;
  border-radius: 10px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  -ms-border-radius: 10px;
  -o-border-radius: 10px;
}

.weather_header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

input {
  border: none;
  background: #1e1e1e;
  color: #fff;
  /* outline: none; */
  /* width: 34rem; */
  padding: 0.5rem 2.5rem;
  margin-bottom: 1rem;
  border-radius: 5px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  -ms-border-radius: 5px;
  -o-border-radius: 5px;
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}

input ::placeholder {
  color: #f7f7f7;
}

.weather_search {
  position: relative;
}

.weather_search i {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 15px;
  color: #fff;
}

.weather_units {
  font-size: 1.5rem;
}

.weather_units span {
  cursor: pointer;
}

.weather_units span:first-child {
  margin-right: 0.5rem;
}

.weather_body {
  text-align: center;
}

.weather_date_time {
  margin-bottom: 2rem;
  font-size: 14px;
}

.weather_forecast {
  background: #1e1e1e;
  color: #fff;
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 30px;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  -ms-border-radius: 30px;
  -o-border-radius: 30px;
}

.weather_icon img {
  width: 100px;
  filter: drop-shadow(2px 4px 6px black);
  -webkit-filter: drop-shadow(2px 4px 6px black);
}

.weather_temperature {
  font-size: 1.75rem;
}

.weather_minmax {
  display: flex;
  justify-content: center;
}

.weather_minmax p {
  font-size: 14px;
  margin: 0.5rem;
}

.weather_info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px; /* Space between the cards */
  max-width: 500px; /* Adjust as needed */
  margin: auto;
  background: #1e1e1e;
  background-color: #f7f7f7;
  color: #000;
  padding: 1rem;
  border-radius: 10px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  -ms-border-radius: 10px;
  -o-border-radius: 10px;
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}

.weather_card {
  width: 45%; /* Each card takes almost half of the container */
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.weather_card i {
  font-size: 1.5rem;
  margin-right: 1rem;
}

.weather_card p {
  font-size: 14px;
}

.weather_card {
  transform: scale(0.8);
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

/* Staggered animation for each card */
.weather_card:nth-child(1) {
  animation-delay: 0.2s;
}
.weather_card:nth-child(2) {
  animation-delay: 0.4s;
}
.weather_card:nth-child(3) {
  animation-delay: 0.6s;
}
.weather_card:nth-child(4) {
  animation-delay: 0.8s;
}

/* Hover effect */
.weather_card:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease-in-out;
}

/* Keyframes for fade-in effect */
@keyframes fadeIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Rotate icon on hover */
.weather_card:hover i {
  transform: rotate(360deg);
  transition: transform 0.5s ease-in-out;
}

/* Small devices (max-width: 768px) */
@media (max-width: 768px) {
  .container {
    width: 90%;
    padding: 1.5rem;
  }

  .weather_header {
    flex-direction: column;
    gap: 10px;
  }

  .weather_search {
    width: 100%;
  }

  input {
    width: 100%;
    padding: 0.5rem 2rem;
    font-size: 14px;
  }

  .weather_search i {
    left: 12px;
    top: 50%;
    font-size: 16px;
    transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    -o-transform: translateY(-50%);
}

  .weather_info {
    max-width: 100%;
    padding: 0.8rem;
    gap: 15px;
  }

  .weather_card {
    width: 100%;
    flex-direction: column;
    padding: 10px;
  }

  .weather_card i {
    font-size: 1.2rem;
    margin-right: 0;
  }
}

/* Extra Small Devices (max-width: 480px) */
@media (max-width: 480px) {
  .container {
    width: 95%;
    padding: 1rem;
  }

  .weather_header {
    flex-direction: column;
    gap: 10px;
  }

  .weather_search {
    width: 100%;
    position: relative;
  }

  input {
    width: 100%;
    padding: 0.6rem 2.5rem;
    font-size: 14px;
  }

  .weather_search i {
    left: 10px; /* Ensures the icon doesn't overlap */
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
  }

  .weather_info {
    flex-direction: column;
    padding: 0.5rem;
  }

  .weather_card {
    width: 100%;
    padding: 12px;
  }

  .weather_card p {
    font-size: 12px;
  }

  .weather_card i {
    font-size: 1rem;
  }

  .weather_temperature {
    font-size: 1.3rem;
  }
}

/* Make search bar full width on all devices */
.weather_search {
  width: 100%;
  position: relative;
}

input {
  width: 100%;
  padding: 0.8rem 2.5rem;
  font-size: 16px;
  border: none;
  background: #1e1e1e;
  color: #fff;
  outline: none;
  border-radius: 10px;
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  -ms-border-radius: 10px;
  -o-border-radius: 10px;
}

/* Fix search icon position */
.weather_search i {
  position: absolute;
  left: 15px;
  top: 40%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #fff;
  border-radius: 30px;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  -ms-border-radius: 30px;
  -o-border-radius: 30px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    width: 80%;
  }
}

@media (max-width: 768px) {
  .container {
    width: 90%;
  }
}

@media (max-width: 480px) {
  .container {
    width: 95%;
  }
}

