/* ========== 全局基础 ========== */
html, body, #map {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  color: #333;
  background: #f0f2f5;
}

.map-container {
  flex: 1;
  position: relative;
}

/* ========== 顶栏 ========== */
#topbar {
  top: 0;
  left: 0;
  right: 0;
  min-height: 44px;
  background: #fff;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  z-index: 1000;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* 工具栏分组 */
#topbar .tb-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
#topbar .tb-divider {
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  margin: 0 6px;
  flex-shrink: 0;
}

/* 按钮基础 */
#topbar button {
  padding: 5px 10px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  transition: all 0.15s ease;
  line-height: 1.4;
}
#topbar button:hover {
  border-color: #4a90d9;
  color: #4a90d9;
  background: #f0f7ff;
}
#topbar button:active {
  background: #e6f0fa;
}

/* 主操作按钮 */
#topbar button.btn-primary {
  background: #4a90d9;
  color: #fff;
  border-color: #4a90d9;
  font-weight: 500;
}
#topbar button.btn-primary:hover {
  background: #3a7bc8;
  border-color: #3a7bc8;
  color: #fff;
}

/* 成功按钮 */
#topbar button.btn-success {
  background: #52c41a;
  color: #fff;
  border-color: #52c41a;
  font-weight: 500;
}
#topbar button.btn-success:hover {
  background: #49b016;
  border-color: #49b016;
  color: #fff;
}

/* 危险按钮 */
#topbar button.btn-danger {
  color: #ff4d4f;
  border-color: #ff4d4f;
}
#topbar button.btn-danger:hover {
  background: #fff2f0;
  color: #ff4d4f;
  border-color: #ff4d4f;
}

/* 完成选择按钮（特殊高亮） */
#topbar button.btn-finish {
  background: #52c41a;
  color: #fff;
  border-color: #52c41a;
  font-weight: 600;
  padding: 5px 14px;
  animation: pulse-finish 2s ease-in-out infinite;
}
@keyframes pulse-finish {
  0%, 100% { box-shadow: 0 0 0 0 rgba(82, 196, 26, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(82, 196, 26, 0); }
}
#topbar button.btn-finish:hover {
  background: #49b016;
}

/* 下拉框 */
#topbar select {
  padding: 5px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  background: #fff;
  cursor: pointer;
  outline: none;
  min-width: 120px;
}
#topbar select:hover { border-color: #4a90d9; }
#topbar select:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15); }

/* 外部链接 */
#topbar a {
  font-size: 12px;
  color: #4a90d9;
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  white-space: nowrap;
}
#topbar a:hover { background: #f0f7ff; text-decoration: underline; }

/* 坐标指示器 */
#coord-indicator {
  margin-left: 4px;
  color: #8c8c8c;
  font-size: 11px;
  font-weight: 500;
  user-select: none;
}

/* 状态栏 */
#status {
  flex: 1;
  min-width: 0;
  margin-left: 8px;
  color: #8c8c8c;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  padding-right: 4px;
}

/* ========== 底部图例 ========== */
#park-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 1000;
  border: 1px solid #e8e8e8;
  max-width: 280px;
}

/* ========== 弹窗 ========== */
#versions-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
}

#versions-modal .modal-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
#versions-modal .modal-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #1a1a1a;
}
#versions-modal .modal-card .modal-desc {
  color: #999;
  font-size: 12px;
  margin: 0 0 16px;
  line-height: 1.5;
}
#versions-modal .modal-card .version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
#versions-modal .modal-card .version-item:hover {
  background: #fafafa;
}
#versions-modal .modal-card .version-item.latest {
  background: #f6ffed;
}
#versions-modal .modal-card .version-item.daily-backup {
  background: #fffbe6;
  border-left: 3px solid #faad14;
}
#versions-modal .modal-card .version-item .v-time {
  font-size: 13px;
  color: #333;
}
#versions-modal .modal-card .version-item .v-meta {
  font-size: 11px;
  color: #bbb;
  margin-top: 2px;
}
#versions-modal .modal-card .version-item .v-latest-badge {
  display: inline-block;
  background: #52c41a;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 4px;
  font-weight: 500;
}
#versions-modal .modal-card .version-item .v-daily-badge {
  display: inline-block;
  background: #faad14;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 4px;
  font-weight: 500;
}
#versions-modal .modal-card .btn-restore {
  padding: 4px 12px;
  font-size: 12px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
#versions-modal .modal-card .btn-restore:hover {
  background: #3a7bc8;
}
#versions-modal .modal-card .btn-close {
  padding: 7px 18px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  transition: all 0.15s;
}
#versions-modal .modal-card .btn-close:hover {
  border-color: #4a90d9;
  color: #4a90d9;
}

/* ========== 节点标记 ========== */
.node-marker {
  background: #4a90d9;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.node-marker.selected {
  background: #fa8c16;
  box-shadow: 0 0 8px rgba(250, 140, 22, 0.7);
}

/* ========== 路线结果面板（地图右上角） ========== */
#route-result-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  border: 1px solid #e8e8e8;
  max-width: 320px;
  min-width: 200px;
  line-height: 1.6;
}
#route-result-panel .rp-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}
#route-result-panel .rp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
}
#route-result-panel .rp-label {
  color: #999;
  font-size: 11px;
}
#route-result-panel .rp-value {
  color: #333;
  font-weight: 500;
  text-align: right;
}
#route-result-panel .rp-value.dist {
  color: #4a90d9;
  font-size: 14px;
  font-weight: 700;
}
#route-result-panel .rp-segments {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f0f0f0;
  max-height: 200px;
  overflow-y: auto;
}
#route-result-panel .rp-seg {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
}
#route-result-panel .rp-seg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
#route-result-panel .rp-seg-dot.internal { background: #e74c3c; }
#route-result-panel .rp-seg-dot.external { background: #ff6600; }
#route-result-panel .rp-seg-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #666;
}
#route-result-panel .rp-seg-dist {
  color: #999;
  font-size: 10px;
  flex-shrink: 0;
}
#route-result-panel .rp-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  cursor: pointer;
  color: #bbb;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  border-radius: 4px;
  transition: all 0.15s;
}
#route-result-panel .rp-close:hover {
  background: #f5f5f5;
  color: #666;
}

/* ========== 加载/空状态 ========== */
.versions-empty {
  padding: 28px;
  text-align: center;
  color: #bbb;
  font-size: 13px;
}
.versions-loading {
  padding: 28px;
  text-align: center;
  color: #bbb;
  font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  #topbar {
    padding: 4px 6px;
    gap: 2px;
    min-height: 38px;
  }
  #topbar button {
    padding: 4px 7px;
    font-size: 11px;
  }
  #topbar .tb-divider {
    margin: 0 2px;
  }
  #status {
    font-size: 11px;
  }
}
