/* ══════════════════════════════════════
   RESET
══════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ══════════════════════════════════════
   BASE
══════════════════════════════════════ */
body {
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  padding: 2rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  background: #0b1f3a;
}

/* ══════════════════════════════════════
   CLOUD PHOTO BACKGROUND
══════════════════════════════════════ */
.sky-bg {
  position: fixed;
  inset: -15px;
  z-index: 0;
  background-image: url('clouds_bg.png');
  background-size: max(200%, 160vh) auto;
  background-position: 0% 40%;
  background-repeat: no-repeat;
  animation: cloudPan 60s linear infinite alternate;
  transform-origin: center;
}

/* Very slow scale pulse adds depth */
@keyframes cloudPan {
  0%   { background-position: 0% 40%;   transform: scale(1.04); }
  50%  { background-position: 60% 50%;  transform: scale(1.08); }
  100% { background-position: 100% 45%; transform: scale(1.04); }
}

/* Dark gradient overlay — keeps text readable, differs from card */
.sky-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    160deg,
    rgba(5, 15, 40, 0.55) 0%,
    rgba(10, 25, 60, 0.40) 50%,
    rgba(5, 10, 30, 0.65) 100%
  );
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

/* ══════════════════════════════════════
   APP WRAPPER
══════════════════════════════════════ */
.app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  animation: appEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes appEntrance {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.header { display: flex; align-items: center; padding: 0 0.2rem; }
.logo   { display: flex; align-items: center; gap: 0.65rem; }

.logo-svg {
  width: 34px; height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(251,191,36,0.5));
  animation: logoFloat 5s ease-in-out infinite;
}
@keyframes logoFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════
   SEARCH BAR
   — Contrasting dark frosted glass
══════════════════════════════════════ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(8, 16, 38, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 0.65rem 0.65rem 0.65rem 1.1rem;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.search-bar:focus-within {
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.5),
    0 0 0 4px rgba(96,165,250,0.15),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

.search-icon {
  width: 17px; height: 17px;
  color: rgba(255,255,255,0.4);
  flex-shrink: 0;
  transition: color 0.3s;
}
.search-bar:focus-within .search-icon { color: #60a5fa; }

.search-bar input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 400;
}
.search-bar input::placeholder { color: rgba(255,255,255,0.32); }

#search-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.25s;
  box-shadow: 0 4px 18px rgba(37,99,235,0.5);
  flex-shrink: 0;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#search-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
#search-btn:hover::after { opacity: 1; }
#search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(37,99,235,0.65);
}
#search-btn:active { transform: scale(0.97); box-shadow: none; }

.btn-arrow {
  display: inline-block;
  font-size: 1rem;
  transition: transform 0.25s;
}
#search-btn:hover .btn-arrow { transform: translateX(4px); }

/* ══════════════════════════════════════
   WEATHER CARD
   — Contrasting deep frosted glass panel
══════════════════════════════════════ */
.card {
  background: rgba(6, 14, 36, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: 2rem 1.8rem;
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 4px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  animation: cardIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

/* Subtle top shimmer line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,0.6), transparent);
  animation: shimmerLine 4s ease-in-out infinite;
}
@keyframes shimmerLine {
  0%,100% { opacity: 0.3; }
  50%      { opacity: 1; }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Card Top: City + Emoji ── */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.location {
  flex: 1;
  min-width: 0;
}
.city-name {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
  word-break: break-word;
  overflow-wrap: break-word;
}
.date-time {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  margin-top: 0.35rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.weather-icon {
  font-size: 4rem;
  line-height: 1;
  display: block;
  animation: levitate 4.5s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
  flex-shrink: 0;
}
@keyframes levitate {
  0%,100% { transform: translateY(0)   rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

/* ── Card Mid: Temperature + Condition ── */
.card-mid { display: flex; flex-direction: column; gap: 0.4rem; }
.temperature {
  font-size: 4.8rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #fff 0%, #bfdbfe 60%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.condition {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
  word-break: break-word;
}

/* ── Separator ── */
.sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
}

/* ══════════════════════════════════════
   STATS
══════════════════════════════════════ */
.stats { display: flex; gap: 0.75rem; }

.stat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  padding: 1.1rem 0.4rem;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), background 0.3s, box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.stat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.07), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.stat:hover::after  { opacity: 1; }
.stat:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 32px rgba(0,0,0,0.4);
}

/* Staggered entry */
.s1 { animation: statIn 0.55s cubic-bezier(0.22,1,0.36,1) 0.2s  both; }
.s2 { animation: statIn 0.55s cubic-bezier(0.22,1,0.36,1) 0.32s both; }
.s3 { animation: statIn 0.55s cubic-bezier(0.22,1,0.36,1) 0.44s both; }
@keyframes statIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  animation: iconPop 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
.s1 .stat-icon { animation-delay: 0.3s; }
.s2 .stat-icon { animation-delay: 0.42s; }
.s3 .stat-icon { animation-delay: 0.54s; }
@keyframes iconPop {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}
.stat:hover .stat-icon { animation: iconSpin 0.6s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes iconSpin {
  0%   { transform: rotate(0deg)   scale(1); }
  50%  { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}

.stat-label {
  font-size: 0.67rem;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* ══════════════════════════════════════
   RESPONSIVE DESIGN (MOBILE & SMALL SCREENS)
══════════════════════════════════════ */
@media (max-width: 480px) {
  body {
    padding: 1.25rem 0.85rem;
  }

  .app {
    gap: 1rem;
  }

  .search-bar {
    padding: 0.55rem 0.55rem 0.55rem 0.95rem;
    gap: 0.55rem;
    border-radius: 14px;
  }

  #search-btn {
    padding: 0.55rem 1.05rem;
    font-size: 0.85rem;
    border-radius: 9px;
  }

  .card {
    padding: 1.6rem 1.35rem;
    border-radius: 24px;
    gap: 1.25rem;
  }

  .city-name {
    font-size: 1.7rem;
  }

  .weather-icon {
    font-size: 3.5rem;
  }

  .temperature {
    font-size: 4.1rem;
  }

  .stats {
    gap: 0.55rem;
  }

  .stat {
    padding: 0.95rem 0.3rem;
    border-radius: 16px;
    gap: 0.45rem;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
  }

  .stat-label {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  .stat-value {
    font-size: 0.92rem;
  }
}

@media (max-width: 360px) {
  body {
    padding: 0.85rem 0.6rem;
  }

  .header {
    padding: 0;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .logo-svg {
    width: 30px;
    height: 30px;
  }

  .search-bar {
    padding: 0.5rem 0.5rem 0.5rem 0.8rem;
    gap: 0.45rem;
    border-radius: 12px;
  }

  .search-icon {
    width: 15px;
    height: 15px;
  }

  #search-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
    gap: 0.3rem;
  }

  .card {
    padding: 1.35rem 1rem;
    border-radius: 20px;
    gap: 1.1rem;
  }

  .city-name {
    font-size: 1.45rem;
  }

  .weather-icon {
    font-size: 3rem;
  }

  .temperature {
    font-size: 3.4rem;
  }

  .condition {
    font-size: 0.88rem;
  }

  .stats {
    gap: 0.4rem;
  }

  .stat {
    padding: 0.8rem 0.2rem;
    border-radius: 13px;
    gap: 0.35rem;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-label {
    font-size: 0.56rem;
    letter-spacing: 0.03em;
  }

  .stat-value {
    font-size: 0.82rem;
  }
}

/* Landscape orientation on mobile devices */
@media (max-height: 540px) and (orientation: landscape) {
  body {
    padding: 1rem;
  }

  .app {
    margin: 1rem 0;
  }
}
