/* ============================================================
   因缘图鉴 · 互动地图样式
   风格：复古手账治愈系（与全局 style.css 一致）
   配色：米白 #F5F2E6 / 青绿 #3F7A6E / 深蓝 #1E3A5F / 灰褐 #8C8A80
   ============================================================ */

.map-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------- 顶部栏 ---------------- */
.map-topbar { flex: none; }
.map-topbar-inner { max-width: none; }
.map-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.map-back {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 15px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  white-space: nowrap;
  transition: background 0.2s;
}
.map-back:hover { background: rgba(255, 255, 255, 0.18); }
.map-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 主布局 ---------------- */
.map-page {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

/* 左侧面板 */
.map-sidebar {
  flex: none;
  width: 320px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 20;
  transition: margin-left 0.25s ease;
}
.map-sidebar.collapsed { margin-left: -320px; }
.sidebar-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(63, 122, 110, 0.06);
}
.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
}
.sidebar-toggle {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.sidebar-toggle:hover { border-color: var(--primary); color: var(--primary); }
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* 面板分区 */
.panel-section {
  padding: 12px 14px;
  border-bottom: 1px dashed var(--border);
}
.panel-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  border-left: 3px solid var(--primary);
  padding-left: 8px;
  margin-bottom: 10px;
}

/* ---------------- 地图层级列表 ---------------- */
.map-level-list { display: flex; flex-direction: column; gap: 8px; }
.map-level-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s;
}
.map-level-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.map-level-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.level-name { font-size: 15px; font-weight: 700; display: block; }
.level-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}
.map-level-item.active .level-desc { color: rgba(255, 255, 255, 0.8); }

/* ---------------- 标记点筛选 ---------------- */
.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.filter-head .panel-section-title { margin-bottom: 0; }
.filter-actions { display: flex; gap: 6px; }
.filter-actions .btn-sm { font-size: 12px; padding: 2px 10px; }

.type-groups { margin-top: 12px; }
.type-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: #fff;
}
.type-group.off .type-name { color: var(--muted); }
.type-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.type-group-head:hover { background: rgba(63, 122, 110, 0.06); }
.type-icon {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.type-name { flex: 1; font-size: 14px; font-weight: 600; }
.type-group.off .type-icon { opacity: 0.45; }
.type-badge {
  background: rgba(63, 122, 110, 0.12);
  color: var(--primary-dark);
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
  min-width: 26px;
  text-align: center;
}
.type-arrow {
  color: var(--muted);
  font-size: 12px;
  padding: 2px 4px;
}
.type-group-list {
  list-style: none;
  margin: 0;
  padding: 0 10px 8px;
  display: none;
}
.type-group.open .type-group-list { display: block; }
.type-group-list li {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.type-group-list li:hover { background: rgba(63, 122, 110, 0.1); color: var(--primary-dark); }
.filter-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0; }

/* ---------------- 中央地图画布 ---------------- */
.map-canvas-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  background: #EDEAE0;
}
.map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.map-empty {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EDEAE0;
  pointer-events: none;
}
.map-empty-card {
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 36px;
  box-shadow: var(--shadow);
}
.map-empty-icon {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 8px;
}
.map-empty-card p { font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.map-empty-card span { font-size: 13px; color: var(--muted); }

/* 移动端面板展开按钮 */
.sidebar-open {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 15;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--primary-dark);
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: none;
  align-items: center;
  gap: 6px;
}
.sidebar-open:hover { border-color: var(--primary); }

/* ---------------- Leaflet 定制 ---------------- */
.leaflet-container {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #EDEAE0;
}
.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: var(--shadow) !important;
}
.leaflet-control-zoom a {
  width: 30px;
  height: 30px;
  line-height: 30px;
  color: var(--primary-dark) !important;
  font-size: 16px !important;
  background: var(--card-bg) !important;
}
.leaflet-control-zoom a:hover { background: rgba(63, 122, 110, 0.12) !important; }

/* 标记点 divIcon */
.map-marker-wrap {
  background: transparent;
  border: none;
}
.map-marker {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.3);
  transition: transform 0.2s;
}
.map-marker > span {
  transform: rotate(45deg);
}
.map-marker-wrap:hover .map-marker { transform: rotate(-45deg) scale(1.15); }

/* 点位气泡 */
.leaflet-popup-content-wrapper {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(30, 58, 95, 0.2);
}
.leaflet-popup-content { margin: 12px 14px; line-height: 1.6; }
.map-popup h4 {
  font-size: 15px;
  color: var(--primary-dark);
  margin: 0 0 4px;
}
.map-popup p {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 6px;
}
.map-popup-tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 10px;
  border-radius: 10px;
  background: rgba(63, 122, 110, 0.12);
  color: var(--primary-dark);
}
.leaflet-popup-close-button {
  color: var(--muted) !important;
}

/* ---------------- 移动端适配 ---------------- */
@media (max-width: 768px) {
  .map-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 82vw;
    max-width: 320px;
    margin-left: -100%;
    box-shadow: 0 4px 20px rgba(30, 58, 95, 0.25);
  }
  .map-sidebar.open { margin-left: 0; }
  .map-sidebar.collapsed { margin-left: -100%; }
  .sidebar-open { display: inline-flex; }
  .map-title { font-size: 16px; }
  .map-back { font-size: 14px; padding: 3px 8px; }
  .type-group-list li,
  .type-name,
  .panel-section-title,
  .map-popup p { font-size: 14px; }
}
