@charset "UTF-8";

/* =====================
*
地図
*
=====================*/
/* ---------------------
マップコンテナスタイル
---------------------*/
.map-container {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: margin-left 0.3s ease-in-out;
}

#map-center-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  background-color: rgba(63, 134, 200, 0.2);
  box-shadow: 0 0 0 4px rgba(63, 134, 200, 0.1);
  pointer-events: none;
}

#map-center-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background-color: var(--primary-color);
  border-radius: 50%;
}

/* ---------------------
マップエリアスタイル
---------------------*/
.map-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.map-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  width: 100%;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

/* ---------------------
スケールバー
---------------------*/
.scale-bar {
  position: absolute;
  bottom: 70px;
  right: 15px;
  padding: 8px 12px;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--text-color);
  font-family: Arial, sans-serif;
  background: none;
}

.scale-bar-text {
  margin-bottom: 2px;
  text-shadow: 1px 1px 0 var(--bg-color), -1px 1px 0 var(--bg-color), 1px -1px 0 var(--bg-color), -1px -1px 0 var(--bg-color);
}

.scale-bar-ruler {
  height: 3px;
  background-color: var(--text-color);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ---------------------
著作権表示
---------------------*/
.copyright-notice {
  /* ビューポート基準で固定 */
  position: fixed;
  bottom: 40px;
  right: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 5px;
  font-size: 10px;
  pointer-events: none;
  border-radius: 3px;
  color: #333;
  font-family: 'Arial, sans-serif';
}

/* ---------------------
マーカー
---------------------*/

/* - マーカーのホバー/選択時はわずかに前面へ出すが、ポップアップ (500) よりは下に留める。 */
.maplibregl-marker,
.maplibregl-marker-anchor-center,
.marker,
.custom-marker {
  position: absolute;
  pointer-events: auto;
  will-change: transform;
}

.marker.marker--hovered {
  transform: translateZ(0);
}

.marker.marker--selected {
  transform: translateZ(0);
}

/* マーカー色を切り替え */
.marker svg {
  color: #3FB1CE;
}

.marker.marker--hovered svg {
  color: #1565C0;
}

.marker.marker--selected svg {
  color: #e74c3c;
}

/* marker クラス内の SVG の中にある circle または path 要素を対象 */
.marker svg circle:not(.marker-outline):not([fill="#FFFFFF"]),
.marker svg path:not(.marker-outline):not([fill="#FFFFFF"]) {
  /* その要素の現在の color 値（祖先の svg に設定された color を利用）を使って塗りを設定 */
  fill: currentColor;
}

/* ---------------------
長押し
---------------------*/

.location-detail-panel {
  position: fixed;
  bottom: 50px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 500px;
  max-width: 90vw;
  height: auto;
  max-height: 70vh;
  box-shadow: rgba(0, 0, 0, 0.2) 0px -8px 32px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: white;
  border-radius: 16px;
  overflow: hidden;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding: 14px 16px;
  border-bottom: 1px solid rgb(240, 240, 240);
  background: white;
}

.detail-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgb(26, 26, 26);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0px;
}

.detail-content {
  max-height: 45vh;
  overflow-y: auto;
  padding: 10px 16px 12px;
  background: white;
}

.detail-info-grid {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  gap: 4px;
}

.detail-info-item {
  display: flex;
  align-items: center;
  min-height: 18px;
  position: relative;
  gap: 8px;
  padding: 2px 0px;
  background: transparent;
  border-width: initial;
  border-style: none;
  border-color: initial;
  border-image: initial;
  border-radius: 0px;
  transition: 0.2s;
}

.detail-info-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-info-content {
  min-width: 0px;
  flex: 1 1 0%;
}

.detail-info-value {
  color: #333;
  font-weight: 400;
  font-size: 14px;
}

/* アクションボタンエリア */
.detail-actions {
  display: flex;
  gap: 6px;
  padding-top: 12px;
  justify-content: center;
}

