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

:root {
  --radius: 24px;
  --text: #1a1a2e;
}

body {
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  padding: 20px 16px 60px;
  color: var(--text);
  transition: background 1s;
}

/* ── BACKGROUNDS ── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  transition: background 1.2s ease;
}

.bg-sunny      { background: linear-gradient(160deg, #ffe066 0%, #ff9f1c 50%, #ffcc00 100%); }
.bg-clear-night{ background: linear-gradient(160deg, #0d1b4b 0%, #1a2a6c 60%, #2e0e60 100%); }
.bg-cloudy     { background: linear-gradient(160deg, #a8c0d6 0%, #c9d8e8 100%); }
.bg-rainy      { background: linear-gradient(160deg, #4a7fa5 0%, #2c5f7a 100%); }
.bg-snowy      { background: linear-gradient(160deg, #c8dff0 0%, #e8f4fd 100%); }
.bg-stormy     { background: linear-gradient(160deg, #1a1a2e 0%, #2d1b5e 100%); }
.bg-foggy      { background: linear-gradient(160deg, #b0bec5 0%, #cfd8dc 100%); }

/* Sun glow */
.bg-sunny::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,150,0.7) 0%, transparent 70%);
  animation: sunpulse 3s ease-in-out infinite;
}
@keyframes sunpulse {
  0%,100% { transform: scale(1);   opacity: 0.8; }
  50%      { transform: scale(1.12); opacity: 1; }
}

/* Lightning */
.bg-stormy::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  animation: lightning 7s infinite;
}
@keyframes lightning {
  0%,93%,96%,100% { opacity: 0; }
  94%              { opacity: 0.12; }
}

/* ── PARTICLES ── */
.particles { position: absolute; inset: 0; overflow: hidden; }

.particle { position: absolute; pointer-events: none; animation-iteration-count: infinite; animation-timing-function: linear; }

.drop {
  width: 2px; border-radius: 2px;
  background: rgba(100,170,255,0.6);
  animation-name: fall-rain;
}
@keyframes fall-rain {
  0%   { transform: translateY(-40px) translateX(0); opacity: 0.9; }
  100% { transform: translateY(110vh)  translateX(-25px); opacity: 0.1; }
}

.flake {
  border-radius: 50%;
  background: white;
  animation-name: fall-snow;
}
@keyframes fall-snow {
  0%   { transform: translateY(-20px) translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) translateX(50px) rotate(360deg); opacity: 0.2; }
}

.star {
  border-radius: 50%; background: white;
  animation-name: twinkle;
}
@keyframes twinkle {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.15; transform: scale(0.4); }
}

/* ── APP ── */
.app { max-width: 700px; margin: 0 auto; position: relative; z-index: 1; }

