/* =====================================================
   業務用Webマップ - スタイルシート
   方針: 業務ソフト風。落ち着いた配色。派手さは不要。
   ===================================================== */

/* --- リセット・基本設定 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: "Meiryo", "メイリオ", "Yu Gothic", sans-serif;
  font-size: 13px;
  color: #333;
  background: #e8e8e8;
}

/* --- 全体レイアウト: 左パネル | 地図 | 右パネル --- */
body {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* =====================================================
   左パネル
   ===================================================== */
#left-panel {
  width: 240px;
  min-width: 240px;
  background: #fff;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

/* =====================================================
   右パネル
   ===================================================== */
#right-panel {
  width: 260px;
  min-width: 260px;
  background: #fff;
  border-left: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

/* =====================================================
   パネル共通パーツ
   ===================================================== */

/* パネル上部ヘッダー */
.panel-header {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* セクション区切り */
.panel-section {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
}

/* セクションタイトル */
.section-title {
  font-size: 11px;
  color: #777;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

/* タイトルと解除ボタンを横並びにするラッパー
   section-title の border-bottom / margin-bottom をラッパー側で担う */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

/* ラッパー内では section-title 自身の下余白・ボーダーを無効化して重複を防ぐ */
.section-header-row .section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* 選択解除ボタン */
.btn-clear-selection {
  font-size: 11px;
  color: #c0392b;
  background: #fff;
  border: 1px solid #e0a0a0;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 2px;
}

.btn-clear-selection:hover {
  background: #ffe8e8;
  border-color: #c0392b;
}

/* =====================================================
   検索
   ===================================================== */
.search-input {
  width: 100%;
  padding: 5px 7px;
  font-size: 12px;
  border: 1px solid #bbb;
  background: #fafafa;
  color: #333;
  outline: none;
  margin-bottom: 5px;
}

.search-input:focus {
  border-color: #5a7fa8;
  background: #fff;
}

/* アクションボタン: 業務ソフト風の控えめなボタン */
.btn-action {
  display: block;
  width: 100%;
  padding: 5px 0;
  background: #5a7fa8;
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.btn-action:hover {
  background: #4a6f98;
}

/* 検索結果メッセージの共通レイアウト（色はis-success / is-errorで上書きする） */
.search-result-text {
  margin-top: 6px;
  font-size: 11px;
  min-height: 18px;
  padding: 3px 6px;
  line-height: 1.4;
}

/* 検索成功 */
.search-result-text.is-success {
  color: #1e5e22;
  background: #eaf4ea;
  border-left: 3px solid #4caf50;
}

/* 未検出・エラー */
.search-result-text.is-error {
  color: #8b1a08;
  background: #fdecea;
  border-left: 3px solid #c0392b;
}

/* =====================================================
   背景地図切替ラジオボタン
   ===================================================== */
.radio-row {
  display: flex;
  align-items: center;
  gap: 6px;
  /* padding-left を広めに取り、選択時の左ボーダーでレイアウトがずれないようにする */
  padding: 4px 4px 4px 9px;
  font-size: 12px;
  cursor: pointer;
  color: #444;
  border-left: 3px solid transparent;  /* 非選択時は透明で幅を確保 */
}

.radio-row:hover {
  background: #f5f5f5;
  color: #2c3e50;
}

/* 選択中の背景地図ラベルを強調表示 */
.radio-row:has(input:checked) {
  background: #eaf0f8;
  color: #1a3a5c;
  font-weight: bold;
  border-left-color: #5a7fa8;
}

/* =====================================================
   レイヤ管理
   ===================================================== */

/* レイヤグループ: 分類見出し + その配下のレイヤ行をまとめる単位 */
.layer-group {
  margin-bottom: 6px;
}

/* レイヤ分類見出し: セクションタイトルより小さく、補助的な位置づけ */
.layer-group-title {
  font-size: 10px;
  color: #aaa;
  letter-spacing: 0.05em;
  padding: 4px 0 3px 0;
  border-bottom: 1px dotted #e0e0e0;
  margin-bottom: 3px;
}

.layer-row {
  padding: 4px 0;
}

.layer-row-sub {
  padding-left: 12px;
}

/* 開閉式ツリー（公共基準点など） */
.layer-tree {
  margin: 0;
  padding: 0;
  border: none;
}

.layer-tree-title {
  font-size: 12px;
  color: #444;
  padding: 4px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.layer-tree-title::-webkit-details-marker {
  display: none;
}

.layer-tree-title::before {
  content: '▶ ';
  font-size: 12px;
  color: #555;
}

.layer-tree[open] .layer-tree-title::before {
  content: '▼ ';
}

.layer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #444;
}

.layer-label:hover {
  color: #2c3e50;
}


/* レイヤ凡例シンボル（基底クラス）
   ポリゴン用 .layer-symbol-polygon や点用 .layer-symbol-point と組み合わせて使う */
.layer-symbol {
  display: inline-block;
  width: 14px;
  height: 10px;
  flex-shrink: 0;
}

/* ポリゴンレイヤ用シンボル（塗り＋輪郭の矩形） */
.layer-symbol-polygon {
  background: rgba(255, 255, 0, 0.35);
  border: 1px solid #cc0000;
}

/* 地番図レイヤ用シンボル（青系で筆界の黄色・赤と区別する） */
.layer-symbol-polygon-chiban {
  background: rgba(100, 180, 255, 0.45);
  border: 1px solid #1a5fa0;
}

/* 点レイヤ用シンボル（円形）
   公共基準点など点データのレイヤ行で使う。
   width/height を上書きして正方形にしてから border-radius で円形にする。 */
.layer-symbol-point {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5a7fa8;
  border: 1.5px solid #2c5f8a;
}

/* 透明度スライダー行 */
.layer-opacity-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0 4px 0;
}

.opacity-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

.layer-opacity-row input[type="range"] {
  flex: 1;
  height: 3px;
  cursor: pointer;
  accent-color: #5a7fa8;
}

/* =====================================================
   中央：地図コンテナ
   ===================================================== */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* MapLibre のデフォルトコントロールを業務ソフト風に調整 */
.maplibregl-ctrl-group {
  border-radius: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

.maplibregl-ctrl-group button {
  border-radius: 0 !important;
}

/* =====================================================
   右パネル：属性情報
   ===================================================== */

/* 地物未選択時のプレースホルダーテキスト */
.attr-placeholder {
  color: #aaa;
  font-size: 12px;
  line-height: 1.7;
  padding: 4px 0;
}

/* 属性表示上部のレイヤ由来ラベル（どのレイヤの地物かを示す） */
.attr-layer-label {
  font-size: 11px;
  color: #5a7fa8;
  font-weight: bold;
  letter-spacing: 0.05em;
  padding: 2px 0 6px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid #e0e0e0;
}

/* 属性テーブル */
.attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.6;   /* 行間を広げて複数行でも読みやすくする */
}

.attr-table th,
.attr-table td {
  text-align: left;
  padding: 6px 8px;   /* 余白を少し広げて窮屈さを解消 */
  border-bottom: 1px solid #eee;
  vertical-align: top;
  overflow-wrap: anywhere;  /* break-all を廃止。必要なときだけ折り返す */
}

/* 属性名（th）: やや小さめのラベル文字として区別する */
.attr-table th {
  font-size: 11px;
  color: #888;
  font-weight: normal;
  letter-spacing: 0.03em;
  width: 72px;
  min-width: 72px;
  background: #f5f5f5;
}

/* 属性値（td）: th より少し濃くして値として読みやすくする */
.attr-table td {
  color: #222;
}

/* 正式値未登録の属性値。実測値との混同を防ぐために斜体・薄色で表示する */
.attr-unregistered {
  color: #bbb;
  font-style: italic;
  font-size: 11px;
}

/* 主要情報テーブル: 下に少し間隔を空ける */
.attr-primary {
  margin-bottom: 6px;
}

/* 折りたたみセクション */
.attr-section {
  border-top: 1px solid #e8e8e8;
  margin-top: 2px;
}

.attr-section-title {
  font-size: 11px;
  font-weight: bold;
  color: #5a7fa8;
  letter-spacing: 0.04em;
  padding: 5px 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.attr-section-title::before {
  content: '▶ ';
  font-size: 9px;
  color: #aaa;
}

.attr-section[open] > .attr-section-title::before {
  content: '▼ ';
}

/* =====================================================
   右パネル：出力（将来実装の受け皿）
   ===================================================== */

/* 出力形式ボタン 4列×2行グリッド */
.output-format-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 2px 0;
}

/* 出力形式タグ（SIMA / CSV / DXF / KML）
   クリック不可・操作不可であることをグレー表示で示す */
.output-format-tag {
  font-size: 11px;
  color: #bbb;
  background: #f5f5f5;
  border: 1px solid #ddd;
  padding: 2px 7px;
  letter-spacing: 0.04em;
  cursor: default;
  user-select: none;
}

/* 出力セクション内の選択中対象表示（showAttrContent から同期される） */
.output-target-label {
  font-size: 11px;
  color: #777;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px dotted #e0e0e0;
}

/* 未選択時: テキストを薄いグレーで表示 */
.output-target-label.is-empty {
  color: #bbb;
}

/* 出力ボタン共通ベース
   .btn-export-sima / csv-math / csv-survey / dxf / kml / geojson / jww / placeholder
   すべてこの構造を継承する */
.btn-export-sima,
.btn-export-csv-math,
.btn-export-csv-survey,
.btn-export-dxf,
.btn-export-kml,
.btn-export-geojson,
.btn-export-jww,
.btn-export-placeholder {
  font-size: 11px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  padding: 2px 7px;
  letter-spacing: 0.04em;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.btn-export-sima:disabled,
.btn-export-csv-math:disabled,
.btn-export-csv-survey:disabled,
.btn-export-dxf:disabled,
.btn-export-kml:disabled,
.btn-export-geojson:disabled,
.btn-export-jww:disabled,
.btn-export-placeholder:disabled {
  color: #bbb;
  cursor: default;
}

.btn-export-sima:not(:disabled),
.btn-export-csv-math:not(:disabled),
.btn-export-csv-survey:not(:disabled),
.btn-export-dxf:not(:disabled),
.btn-export-kml:not(:disabled),
.btn-export-geojson:not(:disabled),
.btn-export-jww:not(:disabled) {
  color: #2c5f8a;
  border-color: #5a7fa8;
  background: #eaf0f8;
  cursor: pointer;
}

.btn-export-sima:not(:disabled):hover,
.btn-export-csv-math:not(:disabled):hover,
.btn-export-csv-survey:not(:disabled):hover,
.btn-export-dxf:not(:disabled):hover,
.btn-export-kml:not(:disabled):hover,
.btn-export-geojson:not(:disabled):hover,
.btn-export-jww:not(:disabled):hover {
  background: #dce8f5;
}

/* 空き枠プレースホルダー：無地・枠線あり・操作不可 */
.btn-export-placeholder {
  background: #f5f5f5;
  border: 1px solid #ddd;
  cursor: default;
  pointer-events: none;
}

/* 出力セクションの補足説明文 */
.output-description {
  font-size: 11px;
  color: #bbb;
  font-style: italic;
  margin-top: 6px;
  line-height: 1.5;
}

/* =====================================================
   スクロールバー（Windows向けに細く整える）
   ===================================================== */
#left-panel::-webkit-scrollbar,
#right-panel::-webkit-scrollbar {
  width: 5px;
}

#left-panel::-webkit-scrollbar-track,
#right-panel::-webkit-scrollbar-track {
  background: #f0f0f0;
}

#left-panel::-webkit-scrollbar-thumb,
#right-panel::-webkit-scrollbar-thumb {
  background: #bbb;
}
