/* ==========================================================================
   錄音室指南「地圖模式」（左清單＋右地圖，參考樂居房價地圖）— 2026-09-25
   由 template-studios.php 直接載入（只有這頁用），JS 在 assets/js/studios-map.js；
   Leaflet 地圖套件切到地圖時才載入。刻意不寫進 style.css：讓這個功能可以單獨上傳部署。
   ========================================================================== */
.studio-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.studio-toolbar .show-filters { margin-bottom: 0; }
.studio-view-toggle {
  display: inline-flex; padding: 3px; gap: 2px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 100px;
}
.studio-view-toggle button {
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  color: var(--ink-soft); background: transparent; border: 0;
  border-radius: 100px; padding: 6px 16px; min-height: 36px;
  transition: background .12s, color .12s;
}
.studio-view-toggle button:hover { color: var(--ink); }
.studio-view-toggle button.is-active { background: var(--ink); color: #fff; }
.studio-grid-section[hidden], .studio-map-section[hidden] { display: none; }

.studio-map-layout {
  display: grid; grid-template-columns: 330px 1fr; gap: 0;
  height: min(720px, calc(100vh - 140px)); min-height: 520px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
  /* Leaflet 內部圖層 z-index 到 1000，要關在這個框裡，不然會蓋過詳細資訊抽屜（z-index 300）和頁首 */
  isolation: isolate;
}
.studio-map-list {
  overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--line); background: var(--bg);
}
.smap-group[hidden] { display: none; }
.smap-group ul { list-style: none; margin: 0; padding: 0; }
.smap-group-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: baseline; width: 100%;
  font: inherit; font-weight: 800; font-size: 0.95rem; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--bg-soft); border: 0; border-bottom: 1px solid var(--line); padding: 10px 18px;
}
.smap-group-head:hover { color: var(--forest); }
.smap-count { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.smap-row {
  display: flex; flex-direction: column; gap: 3px; width: 100%;
  font: inherit; text-align: left; cursor: pointer; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; padding: 12px 18px 12px 15px;
  transition: background .12s, border-color .12s;
}
.smap-row:hover, .smap-row.is-hover { background: var(--bg-hover); }
.smap-row.is-active { background: var(--forest-soft); border-left-color: var(--forest); }
.smap-row-name { font-weight: 700; font-size: 0.95rem; line-height: 1.4; }
.smap-row-cat { font-size: 0.78rem; color: var(--forest); font-weight: 600; }
.smap-row-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.smap-row-badges .studio-badge { font-size: 0.66rem; padding: 2px 8px; }
.smap-nopin { font-size: 0.72rem; color: var(--ink-soft); padding: 2px 0; }
.smap-nopin::before { content: "⌀ "; }

.studio-map-stage { position: relative; min-width: 0; }
.studio-map { position: absolute; inset: 0; background: #E3ECE7; }
.studio-map-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 0.9rem; pointer-events: none; z-index: 2;
}
.studio-map-loading[hidden] { display: none; }
.studio-map-reset {
  position: absolute; top: 12px; right: 12px; z-index: 500;
  font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 100px; padding: 8px 16px; box-shadow: var(--shadow-card);
}
.studio-map-reset:hover { background: var(--bg-hover); }
.studio-map-reset[hidden] { display: none; }

/* 圖像版底圖：海是淡青綠，陸地米色色塊（由 JS 畫），沒有街道 */
.studio-map.leaflet-container { background: #E3ECE7; }
.smap-label { background: none; border: 0; pointer-events: none; }
.smap-label span {
  display: block; transform: translate(-50%, -50%); white-space: nowrap;
  font-family: var(--font-body); font-weight: 700; letter-spacing: 0.04em;
  text-shadow: 0 0 3px #FBF7F2, 0 0 3px #FBF7F2, 0 0 2px #FBF7F2;
}
.smap-label--county span { font-size: 0.72rem; color: #A89C8C; }
.smap-label--town span { font-size: 0.7rem; font-weight: 600; color: #B5A999; }
.smap-label--town.is-hot span { color: #8A6D1F; font-weight: 800; }
.studio-map .leaflet-container, .studio-map.leaflet-container { font-family: var(--font-body); }
.studio-map .leaflet-control-attribution { font-size: 10px; }

/* 城市泡泡（縮小看全台時） */
.smap-city-wrap { background: none; border: 0; }
.smap-city {
  display: inline-flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%);
  white-space: nowrap; cursor: pointer; line-height: 1.25;
  background: var(--forest); color: #fff; border: 2px solid #fff;
  border-radius: 12px; padding: 5px 12px 6px; box-shadow: 0 3px 10px rgba(40, 50, 45, 0.28);
  transition: transform .12s, background .12s;
}
.smap-city b { font-size: 0.92rem; font-weight: 800; }
.smap-city span { font-size: 0.74rem; font-weight: 600; opacity: 0.85; }
.smap-city:hover { background: var(--forest-dark); transform: translate(-50%, -50%) scale(1.06); }
.smap-city::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -6px;
  border: 6px solid transparent; border-bottom: 0; border-top-color: var(--forest);
}

/* 單間錄音室的針：圓點，放大後旁邊顯示名稱 */
.smap-pin-wrap { background: none; border: 0; }
.smap-pin { position: relative; display: block; width: 16px; height: 16px; cursor: pointer; }
.smap-pin i {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--forest); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform .12s;
}
.smap-pin.is-visited i { background: #E0A800; }
.smap-pin.is-unverified i { background: #9A948A; }
.smap-pin b {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: 0.75rem; font-weight: 700; color: var(--ink);
  background: rgba(255, 255, 255, 0.94); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 7px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  display: none; pointer-events: none;
}
.smap-show-labels .smap-pin b { display: block; }
.is-hover .smap-pin i, .smap-pin:hover i { transform: scale(1.35); }
.is-hover .smap-pin b, .smap-pin:hover b { display: block; background: var(--ink); color: #fff; border-color: var(--ink); }

/* 點針跳出的小卡 */
.studio-map .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-hover); }
.studio-map .leaflet-popup-content { margin: 14px 16px; min-width: 200px; }
.smap-pop { display: flex; flex-direction: column; gap: 4px; font-family: var(--font-body); color: var(--ink); }
.smap-pop strong { font-size: 1rem; font-weight: 800; line-height: 1.35; padding-right: 12px; }
.smap-pop-meta { font-size: 0.78rem; font-weight: 600; color: var(--forest); }
.smap-pop-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.smap-pop-tags .studio-badge { font-size: 0.66rem; padding: 2px 8px; }
.smap-pop-actions { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.smap-pop-actions .btn { padding: 6px 14px; font-size: 0.8rem; }
.smap-pop-actions .card-link { font-size: 0.8rem; padding: 5px 8px; margin: 0; }

/* 平板與手機：地圖在上、清單在下 */
@media (max-width: 900px) {
  .studio-map-layout { grid-template-columns: 1fr; grid-template-rows: 56vh auto; height: auto; min-height: 0; }
  .studio-map-stage { order: -1; min-height: 320px; }
  .studio-map-list { border-right: 0; border-top: 1px solid var(--line); max-height: 60vh; }
}
@media (max-width: 600px) {
  .studio-toolbar { flex-direction: column-reverse; }
  .studio-map-layout { grid-template-rows: 52vh auto; }
}
