/* ===== Base ===== */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  transition:
    background 0.2s,
    color 0.2s;
}

/* ===== Themes ===== */
.theme-light {
  background: lightblue;
  color: #111;
}

.theme-dark {
  background: #111;
  color: #f4f4f4;
}

/* ===== Theme button (top right) ===== */
.topbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.theme-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;

  border: none;
  cursor: pointer;
  padding: 0.45rem 0.8rem;

  background: whitesmoke;
  border-radius: 999px;
}

.icon {
  width: 20px;
  height: 20px;
}

/* Keep theme button icon normal */
.theme-dark .theme-button .icon {
  filter: none;
}

/* ===== Page layout ===== */
.page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 0.75rem;
  padding: 2.5rem 1rem 2rem;
}

.title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  text-align: center;
}

/* ===== Card ===== */
.card {
  width: min(20rem, 100%);
  min-height: 22rem;

  background: whitesmoke;
  border-radius: 1.25rem;
  padding: 1.5rem;

  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.theme-dark .card {
  background: #222;
  color: #fff;
}

/* ===== Search row ===== */
.search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-location {
  width: 18px;
  height: 18px;
}

.search-input {
  flex: 1;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid #ccc;
  padding: 0 0.85rem;
  outline: none;
}

.search-input:focus {
  border-color: #888;
}

.search-button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #eee;
}

.search-button:hover {
  background: #ddd;
}

.theme-dark .search-input {
  background: #1c1c1c;
  color: #fff;
  border: 1px solid #555;
}

.theme-dark .search-input:focus {
  border-color: #888;
}

.theme-dark .search-button {
  background: #444;
}

.theme-dark .search-button:hover {
  background: #555;
}

/* Make icons readable in dark mode (except theme button icon) */
.theme-dark .search .icon,
.theme-dark .weather-icon {
  filter: invert(1) brightness(1.15);
}

/* ===== City ===== */
.city {
  margin: 0.25rem 0 0;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 800;
}

/* ===== Current weather ===== */
.now {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.25rem;
}

.temp {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.weather-icon {
  width: 76px;
  height: 76px;
}

.condition {
  margin: 0;
  text-align: center;
  font-weight: 700;
  opacity: 0.95;
}

/* ===== Stats ===== */
.stats {
  display: flex;
  gap: 0.75rem;
  margin-top: auto; /* pushes stats down for balance */
  padding-top: 0.5rem;
}

.stat {
  flex: 1;
  text-align: center;

  background: rgba(0, 0, 0, 0.04);
  border-radius: 0.9rem;
  padding: 0.8rem 0.6rem;
}

.theme-dark .stat {
  background: rgba(255, 255, 255, 0.06);
}

.stat-name {
  font-size: 0.8rem;
  color: #666;
}

.theme-dark .stat-name {
  color: #bbb;
}

.stat-value {
  font-weight: 900;
  font-size: 1.1rem;
  margin-top: 0.25rem;
}

/* ===== Error ===== */
.error {
  margin: 0;
  text-align: center;
  color: #b00020;
  font-weight: 700;
}

.theme-dark .error {
  color: #ff6b6b;
}