/* ---------------------
右クリックのポップアップ
---------------------*/
.maplibregl-popup.custom-popup .maplibregl-popup-content {
  padding: 0;
  font-size: 12px;
  background-color: var(--bg-color);
  color: var(--text-color);
  border-radius: 4px;
  box-shadow: 0 2px 10px var(--shadow-color);
  min-width: 200px;
  max-height: 80vh;
  overflow-y: auto;
}

.maplibregl-popup.custom-popup .maplibregl-popup-close-button {
  font-size: 20px;
  padding: 6px;
  right: 5px;
  top: 5px;
  color: var(--text-color);
  background: none;
  border: none;
  cursor: pointer;
}

.custom-popup-content {
  padding: 10px;
  padding-top: 25px;
}

.maplibregl-popup.custom-popup .popup-link {
  color: var(--text-color);
  text-decoration: none;
  display: block;
  padding: 3px 0;
  border-bottom: 1px solid #eee;
}

.maplibregl-popup.custom-popup .popup-link:hover {
  background-color: #f5f5f5;
}

.maplibregl-popup.custom-popup .popup-link.coordinates {
  font-weight: bold;
  color: #3F86C8;
}

/* ---------------------
ローディングバー
---------------------*/
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: rgba(0, 0, 0, 0.05);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-bar.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-progress {
  height: 100%;
  background-color: #5fa3f4;
  width: 0%;
  transition: width 0.4s ease-out;
  box-shadow: 0 0 10px rgba(25, 118, 210, 0.3);
}

/* ---------------------
スナップショット
---------------------*/
/* スナップショット時のフラッシュ効果 */
@keyframes flash {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.snapshot-flash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-color);
  opacity: 0;
  pointer-events: none;
  animation: flash 0.3s ease-out;
}

.snapshot-attribution {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 2px 5px;
  font-size: 20px;
  font-family: Arial, sans-serif;
  color: #333;
  border-radius: 3px;
  pointer-events: none;
  /* クリック等を受けない */
}

/* ---------------------
クリップボード
---------------------*/
/* textarea を画面外に確実に配置するためのスタイル */
.clipboard-offscreen {
  position: fixed;
  left: -999999px;
  top: -999999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* === サイズ別の指定 === */

/* モバイル広告が表示される前提のスタイルは、(max-width: 768px), を条件にしない */
@media (hover: none) and (pointer: coarse) {

  /* マップコンテナスタイル */
  .map-container {
    position: fixed;
    inset: 0;
    margin-left: 0;
    /* iOS Safariの高さズレ対策:フォールバック→本命の順に書く */
    height: -webkit-fill-available;
    height: 100dvh;
  }

  .location-detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    height: auto;
    max-height: 70vh;
    bottom: calc(50px + env(safe-area-inset-bottom, 0px));
    background: white;
    flex-direction: column;
    box-sizing: border-box;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  /* スケールバー、著作権表示 */
  .scale-bar,
  .copyright-notice {
    position: fixed;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    pointer-events: none;
  }

  .scale-bar {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  .copyright-notice {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .map-content {
    top: 0;
    height: 100%;
    position: absolute;
  }

  .map-area {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
  }

  #map {
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
  }

  .scale-bar-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
    text-shadow:
      1px 1px 2px rgba(255, 255, 255, 0.8),
      -1px -1px 1px rgba(0, 0, 0, 0.2);
  }

  .scale-bar-ruler {
    height: 3px;
    background: linear-gradient(135deg, #333, #666);
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  /* アプリで見るボタン用 */
  .view-in-app-container {
    position: fixed;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    left: 20px;
  }

  .view-in-app-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-color);
    color: #007aff;
    border: 1px solid #007aff;
    border-radius: 20px;
    min-height: 44px;
    min-width: 85px;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin: 0;
  }

}

/* モバイル・タブレット横向きでの高さ対応。400pxまでに対して設定 */
/* iPhone SE 第2/3世代（高さ:320〜375px） */
/* iPhone SE 第1世代（高さ:320px） */
@media (max-height: 400px) {

  /* 横向きなど高さの少ない時にはスケールバー除去 */
  .scale-bar {
    display: none;
  }
}