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

:root {
  --bg: #050b14;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.08);
  --accent: #38bdf8;
  --accent2: #818cf8;
  --text: #f0f4f8;
  --muted: rgba(255,255,255,0.4);
  --danger: #f87171;
  --card-bg: rgba(14, 25, 45, 0.7);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ── Animated background orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: drift 12s ease-in-out infinite alternate;
}
.orb1 { width: 500px; height: 500px; background: #38bdf8; top: -150px; left: -100px; animation-delay: 0s; }
.orb2 { width: 400px; height: 400px; background: #818cf8; bottom: -100px; right: -80px; animation-delay: -4s; }
.orb3 { width: 300px; height: 300px; background: #34d399; top: 50%; left: 50%; transform: translate(-50%, -50%); animation-delay: -8s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

/* ── Layout ── */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px 80px;
  gap: 40px;
}

/* ── Header ── */
.header {
  text-align: center;
  animation: fadeDown 0.7s ease both;
}
.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 8vw, 5.5rem);
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 1;
}
.logo span {
  color: var(--accent);
}
.tagline {
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Search ── */
.search-wrap {
  width: 100%;
  max-width: 540px;
  animation: fadeDown 0.7s ease 0.1s both;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 6px 6px 18px;
  gap: 10px;
  backdrop-filter: blur(20px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.12);
}
.search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--text);
  padding: 10px 0;
}
.search-box input::placeholder {
  color: var(--muted);
}
.search-box button {
  background: var(--accent);
  color: #050b14;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.search-box button:hover { background: #7dd3fc; }
.search-box button:active { transform: scale(0.96); }

/* ── Result Area ── */
.result-area {
  width: 100%;
  max-width: 540px;
  animation: fadeDown 0.7s ease 0.2s both;
}

/* Placeholder */
.placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.placeholder-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
  filter: grayscale(0.5);
}
.placeholder p {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* ── Weather Card ── */
.weather-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  backdrop-filter: blur(24px);
  animation: popIn 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
  overflow: hidden;
  position: relative;
}
.weather-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 24px 24px 0 0;
}

/* City header row */
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.city-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2rem, 6vw, 2.8rem);
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--text);
}
.city-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
}
.condition-badge {
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-top: 4px;
}

/* Big temperature */
.temp-display {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
}
.temp-icon {
  font-size: 4.5rem;
  line-height: 1;
}
.temp-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 14vw, 6.5rem);
  line-height: 0.85;
  color: var(--accent);
}
.temp-unit {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: var(--muted);
  margin-top: 10px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: background 0.2s;
}
.stat-card:hover { background: var(--surface-hover); }
.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text);
}
.stat-icon {
  font-size: 1.3rem;
  margin-bottom: 8px;
  display: block;
}

/* Day/Night indicator */
.daynight {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 16px;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
}
.daynight-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

/* Error state */
.error-box {
  text-align: center;
  padding: 40px 20px;
  background: rgba(248,113,113,0.06);
  border: 1px solid rgba(248,113,113,0.15);
  border-radius: 20px;
  color: var(--danger);
  font-size: 0.95rem;
  animation: popIn 0.4s ease both;
}
.error-box .err-icon { font-size: 2.5rem; margin-bottom: 10px; }

/* Loading */
.loading {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Keyframes */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.93) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Responsive */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .weather-card { padding: 24px 20px; }
}