/* ── SITE TITLE ── */
.site-title {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.title-icon {
  font-size: 3rem;
  animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.site-title h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  color: white;
  text-shadow: 0 3px 12px rgba(0,0,0,0.25);
  -webkit-text-stroke: 1px rgba(0,0,0,0.08);
}

/* ── TOP BAR ── */
.top-bar { margin-bottom: 22px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 10px; }

.search-bar input {
  flex: 1;
  background: rgba(255,255,255,0.85);
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 50px;
  padding: 13px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input:focus {
  border-color: #ff9f1c;
  box-shadow: 0 0 0 4px rgba(255,159,28,0.3);
}
.search-bar input::placeholder { color: #aaa; font-weight: 600; }

.search-bar button {
  background: #ff6b35;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 13px 24px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 0 #c0441a;
}
.search-bar button:hover  { transform: translateY(-2px); box-shadow: 0 6px 0 #c0441a; }
.search-bar button:active { transform: translateY(2px);  box-shadow: 0 2px 0 #c0441a; }

#locate-btn {
  background: rgba(255,255,255,0.85);
  color: #333;
  font-size: 1.3rem;
  padding: 13px 18px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
#locate-btn:hover  { transform: translateY(-2px); }
#locate-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.15); }

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

.unit-btn {
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50px;
  padding: 8px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: #333;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.12);
  transition: transform 0.15s;
}
.unit-btn:hover  { transform: translateY(-2px); background: #fff; }
.unit-btn:active { transform: translateY(1px); }

.refresh-info {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ── LOADING ── */
.hidden { display: none !important; }

#loading {
  text-align: center;
  padding: 80px 0;
  color: white;
  font-size: 1.2rem;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.spinner {
  width: 56px; height: 56px;
  border: 5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ERROR ── */
#error {
  text-align: center;
  padding: 40px;
  background: rgba(255,255,255,0.85);
  border-radius: var(--radius);
  color: #e74c3c;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
}

/* ── CURRENT CARD ── */
.current-card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border: 3px solid rgba(255,255,255,0.95);
}

.mascot-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.mascot {
  font-size: 5rem;
  line-height: 1;
  animation: wobble 3s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes wobble {
  0%,100% { transform: rotate(-5deg) scale(1); }
  50%      { transform: rotate(5deg) scale(1.08); }
}

.location {
  font-size: 1.4rem;
  font-weight: 900;
  color: #2c3e50;
}
#country {
  font-size: 1rem;
  font-weight: 700;
  color: #7f8c8d;
  margin-left: 4px;
}
.date-time {
  font-size: 0.88rem;
  font-weight: 700;
  color: #95a5a6;
  margin-top: 4px;
}

.temp-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.temp {
  font-size: 5rem;
  font-weight: 900;
  color: #2c3e50;
  line-height: 1;
}

.condition-text {
  font-size: 1.3rem;
  font-weight: 900;
  color: #e67e22;
}
.feels-like {
  font-size: 0.95rem;
  font-weight: 700;
  color: #95a5a6;
  margin-top: 4px;
}

/* ── DETAILS GRID ── */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.detail {
  background: linear-gradient(135deg, #f8f9ff 0%, #eef2ff 100%);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  border: 2px solid rgba(100,100,255,0.08);
  transition: transform 0.2s;
}
.detail:hover { transform: translateY(-4px); }

.d-icon { font-size: 1.6rem; }
.label  { font-size: 0.72rem; font-weight: 800; color: #95a5a6; text-transform: uppercase; letter-spacing: 0.5px; }
.detail span:last-child { font-size: 1rem; font-weight: 900; color: #2c3e50; }

/* UV colors */
.uv-low    { color: #27ae60 !important; }
.uv-mod    { color: #f39c12 !important; }
.uv-high   { color: #e67e22 !important; }
.uv-vhigh  { color: #e74c3c !important; }
.uv-extreme{ color: #8e44ad !important; }

/* ── FUN FACT ── */
.funfact-card {
  background: linear-gradient(135deg, #a29bfe, #6c5ce7);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 18px;
  color: white;
  box-shadow: 0 6px 20px rgba(108,92,231,0.35);
  border: 3px solid rgba(255,255,255,0.3);
}
.funfact-label {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
  display: block;
  margin-bottom: 6px;
}
.funfact-card p {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

/* ── SECTION LABEL ── */
.section-label {
  font-size: 1rem;
  font-weight: 900;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-bottom: 12px;
}

/* ── HOURLY ── */
.hourly-scroll {
  overflow-x: auto;
  margin-bottom: 22px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.hourly-track { display: flex; gap: 10px; width: max-content; }

.hour-card {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 14px 16px;
  text-align: center;
  min-width: 86px;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s;
}
.hour-card:hover { transform: translateY(-5px); }
.hour-card.now {
  background: #ff6b35;
  border-color: #ff9f1c;
  color: white;
}
.hour-card.now .hour-time,
.hour-card.now .hour-precip { color: rgba(255,255,255,0.8); }
.hour-card.now .hour-temp   { color: white; }

.hour-time   { font-size: 0.78rem; font-weight: 800; color: #95a5a6; margin-bottom: 8px; }
.hour-icon   { font-size: 1.8rem; margin-bottom: 8px; }
.hour-temp   { font-size: 1rem; font-weight: 900; color: #2c3e50; }
.hour-precip { font-size: 0.75rem; font-weight: 700; color: #3498db; margin-top: 4px; }
.hour-bar-wrap { height: 5px; background: rgba(0,0,0,0.08); border-radius: 3px; margin-top: 8px; }
.hour-bar      { height: 5px; background: linear-gradient(90deg, #4f9eff, #a855f7); border-radius: 3px; }

/* ── DAILY ── */
.daily-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.day-row {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 80px 44px 1fr 52px 52px;
  align-items: center;
  gap: 12px;
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  transition: transform 0.2s;
}
.day-row:hover { transform: translateX(6px); }

.day-name  { font-weight: 900; font-size: 1rem; color: #2c3e50; }
.day-icon  { font-size: 1.8rem; text-align: center; }
.day-bar-wrap { height: 8px; background: rgba(0,0,0,0.08); border-radius: 4px; position: relative; overflow: hidden; }
.day-bar   { position: absolute; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4f9eff, #ff6b35); }
.day-low   { font-size: 0.9rem; font-weight: 700; color: #95a5a6; text-align: right; }
.day-high  { font-size: 1.05rem; font-weight: 900; color: #2c3e50; text-align: right; }

/* ── TIP CARD ── */
.tip-card {
  background: linear-gradient(135deg, #00b894, #00cec9);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  line-height: 1.6;
  box-shadow: 0 6px 20px rgba(0,184,148,0.35);
  border: 3px solid rgba(255,255,255,0.3);
}

/* ── RESPONSIVE ── */
@media (max-width: 500px) {
  .temp { font-size: 3.5rem; }
  .mascot { font-size: 3.5rem; }
  .current-card { padding: 18px; }
  .details-grid { grid-template-columns: repeat(2, 1fr); }
  .day-row { grid-template-columns: 70px 36px 1fr 44px 44px; gap: 8px; }
}
