:root {
  --primary-gradient: linear-gradient(135deg, #74ebd5 0%, #9face6 100%);
  --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: rgba(255, 255, 255, 0.15);
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 1.2s ease-in-out;
  color: var(--text-primary);
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--secondary-gradient);
  opacity: 0.85;
  z-index: -1;
  transition: opacity 0.5s ease;
}

.weather-app {
  width: 100%;
  max-width: 1200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeIn 1s ease-in-out;
  padding: 25px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.app-title {
  font-weight: 700;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title i {
  font-size: 2rem;
  background: var(--primary-gradient);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#search-form {
  display: flex;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

#search-form:focus-within {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
}

#search-input {
  background: transparent;
  border: none;
  padding: 10px 20px;
  color: var(--text-primary);
  width: 250px;
  outline: none;
}

#search-form button {
  background: var(--primary-gradient);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

#search-form button:hover {
  transform: rotate(15deg) scale(1.05);
}

#loader {
  padding: 40px 0;
}

.spinner-border {
  width: 3rem;
  height: 3rem;
}

.current-weather {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.location-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

#city-name {
  font-weight: 700;
  font-size: 2.5rem;
  margin: 0;
}

.location-container i {
  font-size: 1.2rem;
  opacity: 0.8;
}

#weather-description {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 20px;
  text-transform: capitalize;
}

.temp-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

#weather-icon-container {
  display: flex;
  justify-content: center;
}

#weather-icon-container img {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

#temperature {
  font-weight: 700;
  font-size: 4rem;
  margin: 0;
  background: var(--primary-gradient);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 40px;
}

.detail-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detail-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.detail-card i {
  font-size: 2rem;
  margin-bottom: 10px;
  background: var(--primary-gradient);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.detail-card p {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.detail-card small {
  font-size: 0.9rem;
  opacity: 0.8;
}

.forecast-title {
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 20px;
  padding-left: 10px;
  border-left: 4px solid;
  border-image: var(--primary-gradient);
  border-image-slice: 1;
}

.forecast-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.forecast-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.forecast-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.forecast-card .day {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.forecast-card img {
  width: 50px;
  height: 50px;
  margin: 10px 0;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
}

.forecast-card .temp {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 5px 0;
  background: var(--primary-gradient);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.forecast-card .desc {
  font-size: 0.9rem;
  opacity: 0.9;
  text-transform: capitalize;
}

.app-footer {
  margin-top: 40px;
  text-align: center;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 992px) {
  .weather-app {
    padding: 20px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  #search-form {
    width: 100%;
  }

  #search-input {
    width: 100%;
  }

  .temp-container {
    flex-direction: column;
    gap: 10px;
  }

  #temperature {
    font-size: 3.5rem;
  }
}

@media (max-width: 768px) {
  .weather-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .forecast-container {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  #city-name {
    font-size: 2rem;
  }

  #temperature {
    font-size: 3rem;
  }
}

@media (max-width: 576px) {
  body {
    padding: 10px;
  }

  .weather-app {
    border-radius: 20px;
    padding: 15px;
  }

  .weather-details {
    grid-template-columns: 1fr;
  }

  .forecast-container {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .detail-card {
    padding: 15px;
  }

  .forecast-card {
    padding: 15px;
  }

  #city-name {
    font-size: 1.8rem;
  }

  #temperature {
    font-size: 2.5rem;
  }

  #weather-icon-container img {
    width: 80px;
    height: 80px;
  }
}

/* Animation for cards */
@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.weather-details .detail-card {
  animation: cardAppear 0.5s ease-out forwards;
}

.forecast-container .forecast-card {
  animation: cardAppear 0.5s ease-out forwards;
}

.detail-card:nth-child(1) {
  animation-delay: 0.1s;
}
.detail-card:nth-child(2) {
  animation-delay: 0.2s;
}
.detail-card:nth-child(3) {
  animation-delay: 0.3s;
}

.forecast-card:nth-child(1) {
  animation-delay: 0.1s;
}
.forecast-card:nth-child(2) {
  animation-delay: 0.2s;
}
.forecast-card:nth-child(3) {
  animation-delay: 0.3s;
}
.forecast-card:nth-child(4) {
  animation-delay: 0.4s;
}
.forecast-card:nth-child(5) {
  animation-delay: 0.5s;
}

/* Error message styling */
#error-message {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 15px;
  text-align: center;
}
