/******************************
 * /map (page-id:8170) 専用CSS 完全版
 * ギャル盛り：読みやすさ・押しやすさ・スクロール最適化
 ******************************/

/* === 全画面マップ＆リセット === */
html, body,
.page-id-8170 #map,
.page-id-8170 .content,
.page-id-8170 #main,
.page-id-8170 #primary {
  margin: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  box-sizing: border-box;
  overflow: hidden;
}

/* body固定（ページスクロール禁止） */
.page-id-8170 body {
  overflow: hidden;
}

/* マップdiv */
.page-id-8170 #map {
  display: block;
}

/* === ヘッダー/フッター類は非表示（全画面優先） === */
.mobile-footer-menu,
.navi-menu-button,
.mobile-menu,
.mobile-header-menu {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* === ロゴ調整 === */
img.custom-logo {
  width: 250px;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

/* =========================
   Leaflet ポップアップ系
   ========================= */

/* 外枠（PC幅ベース） */
.leaflet-popup-content-wrapper {
  width: auto;
  max-width: 960px;            /* ← PCでしっかり太めにしたいならここを上げる */
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* 中身：右だけ余白が出ないよう、マージン殺し＋左右均等の内側余白 */
.leaflet-popup-content {
  margin: 0 !important;        /* ← Leaflet既定の左右マージンを消すのがキモ */
  line-height: 1.7;
  font-size: 16px;
  letter-spacing: 0.2px;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px;          /* ← 均等な内側余白に（好みで 12〜18px） */
  box-sizing: border-box;
}

/* ★ここだけ変更：幅は“100%”で外枠にフィット、上限pxは外す */
.custom-popup {
  width: 100% !important;      /* ← 枠いっぱいに広がる */
  max-width: none !important;  /* ← 940px 上限は撤去（ズレ防止） */
  max-height: none !important;
  overflow: visible !important;  /* ← ここがポイント */
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.6;
}

/* 画像も“細すぎ”をやめて本文幅いっぱいに */
.leaflet-popup-content img,
.custom-popup img {
width: 400px;        /* ← 固定！ */
  max-width: 100%;     /* ← スマホで400px入らん時は縮小 */
  height: auto;
  display: block;
  margin: 6px auto 10px;
  border-radius: 6px;
}

/* 長いURLで横伸び→右余白発生を防止 */
.leaflet-popup-content a,
.custom-popup a {
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* タイトルやラベルの視認性UP */
.custom-popup .name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 6px;
}
.custom-popup .label {
  font-size: 14px;
  font-weight: bold;
  display: block;
  color: #444;
  margin: 6px 0 2px;
}
.custom-popup .address,
.custom-popup .classify,
.custom-popup .memo {
  font-size: 16px;
  margin: 4px 0 6px;
}

/* リンク：押しやすさ＆見やすさ */
.custom-popup a,
.leaflet-popup-content a {
  color: #0078d7;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0,120,215,0.5);
  padding: 2px 0; /* タップ面積UP */
}
.custom-popup a:hover,
.leaflet-popup-content a:hover {
  border-bottom-style: solid;
}

.custom-popup .gmap-link { font-size: 14px; }
.custom-popup .blog-link { font-size: 16px; }

/* 画像：角丸＆ゆとり */
.custom-popup img,
.leaflet-popup-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 6px auto 10px;
  border-radius: 6px;
}

/* 駅用の小型ポップアップ（固定高さ→柔軟に） */
.custom-popup-station {
  width: 250px;
  max-height: 180px;   /* 固定ではなく上限に */
  overflow-y: auto;
  font-size: 16px;
  line-height: 1.5;
}
.custom-popup-station .name { font-size: 18px; }

/* 閉じるボタン：指でも押しミスらんサイズに */
.leaflet-popup-close-button {
  font-size: 30px !important;
  width: 44px !important;      /* iOS/Androidガイドの最小タップ領域 */
  height: 44px !important;
  line-height: 42px !important;
  text-align: center !important;
  padding: 0 !important;
  margin: 0 !important;
  color: #333 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  position: absolute !important;
  top: 6px !important;
  right: 6px !important;
  z-index: 10000 !important;
}
.leaflet-popup-close-button:hover { opacity: 1; }

/* =========================
   CTA/広告ボタン
   ========================= */
.tabelog, .jalan, .rakuten {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  text-decoration: none;
  border: 1px solid #000;
  border-radius: 8px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.tabelog { background-color: #FFAA00; }
.jalan  { background-color: #FF7A15; }
.rakuten{ background-color: #00B900; }
.tabelog a, .jalan a, .rakuten a { color: #fff !important; }

.support-link-mid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ffe066;
  color: #222;
  border: 1px solid #e0b100;
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  transition: background .3s, color .3s;
}
.support-link-mid:hover { background-color: #ffcc00; color: #000; }

/* =========================
   レイヤー類
   ========================= */
.hidden-layers {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.leaflet-control-layers-overlays {
  column-count: 2;
  column-gap: 10px;
  max-height: 400px;
  width: 400px;
  overflow-y: auto;
  row-gap: 6px;
  padding-right: 6px; /* スクロールバー逃がし */
}
.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
  font-size: 18px;
  font-weight: 500;
  line-height: 2.0;
}

.custom-layers-panel {
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* フォーカス見える化（アクセシビリティ） */
a:focus-visible, button:focus-visible, .leaflet-interactive:focus-visible {
  outline: 2px solid rgba(0,120,215,.6);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Leafletインタラクティブ既定のアウトラインは無効化 */
.leaflet-interactive:focus {
  outline: none;
  box-shadow: none;
}

/* =========================
   スポット追加フォーム
   ========================= */
#add-spot-form {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid #aaa;
  z-index: 9999;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  width: 90vw;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.0;
  padding: 16px;
}
#add-spot-form h3 {
  margin: 0 0 5px;
  font-size: 15px;
  text-align: center;
}
#add-spot-form label {
  display: block;
  margin: 1px 0 0px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.0;
}
#add-spot-form input,
#add-spot-form textarea,
#add-spot-form select {
  width: 100%;
  padding: 2px 4px;
  margin: 0 0 2px;
  box-sizing: border-box;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 3px;
}
#add-spot-form textarea {
  resize: vertical;
  min-height: 48px;
}
#add-spot-form button {
  padding: 5px 10px;
  margin: 6px 4px 0 0;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  background-color: #0078d7;
  color: #fff;
  cursor: pointer;
}
#add-spot-form button#cancel-spot { background-color: #aaa; }
#add-spot-form p {
  font-size: 12px;
  color: #555;
  margin-top: 6px;
}

/* =========================
   検索ボックス
   ========================= */
#search-container {
  background-color: #f0f8ff;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: none;
  box-shadow: none;
}
#search-box {
  width: 100%;
  padding: 10px 8px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #ffffff;
  color: #333;
}
#search-box:focus {
  outline: none;
  border-color: #0078d7;
  box-shadow: 0 0 4px rgba(0,120,215,0.4);
}
#search-button {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  background-color: #0078d7;
  color: white;
  border: none;
  border-radius: 6px;
  margin-top: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
