/* 熱點地圖（/map）專屬樣式；共用樣式在 styles.css */
.map-main { max-width: 1100px; padding-top: 1rem; }

.map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .9rem;
  margin-bottom: .75rem;
}
.map-controls label { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; color: var(--fg-dim); }
.map-controls select,
.map-controls input {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .45rem;
  font: inherit;
  font-size: .9rem;
  color-scheme: dark;
}
.map-controls select:focus-visible,
.map-controls input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.map-home { display: none; font-size: .85rem; color: var(--fg-dim); white-space: nowrap; }
.map-status { font-size: .85rem; color: var(--fg-dim); margin-left: auto; }

.map-wrap { position: relative; }
.map-canvas {
  height: 70vh;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #dfe6ec;
}

.map-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 800;
  max-width: min(90%, 360px);
  padding: 1rem 1.25rem;
  text-align: center;
  background: rgba(15, 20, 25, .92);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.map-empty[hidden] { display: none; }
.map-empty p { margin: .25rem 0; font-size: .9rem; color: var(--fg-dim); }
.map-empty strong { color: var(--fg); font-size: 1.05rem; }

/* 📍 移到目前位置（Leaflet 控制項，zoom 控制下方） */
.map-locate-btn {
  display: block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}

/* 記錄側欄：桌機疊在地圖右側 360px */
.map-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  width: 360px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(15, 20, 25, .97);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow);
}
.map-panel[hidden] { display: none; }
.map-panel-handle { display: none; }
.map-panel-head {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .75rem .9rem .4rem;
  border-bottom: 1px solid var(--border);
}
.map-panel-title { flex: 1; margin: 0; font-size: 1rem; line-height: 1.4; }
.map-panel-close {
  flex: 0 0 auto;
  background: none;
  border: 0;
  color: var(--fg-dim);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 .25rem;
  cursor: pointer;
}
.map-panel-close:hover { color: var(--fg); }
.map-panel-close:focus-visible,
.map-panel-more:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.map-panel-status { margin: .4rem .9rem; font-size: .8rem; color: var(--fg-dim); }
.map-panel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0 .9rem;
}
.map-card {
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.map-card-name { font-weight: 600; font-size: .95rem; margin-bottom: .2rem; }
.map-card-meta { color: var(--fg-dim); margin: .1rem 0; overflow-wrap: anywhere; }
.map-card-label { display: inline-block; min-width: 4.5em; margin-right: .35rem; color: var(--fg-dim); opacity: .75; }
.map-card-link { display: inline-block; margin-top: .25rem; font-size: .85rem; }
.map-panel-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .9rem;
  border-top: 1px solid var(--border);
}
.map-panel-more {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.map-panel-more[hidden],
.map-panel-county[hidden] { display: none; }
.map-panel-more:disabled { opacity: .6; cursor: default; }
.map-panel-county { font-size: .85rem; margin-left: auto; }

/* 手機：底部抽屜 60vh，把手可拖、拖低即關 */
@media (max-width: 640px) {
  .map-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    width: auto;
    height: 60vh;
    max-height: 90vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
  }
  .map-panel-handle {
    display: block;
    flex: 0 0 auto;
    height: 22px;
    cursor: grab;
    touch-action: none;
    position: relative;
  }
  .map-panel-handle::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 5px;
    margin-left: -20px;
    border-radius: 3px;
    background: var(--border);
  }
  .map-panel-head { padding-top: .2rem; }
}

/* 行動版：全螢幕地圖 + 頂部一列控制 */
@media (max-width: 720px) {
  .map-page .site-header { display: none; }
  .map-main { padding: 0; max-width: none; }
  .map-controls {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: .5rem;
    margin: 0;
    padding: .4rem .5rem;
    background: rgba(15, 20, 25, .95);
    border-bottom: 1px solid var(--border);
  }
  .map-home { display: inline; flex: 0 0 auto; font-size: .8rem; }
  .map-controls label { flex: 0 0 auto; font-size: .8rem; }
  .map-controls select,
  .map-controls input { font-size: .8rem; padding: .2rem .3rem; }
  .map-status { flex: 0 0 auto; margin-left: 0; font-size: .75rem; white-space: nowrap; }
  .map-canvas {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
  .map-page .leaflet-top { top: 2.6rem; }
  .map-empty { top: calc(50% + 1.3rem); }
  .map-page .site-footer { margin-top: 0; }
}
