/* ==========================================================================
   石巻管内防災カメラポータルサイト - スタイルシート
   ========================================================================== */

/* 
 * カラーパレット定義（CSS変数）
 */
:root {
  --bg-primary: #0b0f17;
  --bg-secondary: #131924;
  --bg-card: rgba(22, 30, 44, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --border: rgba(51, 65, 85, 0.6);
  --border-highlight: rgba(56, 189, 248, 0.4);
  
  /* カテゴリ別カラー */
  --river: #3b82f6;
  --road: #f59e0b;
  --coast: #06b6d4;
  --city: #10b981;
  --other: #a78bfa;
  --fav-gold: #fbbf24;
}

/* 
 * ベース・リセット 
 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

/* ==========================================================================
   レイアウト
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ヘッダー */
.header {
  height: 56px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 地図折りたたみボタン */
.map-toggle-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-highlight);
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.map-toggle-btn:hover {
  background: var(--accent);
  color: #0f172a;
}

/* カウントダウンタイマー & プログレスバー */
.timer-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  position: relative;
}

.timer-display {
  font-size: 12px;
  color: var(--accent);
  font-family: monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-info-icon {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.timer-info-icon:hover {
  color: var(--accent);
}

.timer-tooltip-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 280px;
  background: #1e293b;
  border: 1px solid var(--border-highlight);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.timer-tooltip-popup.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.timer-progress-bg {
  width: 100px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.timer-progress {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 1s linear;
}

/* 管理者フィルターボタン */
.operator-filter-group {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.operator-btn {
  padding: 3px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.operator-btn.active {
  background: var(--accent);
  color: #0f172a;
  font-weight: 600;
}

/* ステータスバー */
.status-bar {
  height: 26px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

/* メインコンテンツエリア */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* マップエリア */
.map-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  height: 100%;
  transition: flex 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
  min-width: 0;
  min-height: 0;
}

.map-wrapper.collapsed {
  flex: 0 0 0px !important;
  width: 0 !important;
  overflow: hidden !important;
}

#map {
  flex: 1;
  height: 100%;
  width: 100%;
  background: #0f172a;
}

/* サイドバー開閉トグルボタン */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 24px;
  height: 60px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
  transition: background 0.2s, color 0.2s;
}

.sidebar-toggle:hover {
  background: var(--accent);
  color: #0f172a;
}

/* サイドバー（右側カメラ画像列） */
.sidebar {
  width: 420px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), flex 0.3s ease;
  overflow: hidden;
  min-height: 0;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-left: none;
}

.main-content.map-is-collapsed .sidebar {
  flex: 1;
  width: 100%;
  max-width: none;
}

.sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-count {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

/* 検索フォーム */
.sidebar-search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

#search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

#search-input::placeholder {
  color: var(--text-secondary);
}

/* ==========================================================================
   蛇腹アコーディオン構造 & スクロール修正
   ========================================================================== */

.camera-list {
  flex: 1;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.accordion-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.4);
  overflow: hidden;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.accordion-group:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.accordion-group[data-group-id="group_fav"] {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.05);
}

.accordion-header {
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: rgba(30, 41, 59, 0.9);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.accordion-group[data-group-id="group_fav"] .accordion-title {
  color: var(--fav-gold);
}

.group-count-badge {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 400;
}

.accordion-arrow {
  font-size: 11px;
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.accordion-group.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 10px;
  flex-direction: column;
  gap: 10px;
}

.accordion-group.open .accordion-body {
  display: flex;
}

/* ★★★ 地図折りたたみ（全画面モード）時のグリッド表示設定 ★★★ */
.main-content.map-is-collapsed .accordion-group.open .accordion-body {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)) !important;
  gap: 12px !important;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  display: none;
}

/* ==========================================================================
   フィルターボタン
   ========================================================================== */

.filter-group {
  display: flex;
  gap: 6px;
}

.filter-btn {
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-btn:hover {
  border-color: var(--text-secondary);
}

.filter-btn.active[data-category="river"] {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--river);
  color: var(--accent);
}

