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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(18, 40, 90, 0.35), transparent 35%),
    #050816;
  padding: 24px;
  color: #ffffff;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
}

/* TOP BAR */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.recent-searches {
  margin-bottom: 26px;
}

.recent-searches h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  margin-bottom: 12px;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(180deg, rgba(35, 58, 112, 0.95), rgba(14, 24, 48, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.app-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.search-box {
  min-width: 380px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 60px;
  border-radius: 999px;
  background: rgba(8, 14, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.search-icon {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.65);
}

.city-input,
.location-btn,
.unit-toggle,
.recent-city {
  border: 1px solid rgba(255, 255, 255, 0.12);
  outline: none;
  font-size: 1rem;
  background: rgba(10, 16, 35, 0.7);
  backdrop-filter: blur(14px);
  color: white;
  transition: 0.3s ease;
}

.search-box .city-input {
  border: none;
  background: transparent;
  padding: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
}

.city-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.location-btn,
.unit-toggle,
.recent-city {
  cursor: pointer;
}

.location-btn,
.unit-toggle {
  height: 60px;
  padding: 0 22px;
  border-radius: 20px;
  background: rgba(8, 14, 30, 0.85);
}

.location-btn:hover,
.unit-toggle:hover {
  transform: translateY(-2px);
  background: rgba(18, 28, 55, 0.95);
  border-color: rgba(255,255,255,0.18);
}

.recent-city:hover {
  transform: translateY(-2px);
  background: #2f7de1;
  border-color: #4aa8ff;
}

/* MAIN DASHBOARD */
.dashboard {
  display: grid;
  gap: 22px;
}

.main-weather-card,
.detail-card,
.forecast-card {
  background: rgba(8, 14, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

/* HERO SECTION */
.main-weather-card {
  min-height: 430px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  align-items: center;
  gap: 20px;
  background:
    radial-gradient(circle at 70% 35%, rgba(255, 187, 70, 0.22), transparent 18%),
    radial-gradient(circle at center, rgba(15, 32, 70, 0.45), rgba(5, 8, 22, 0.96));
  overflow: hidden;
  position: relative;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.location-line,
.hero-condition-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.location-dot,
.condition-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.location-dot {
  background: #ffb224;
  box-shadow: 0 0 18px rgba(255, 178, 36, 0.8);
}

.condition-dot {
  background: #ffb224;
  box-shadow: 0 0 18px rgba(255, 178, 36, 0.9);
}

.hero-city {
  font-size: 1.8rem;
  font-weight: 600;
}

.hero-date-time,
.feels-like {
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
}

.hero-temp-row {
  display: flex;
  align-items: flex-start;
  line-height: 1;
}

.hero-temp {
  font-size: 8rem;
  font-weight: 700;
}

.hero-degree {
  font-size: 2.8rem;
  margin-top: 10px;
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.75);
}

.hero-condition {
  font-size: 1.5rem;
  font-weight: 500;
}

.hero-right {
  position: relative;
  height: 100%;
  min-height: 350px;
  z-index: 1;
}

/* GOLDEN MOON / SUN */
.sun-glow {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  top: 50px;
  right: 95px;
  background:
    radial-gradient(circle at 35% 35%, #fff7d0 0%, #ffe38a 18%, #ffc94f 42%, #ffb224 65%, rgba(255, 178, 36, 0.12) 82%, transparent 100%);
  box-shadow:
    0 0 40px rgba(255, 186, 70, 0.55),
    0 0 90px rgba(255, 170, 40, 0.28),
    0 0 140px rgba(255, 170, 40, 0.16);
  z-index: 1;
}

.cloud {
  position: absolute;
  background: linear-gradient(180deg, #1c2740 0%, #10192d 100%);
  border-radius: 999px;
  box-shadow:
    inset -12px -12px 25px rgba(255,255,255,0.03),
    inset 12px 12px 25px rgba(0,0,0,0.45),
    0 20px 40px rgba(0,0,0,0.35);
  z-index: 2;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: linear-gradient(180deg, #1c2740 0%, #10192d 100%);
  border-radius: 50%;
}

.cloud-1 {
  width: 280px;
  height: 100px;
  bottom: 80px;
  right: 70px;
}

.cloud-1::before {
  width: 110px;
  height: 110px;
  left: 35px;
  top: -45px;
}

.cloud-1::after {
  width: 140px;
  height: 140px;
  right: 35px;
  top: -60px;
}

.cloud-2 {
  width: 150px;
  height: 60px;
  top: 110px;
  left: 40px;
  opacity: 0.9;
}

.cloud-2::before {
  width: 60px;
  height: 60px;
  left: 20px;
  top: -25px;
}

.cloud-2::after {
  width: 75px;
  height: 75px;
  right: 15px;
  top: -30px;
}

.cloud-3 {
  width: 110px;
  height: 45px;
  top: 60px;
  right: 20px;
  opacity: 0.7;
}

.cloud-3::before {
  width: 45px;
  height: 45px;
  left: 12px;
  top: -18px;
}

.cloud-3::after {
  width: 55px;
  height: 55px;
  right: 10px;
  top: -22px;
}

/* DETAILS */
.weather-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.detail-card {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  text-align: left;
  padding: 20px;
}

.detail-card,
.forecast-card {
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.detail-card:hover,
.forecast-card:hover {
  transform: translateY(-5px);
  background: rgba(14, 22, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.14);
}

.detail-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: linear-gradient(180deg, rgba(24, 39, 76, 0.95), rgba(12, 20, 38, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.detail-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-label {
  font-size: 0.95rem;
  opacity: 0.72;
}

.detail-value {
  font-size: 1.35rem;
  font-weight: 700;
}

/* SECTION HEADINGS */
.forecast-section h2,
.recent-searches h2 {
  margin-bottom: 15px;
  font-size: 1.3rem;
  font-weight: 700;
}

/* FORECAST */
.forecast-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.forecast-card {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  font-weight: 600;
  background: linear-gradient(180deg, rgba(12, 20, 38, 0.95), rgba(8, 14, 30, 0.82));
}

.forecast-day {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.9;
}

.forecast-icon {
  width: 62px;
  height: 62px;
  object-fit: contain;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(24, 39, 76, 0.95), rgba(12, 20, 38, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.forecast-temp {
  font-size: 1.5rem;
  font-weight: 700;
}

.forecast-condition {
  font-size: 0.95rem;
  opacity: 0.78;
}

/* RECENT */
.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recent-city {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-controls {
    justify-content: stretch;
  }

  .search-box {
    min-width: 100%;
  }

  .weather-details {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .main-weather-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-right {
    min-height: 280px;
  }

  .sun-glow {
    width: 180px;
    height: 180px;
    right: 50%;
    transform: translateX(50%);
    top: 35px;
  }

  .hero-temp {
    font-size: 6rem;
  }
}

@media (max-width: 700px) {
  .weather-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body {
    padding: 16px;
  }

  .search-box,
  .location-btn,
  .unit-toggle {
    width: 100%;
  }

  .hero-temp {
    font-size: 4.8rem;
  }

  .hero-degree {
    font-size: 2rem;
  }

  .hero-city {
    font-size: 1.4rem;
  }

  .detail-card {
    padding: 18px;
  }
}

.loading-text,
.error-text {
  margin-top: 10px;
  font-size: 0.95rem;
}

.loading-text {
  color: #8ec5ff;
}

.error-text {
  color: #ff7b7b;
}

/* DYNAMIC WEATHER THEMES */
.main-weather-card.sunny-theme {
  background:
    radial-gradient(circle at 78% 26%, rgba(255, 214, 102, 0.55), transparent 16%),
    radial-gradient(circle at 62% 18%, rgba(255, 180, 70, 0.16), transparent 22%),
    linear-gradient(135deg, #4aa8ff 0%, #2f7de1 45%, #174ea8 100%);
}

.main-weather-card.cloudy-theme {
  background:
    radial-gradient(circle at 78% 24%, rgba(190, 205, 235, 0.18), transparent 18%),
    linear-gradient(135deg, #30394d 0%, #1f2738 45%, #101827 100%);
}

.main-weather-card.rainy-theme {
  background:
    radial-gradient(circle at 75% 22%, rgba(120, 170, 255, 0.16), transparent 18%),
    linear-gradient(135deg, #14253d 0%, #0b1628 45%, #050c18 100%);
}

.main-weather-card.night-theme {
  background:
    radial-gradient(circle at 78% 26%, rgba(255, 214, 125, 0.20), transparent 16%),
    linear-gradient(135deg, #0b1430 0%, #08101f 50%, #040812 100%);
}

/* SUNNY CLOUDS */
.main-weather-card.sunny-theme .cloud,
.main-weather-card.sunny-theme .cloud::before,
.main-weather-card.sunny-theme .cloud::after {
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

/* CLOUDY WEATHER CLOUDS */
.main-weather-card.cloudy-theme .cloud-1 {
  transform: scale(1.08);
  opacity: 1;
}

.main-weather-card.cloudy-theme .cloud-2,
.main-weather-card.cloudy-theme .cloud-3 {
  opacity: 1;
}

.main-weather-card.cloudy-theme .cloud,
.main-weather-card.cloudy-theme .cloud::before,
.main-weather-card.cloudy-theme .cloud::after {
  background: linear-gradient(180deg, #5f6d86 0%, #313c52 100%);
}

/* =========================
   RAINY THEME - CINEMATIC
========================= */

.main-weather-card.rainy-theme {
  background:
    radial-gradient(circle at 72% 18%, rgba(150, 210, 255, 0.14), transparent 18%),
    radial-gradient(circle at 82% 28%, rgba(120, 180, 255, 0.10), transparent 22%),
    linear-gradient(135deg, #13253e 0%, #0a1628 48%, #040b16 100%);
}

/* subtle lightning-like sky flash */
.main-weather-card.rainy-theme::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 22%, rgba(205, 232, 255, 0.18), transparent 18%),
    radial-gradient(circle at 62% 14%, rgba(170, 215, 255, 0.08), transparent 20%);
  opacity: 0.55;
  z-index: 0;
  animation: stormGlow 4.8s ease-in-out infinite;
}

/* darker storm clouds */
.main-weather-card.rainy-theme .cloud,
.main-weather-card.rainy-theme .cloud::before,
.main-weather-card.rainy-theme .cloud::after {
  background: linear-gradient(180deg, #33435f 0%, #182334 100%);
}

.main-weather-card.rainy-theme .cloud {
  box-shadow:
    inset -12px -12px 25px rgba(255,255,255,0.02),
    inset 12px 12px 25px rgba(0,0,0,0.42),
    0 22px 42px rgba(0,0,0,0.42);
}

/* make rain visible only in rainy theme */
.main-weather-card.rainy-theme .rain {
  opacity: 1;
  animation: rainFall 0.95s linear infinite;
}

/* better rainy rain look */
.rain {
  position: absolute;
  width: 2.5px;
  height: 95px;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0),
    rgba(185, 225, 255, 0.85) 35%,
    rgba(130, 195, 255, 0.95) 100%
  );
  border-radius: 30px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 0 6px rgba(120, 190, 255, 0.25));
}

/* front rain = brighter */
.rain-1,
.rain-3,
.rain-5 {
  width: 3px;
  height: 110px;
  opacity: 0;
}

/* back rain = softer */
.rain-2,
.rain-4,
.rain-6 {
  width: 2px;
  height: 82px;
  opacity: 0;
}

/* rain positions */
.rain-1 { top: 55px; left: 110px; animation-delay: 0s; }
.rain-2 { top: 88px; left: 185px; animation-delay: 0.18s; }
.rain-3 { top: 72px; left: 255px; animation-delay: 0.3s; }
.rain-4 { top: 52px; right: 195px; animation-delay: 0.1s; }
.rain-5 { top: 92px; right: 118px; animation-delay: 0.24s; }
.rain-6 { top: 80px; right: 52px; animation-delay: 0.4s; }

@keyframes rainFall {
  0% {
    transform: translateY(0) translateX(0) rotate(18deg);
    opacity: 0;
  }

  15% {
    opacity: 0.95;
  }

  100% {
    transform: translateY(155px) translateX(-10px) rotate(18deg);
    opacity: 0;
  }
}

@keyframes stormGlow {
  0% {
    opacity: 0.22;
  }

  18% {
    opacity: 0.28;
  }

  22% {
    opacity: 0.48;
  }

  26% {
    opacity: 0.24;
  }

  55% {
    opacity: 0.20;
  }

  60% {
    opacity: 0.42;
  }

  64% {
    opacity: 0.22;
  }

  100% {
    opacity: 0.18;
  }
}

/* NIGHT THEME */
.main-weather-card.night-theme .sun-glow {
  width: 140px;
  height: 140px;
  top: 55px;
  right: 70px;
  background: radial-gradient(circle, rgba(255, 244, 200, 0.95) 0%, rgba(255, 223, 120, 0.35) 35%, rgba(255, 223, 120, 0.08) 65%, transparent 100%);
  box-shadow:
    0 0 25px rgba(255, 223, 120, 0.35),
    0 0 60px rgba(255, 223, 120, 0.18);
  opacity: 0.95;
  transform: scale(0.9);
  z-index: 1;
  animation: moonPulse 4.5s ease-in-out infinite;
}

.main-weather-card.night-theme .sun-glow::after {
  content: "";
  position: absolute;
  width: 105px;
  height: 105px;
  top: 18px;
  left: 34px;
  border-radius: 50%;
  background: #11172b;
  opacity: 0.95;
}

.main-weather-card.night-theme::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.9) 0 1.5px, transparent 2px),
    radial-gradient(circle at 30% 12%, rgba(255,255,255,0.75) 0 1px, transparent 2px),
    radial-gradient(circle at 48% 26%, rgba(255,255,255,0.8) 0 1.2px, transparent 2px),
    radial-gradient(circle at 62% 16%, rgba(255,255,255,0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 24%, rgba(255,255,255,0.85) 0 1.4px, transparent 2px),
    radial-gradient(circle at 86% 14%, rgba(255,255,255,0.65) 0 1px, transparent 2px);
  opacity: 0.75;
  z-index: 0;
  animation: starTwinkle 4.5s ease-in-out infinite alternate;
}

.main-weather-card.night-theme .cloud,
.main-weather-card.night-theme .cloud::before,
.main-weather-card.night-theme .cloud::after {
  background: rgba(180, 190, 220, 0.16);
}

.main-weather-card.night-theme .cloud {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

/* FIXED NIGHT CLOUD MOVEMENT */
.main-weather-card.night-theme .cloud-1 {
  animation: nightCloudFloat1 11s ease-in-out infinite alternate;
}

.main-weather-card.night-theme .cloud-2 {
  animation: nightCloudFloat2 14s ease-in-out infinite alternate;
}

.main-weather-card.night-theme .cloud-3 {
  animation: nightCloudFloat3 12s ease-in-out infinite alternate;
}

@keyframes nightCloudFloat1 {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(24px, -8px);
  }
}

@keyframes nightCloudFloat2 {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(-22px, 10px);
  }
}

@keyframes nightCloudFloat3 {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(18px, 8px);
  }
}

@keyframes starTwinkle {
  0% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.01);
  }
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
}

@keyframes moonPulse {
  0% {
    box-shadow:
      0 0 22px rgba(255, 223, 120, 0.28),
      0 0 52px rgba(255, 223, 120, 0.14);
    transform: scale(0.88);
  }

  50% {
    box-shadow:
      0 0 32px rgba(255, 223, 120, 0.42),
      0 0 78px rgba(255, 223, 120, 0.22);
    transform: scale(0.93);
  }

  100% {
    box-shadow:
      0 0 24px rgba(255, 223, 120, 0.3),
      0 0 58px rgba(255, 223, 120, 0.16);
    transform: scale(0.89);
  }
}

/* ==================================================
   16. FOOTER
================================================== */

.footer {
  margin-top: 40px;
  padding: 20px 0;
  text-align: center;
}

.footer p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
}

.footer p:hover {
  color: rgba(255, 255, 255, 0.8);
  transition: 0.3s ease;
}