#search-button:hover { background-color: #005fa3; }
#search-results-wrapper {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-top: 6px;
}
#search-results li:hover { background-color: #f0f8ff; }
#close-results {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #888;
}
#close-results:hover { color: #000; }

/* =========================
   画像モーダル
   ========================= */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
}
.modal-gallery {
  position: relative;
  width: 100%;
  height: 100%;
}
.modal-slide {
  position: absolute;
  max-width: 90%;
  max-height: 90%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}
.modal button.prev,
.modal button.next {
  position: absolute;
  top: 50%;
  font-size: 30px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 100000;
  transform: translateY(-50%);
}
.modal .prev { left: 10px; }
.modal .next { right: 10px; }
.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 30px;
  color: white;
  cursor: pointer;
  z-index: 10001;
}

/* =========================
   iframe 埋め込み時の調整
   ========================= */
body.iframe-mode .custom-popup {
  max-height: 350px;
  overflow-y: auto;
}

/* =========================
   お知らせポップアップ
   ========================= */
.notice-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 1em;
}
.popup-content {
  background: #fff;
  padding: 2em;
  border-radius: 15px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}
.center-list {
  margin: 0 auto 0.8em auto;
  padding-left: 0;
  list-style: none;
  text-align: left;
  max-width: 300px;
}
.center-list li { margin-bottom: 0.3em; }
#close-popup-button {
  background: #444;
  color: white;
  border: none;
  padding: 0.6em 1.5em;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
}

