/* サイドバー内 地方トグル */
.weather-region-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: bold;
  padding: 4px 0;
  user-select: none;
}

.weather-region-toggle:hover { color: #555; }

.weather-arrow {
  font-size: 1.0rem;
  color: #8aafc8;
  transition: transform 0.2s;
  display: inline-block;
  transform: rotate(90deg);
}

.weather-arrow.open { transform: rotate(-90deg); }

.weather-pref-list { margin-left: 8px; }

.weather-pref-label {
  display: block;
  padding: 3px 6px;
  margin: 1px 0;
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-radius: 4px;
  border-left: 3px solid transparent;
}

.weather-pref-label:hover {
  background: #f0f4f8;
  color: #333;
}

.weather-pref-label.active {
  font-weight: bold;
  color: #177c65;
  background: #e3f3ef;
  border-left-color: #177c65;
}

/* メインエリア */
.weather-result-area { padding: 10px 0; }

.weather-placeholder,
.weather-loading,
.weather-error {
  color: #999;
  font-size: var(--font-size-sm);
}

.weather-pref-title {
  font-size: 1.1rem;
  margin: 0 0 16px 0;
}


/* 週間天気テーブル */
.weather-table-wrap {
  overflow-x: auto;
}

.weather-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: var(--font-size-sm);
  table-layout: fixed;
}

.weather-table th,
.weather-table td {
  border: 1px solid #ddd;
  padding: 8px 6px;
  text-align: center;
  white-space: nowrap;
}

.weather-table thead th {
  background: #f5f7fa;
  font-weight: bold;
}

.weather-table thead th:first-child,
.weather-table tbody th {
  width: 5em;
  background: #f5f7fa;
  font-weight: bold;
  text-align: left;
  padding-left: 8px;
}

.weather-table thead th.sun { color: #e53935; }
.weather-table thead th.sat { color: #1976d2; }

.weather-tbl-icon {
  width: 40px;
  height: 40px;
}

.weather-tbl-pop { color: #1976d2; }

.temp-max { color: #e53935; font-weight: bold; }
.temp-min { color: #1976d2; font-weight: bold; }

/* 年間気候グラフ */
.weather-climate {
  margin-top: 32px;
}

.climate-title {
  font-size: 1rem;
  margin: 0 0 12px 0;
}

.climate-note {
  font-size: 0.75rem;
  color: #999;
  font-weight: normal;
}

.climate-chart-wrap {
  position: relative;
  width: 100%;
}

@media (max-width: 768px) {
  .climate-chart-wrap { width: 100%; }

  /* 天気ページ: 都道府県を選ぶまでは地方(グレー)と都道府県(白)を
     通常のページ内コンテンツとして最初から全て表示する(ヘッダーなどを
     隠す固定オーバーレイにはしない)。都道府県を選んだ後だけ、他の
     一覧ページの「絞り込み」と同じ画面下部固定トグルに切り替える
     (.weather-floating、JS側で付与)。 */
  .sidebar:has(.sidebar-toggle--weather) {
    position: static;
    width: 100%;
    background: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 16px;
  }

  .sidebar:has(.sidebar-toggle--weather) .sidebar-content {
    display: block;
    max-height: none;
    padding: 0;
  }

  .sidebar:has(.sidebar-toggle--weather) .filter-group {
    margin: 0;
  }

  .sidebar:has(.sidebar-toggle--weather).weather-floating {
    position: fixed;
    bottom: 56px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    background-color: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    margin-bottom: 0;
  }

  .sidebar:has(.sidebar-toggle--weather).weather-floating .sidebar-content {
    display: none;
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px;
  }

  .sidebar:has(.sidebar-toggle--weather).weather-floating .sidebar-content.open {
    display: block;
  }

  /* 開閉トグルの共通JSは開いた時に .expanded を付与し、他ページでは
     全画面(top:0)にする作りだが、天気ページではヘッダーまで覆うと
     都合が悪いので、ヘッダー分だけ空けた位置から下部トグルの直前までを
     埋める形に変更する(結果表示の上に中途半端に重なるのを防ぐ)。 */
  .sidebar:has(.sidebar-toggle--weather).expanded {
    top: 59px;
    z-index: 9999;
  }

  .sidebar:has(.sidebar-toggle--weather).expanded .sidebar-content {
    flex: 1;
    max-height: none;
  }

  .sidebar-content .weather-region-toggle {
    background: #177c65;
    color: #fff;
    padding: 5px 20px;
    font-size: 0.85rem;
  }

  .weather-arrow {
    display: none;
  }

  .weather-pref-list {
    display: block !important;
    margin-left: 0;
    background: #fff;
  }

  .sidebar-content .weather-pref-label {
    padding: 10px 20px 10px 36px;
    margin: 0;
    border-radius: 0;
    font-size: 1.05rem;
    color: #555;
  }

  .weather-pref-label.active {
    background: #e3f3ef;
    color: #177c65;
    border-left: none;
  }
}
