
/* ========================================
   地图瓦片加载优化 - 防止429错误
   ======================================== */

/* 瓦片平滑加载 */
.leaflet-tile {
  transition: opacity 0.2s ease-in-out;
  will-change: transform;
}

/* 瓦片容器背景 */
.leaflet-tile-container {
  background-color: #f0f0f0;
}

/* 错误瓦片的回退样式 */
.leaflet-tile.leaflet-tile-error {
  background-color: #e5e7eb !important;
  background-image: none !important;
}

/* ========================================
   历史疆域图层样式
   ======================================== */

/* 疆域按钮激活状态 */
#territoryBtn.active {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

/* 疆域图例 */
.territory-legend {
  position: fixed;
  top: 130px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-width: 180px;
  max-width: 250px;
  box-shadow: var(--shadow);
  z-index: 9999;
  font-size: 13px;
}

.territory-legend .legend-title {
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.territory-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.territory-legend .legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.territory-legend .legend-name {
  flex: 1;
  color: var(--text-primary);
}

.territory-legend .legend-year {
  color: var(--text-muted);
  font-size: 11px;
}

/* 疆域提示框 */
.territory-tooltip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.territory-tooltip strong {
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}

/* Leaflet 疆域多边形样式覆盖 */
.leaflet-interactive.territory-polygon {
  transition: all 0.3s ease;
}

.leaflet-interactive.territory-polygon:hover {
  fill-opacity: 0.5 !important;
  stroke-width: 3 !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .territory-legend {
    top: auto;
    bottom: 130px;
    right: 10px;
    left: 10px;
    max-width: none;
    min-width: auto;
  }
  
  .territory-legend .legend-item {
    font-size: 12px;
  }
}
