/* ============================================
   SKYCAST — GLOBAL WEATHER APP
   Design: Deep twilight sky + electric accents
   Font: Space Grotesk (body) + DM Serif Display (hero)
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sky-deep:    #050d1a;
  --sky-mid:     #091e3a;
  --sky-horizon: #0d3b6e;
  --glow-cyan:   #00d4ff;
  --glow-violet: #a855f7;
  --glow-amber:  #f59e0b;
  --card-bg:     rgba(9, 30, 58, 0.72);
  --card-border: rgba(0, 212, 255, 0.18);
  --text-primary: #e8f4fd;
  --text-muted:   #7aa8c7;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── BASE ─────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--sky-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ─── ANIMATED SKY BACKGROUND ──────────────── */
.sky-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    180deg,
    #020812 0%,
    #050d1a 30%,
    #091e3a 65%,
    #0d3b6e 100%
  );
  overflow: hidden;
}

/* Stars */
.star-field {
  position: absolute;
  inset: 0;
}

/* ─── REALISTIC DRIFTING CLOUDS ─────────────── */
/* Each cloud is built from layered radial blobs to look like a real cumulus puff */
.cloud {
  position: absolute;
  border-radius: 50%;
  animation: driftCloud linear infinite;
  opacity: 0.85;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud-1 {
  width: 180px; height: 60px;
  top: 12%; left: -240px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 70%);
  filter: blur(6px);
  animation-duration: 70s;
  animation-delay: 0s;
}
.cloud-1::before { width: 100px; height: 100px; top: -45px; left: 15px; }
.cloud-1::after  { width: 70px;  height: 70px;  top: -25px; left: 100px; }

.cloud-2 {
  width: 140px; height: 46px;
  top: 28%; left: -200px;
  background: radial-gradient(ellipse at center, rgba(168,85,247,0.08), rgba(168,85,247,0.015) 70%);
  filter: blur(7px);
  animation-duration: 95s;
  animation-delay: -25s;
}
.cloud-2::before { width: 80px; height: 80px; top: -32px; left: 10px; }
.cloud-2::after  { width: 55px; height: 55px; top: -18px; left: 78px; }

.cloud-3 {
  width: 220px; height: 70px;
  top: 6%; left: -300px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.07), rgba(255,255,255,0.01) 70%);
  filter: blur(8px);
  animation-duration: 120s;
  animation-delay: -55s;
}
.cloud-3::before { width: 120px; height: 120px; top: -55px; left: 20px; }
.cloud-3::after  { width: 85px;  height: 85px;  top: -32px; left: 125px; }

.cloud-4 {
  width: 160px; height: 50px;
  top: 20%; left: -220px;
  background: radial-gradient(ellipse at center, rgba(0,212,255,0.06), rgba(0,212,255,0.01) 70%);
  filter: blur(6px);
  animation-duration: 85s;
  animation-delay: -65s;
}
.cloud-4::before { width: 90px; height: 90px; top: -38px; left: 12px; }
.cloud-4::after  { width: 60px; height: 60px; top: -20px; left: 85px; }

@keyframes driftCloud {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 400px)); }
}

/* ─── ANIMATED RAIN ──────────────────────────── */
.rain-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
}
.raindrop {
  position: absolute;
  top: -10%;
  width: 1px;
  height: 70px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(170, 220, 255, 0.55) 50%,
    rgba(170, 220, 255, 0.05) 100%
  );
  animation: fallRain linear infinite;
}
@keyframes fallRain {
  0%   { transform: translateY(-10vh) translateX(0); opacity: 0; }
  8%   { opacity: 1; }
  100% { transform: translateY(110vh) translateX(-40px); opacity: 0.2; }
}

/* Northern-lights shimmer at horizon */
.sky-bg::after {
  content: '';
  position: absolute;
  bottom: 0; left: -20%;
  width: 140%;
  height: 35%;
  background: radial-gradient(
    ellipse at 50% 100%,
    rgba(0, 212, 255, 0.08) 0%,
    rgba(168, 85, 247, 0.06) 40%,
    transparent 70%
  );
  animation: aurora 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes aurora {
  from { opacity: 0.5; transform: scaleX(1); }
  to   { opacity: 1;   transform: scaleX(1.05); }
}

/* ─── APP WRAPPER ───────────────────────────── */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ─── HEADER ────────────────────────────────── */
.app-header {
  text-align: center;
  padding: 40px 0 8px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.logo-icon {
  font-size: 2.4rem;
  filter: drop-shadow(0 0 12px var(--glow-cyan));
  animation: floatIcon 4s ease-in-out infinite;
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.logo-text {
  font-family: 'DM Serif Display', serif;
  font-size: 3rem;
  letter-spacing: -1px;
  background: linear-gradient(120deg, var(--glow-cyan), var(--glow-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(0,212,255,0.3));
}
.logo-sub {
  font-size: 0.82rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ─── SEARCH PANEL ──────────────────────────── */
.search-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 36px 0 20px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45),
              0 0 0 1px rgba(0, 212, 255, 0.06) inset;
  position: relative;
  z-index: 5;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: start;
}
@media (max-width: 580px) {
  .search-row {
    grid-template-columns: 1fr;
  }
}

.select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
}
.select-wrapper label {
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--glow-cyan);
  font-weight: 600;
}

/* ─── SEARCHABLE COMBO INPUT ─────────────────── */
.combo-wrapper { position: relative; }

.combo-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(0, 212, 255, 0.22);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
}
.combo-input::placeholder { color: var(--text-muted); }
.combo-input:focus {
  outline: none;
  border-color: var(--glow-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}
.combo-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #0a2240;
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  z-index: 50;
  display: none;
}
.combo-list.open { display: block; }

