@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

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

body {
  font-family: 'Poppins', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  background: #0a0e18;
}

/* ── Scene ── */
.scene {
  position: relative;
  width: 100%;
  height: 100vh;
  perspective: 1200px;
  overflow: hidden;
}

/* ── Layers ── */
.layer {
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  transition: all 1.5s ease;
}

.sky {
  top: 0; bottom: 0; right: 0;
  z-index: 0;
  transition: background 1.5s ease;
}

/* ── Celestial ── */
.celestial {
  position: absolute;
  border-radius: 50%;
  transition: all 1s ease;
}

.sun {
  width: 80px; height: 80px;
  top: 60px; right: 15%;
  z-index: 1;
  box-shadow: 0 0 60px 20px rgba(255,200,50,0.4);
}

.layer svg.moon-svg {
  position: absolute;
  width: 60px;
  height: 60px;
  min-width: 60px;
  top: 80px; right: 20%;
  z-index: 1;
  filter: drop-shadow(0 0 20px rgba(200,220,255,0.3));
  transition: all 1s ease;
  display: none;
  overflow: visible;
}

/* ── Stars ── */
.stars {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle 3s infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* ── Aurora ── */
.aurora-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 60%;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease;
}

@keyframes auroraShift {
  0% { transform: translateX(0); }
  50% { transform: translateX(30px); }
  100% { transform: translateX(0); }
}

/* ── Clouds ── */
.clouds {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 300px;
  z-index: 2;
  overflow: hidden;
}

.cloud {
  position: absolute;
  border-radius: 50%;
  opacity: 0.8;
  animation: drift linear infinite;
}

@keyframes drift {
  from { transform: translateX(-200px); }
  to { transform: translateX(calc(100vw + 200px)); }
}

/* ── Fog overlay ── */
#fog-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease;
  background: radial-gradient(ellipse at 50% 70%,
    rgba(200,210,220,0.9) 0%,
    rgba(180,195,205,0.7) 50%,
    rgba(160,175,185,0.4) 100%);
}

/* ── Weather particles ── */
.weather-particles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
  transition: transform 1s ease;
}

.raindrop {
  position: absolute;
  width: 2px;
  background: linear-gradient(transparent, rgba(174,194,224,0.6));
  animation: rain linear infinite;
}

@keyframes rain {
  0% { transform: translateY(-100px); opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0.3; }
}

.snowflake {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0.8;
  animation: snow linear infinite;
}

@keyframes snow {
  0% { transform: translateY(-20px) translateX(0) rotate(0deg); }
  100% { transform: translateY(100vh) translateX(var(--snow-drift, 0px)) rotate(360deg); }
}

/* ── Lightning ── */
#lightning-flash {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 22;
  pointer-events: none;
  background: rgba(220,230,255,0);
  transition: background 0.08s ease;
}

/* ── SVG layer containers ── */
.layer-5 { z-index: 3; height: 75%; }
.layer-5 svg { position: absolute; bottom: 0; width: 100%; height: 100%; }

.layer-4 { z-index: 5; height: 60%; }
.layer-4 svg { position: absolute; bottom: 0; width: 100%; height: 100%; }

.layer-2 { z-index: 9; height: 40%; }
.layer-2 svg { position: absolute; bottom: 0; width: 100%; height: 100%; }

.layer-1 { z-index: 11; height: 18%; }
.layer-1 svg { position: absolute; bottom: 0; width: 100%; height: 100%; }

.layer svg { min-width: 100%; width: 100%; height: 100%; }

/* ── Parallax ── */
.scene.parallax .layer-5,
.scene.parallax .layer-4,
.scene.parallax .layer-2,
.scene.parallax .layer-1 { transition: transform 0.1s ease-out; }

/* ── Top bar ── */
.top-bar {
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 20px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.12);
  color: white;
  font-size: 0.8rem;
  white-space: nowrap;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-city {
  font-weight: 500;
  letter-spacing: 0.5px;
}

.top-bar-temp {
  font-weight: 600;
  font-size: 0.9rem;
}

.top-bar-condition {
  opacity: 0.7;
  font-weight: 300;
}

.top-bar-right {
  opacity: 0.5;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

/* ── Panel toggle ── */
.panel-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 31;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: white;
  padding: 12px 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.panel-toggle:hover {
  background: rgba(255,255,255,0.15);
  padding-right: 10px;
}

.panel-toggle.open svg {
  transform: rotate(180deg);
}

/* ── Side panel ── */
.side-panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 340px;
  z-index: 30;
  background: rgba(8,14,22,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255,255,255,0.08);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
  color: white;
  display: flex;
  flex-direction: column;
}

