﻿:root {
  --bg-dark: #050810;
  --bg-darker: #020409;
  --card-bg: rgba(12, 20, 36, 0.7);
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.35);
  --text-primary: #f8fafc;
  --text-secondary: rgba(226, 232, 240, 0.7);
  --danger: #f97316;
  --success: #22c55e;
  --transition: 200ms ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
}

.background-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, #1f2937 0%, transparent 40%),
    radial-gradient(circle at 80% 10%, #0ea5e9 0%, transparent 35%),
    radial-gradient(circle at 10% 80%, #1d4ed8 0%, transparent 40%),
    radial-gradient(circle at 90% 70%, #581c87 0%, transparent 45%);
  opacity: 0.65;
  filter: blur(20px);
  animation: pulse 12s ease-in-out infinite alternate;
  z-index: -2;
}

.background-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
}

.orb {
  position: absolute;
  width: clamp(18rem, 30vw, 25rem);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, transparent 70%);
  filter: blur(0);
  opacity: 0.35;
  border-radius: 50%;
  animation: float 18s ease-in-out infinite;
}

.orb--one {
  top: 10%;
  left: 8%;
}

.orb--two {
  bottom: 15%;
  right: 12%;
  animation-delay: 4s;
}

.orb--three {
  top: 55%;
  left: 50%;
  animation-delay: 8s;
}

.weather-app {
  position: relative;
  max-width: min(1100px, 92vw);
  margin: clamp(2rem, 6vh, 4rem) auto;
  padding: clamp(2rem, 5vw, 3.5rem);
  background: linear-gradient(135deg, rgba(9, 13, 23, 0.8), rgba(6, 14, 25, 0.35));
  border-radius: 30px;
  border: 1px solid rgba(148, 163, 184, 0.08);
  backdrop-filter: blur(24px);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.4);
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.location-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.location-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 220px;
}

.location-select select {
  width: 100%;
  appearance: none;
  background: rgba(12, 18, 30, 0.8);
  color: var(--text-primary);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 0.65rem 2.8rem 0.65rem 1.1rem;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border var(--transition), box-shadow var(--transition), background var(--transition);
}

.location-select select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.location-select select:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(12, 18, 30, 0.92);
}

.select-icon {
  position: absolute;
  right: 1rem;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border-right: 2px solid rgba(248, 250, 252, 0.75);
  border-bottom: 2px solid rgba(248, 250, 252, 0.75);
  transform: rotate(45deg);
  transition: transform var(--transition), border var(--transition);
}

.location-select select:focus + .select-icon,
.location-select select:hover + .select-icon {
  border-color: var(--accent);
}

.last-updated {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.local-datetime {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.refresh-btn {
  align-self: flex-end;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.4);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform var(--transition), border var(--transition), background var(--transition),
    box-shadow var(--transition);
}

.refresh-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.refresh-btn:hover,
.refresh-btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.18);
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.refresh-btn:active {
  transform: scale(0.96);
}

.refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.refresh-btn.refreshing svg {
  animation: spin 0.9s linear infinite;
}

.refresh-btn:focus {
  outline: none;
}

.datetime-block {
  text-align: right;
  color: var(--text-secondary);
  font-weight: 300;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.dde-link {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity var(--transition), color var(--transition);
}

.dde-link:hover {
  opacity: 1;
  color: var(--accent);
}

.current-weather {
  display: flex;
  justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(2rem, 4vw, 2.5rem) 0 2rem;
}

.main-temp {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.08em;
  width: fit-content;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.temp-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#current-temp {
  font-size: clamp(4.5rem, 9vw, 6rem);
  font-weight: 600;
  line-height: 1;
}

.temp-sub {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-weight: 300;
}

.weather-visual {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 0.85rem;
}

#condition-icon {
  width: clamp(110px, 15vw, 160px);
  filter: drop-shadow(0 20px 40px rgba(14, 165, 233, 0.35));
  transform: translateY(0);
  transition: transform 600ms ease;
}

#condition-icon.animate {
  transform: translateY(-8px) scale(1.02);
}

.sky {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.highlights {
  margin-top: 0.5rem;
}

.section-title {
  font-size: 1.4rem;
  margin: 0 0 1.2rem;
  letter-spacing: 0.06em;
}

.cards-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.highlight-card {
  background: var(--card-bg);
  padding: 1.4rem;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.05);
  transition: transform var(--transition), border var(--transition), box-shadow var(--transition);
}

.highlight-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.highlight-card p {
  margin: 1rem 0 0.5rem;
  font-size: 1.8rem;
  font-weight: 500;
}

.highlight-card .meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.highlight-card:hover {
  transform: translateY(-6px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.38);
}

.forecast {
  margin-top: clamp(2.2rem, 5vw, 3rem);
}

.forecast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.unit-toggle {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), border var(--transition);
}

.unit-toggle:hover,
.unit-toggle:focus-visible {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
}

.forecast-grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.forecast-card {
  background: rgba(12, 18, 30, 0.75);
  border-radius: 24px;
  padding: 1.6rem 1.4rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.forecast-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.08), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.forecast-card:hover::before {
  opacity: 1;
}

.day-name {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.day-icon {
  width: 80px;
  filter: drop-shadow(0 10px 20px rgba(14, 165, 233, 0.25));
}

.temps {
  display: flex;
  gap: 0.75rem;
  font-weight: 500;
}

.max-temp {
  color: var(--text-primary);
}

.min-temp {
  color: var(--text-secondary);
}

.day-condition {
  color: var(--text-secondary);
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

.app-footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--accent);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.loading-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  gap: 1rem;
  z-index: 10;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(56, 189, 248, 0.25);
  border-top-color: var(--accent);
  animation: spin 1.2s linear infinite;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal 0.9s ease forwards;
}

.reveal:nth-child(2) {
  animation-delay: 0.15s;
}

.reveal:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0% {
    filter: blur(18px);
    opacity: 0.5;
  }
  100% {
    filter: blur(26px);
    opacity: 0.75;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(-15px) scale(1);
  }
  50% {
    transform: translateY(15px) scale(1.05);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .location-select {
    min-width: 100%;
  }

  .location-select select {
    font-size: 1.2rem;
  }

  .datetime-block {
    text-align: left;
    align-items: flex-start;
  }

  .refresh-btn {
    align-self: flex-start;
  }

  .current-weather {
    flex-direction: column;
    align-items: flex-start;
  }

  .weather-visual {
    align-items: flex-start;
    justify-items: flex-start;
  }

  .forecast-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 480px) {
  .weather-app {
    padding: 2rem 1.5rem;
  }

  #current-temp {
    font-size: 3.8rem;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