.combo-item {
  padding: 10px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-item:hover,
.combo-item.highlighted {
  background: rgba(0, 212, 255, 0.16);
}
.combo-item.empty {
  color: var(--text-muted);
  cursor: default;
  font-style: italic;
}
.combo-item.empty:hover { background: transparent; }

/* scrollbar inside dropdown */
.combo-list::-webkit-scrollbar { width: 6px; }
.combo-list::-webkit-scrollbar-thumb {
  background: rgba(0,212,255,0.3);
  border-radius: 3px;
}

.btn-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--glow-cyan), var(--glow-violet));
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.25);
  position: relative;
  overflow: hidden;
  margin-top: 23px;
  height: 44px;
}
.btn-search::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
}
.btn-search:hover:not(:disabled)::before {
  background: rgba(255,255,255,0.1);
}
.btn-search:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4);
}
.btn-search:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-icon { font-size: 1rem; }

.search-hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.5px;
}

/* ─── LOADING BAR ───────────────────────────── */
.loading-bar {
  height: 3px;
  background: rgba(0, 212, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
  display: none;
}
.loading-bar.active { display: block; }
.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--glow-cyan), var(--glow-violet), var(--glow-amber));
  border-radius: 2px;
  animation: loadPulse 1.6s ease-in-out infinite;
}
@keyframes loadPulse {
  0%   { width: 0%;   opacity: 1; }
  50%  { width: 70%;  opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

/* ─── WEATHER CARD ──────────────────────────── */
.weather-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 60px rgba(0,0,0,0.5),
              0 0 0 1px rgba(0,212,255,0.05) inset;
  animation: cardAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: relative;
  z-index: 1;
}
@keyframes cardAppear {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card Top */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: 1px solid rgba(0,212,255,0.08);
}
.card-location {
  display: flex;
  align-items: center;
  gap: 14px;
}
.card-flag {
  font-size: 2.4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
.card-city {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: var(--text-primary);
  line-height: 1.1;
}
.card-country {
  font-size: 0.78rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}
.card-time {
  font-size: 0.78rem;
  color: var(--glow-cyan);
  letter-spacing: 0.5px;
  text-align: right;
  line-height: 1.6;
}

/* Card Main */
.card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 28px 20px;
  gap: 20px;
  flex-wrap: wrap;
}
.temp-block {
  display: flex;
  align-items: center;
  gap: 16px;
}
.weather-emoji {
  font-size: 4.5rem;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.35));
  animation: floatIcon 3s ease-in-out infinite;
}
.temp-number {
  font-family: 'DM Serif Display', serif;
  font-size: 4.5rem;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff, var(--glow-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 120px;
}
.temp-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.unit-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(0,212,255,0.18);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.unit-btn.active {
  background: rgba(0,212,255,0.15);
  border-color: var(--glow-cyan);
  color: var(--glow-cyan);
}
.unit-btn:hover:not(.active) {
  border-color: rgba(0,212,255,0.4);
  color: var(--text-primary);
}

.weather-desc-block { text-align: right; }
.weather-desc {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  font-size: 1.4rem;
  color: var(--text-primary);
  text-transform: capitalize;
}
.feels-like {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid rgba(0,212,255,0.08);
  border-bottom: 1px solid rgba(0,212,255,0.08);
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 10px;
  gap: 6px;
  background: rgba(255,255,255,0.015);
  border-right: 1px solid rgba(0,212,255,0.06);
  transition: var(--transition);
  cursor: default;
}
.stat-card:last-child { border-right: none; }
.stat-card:hover {
  background: rgba(0,212,255,0.05);
}
.stat-icon { font-size: 1.4rem; }
.stat-label {
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Forecast */
.forecast-section {
  padding: 24px 28px;
}
.forecast-title {
  font-size: 0.72rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--glow-violet);
  margin-bottom: 16px;
  font-weight: 600;
}
.forecast-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 480px) {
  .forecast-row { grid-template-columns: repeat(3, 1fr); }
}

.forecast-day {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  text-align: center;
  transition: var(--transition);
  cursor: default;
}
.forecast-day:hover {
  background: rgba(0,212,255,0.07);
  border-color: rgba(0,212,255,0.25);
  transform: translateY(-3px);
}
.fc-day-name {
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.fc-emoji { font-size: 1.5rem; }
.fc-hi {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-top: 6px;
}
.fc-lo {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── ERROR CARD ────────────────────────────── */
.error-card {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  animation: cardAppear 0.4s ease forwards;
}
.error-icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.error-msg  { color: #f87171; font-size: 0.95rem; }

/* ─── FOOTER ────────────────────────────────── */
.app-footer {
  text-align: center;
  margin-top: 40px;
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: rgba(122, 168, 199, 0.45);
}

/* ─── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--sky-deep); }
::-webkit-scrollbar-thumb {
  background: var(--sky-horizon);
  border-radius: 3px;
}