html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Poppins', sans-serif;
}

body {
  position: relative;
  overflow: hidden;
  background: linear-gradient(to bottom, #b9dcff 0%, #ffffff 100%);
  color: #0f172a;
  transition: background 0.8s ease, color 0.8s ease;
}

body.night {
  background:
    radial-gradient(circle at 28% 18%,
      rgba(88, 110, 140, 0.55) 0%,
      rgba(48, 68, 98, 0.4) 22%,
      rgba(18, 28, 48, 0.35) 40%,
      rgba(8, 12, 26, 0.28) 55%,
      rgba(4, 6, 16, 0.22) 70%,
      rgba(1, 2, 8, 0.95) 100%
    ),
    linear-gradient(to bottom,
      rgba(20, 30, 50, 0.9) 0%,
      rgba(4, 6, 16, 1) 65%
    );
  color: #f8fafc;
}

/* Background layers */
.aurora-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.aurora-1,
.aurora-2 {
  background: radial-gradient(circle at 50% 50%,
    rgba(80, 150, 255, 0.18) 0%,
    rgba(30, 70, 140, 0.12) 40%,
    rgba(5, 10, 20, 0) 70%
  );
}

body.night .aurora-1,
body.night .aurora--2 {
  opacity: 0.55;
}

@keyframes auroraFloat1 {
  0% { transform: translate(-12%, -8%) scale(1.15); }
  50% { transform: translate(8%, 6%) scale(1.25); }
  100% { transform: translate(-12%, -8%) scale(1.15); }
}

@keyframes auroraFloat2 {
  0% { transform: translate(10%, 12%) scale(1.1); }
  50% { transform: translate(-6%, -14%) scale(1.22); }
  100% { transform: translate(10%, 12%) scale(1.1); }
}

.aurora-1 {
  animation: auroraFloat1 38s ease-in-out infinite;
}

.aurora-2 {
  animation: auroraFloat2 52s ease-in-out infinite;
  opacity: 0.35;
}

.stars-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.35), transparent 70%),
    radial-gradient(1.5px 1.5px at 70% 80%, rgba(255, 255, 255, 0.28), transparent 70%),
    radial-gradient(1px 1px at 30% 60%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(1.2px 1.2px at 85% 25%, rgba(255, 255, 255, 0.3), transparent 70%),
    radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.18), transparent 70%);
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity 1.5s ease;
}

body.night .stars-layer {
  opacity: 0.55;
}

.fog-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  background: radial-gradient(circle at 50% 80%,
    rgba(200, 200, 255, 0.1) 0%,
    rgba(180, 180, 255, 0.08) 22%,
    rgba(140, 140, 200, 0.05) 40%,
    rgba(80, 80, 120, 0.02) 65%,
    rgba(0, 0, 0, 0) 100%
  );
  filter: blur(35px);
  animation: fogFloat 65s ease-in-out infinite;
  transition: opacity 1.2s ease;
}

body.night .fog-layer {
  opacity: 0.45;
}

@keyframes fogFloat {
  0% { transform: translate(-6%, 3%) scale(1.05); }
  50% { transform: translate(8%, -4%) scale(1.13); }
  100% { transform: translate(-6%, 3%) scale(1.05); }
}

.glass-card {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 16px 28px rgba(2, 6, 23, 0.15);
  transition: background 0.8s ease, box-shadow 0.8s ease;
}

body.night .glass-card {
  background: rgba(30, 41, 59, 0.68);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.35),
    inset 0 0 2px rgba(255, 255, 255, 0.05);
}

.switch {
  position: relative;
  display: inline-block;
  width: 70px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 50px;
  cursor: pointer;
  background: #d1d5db;
  transition: background .3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body.night .slider {
  background: #6b7280;
}

.slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: transform .3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.switch input:checked + .slider::before {
  transform: translateX(36px);
}

/* Gradient temperature styles (all but neutral) */
.subfreezing {
  background: linear-gradient(180deg, #a5f3fc 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  color: transparent !important;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
  font-weight: 700;
}

.freezing {
  background: linear-gradient(180deg, #bae6fd 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  color: transparent !important;
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.6);
  font-weight: 700;
}

.cold-gray {
  background: linear-gradient(180deg, #1e3a8a 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  color: transparent !important;
  text-shadow: 0 0 4px rgba(30, 58, 138, 0.45);
  font-weight: 700;
}

.feels-neutral {
  color: inherit !important;
}

@keyframes subGlow {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

.weather-line {
  margin: 4px 0;
}

.lightning-line {
  margin-top: 6px;
  opacity: 0;
  animation: fadeInLightning .6s ease forwards;
}

.lightning-active {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

body.night .lightning-active {
  color: #fde68a;
  text-shadow: 0 0 12px rgba(255, 230, 120, 0.6);
}

.lightning-icon {
  color: #ffeb7b;
  text-shadow: 0 0 14px rgba(255, 230, 120, 0.85);
}

.lightning-inactive {
  color: rgba(200, 200, 200, 0.8);
  text-shadow: none;
}

@keyframes fadeInLightning {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.day .lightning-active {
  color: #b45309 !important;
  text-shadow: none !important;
}

body.day .lightning-icon {
  color: #d97706 !important;
  text-shadow: none !important;
}

body.day .lightning-inactive {
  color: #475569 !important;
}

#radarMap {
  width: 100%;
  height: 260px;
  border-radius: 14px;
  overflow: hidden;
}

.radar-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.radar-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(15, 23, 42, 0.85);
  color: #f9fafb;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.radar-btn:hover {
  background: rgba(15, 23, 42, 1);
  transform: translateY(-1px);
}

body.day .radar-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  border-color: rgba(148, 163, 184, 0.7);
}

body.day .radar-btn:hover {
  background: #ffffff;
}

.radar-time-label {
  opacity: 0.9;
  font-size: 11px;
  white-space: nowrap;
}

/* History panel range button active state */
.history-range-btn.active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35) inset;
}

body.day .history-range-btn.active {
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.25) inset;
}

