/* 🔝 検索エリアを画面上部に固定 */
.fixed-top {
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 999;
  padding: 1rem 0;
  border-bottom: 1px solid #ccc;
  display: flex;
  justify-content: center;
}

@media (prefers-color-scheme: dark) {
  .fixed-top {
    background-color: #111;
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.1);
  }
}

/* 共通余白 */
.weather-card,
.container,
#weather {
  margin-top: 8rem;
}

#weather {
  padding-bottom: 2rem;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  padding: 1rem;
  background-color: white;
  color: black;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 600px;
  margin: auto;
  text-align: center;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

/* 🌤 天気カード */
.weather-card {
  background-color: rgba(240, 240, 240, 0.8);
  padding: 1rem;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: 1.5rem;
  transition: background-color 0.3s ease;
}

.weather-card p {
  margin: 0.6rem 0;
  font-size: 1.1rem;
}

/* 🔘 ボタン */
button {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  background-color: #0077cc;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #005fa3;
}

/* 🌙 ダークモード */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #111;
    color: #eee;
  }

  .weather-card {
    background-color: rgba(40, 40, 40, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }

  button {
    background-color: #3399ff;
    color: #111;
  }

  button:hover {
    background-color: #66b3ff;
  }
}

/* 📱 レスポンシブ調整 */
@media screen and (max-width: 480px) {
  h1 {
    font-size: 1.4rem;
  }

  .container {
    padding: 0.5rem;
  }

  button {
    width: 100%;
    font-size: 1.1rem;
    padding: 0.8rem;
  }

  .weather-card p {
    font-size: 1rem;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  #location-input,
  #filter-input,
  #search-weather-btn,
  #filter-btn {
    width: 100%;
  }
}

/* 🔄 ローディングスピナー */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  color: #666;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #ccc;
  border-top: 4px solid #0077cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 0.5rem;
}

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

/* 🔍 検索エリアの外枠 */
.search-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

/* 各検索列（検索＋ボタン） */
.search-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* 入力欄統一 */
#location-input,
#filter-input {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  width: 280px;
  max-width: 100%;
  box-sizing: border-box;  /* 念のため */
}

/* 🌆 都市カードをグリッド表示 */
.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

/* スマホでは1列 */
@media screen and (max-width: 600px) {
  .weather-grid {
    grid-template-columns: 1fr;
  }
}