.side-panel.open {
  transform: translateX(0);
}

.side-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.side-panel-header h3 {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.side-panel-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
}

.side-panel-close:hover { color: white; }

.side-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.side-panel-scroll::-webkit-scrollbar { width: 4px; }
.side-panel-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* Panel sections */
.panel-section {
  margin-bottom: 20px;
}

.panel-section-title {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 10px;
}

.panel-hero {
  text-align: center;
  padding: 12px 0 16px;
}

.panel-hero-temp {
  font-size: 2.8rem;
  font-weight: 300;
  line-height: 1;
}

.panel-hero-condition {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 4px;
}

.panel-hero-feelslike {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-top: 2px;
}

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.panel-row-label {
  color: rgba(255,255,255,0.5);
}

.panel-row-value {
  font-weight: 500;
}

/* Kp bar */
.kp-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.kp-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.5s ease;
}

/* Hourly forecast */
.hourly-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}

.hourly-scroll::-webkit-scrollbar { display: none; }

.hourly-item {
  flex: 0 0 52px;
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  font-size: 0.65rem;
}

.hourly-item-hour {
  opacity: 0.5;
  margin-bottom: 4px;
}

.hourly-item-icon {
  font-size: 1rem;
  margin: 2px 0;
}

.hourly-item-temp {
  font-weight: 500;
}

/* 7-day forecast */
.forecast-day {
  display: grid;
  grid-template-columns: 50px 28px 1fr 50px;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.forecast-day-name {
  font-weight: 500;
}

.forecast-day-icon {
  font-size: 0.9rem;
  text-align: center;
}

.forecast-day-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  position: relative;
}

.forecast-day-bar-fill {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #5BB88A, #D4856B);
}

.forecast-day-temps {
  text-align: right;
  font-size: 0.7rem;
}

.forecast-day-temps span:first-child { opacity: 0.5; }

/* ── Simulator panel ── */
.simulator-panel {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 25;
  width: 300px;
  background: rgba(8,14,22,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  color: white;
  font-size: 0.75rem;
  user-select: none;
}

.sim-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: grab;
}

.sim-header:active { cursor: grabbing; }

.sim-drag-handle {
  opacity: 0.4;
  font-size: 0.9rem;
}

.sim-title {
  flex: 1;
  font-weight: 500;
  font-size: 0.8rem;
}

.sim-collapse {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
  transition: transform 0.3s ease;
}

.sim-collapse.collapsed {
  transform: rotate(-90deg);
}

.sim-body {
  padding: 12px 16px 16px;
  max-height: 500px;
  overflow-y: auto;
  transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sim-body::-webkit-scrollbar { width: 4px; }
.sim-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sim-body.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
}

.sim-group {
  margin-bottom: 14px;
}

.sim-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.7rem;
}

.sim-label-name {
  color: rgba(255,255,255,0.5);
}

.sim-label-value {
  font-weight: 500;
}

/* Slider styling */
.sim-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  outline: none;
}

.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #5BB88A;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.3);
}

.sim-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #5BB88A;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.3);
}

/* Weather type buttons */
.sim-weather-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.sim-weather-btn {
  padding: 6px 4px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
  font-family: 'Poppins', sans-serif;
  font-size: 0.6rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.sim-weather-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sim-weather-btn.active {
  background: rgba(91,184,138,0.25);
  border-color: rgba(91,184,138,0.5);
  color: #5BB88A;
  font-weight: 500;
}

.sim-reset {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  font-family: 'Poppins', sans-serif;
  font-size: 0.7rem;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.sim-reset:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .layer-5 { height: 70%; }
  .layer-4 { height: 55%; }
  .layer-2 { height: 35%; }
  .layer-1 { height: 15%; }

  .top-bar {
    top: 12px;
    padding: 8px 14px;
    font-size: 0.7rem;
    gap: 10px;
  }

  .sun { width: 60px; height: 60px; top: 70px; }
  .layer svg.moon-svg { width: 45px; height: 45px; min-width: 45px; top: 80px; }

  .side-panel { width: 100%; }

  .simulator-panel {
    left: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    max-width: 340px;
  }
}
