/* 地図ページ専用スタイル（ビルド不要の素のCSS）。配色はapp.cssのテーマ値に合わせる。 */
:root {
  --map-header-h: 3.8rem;
  --map-nav-h: 4rem;
  --map-accent: #c2410c;
  --map-accent-dark: #b13f12;
  --map-brand: #244d7a;
  --map-ink: #1f2933;
  --map-line: #d8dee6;
}

.map-main { width: 100%; padding: 0; }

.map-app {
  position: relative;
  height: calc(100dvh - var(--map-header-h) - var(--map-nav-h));
  min-height: 24rem;
  overflow: hidden;
}

.map-stage { position: absolute; inset: 0; background: #e9eef3; }
.map-canvas { position: absolute; inset: 0; }

/* モバイルは地図全面。フッターは非表示（免責は結果パネル側）。デスクトップは下に残す。 */
@media (max-width: 1023.98px) {
  main#main ~ footer { display: none; }
  .map-panel { display: none; }
}

/* 上部フィルタ行 */
.map-filter {
  position: absolute; z-index: 5; top: 0.5rem; left: 0.5rem; right: 0.5rem;
  max-width: 34rem;
  border: 1px solid var(--map-line); border-radius: 0.5rem; background: #fff;
  box-shadow: 0 1px 4px rgba(16, 36, 59, 0.2);
}
.map-filter > details > summary {
  display: flex; min-height: 2.75rem; cursor: pointer; align-items: center;
  justify-content: space-between; gap: 0.5rem; padding: 0 0.75rem; list-style: none;
}
.map-filter summary::-webkit-details-marker { display: none; }
.map-filter summary::after { content: "▾"; color: var(--map-brand); }
.map-filter details[open] > summary::after { content: "▴"; }
.map-count { font-size: 0.875rem; font-weight: 700; color: var(--map-accent-dark); margin-left: auto; }
.map-filter-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.5rem;
  border-top: 1px solid var(--map-line); padding: 0.5rem 0.75rem 0.75rem;
}
.map-filter-body .field-label { margin-bottom: 0.125rem; font-size: 0.75rem; }
.map-filter-body .field { min-height: 2.75rem; padding: 0.25rem 0.5rem; font-size: 0.9375rem; }
.map-filter-body { max-height: calc(100dvh - 9rem); overflow-y: auto; }
.map-advanced > summary {
  display: flex; min-height: 2.75rem; cursor: pointer; align-items: center; justify-content: space-between;
  gap: 0.5rem; list-style: none; font-size: 0.875rem; font-weight: 700; color: var(--map-brand);
}
.map-advanced-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding-top: 0.25rem; }
.map-checks { min-width: 0; margin: 0; padding: 0; border: 0; }
.map-check-row { display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.map-check-scroll { max-height: 11rem; overflow-y: auto; }
.map-check { display: inline-flex; min-height: 2.75rem; align-items: center; gap: 0.375rem; font-size: 0.875rem; }
.map-check input { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.map-note { font-size: 0.8125rem; color: #52606d; }
.col-span-full { grid-column: 1 / -1; }

/* 地図上の部品 */
.map-fab {
  position: absolute; z-index: 4; left: 50%; bottom: 2rem; transform: translateX(-50%);
  box-shadow: 0 2px 8px rgba(16, 36, 59, 0.35); white-space: nowrap;
}
.map-fab:hover { transform: translateX(-50%); }
.map-attribution {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; margin: 0;
  padding: 0.125rem 0.5rem; background: rgba(255, 255, 255, 0.88);
  font-size: 0.6875rem; line-height: 1.4; text-align: right; color: #3e4c59;
}
.map-attribution a { color: #1b3d63; text-decoration: underline; }
.map-stage .maplibregl-ctrl-bottom-right { bottom: 1.4rem; }
@media (max-width: 479.98px) {
  .map-stage .maplibregl-ctrl-bottom-right { bottom: 2.6rem; }
  .map-fab { bottom: 3rem; }
}
.map-fallback {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.75rem; padding: 1rem;
  background: #f5f7fa; text-align: center;
}
.map-fallback[hidden] { display: none; }

/* 選択物件のボトムシート（モバイル）。画面下へ全幅で寄せ、1行分の高さに収める。 */
.map-sheet {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 1.4rem;
  border-top: 2px solid var(--map-line); background: #fff; box-shadow: 0 -2px 8px rgba(16, 36, 59, 0.18);
}
.map-sheet[hidden] { display: none; }
.map-sheet .sheet-close {
  position: absolute; top: -1.875rem; right: 0.3125rem; display: inline-flex; align-items: center; gap: 0.25rem;
  min-height: 1.875rem; padding: 0 0.75rem; border: 0; border-radius: 0.3125rem 0.3125rem 0 0;
  background: #fff; color: #1b5fa8; font-size: 0.8125rem; cursor: pointer; box-shadow: 0 -2px 6px rgba(16, 36, 59, 0.12);
}
.map-sheet .sheet-row { display: flex; gap: 0.625rem; padding: 0.625rem; color: inherit; text-decoration: none; }
.map-sheet .sheet-row:focus-visible { outline: 2px solid var(--map-accent); outline-offset: -2px; }
.map-sheet .sheet-image { flex: none; width: 5.125rem; height: 5.125rem; object-fit: cover; border-radius: 0.25rem; background: #e9eef3; }
.map-sheet .sheet-body { min-width: 0; flex: 1; }
.map-sheet .sheet-body p { margin: 0; }
.map-sheet .sheet-price { font-size: 1.125rem; font-weight: 800; color: var(--map-accent-dark); line-height: 1.3; }
.map-sheet .sheet-price-note { margin-left: 0.375rem; font-size: 0.6875rem; font-weight: 400; color: #52606d; }
.map-sheet .sheet-meta, .map-sheet .sheet-address { font-size: 0.75rem; line-height: 1.4; color: #323f4b; }
.map-sheet .sheet-address { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-sheet .sheet-badges { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.125rem; }
.map-sheet .sheet-badges .badge { font-size: 0.6875rem; padding: 0 0.375rem; }
.map-sheet .map-approx { margin: 0.125rem 0 0; font-size: 0.6875rem; }
@media (max-width: 479.98px) {
  .map-sheet { bottom: 2.6rem; }
}
/* シート表示中は一覧FABを隠し、ズーム操作をシートの上へ逃がす。 */
.map-stage:has(.map-sheet:not([hidden])) .map-fab { display: none; }
.map-stage:has(.map-sheet:not([hidden])) .maplibregl-ctrl-bottom-right { bottom: 14rem; }
.map-list .item-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0.375rem; background: #e9eef3; margin-bottom: 0.375rem; }
.map-list li { position: relative; cursor: pointer; }
.map-list .item-link::before { content: ""; position: absolute; inset: 0; border-radius: 0.5rem; }
.map-list .item-actions .btn:not(.item-link) { position: relative; z-index: 1; }
.map-approx { margin: 0.25rem 0; font-size: 0.8125rem; font-weight: 700; color: #8a4b00; }

/* 価格ラベル・クラスタ（HTMLマーカー） */
.map-pin {
  position: relative; isolation: isolate; display: block; margin: 0; padding: 0.125rem 0.5rem 0.25rem;
  border: 2px solid var(--map-accent); border-radius: 0.5rem; background: #fff; color: var(--map-accent-dark);
  font: 800 0.8125rem/1.3 system-ui, sans-serif; white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 36, 59, 0.35);
}
.map-pin::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 0.5rem; height: 0.5rem; margin-left: -0.25rem; margin-top: -0.3rem;
  background: #fff; border-right: 2px solid var(--map-accent); border-bottom: 2px solid var(--map-accent); transform: rotate(45deg); z-index: -1;
}
.map-pin-price, .map-pin-detail { display: block; text-align: center; }
.map-pin-detail { font-size: 0.6875rem; font-weight: 700; color: #3e4c59; line-height: 1.2; }
.map-pin[data-selected="true"] .map-pin-detail, .map-pin:focus-visible .map-pin-detail { color: #fff; }
.map-pin[data-approx="true"] { border-style: dashed; }
.map-pin[data-approx="true"]::after { border-right-style: dashed; border-bottom-style: dashed; }
.map-pin[data-selected="true"], .map-pin:focus-visible { background: var(--map-accent); color: #fff; z-index: 2; }
.map-pin[data-selected="true"]::after, .map-pin:focus-visible::after { background: var(--map-accent); }
.map-cluster {
  display: flex; align-items: center; justify-content: center; border: 3px solid #fff; border-radius: 9999px;
  background: var(--map-brand); color: #fff; font: 800 0.875rem/1 system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 1px 4px rgba(16, 36, 59, 0.5);
}

/* 結果パネル（デスクトップ） */
@media (min-width: 1024px) {
  .map-main { max-width: 96rem; margin: 0 auto; padding: 1rem; }
  .map-app {
    display: grid; grid-template-columns: minmax(0, 1fr) 24rem; grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - 9rem); min-height: 32rem; gap: 0.75rem; overflow: visible;
  }
  .map-filter { position: static; grid-column: 1 / -1; max-width: none; box-shadow: none; }
  .map-filter > details > summary { cursor: default; pointer-events: none; }
  .map-filter > details > summary::after { content: none; }
  .map-filter-body { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; border-top: 0; align-items: end; max-height: none; overflow: visible; }
  .map-advanced-body { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-stage { position: relative; inset: auto; grid-row: 2; border: 1px solid var(--map-line); border-radius: 0.5rem; overflow: hidden; }
  .map-fab { display: none; }
  .map-panel {
    display: flex; flex-direction: column; grid-row: 2; min-height: 0; gap: 0.5rem; padding: 0.75rem;
    overflow-y: auto; border: 1px solid var(--map-line); border-radius: 0.5rem; background: #fff;
  }
  .map-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
}
.map-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.map-list li {
  padding: 0.5rem; border: 1px solid var(--map-line); border-radius: 0.5rem; background: #fff;
}
.map-list li[data-selected="true"] { border-color: var(--map-accent); box-shadow: 0 0 0 2px rgba(212, 80, 26, 0.35); }
.map-list .item-price { font-size: 1.125rem; font-weight: 800; color: var(--map-accent-dark); }
.map-list .item-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.map-list .item-actions .btn { min-height: 2.75rem; }

.map-locate {
  position: absolute; z-index: 4; right: 0.5rem; top: 4.25rem; display: inline-flex; align-items: center; gap: 0.375rem;
  min-height: 2.75rem; padding: 0 0.875rem; border: 1px solid var(--map-line); border-radius: 999px; background: #fff;
  font: inherit; font-size: 0.875rem; font-weight: 700; color: #1b3d63; box-shadow: 0 1px 4px rgba(16, 36, 59, 0.25); cursor: pointer;
}
.map-locate[hidden] { display: none; }
.map-toast {
  position: absolute; z-index: 5; left: 50%; top: 7.5rem; transform: translateX(-50%); max-width: calc(100% - 1.5rem);
  margin: 0; padding: 0.625rem 0.875rem; border-radius: 0.5rem; background: #10243b; color: #fff;
  font-size: 0.875rem; font-weight: 700; box-shadow: 0 2px 8px rgba(16, 36, 59, 0.35);
}
.map-toast[hidden] { display: none; }
@media (min-width: 64rem) { .map-toast { top: 3.75rem; } }
.map-user-dot { width: 16px; height: 16px; border-radius: 50%; background: #1d4ed8; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.35); }
@media (min-width: 64rem) { .map-locate { top: 0.5rem; } }
