/* =========================
 * 共通ラッパー
 * ========================= */
.sm-map-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* =========================
 * フィルタUI
 * ========================= */
.sm-map-filters {
  margin-top: 16px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sm-filter-label {
  font-size: 13px;
  font-weight: 600;
  margin-right: 4px;
}

.sm-filter-btn {
  border-radius: 999px;
  border: 1px solid #d0d7de;
  padding: 3px 10px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
}

.sm-filter-btn.is-active {
  background: #007aff;
  color: #fff;
  border-color: #007aff;
}

/* =========================
 * マップ本体
 * ========================= */
.sm-entities-map {
  width: 100%;
  border-radius: 8px;
  overflow: hidden; /* MapKitの角丸適用 */
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);  
}

#sm-home-map {
  height: 500px;
  margin-top: 12px;
  margin-bottom: 20px;
}

#sm-entity-map {
  height: 340px;
  margin-top: 8px;
  margin-bottom: 12px;
}

/* =========================
 * エンティティカード
 * ========================= */
.sm-entity-card {
  position: absolute;
  /* ★ 位置は JS で left / top / transform を設定するので初期値はリセットしておく */
  left: 0;
  top: 0;
  transform: none;

 /*width: calc(100% - 40px);*/
  max-width: 400px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  z-index: 10020;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.sm-entity-card.show,
.sm-entity-card.is-visible {
  display: block;
  opacity: 1;
}

.sm-entity-card-inner {
  position: relative;      /* closeの基準 */
  padding: 10px 12px;
  padding-right: 34px;     /* close分だけ確保 */
}

.sm-entity-card-logo img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  background: #f5f5f5;
}

.sm-entity-card-main {
  flex: 1;
  min-width: 0;
}

.sm-entity-card-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 2px;
  line-height: 1.25;
}

.sm-entity-card-meta {
  margin: 0 0 2px;
  font-size: 12px;
  line-height: 1.25;
  color: #444;
}

/* 「プロフィールを見る」もCSSで */
.sm-entity-card-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  background: #007aff;
  color: #fff;
  text-decoration: none;
  white-space: nowrap; /* ★ 改行させない */
}

/* close を右上に小さく */
.sm-entity-card-close{
  position: absolute;
  top: 6px;
  right: 6px;

  width: 22px;
  height: 22px;
  padding: 0;

  border: none;
  background: rgba(0,0,0,0.06);
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.sm-entity-card-close:hover{
  opacity: 1;
}

.sm-entity-card-address {
  font-size: 12px;
  color: #777;
}

.sm-entity-card-tags {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sm-entity-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f0f0f0;
  color: #555;
}

.sm-entity-card-close {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* =========================
 * 検索ボックス＋フィルタラッパー
 * ========================= */
.sm-map-controls {
  position: absolute;
  top: 60px; /* 検索窓の高さ分 */
  left: 12px;
  right: 12px;

  z-index: 10000;
}

/* =========================
 * 検索ボックス (通常版）
 * ========================= */
.sm-map-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.sm-map-search-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.sm-map-search-input {
  flex: 1 1 auto;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d0d7de;
  font-size: 13px;
  line-height: 1.4;
}

/* フォーカス時ちょっとだけ強調 */
.sm-map-search-input:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

/* =========================
 * フィルタの余白調整（検索と並べる用）
 * ========================= */
.sm-map-filters {
  margin-top: 0; /* もともとの16pxをゼロに */
}

/* Entity 個別マップ用ラッパー */
.sm-entity-map-wrapper {
  margin-top: 8px;
}

/* 「Google マップで開く」リンク部分 */
.sm-entity-map-actions {
  margin-top: 8px;
  text-align: right;
}

/* ボタン風リンク */
.sm-entity-map-google-link {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #d0d7de;
  font-size: 13px;
  text-decoration: none;
  background: #ffffff;
  line-height: 1.4;
}

.sm-entity-map-google-link:hover {
  background: #f3f4f6;
}

/* 検索バー内のプルダウン */
.sm-map-select {
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.9);
  padding: 0 10px;
  font-size: 12px;
  line-height: 30px;
  color: #333;
  flex-shrink: 0;
}

/* 検索バー */
.sm-map-search--gmaps {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  transform: none;
  height: 40px;
  width: 80%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255,255,255,0.96);
  border: 1px solid #e3e6ea;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 10010;
}
.sm-map-search-icon {
  font-size: 16px;
  color: #5f6368;
  flex-shrink: 0;
}

.sm-map-search--gmaps .sm-map-search-input {
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  min-width: 0;
  max-width: none;  
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  padding: 0;
}

/* フォーカス時 */
.sm-map-search--gmaps:focus-within {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8, 0 6px 18px rgba(26,115,232,0.25);
}

/* Desktop only style */
@media (min-width: 768px) {
  .sm-map-filters {
    gap: 8px;
  }
  .sm-map-controls {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }
  /* スポーツチップは表示 */
  .sm-map-wrapper .sm-filter-group--sports {
    display: flex;
  }

  /* スポーツ用プルダウンは非表示 */
  .sm-map-wrapper .sm-map-select--sport {
    display: none;
  }
}

