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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  color: white;
  font-weight: 600;
}

body {
  background: url(assets/bg.jpg) center / cover no-repeat fixed;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(20px);
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */

.regular-txt {
  font-weight: 400;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--card-gradient, rgba(255, 255, 255, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  backdrop-filter: blur(80px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: background 0.6s ease;
  }
}

/* ── Search bar ─────────────────────────────────────────────────────────────── */

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  padding: 4px 4px 4px 14px;
  gap: 6px;
}

.search-bar__icon {
  font-size: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.search-bar__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}

.search-bar__input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
}

.search-bar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 99px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
}

.search-bar__btn span {
  font-size: 18px;
}

@media (prefers-reduced-motion: no-preference) {
  .search-bar__btn {
    transition: background 0.2s;
  }
}

.search-bar__btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.search-bar__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Recent searches ────────────────────────────────────────────────────────── */

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

.recent-searches:empty {
  display: none;
}

.recent-searches__chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .recent-searches__chip {
    transition: background 0.2s;
  }
}

.recent-searches__chip:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Weather info ───────────────────────────────────────────────────────────── */

.weather-info {
  flex-direction: column;
  gap: 20px;
}

/* ── Weather hero ───────────────────────────────────────────────────────────── */

.weather-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.weather-hero__location {
  display: flex;
  align-items: center;
  gap: 4px;
}

.weather-hero__location span {
  font-size: 20px;
}

.weather-hero__city {
  font-size: 16px;
}

.weather-hero__date {
  font-size: 13px;
  opacity: 0.8;
}

/* ── Weather main ───────────────────────────────────────────────────────────── */

.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.weather-main__icon {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.weather-main__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 2px;
}

.weather-main__temp {
  font-size: 48px;
  line-height: 1;
  margin-top: 4px;
}

.weather-main__feels-like {
  font-size: 13px;
  opacity: 0.75;
}

.weather-main__high-low {
  font-size: 12px;
  opacity: 0.65;
}

.weather-main__condition {
  font-size: 15px;
  margin-top: 2px;
}

/* ── Unit toggle ────────────────────────────────────────────────────────────── */

.unit-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.unit-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.unit-toggle__track {
  position: relative;
  width: 36px;
  height: 18px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 99px;
  flex-shrink: 0;
}

.unit-toggle__track::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
  background: white;
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .unit-toggle__track {
    transition: background 0.25s;
  }

  .unit-toggle__track::before {
    transition: transform 0.25s;
  }
}

.unit-toggle input:checked + .unit-toggle__track {
  background: rgba(255, 255, 255, 0.5);
}

.unit-toggle input:checked + .unit-toggle__track::before {
  transform: translateX(18px);
}

.unit-toggle__label {
  font-size: 12px;
  opacity: 0.7;
}

.unit-toggle__label--f {
  order: -1;
}

/* ── Conditions grid ────────────────────────────────────────────────────────── */

.conditions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.conditions-grid__item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.conditions-grid__item span.material-symbols-outlined {
  font-size: 22px;
  opacity: 0.8;
}

.conditions-grid__label {
  font-size: 11px;
  opacity: 0.65;
}

.conditions-grid__value {
  font-size: 13px;
  font-weight: 600;
}

/* ── AQI ────────────────────────────────────────────────────────────────────── */

.aqi {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aqi__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.aqi__label {
  font-size: 13px;
  font-weight: 700;
}

.aqi__bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.aqi__fill {
  height: 100%;
  border-radius: 99px;
}

@media (prefers-reduced-motion: no-preference) {
  .aqi__fill {
    transition:
      width 0.5s ease,
      background-color 0.5s ease;
  }
}

/* ── Hourly forecast ────────────────────────────────────────────────────────── */

.hourly-forecast__title,
.daily-forecast__title {
  font-size: 12px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.hourly-forecast__list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.hourly-forecast__list::-webkit-scrollbar {
  height: 4px;
}

.hourly-forecast__list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

.hourly-forecast__list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 99px;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 60px;
  flex-shrink: 0;
}

.hourly-item__time {
  font-size: 11px;
  opacity: 0.7;
}

.hourly-item__img {
  width: 28px;
  height: 28px;
}

.hourly-item__temp {
  font-size: 13px;
}

/* ── Daily forecast ─────────────────────────────────────────────────────────── */

.daily-forecast__list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.daily-forecast__list::-webkit-scrollbar {
  height: 4px;
}

.daily-forecast__list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

.daily-forecast__list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 99px;
}

.forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 10px;
  min-width: 70px;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .forecast-item {
    transition: background 0.2s;
  }
}

.forecast-item:hover {
  background: rgba(255, 255, 255, 0.14);
}

.forecast-item__date {
  font-size: 11px;
  opacity: 0.7;
}

.forecast-item__img {
  width: 32px;
  height: 32px;
}

.forecast-item__temp {
  font-size: 14px;
}

.forecast-item__range {
  font-size: 11px;
  opacity: 0.55;
}

/* ── Section messages ───────────────────────────────────────────────────────── */

.section-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 20px 0;
}

.section-message img {
  height: 160px;
  width: auto;
}

/* ── Loading ────────────────────────────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.loading__spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .loading__spinner {
    animation: spin 0.8s linear infinite;
  }
}

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