.filter-btn.active[data-category="road"] {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--road);
  color: var(--road);
}

.filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* ==========================================================================
   カメラカード & お気に入りボタン
   ========================================================================== */

.camera-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.camera-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  border-color: var(--border-highlight);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* お気に入りボタン */
.fav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.2s, transform 0.2s;
}

.fav-btn:hover {
  transform: scale(1.2);
  color: var(--fav-gold);
}

.fav-btn.active {
  color: var(--fav-gold);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 6px;
}

.card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-river { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-road { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-coast { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.badge-other { background: rgba(167, 139, 250, 0.15); color: #c084fc; }

.card-preview {
  height: 120px;
  background: #090d16;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.card-placeholder i {
  font-size: 24px;
  opacity: 0.5;
}

.card-placeholder span {
  font-size: 10px;
}

.card-info {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.card-operator {
  display: block;
}

.card-actions {
  display: flex;
}

.btn-source {
  flex: 1;
  padding: 5px 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  color: var(--accent);
  font-size: 10px;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-source:hover {
  background: rgba(56, 189, 248, 0.2);
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(248, 81, 73, 0.8);
}

.modal-body {
  padding: 20px;
}

.modal-image {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 16px;
  background: #090d16;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-image img {
  width: 100%;
  border-radius: 10px;
}

.modal-details {
  margin-bottom: 16px;
}

.modal-detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.modal-detail-label {
  width: 110px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.modal-detail-value {
  flex: 1;
}

.btn-modal-source {
  flex: 1;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-modal-source:hover {
  background: var(--accent-hover);
  color: white;
}

/* マーカー */
.custom-marker {
  background: none;
  border: none;
}

.marker-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  cursor: pointer;
}

.marker-icon i {
  transform: none;
  font-size: 10px;
}

.marker-icon:hover {
  transform: scale(1.35);
  border-color: #f59e0b;
}

/* Leaflet ポップアップ */
.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-tip {
  background: var(--bg-secondary) !important;
}

.popup-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.popup-category {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.popup-btn {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent);
  color: #0f172a;
  font-weight: 600;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  border: none;
}

.popup-btn:hover {
  background: var(--accent-hover);
  color: white;
}

/* フッター */
.app-footer {
  height: 28px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 16px;
}

.footer-sources span {
  color: var(--text-primary);
}

/* スクロールバーのカスタマイズ */
.camera-list::-webkit-scrollbar {
  width: 6px;
}

.camera-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 3px;
}

.camera-list::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 3px;
}

.camera-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ==========================================================================
   広域表示（引きの縮尺）用コンパクトドットスタイル（カメラ・水位完全共通）
   ========================================================================== */
.leaflet-container.zoom-low .marker-wrapper,
.leaflet-container.zoom-low .water-level-marker-wrapper {
  transform: none !important;
}

.leaflet-container.zoom-low .custom-marker,
.leaflet-container.zoom-low .water-level-marker-wrapper {
  width: 12px !important;
  height: 12px !important;
}

.leaflet-container.zoom-low .marker-icon,
.leaflet-container.zoom-low .water-level-marker-icon {
  width: 10px !important;
  height: 10px !important;
  border-radius: 50% !important;
  transform: none !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.6) !important;
  margin: 0 !important;
}

.leaflet-container.zoom-low .marker-icon i,
.leaflet-container.zoom-low .water-level-marker-icon i {
  display: none !important;
}

.leaflet-container.zoom-low .marker-icon:hover,
.leaflet-container.zoom-low .water-level-marker-icon:hover {
  transform: scale(1.4) !important;
}

/* ==========================================================================
   双方向連動用 ハイライト＆ネオン拡大スタイル
   ========================================================================== */
.marker-active {
  z-index: 9999 !important;
}

.marker-active .marker-icon {
  transform: scale(1.8) rotate(-45deg) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 15px #f59e0b, 0 0 25px #ef4444 !important;
}

.leaflet-container.zoom-low .marker-active .marker-icon {
  width: 18px !important;
  height: 18px !important;
  transform: scale(1.6) !important;
  background-color: #ff3366 !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 12px #ff3366, 0 0 20px #f59e0b !important;
}

.camera-card {
  transition: all 0.3s ease;
}

.camera-card.card-highlight {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.5) !important;
  background: rgba(56, 189, 248, 0.15) !important;
  transform: translateY(-2px);
}

/* ==========================================================================
   ホバー用コンパクト画像ポップアップ
   ========================================================================== */
.hover-popup {
  cursor: pointer;
  text-align: center;
  padding: 4px;
}

.hover-popup-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.hover-popup-img {
  width: 190px;
  height: 115px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.hover-popup-noimg {
  width: 190px;
  height: 60px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
}

.hover-popup-hint {
  font-size: 10px;
  color: var(--accent);
  margin-top: 6px;
  font-weight: 600;
}

/* ==========================================================================
   水位観測所 丸型ネオンポイント（◯）スタイル
   ========================================================================== */
.water-level-marker-icon {
  width: 22px;
  height: 22px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8), 0 0 16px rgba(4, 120, 87, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 11px;
  transition: all 0.25s ease;
  cursor: pointer;
}

.water-level-marker-icon:hover {
  transform: scale(1.35);
  box-shadow: 0 0 18px #10b981, 0 0 25px #047857;
  border-color: #f59e0b;
}

/* 大画面モーダル用 iframe スタイル */
.modal-iframe-container {
  width: 100%;
  height: 520px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #ffffff;
  position: relative;
}

.modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
}





/* ==========================================================================
   スマートフォン対応（レスポンシブ化）
   ========================================================================== */

/* デフォルト（PC）ではボトムタブバーを非表示 */
.bottom-tab-bar {
  display: none;
}

@media (max-width: 768px) {
  /* スマホ版: サイドバーを全幅に */
  .sidebar {
    width: 100%;
    border-left: none;
    z-index: 1000;
  }

  /* 「地図を隠す」ボタンはボトムタブがあるためヘッダーから消す */
  .map-toggle-btn {
    display: none;
  }

  /* ボトムタブバーの表示 */
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
  }

  .tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
  }
  
  .tab-btn i {
    font-size: 20px;
  }

  .tab-btn.active {
    color: var(--accent);
  }

  /* メインコンテンツの高さをタブバー分減らす */
  .app-container {
    height: calc(100vh - 60px);
  }
  
  /* スマホ時の切り替えロジック（JSと連動） */
  .main-content.show-map .sidebar {
    display: none;
  }
  .main-content.show-list .map-wrapper {
    display: none;
  }
  .main-content.show-list .sidebar {
    display: flex;
  }

  /* モーダルのスマホ最適化 */
  .modal-content {
    width: 95%;
    max-height: 90vh;
    padding: 16px;
  }
  
  .modal-image {
    min-height: 200px;
  }

  /* フィルターボタンスクロール化 */
  .header-right {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

/* ==========================================================================
   第3版改修：タイトル、エリア選択、スマホUI最適化
   ========================================================================== */

/* エリア選択ボタン */
.area-select-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-right: 8px;
}
.area-select-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* エリア選択モーダル */
.area-modal-content {
  max-width: 400px;
}
.area-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.area-option-btn {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.area-option-btn:hover {
  background: var(--bg-card-hover);
}
.area-option-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* タイトルの表示切替（デフォルトはPC） */
.title-sp { display: none; }
.title-pc { display: inline; }

/* ==========================================================================
   スマホ用表示のオーバーライド（第3版改修）
   ========================================================================== */
@media (max-width: 768px) {
  /* スマホ時は短いタイトルにする */
  .title-pc { display: none; }
  .title-sp { display: inline; font-size: 15px; }

  /* フィルターボタンの文字を消す（アイコンのみ） */
  .filter-text { display: none; }
  .filter-btn { padding: 5px 8px; }
  
  /* スマホの初期表示は「地図のみ」にするためサイドバーを強制非表示 */
  .sidebar {
    display: none !important; 
  }
  /* ただし、タブで「リスト(show-list)」が選ばれた時は表示する */
  .main-content.show-list .sidebar {
    display: flex !important;
  }
}

/* ==========================================================================
   第4版改修：使い方・凡例ボタン
   ========================================================================== */
.info-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.info-btn:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   スマート・ポップアップ用設定
   ========================================================================== */
.custom-smart-popup .leaflet-popup-tip-container {
  display: none !important; /* ピンの尻尾（三角形）を非表示にしてズレをごまかす */
}
.custom-smart-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ==========================================================================
   気象警報・注意報 リアルタイムバー
   ========================================================================== */
.weather-alert-bar {
  background: var(--bg-tertiary, #1e293b);
  border-bottom: 1px solid var(--border-color, #334155);
  padding: 6px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}
.weather-alert-bar::-webkit-scrollbar {
  height: 3px;
}
.weather-alert-bar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}
.weather-alert-loading {
  color: var(--text-secondary, #94a3b8);
  font-size: 12px;
}
.weather-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.weather-area-name {
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
}
.weather-badge {
  font-size: 11px;
  font-weight: bold;
  padding: 2px 7px;
  border-radius: 4px;
}
.weather-badge.warning-danger {
  background: #ef4444;
  color: #ffffff;
  animation: pulse-danger 2s infinite;
}
.weather-badge.warning-caution {
  background: #f59e0b;
  color: #000000;
}
.weather-badge.warning-none {
  background: #475569;
  color: #cbd5e1;
}

@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   危険水位観測所：常時目立つ波紋リング＆常時表示タグ（マウスホバー不要）
   ========================================================================== */
.water-level-marker-icon.station-danger {
  background-color: #ef4444 !important;
  border-color: #ffffff !important;
  animation: station-pulse-danger 1.5s infinite !important;
  z-index: 1000;
}

.water-level-marker-icon.station-warning {
  background-color: #f59e0b !important;
  border-color: #ffffff !important;
  animation: station-pulse-warning 1.8s infinite !important;
  z-index: 900;
}

.water-level-marker-icon.station-normal {
  background-color: #10b981 !important;
}

@keyframes station-pulse-danger {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.9), 0 0 8px #ef4444;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0), 0 0 20px #ef4444;
    transform: scale(1.25);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 0 8px #ef4444;
    transform: scale(1);
  }
}

@keyframes station-pulse-warning {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.9), 0 0 8px #f59e0b;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(245, 158, 11, 0), 0 0 18px #f59e0b;
    transform: scale(1.2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0), 0 0 8px #f59e0b;
    transform: scale(1);
  }
}

/* 常時表示の危険通知タグ（マウスを当てなくても常時表示） */
.always-visible-alert-tag {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  pointer-events: none;
  z-index: 1001;
}

.always-visible-alert-tag.danger-tag {
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #ffffff;
  animation: tag-bounce 1.5s infinite;
}

.always-visible-alert-tag.warning-tag {
  background: #f59e0b;
  color: #000000;
  border: 1px solid #ffffff;
}

@keyframes tag-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}


/* ==========================================================================
   スマートツールチップ（Leaflet標準白背景を完全不透明ダークカードへ）
   ========================================================================== */
.leaflet-tooltip.custom-smart-tooltip {
  background: #1e293b !important;
  border: 1px solid #475569 !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7) !important;
  color: #ffffff !important;
  padding: 8px 10px !important;
  opacity: 1 !important;
  font-family: inherit !important;
}

.leaflet-tooltip-top.custom-smart-tooltip::before { border-top-color: #1e293b !important; }
.leaflet-tooltip-bottom.custom-smart-tooltip::before { border-bottom-color: #1e293b !important; }
.leaflet-tooltip-left.custom-smart-tooltip::before { border-left-color: #1e293b !important; }
.leaflet-tooltip-right.custom-smart-tooltip::before { border-right-color: #1e293b !important; }

.hover-popup {
  cursor: pointer;
  text-align: left;
  padding: 0;
  min-width: 210px;
  max-width: 240px;
  background: transparent !important;
}
