/* ============================================================
   仍帅 3D 历史地图 — 地图查看器样式
   ============================================================ */

/* ---- Map Container ---- */
.map-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 400px;
  max-height: 70vh;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #e8e2d5;
  margin: 16px 0;
}

#map-container {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* ---- Map Loading ---- */
#map-loading {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(250, 250, 249, 0.92);
  z-index: 800;
  font-size: 0.93rem;
  color: var(--color-text-muted);
  transition: opacity 0.3s;
}

.map-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: map-spin 0.8s linear infinite;
}

@keyframes map-spin {
  to { transform: rotate(360deg); }
}

/* ---- Map Watermark ---- */
#map-watermark {
  display: none; /* JS 控制显示 */
  position: absolute;
  bottom: 40px;
  right: 10px;
  z-index: 600;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  pointer-events: none;
  text-shadow: 0 0 3px rgba(0,0,0,0.5);
}

/* ---- Map Popup ---- */
#map-popup {
  font-family: var(--font-sans);
}

/* ---- Left Panel Wrapper ---- */
.map-left-panel {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- Base Map Switcher ---- */
.basemap-switcher {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255,255,255,0.92);
  border-radius: var(--radius);
  padding: 5px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.basemap-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--color-text-muted);
  border-radius: 3px;
  text-align: left;
  white-space: nowrap;
  transition: all 0.15s;
}
.basemap-btn:hover {
  background: var(--color-tag-bg);
  color: var(--color-text);
}
.basemap-btn.active {
  background: var(--color-accent);
  color: #fff;
}
.basemap-btn.vip-locked {
  position: relative;
  color: #b8ad9a;
}
.basemap-btn.vip-locked::after {
  content: "🔒";
  font-size: 10px;
  margin-left: 4px;
}

/* ---- Annotation Layer Panel ---- */
.map-annotation-panel {
  background: rgba(255,255,255,0.94);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 8px 10px 4px;
  font-size: 11px;
}
.map-annotation-panel .aa-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--color-accent);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.map-annotation-panel label {
  display: block;
  padding: 2px 0;
  cursor: pointer;
  color: var(--color-text);
  opacity: 0.7;
  font-size: 11px;
  white-space: nowrap;
}
.map-annotation-panel label:hover { opacity: 0.9; color: var(--color-accent); }

/* ---- Filter Panel ---- */
.map-filter-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 700;
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px 6px;
  min-width: 130px;
  max-width: 180px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 12px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}
.map-filter-panel::-webkit-scrollbar { width: 4px; }
.map-filter-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.map-filter-panel .filter-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-filter-panel .filter-vip-badge {
  font-size: 10px;
  background: var(--color-vip);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
}

.map-filter-panel label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text);
  opacity: 0.7;
  white-space: nowrap;
}
.map-filter-panel label:hover {
  opacity: 0.9;
  color: var(--color-accent);
}

.map-filter-panel input[type="checkbox"] {
  accent-color: var(--color-accent);
  cursor: pointer;
  pointer-events: auto;
  flex-shrink: 0;
}

.filter-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 2px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.15);
}

/* ---- Bottom Bar (year slider + search) ---- */
.map-bottom-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 6px 16px;
  box-shadow: var(--shadow-sm);
}

.map-year-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-year-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.map-year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
.map-year-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}

.map-year-label {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
  min-width: 58px;
  text-align: center;
}

/* ---- Search Input (in bottom bar) ---- */
.map-bottom-bar .map-search-input {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: rgba(255,255,255,0.85);
  outline: none;
  cursor: pointer;
  color: var(--color-text-muted);
  width: 120px;
}
.map-bottom-bar .map-search-input::placeholder { color: #bbb; }
.map-bottom-bar .map-search-input:hover { border-color: var(--color-accent); }

/* ---- Remove old standalone elements ---- */
.map-search-bar, .map-info-bar { display: none; }


/* ---- VIP Toast ---- */
.map-vip-toast {
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.map-vip-btn-primary {
  display: inline-block;
  padding: 5px 14px;
  background: var(--color-vip);
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.map-vip-btn-primary:hover {
  background: #b8943a;
  text-decoration: none;
  color: #fff;
}

.map-vip-btn-close {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  color: #999;
  cursor: pointer;
  font-family: var(--font-sans);
}
.map-vip-btn-close:hover {
  border-color: #aaa;
  color: #666;
}

/* ---- Info Bar (replaced by bottom bar) ---- */
.map-info-bar { display: none; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .map-wrapper {
    aspect-ratio: 4 / 3;
    min-height: 300px;
  }

  .basemap-switcher {
    display: none;
  }

  .map-annotation-panel {
    display: none;
  }

  .map-filter-panel {
    top: 8px;
    right: 8px;
    min-width: 110px;
    padding: 8px 10px 4px;
    font-size: 11px;
  }

  .maplibregl-ctrl-group {
    display: none !important;
  }

  .map-bottom-bar {
    gap: 6px;
    padding: 4px 10px;
    bottom: 8px;
  }
  .map-year-slider { width: 80px; }
  .map-year-label { font-size: 12px; min-width: 48px; }
  .map-bottom-bar .map-search-input { width: 90px; font-size: 11px; padding: 4px 8px; }
}

@media (max-width: 480px) {
  .map-wrapper {
    aspect-ratio: 1 / 1;
    min-height: 280px;
  }

  .map-filter-panel {
    top: 6px;
    right: 6px;
    padding: 6px 8px 3px;
    min-width: 90px;
    font-size: 10px;
  }
  .map-filter-panel .filter-title { font-size: 11px; }
  .map-filter-panel label { font-size: 10px; padding: 1px 0; }

  .maplibregl-ctrl-group {
    display: none !important;
  }

  .map-bottom-bar {
    padding: 4px 8px;
    gap: 4px;
  }
  .map-year-slider { width: 60px; }
  .map-year-label { font-size: 11px; min-width: 42px; }
  .map-bottom-bar .map-search-input { width: 70px; font-size: 10px; }
}