@media (max-width: 900px) {
  html,
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.4s ease-in-out forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* Frost shimmer & heat pulse for temperature text */
.subfreezing,
.freezing,
.frost-shimmer {
  text-shadow: 0 0 6px rgba(191, 219, 254, 0.95);
  animation: frostPulse 2.4s ease-in-out infinite alternate;
}

@keyframes frostPulse {
  from { filter: brightness(0.9); }
  to   { filter: brightness(1.15); }
}

/* Heat warning pulse for very hot temperatures */
.heat-pulse {
  animation: heatWarning 1.2s ease-in-out infinite alternate;
}

@keyframes heatWarning {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}

/* Night dimming for temperature text */
body.night .subfreezing,
body.night .freezing,
body.night .cold-gray,
body.night .feels-neutral {
  opacity: 0.85;
}

/* --- Active Weather Alerts --- */
#alerts-container {
  animation: fadeInAlerts 0.4s ease-out forwards;
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(14px);
  font-size: 12px;
  line-height: 1.35;
}

.alert-indicator {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(248, 250, 252, 0.5);
}

.alert-headline {
  white-space: nowrap;
}

.alert-meta {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

/* Severity colors */
.alert-severity-extreme {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 40%, #f97316 100%);
  color: #fef2f2;
}
.alert-severity-extreme .alert-indicator {
  background: #fecaca;
}

.alert-severity-severe {
  background: linear-gradient(135deg, #b45309 0%, #ea580c 45%, #f97316 100%);
  color: #fef3c7;
}
.alert-severity-severe .alert-indicator {
  background: #fed7aa;
}

.alert-severity-moderate {
  background: linear-gradient(135deg, #4b5563 0%, #6b7280 45%, #9ca3af 100%);
  color: #f9fafb;
}
.alert-severity-moderate .alert-indicator {
  background: #e5e7eb;
}

.alert-severity-minor {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 45%, #22c55e 100%);
  color: #ecfdf5;
}
.alert-severity-minor .alert-indicator {
  background: #a7f3d0;
}

/* Marquee only when needed */
.alert-marquee {
  display: inline-block;
  padding-left: 100%;
  animation: alertMarquee 14s linear infinite;
}

@keyframes alertMarquee {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes fadeInAlerts {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Theme shifts on severe events (card only) */
#main-weather-card.alert-tornado {
  box-shadow: 0 20px 60px rgba(127, 29, 29, 0.65);
  border-color: rgba(248, 250, 252, 0.2);
}
body.day #main-weather-card.alert-tornado {
  background: radial-gradient(circle at 10% 0%, #fee2e2 0%, #b91c1c 40%, #111827 100%);
}
body.night #main-weather-card.alert-tornado {
  background: radial-gradient(circle at 12% 0%, #7f1d1d 0%, #111827 60%, #020617 100%);
}

#main-weather-card.alert-ice {
  box-shadow: 0 20px 60px rgba(30, 64, 175, 0.65);
}
body.day #main-weather-card.alert-ice {
  background: radial-gradient(circle at 0% 0%, #e0f2fe 0%, #60a5fa 40%, #0f172a 100%);
}
body.night #main-weather-card.alert-ice {
  background: radial-gradient(circle at 0% 0%, #1d4ed8 0%, #020617 60%, #020617 100%);
}

#main-weather-card.alert-hurricane {
  box-shadow: 0 20px 60px rgba(6, 78, 59, 0.65);
}
body.day #main-weather-card.alert-hurricane {
  background: radial-gradient(circle at 0% 0%, #ecfdf5 0%, #0f766e 40%, #022c22 100%);
}
body.night #main-weather-card.alert-hurricane {
  background: radial-gradient(circle at 0% 0%, #064e3b 0%, #020617 60%, #020617 100%);
}

#main-weather-card.alert-flood {
  box-shadow: 0 20px 60px rgba(8, 47, 73, 0.7);
}
body.day #main-weather-card.alert-flood {
  background: radial-gradient(circle at 0% 0%, #e0f2fe 0%, #0284c7 40%, #0f172a 100%);
}
body.night #main-weather-card.alert-flood {
  background: radial-gradient(circle at 0% 0%, #0ea5e9 0%, #020617 60%, #020617 100%);
}

/* Darker Daytime Glass for Main + Forecast Cards */
body.day .glass-card {
  background: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.20) !important;
}

/* Darker daytime panel area behind forecast row (same for mobile) */
body.day #forecast {
  background: rgba(0,0,0,0.05);
  padding: 8px;
  border-radius: 12px;
}

/* Disable any movement for the MAIN card ONLY */
.no-animate {
  transform: none !important;
  transition: none !important;
}
.no-animate:hover {
  transform: none !important;
  box-shadow: inherit !important;
}

/* Slide Down + Fade for Alert Details */
.alert-dropdown {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.alert-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* Kill all temperature animations completely */
.subfreezing,
.freezing,
.frost-shimmer,
.hot-warning,
.temp-animate,
.temp-glow {
  animation: none !important;
  transition: none !important;
}
