:root {
  --bg-1: #09162f;
  --bg-2: #172554;
  --glass-bg: rgba(14, 25, 46, 0.28);
  --glass-border: rgba(255, 255, 255, 0.24);
  --glass-highlight: rgba(255, 255, 255, 0.22);
  --text-primary: #edf6ff;
  --text-secondary: rgba(237, 246, 255, 0.8);
  --text-muted: rgba(203, 213, 225, 0.82);
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.25);
  --danger: #fda4af;
  --surface: rgba(15, 23, 42, 0.18);
}

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

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: linear-gradient(135deg, #07132f 0%, #142a5e 35%, #275d9b 100%);
  overflow-x: hidden;
  transition: background 0.5s ease;
}

body.weather-clear {
  background: linear-gradient(135deg, #081f3e 0%, #193d79 35%, #f8c77d 100%);
}

body.weather-clouds {
  background: linear-gradient(135deg, #0f172a 0%, #294c73 35%, #9fb7d1 100%);
}

body.weather-rain {
  background: linear-gradient(135deg, #020b1d 0%, #0f2d4a 28%, #496f9d 100%);
}

body.weather-thunderstorm {
  background: linear-gradient(135deg, #02040a 0%, #121d31 30%, #374151 100%);
}

body.weather-snow {
  background: linear-gradient(135deg, #dfeafc 0%, #93c5fd 30%, #e0f2fe 100%);
  color: #0f172a;
}

body.weather-night {
  background: linear-gradient(135deg, #020713 0%, #0d1327 30%, #2b2145 100%);
}

.background-glow {
  position: fixed;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.glow-one {
  top: -10rem;
  right: -6rem;
  background: rgba(125, 211, 252, 0.5);
}

.glow-two {
  bottom: -8rem;
  left: -10rem;
  background: rgba(147, 197, 253, 0.55);
}

.glow-three {
  top: 40%;
  left: 30%;
  background: rgba(255, 203, 106, 0.3);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 48px auto;
}

.glass-panel {
  background: rgba(15, 23, 42, 0.16);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 22px;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.2rem, 1.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-flex;
  width: 2.2rem;
  height: 2.2rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.segmented-control {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px;
}

.unit-button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-button.active {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.dashboard {
  display: grid;
  gap: 22px;
}

.search-panel,
.weather-panel,
.detail-panel,
.forecast-panel,
.recent-panel {
  border-radius: 28px;
  padding: 26px;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.input-wrap {
  position: relative;
  flex: 1 1 420px;
  width: 100%;
  min-width: 0;
}

.input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.7;
}

.search-form input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  padding: 1rem 1.25rem 1rem 3rem;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-form input::placeholder {
  color: rgba(226, 232, 240, 0.7);
}

.search-form input:focus {
  border-color: rgba(125, 211, 252, 0.7);
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.12);
  background: rgba(255, 255, 255, 0.09);
}

.primary-button,
.secondary-button,
.clear-button {
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  min-height: 52px;
  padding: 0 1.5rem;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.95), rgba(56, 189, 248, 0.9));
  color: #04111e;
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(56, 189, 248, 0.28);
}

.secondary-button {
  min-height: 52px;
  padding: 0 1.2rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.primary-button:hover,
.secondary-button:hover,
.clear-button:hover,
.unit-button:hover,
.recent-search:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.9);
  outline-offset: 2px;
}

.loading-card,
.error-card {
  margin-top: 18px;
  border-radius: 18px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.loading-card {
  background: rgba(255, 255, 255, 0.06);
}

.error-card {
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(253, 164, 175, 0.2);
  color: #ffe4e6;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(125, 211, 252, 1);
  animation: spin 0.8s linear infinite;
}

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

.weather-panel {
  padding: 28px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  color: rgba(191, 219, 254, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 10px;
}

#cityName {
  font-size: clamp(2rem, 2.8vw, 3rem);
  line-height: 1.1;
  margin-bottom: 6px;
}

.country-name {
  color: var(--text-muted);
  font-size: 1rem;
}

.date-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: right;
}

.hero-weather {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 30px;
  padding: 18px 8px 10px;
}

.weather-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.weather-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 118px;
  height: 118px;
  font-size: clamp(4rem, 7vw, 6rem);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  animation: floatIcon 4s ease-in-out infinite;
}

@keyframes floatIcon {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.weather-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.temperature {
  font-size: clamp(3.2rem, 6vw, 5.4rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.condition-text {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 700;
  text-transform: capitalize;
}

.description-text {
  color: var(--text-muted);
}

.feels-like {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.feels-like span {
  font-weight: 700;
  color: var(--text-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px;
  border-radius: 18px;
  min-height: 120px;
  transition: transform 0.2s ease;
}

.stat-card:hover,
.detail-panel:hover,
.forecast-panel:hover,
.recent-panel:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.4rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.stat-card strong {
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-heading h3 {
  font-size: 1.12rem;
}

.sun-times {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sun-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.sun-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.small-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.forecast-list {
  display: grid;
  gap: 12px;
}

.forecast-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.forecast-day {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.forecast-condition {
  color: var(--text-secondary);
  font-size: 0.86rem;
  text-transform: capitalize;
}

.forecast-temp {
  font-weight: 700;
  white-space: nowrap;
}

.recent-panel {
  padding-top: 24px;
}

.recent-heading {
  margin-bottom: 14px;
}

.clear-button {
  background: transparent;
  color: #dbeafe;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.52rem 0.9rem;
}

.recent-searches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.recent-search {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  padding: 0.8rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.recent-search:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.9);
  outline-offset: 2px;
}

.footer-meta {
  text-align: right;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.82rem;
  margin-top: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 100%);
    margin: 20px auto 32px;
  }

  .topbar,
  .search-panel,
  .weather-panel,
  .detail-panel,
  .forecast-panel,
  .recent-panel {
    padding: 18px;
  }

  .topbar,
  .panel-header,
  .hero-weather {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-header {
    gap: 12px;
  }

  .date-box {
    align-items: flex-start;
    text-align: left;
  }

  .hero-weather {
    gap: 8px;
  }

  .weather-visual {
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .weather-summary {
    align-items: flex-start;
  }

  .search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: stretch;
    gap: 10px;
  }

  .input-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .search-form input {
    padding-right: 1rem;
  }

  .primary-button,
  .secondary-button {
    width: auto;
    min-width: 0;
    min-height: 46px;
    padding: 0.75rem 0.9rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .forecast-item {
    grid-template-columns: 1fr auto auto;
  }

  .forecast-condition {
    display: none;
  }
}