/* =========================
   クラスタ
   ========================= */
.custom-cluster {
  background-color: rgba(0, 123, 255, 0.85);
  color: #fff;
  font-weight: bold;
  text-align: center;
  border-radius: 50%;
  border: 2px solid white;
  line-height: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
}

/* =========================
   スマホ最適化
   ========================= */
@media screen and (max-width: 767px) {

  .leaflet-control-attribution {
    font-size: 10px;
    bottom: 15px !important;
    right: 6px !important;
  }

  .leaflet-control-zoom { display: none !important; }

  /* ロゴ */
  img.custom-logo {
    margin-top: 10px;
    width: 180px;
    padding: 5px;
  }

  /* ポップアップ外枠は画面幅に追従 */
  .leaflet-popup-content-wrapper {
    max-width: 90vw;
  }

  /* 中身：さらに読みやす盛り＋ぬるスク */
  .leaflet-popup-content {
    font-size: 15.5px;
    line-height: 1.75;
    max-height: 65vh;                 /* ← モバイルは65vh上限 */
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 12px;
    margin: 10px 14px;                /* 左右ちょい余白 */
  }

  .custom-popup {
    width: 100%;
    max-height: 65vh;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
  }

  .custom-popup .blog-link {
    font-size: 14px;
    color: #0078d7;
    text-decoration: none;
  }

  /* リンク折返し */
  .custom-popup a { word-break: break-word; }

  /* 閉じるボタン大きめ */
  .leaflet-popup-close-button {
    font-size: 40px !important;
    width: 48px !important;
    height: 48px !important;
  }

  /* フォーム */
  #add-spot-form {
    width: 95vw;
    padding: 10px;
    font-size: 13px;
    line-height: 1.3;
  }
  #add-spot-form label { margin: 2px 0 1px; }
  #add-spot-form input,
  #add-spot-form textarea,
  #add-spot-form select {
    font-size: 13px;
    padding: 4px;
  }

  /* レイヤー */
  .layers-toggle-button {
    font-size: 14px !important;
    padding: 6px 10px !important;
    margin-top: 20px !important;
  }
  .custom-layers-panel {
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    position: absolute;
    top: 45px;
    right: 5px;
    z-index: 1000;
    padding: 12px;
  }
  .leaflet-control-layers-overlays { width: 100%; }
  .leaflet-control-layers-overlays label {
    width: 120px;                 /* 列幅を固定して崩れ防止 */
    display: inline-block;
    font-size: 13.5px;
    line-height: 1.5;
    margin: 3px 0;
    word-break: break-word;
  }
  .leaflet-control-layers-base label { font-size: 12px; }
  .leaflet-control-layers input[type="checkbox"] {
    transform: scale(1.0);
    margin-right: 2px;
  }

  #search-container { margin-bottom: 10px; }
  #search-results-wrapper { margin-top: 8px; }

  /* お知らせポップアップ */
  .popup-content {
    padding: 1em 1em;
    font-size: 13px;
    line-height: 1.2;
    max-width: 90vw;
  }
  .center-list {
    max-width: 100%;
    font-size: 13px;
  }
  .center-list li { margin-left: 1em; }

  /* SNS/支援リンク：指タップ向け */
  .X1,
  .instagram1,
  .support-link-mid {
    font-size: 0.9em;
    padding: 5px 10px;
    margin: 2px 4px;
    display: inline-block;
  }

  #close-popup-button {
    font-size: 0.95em;
    padding: 0.5em 1.2em;
  }

  /* CTA ボタンの内側余白をスマホ寄りに */
  .tabelog, .jalan, .rakuten {
    padding: 5px 10px;
  }
}