/* Mobile only style */
@media (max-width: 767px) {
  .sm-entities-map,
  #sm-entity-map {
    height: 240px; /* お好みで 240〜300px くらいに調整 */
  }

  .sm-entities-map,
  #sm-home-map {
    height: 340px;
  }

  /* スポーツチップは隠す */
  /* map画面(is-map-screen)ではない場合のみ */
  #body_wrap:not(.is-map-screen) .sm-map-wrapper .sm-filter-group--sports {
    display: none;
  }
  #body_wrap:not(.is-map-screen) .sm-map-wrapper .sm-map-select--sport {
    display: block;
  }
  /* ドロップダウン行を出す（既にdisplay:flex指定があるなら不要） */
  #body_wrap:not(.is-map-screen) .sm-map-wrapper .sm-map-dropdowns {
    display: flex;
    gap: 4px;
    margin-top: 4px;
  }

  /* map template */
  #body_wrap.is-map-screen .sm-map-wrapper .sm-filter-group--sports {
    display: flex;
  }

  #body_wrap.is-map-screen .sm-map-wrapper .sm-map-select--sport {
    display: none;
  }
  
  /* ついでに下の余白も少しだけ増やしておくと窮屈さ軽減 */
  .sm-map-controls {
    margin-bottom: 12px !important;
  }
}

/*******************************************************
  #body_wrap.is-map-screen 
  Map template style below
*******************************************************/
#body_wrap.is-map-screen .sm-map-search--gmaps {
  width: 80%;
}

/* 地図画面として成立させる */
#body_wrap.is-map-screen {
  overflow: hidden;
  overscroll-behavior: none;
}

/* /map 専用：検索UIをマップ左上に重ねる */
#body_wrap.is-map-screen .sm-map-wrapper { position: relative; }

/* /map の時：フィルタは検索の下（被り防止） */
#body_wrap.is-map-screen .sm-map-controls {
  top: 60px;      /* 検索バー(40px) + 余白 */
  left: 12px;
  right: 12px;
  z-index: 10000;

  /* 既存のカード表現は維持してOK */
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

/* Desktop only style */
@media (min-width: 768px) {
  #body_wrap.is-map-screen .sm-map-controls {
    width: auto;
    right: auto;
  }
}

/* Mobile only style */
@media (max-width: 767px) {

  #body_wrap.is-map-screen .sm-map-controls {
    top: 56px;           /* 検索バー(40px) + 余白 */
    left: 8px;
    right: 8px;
    max-width: none;
  }
  #body_wrap.is-map-screen .sm-map-select {
    flex-basis: 68px;
    width: 68px;
    max-width: 68px;
    padding-left: 8px;
    padding-right: 4px; 
  }

  /* モバイル用　Sports チップ */
  #body_wrap.is-map-screen .sm-filter-group--sports {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge (旧) */
  }

  /* 横スクロール時にボタンが縮まないように */
  #body_wrap.is-map-screen .sm-filter-group--sports .sm-filter-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #body_wrap.is-map-screen .sm-filter-group--sports::-webkit-scrollbar {
    display: none;                  /* Chrome / Safari / iOS */
  }
}

/* =========================
 * Google Maps風 検索バー（完成版）
 * ========================= */

#body_wrap.is-map-screen .sm-map-search--gmaps {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  transform: none;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255,255,255,0.96);
  border: 1px solid #e3e6ea;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 10010;
}

/* selectは伸びず、固定幅で安定させる */
#body_wrap.is-map-screen .sm-map-search--gmaps .sm-map-select{
  flex: 0 0 72px;
  width: 72px;
  max-width: 72px;
}

#body_wrap.is-map-screen .sm-entities-map,
#body_wrap.is-map-screen #sm-home-map {
  height: calc(100vh - 136px - 96px) !important;
}

/* モバイル用スタイル */
@media (max-width: 767px){
  #body_wrap.is-map-screen .sm-map-dropdowns .sm-map-select {
    flex: 0 0 auto;     /* ← 伸びない */
    width: auto;        /* 中身基準 */
    min-width: 0;

    font-size: 11px;    /* 少し小さく */
    height: 28px;
    line-height: 28px;

    padding-left: 6px;
    padding-right: 2px;
  }

  /* スポーツチップの下のselectを表示 */
  #body_wrap.is-map-screen .sm-map-dropdowns {
    display: flex;
    gap: 4px;
    margin-top: 4px;
  }

  #body_wrap.is-map-screen .sm-entities-map,
  #body_wrap.is-map-screen #sm-home-map {
    height: calc(100vh - 64px); /* 検索バー+安全余白 */
  }
}

/* 検索バー右端のクリアボタン */
.sm-map-search-clear{
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(0,0,0,0.10);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
  line-height: 1;
  cursor: pointer;

  flex: 0 0 auto; /* inputに押されない */
  margin-left: 6px;
  transition: background 0.15s ease, transform 0.1s ease;

}

.sm-map-search-clear:hover{
  background: rgba(0,0,0,0.18);
  transform: scale(1.05);
}


