* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }

/* 侧边栏 */
#sidebar {
  position: fixed; top: 0; left: 0; width: 300px; height: 100%;
  background: #2c3e50; color: #ecf0f1; z-index: 1000;
  display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .3s;
}
#sidebar.collapsed { transform: translateX(-300px); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: #1a252f;
}
.sidebar-header h2 { font-size: 18px; font-weight: 600; }

#btn-toggle-sidebar, #btn-show-sidebar {
  background: none; border: none; color: #ecf0f1; font-size: 18px; cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
}
#btn-toggle-sidebar:hover, #btn-show-sidebar:hover { background: rgba(255,255,255,.1); }

#btn-show-sidebar {
  position: fixed; top: 12px; left: 12px; z-index: 1000;
  background: #2c3e50; border-radius: 6px; font-size: 16px;
}

/* 工具栏 */
.toolbar { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.tool-btn {
  flex: 1; min-width: 80px; padding: 8px 6px; border: 1px solid #4a6274;
  border-radius: 6px; background: #34495e; color: #ecf0f1; cursor: pointer;
  font-size: 12px; transition: all .2s;
}
.tool-btn:hover { background: #4a6274; }
.tool-btn.active { background: #3498db; border-color: #3498db; }

.section-title {
  padding: 10px 20px 6px; font-size: 12px; color: #95a5a6;
  text-transform: uppercase; letter-spacing: 1px;
}

/* 景点列表 */
#spot-list { list-style: none; padding: 0 12px; flex: 1; overflow-y: auto; }
#spot-list li {
  padding: 10px 12px; margin: 4px 0; background: #34495e;
  border-radius: 6px; cursor: pointer; transition: background .2s;
  display: flex; justify-content: space-between; align-items: center;
}
#spot-list li:hover { background: #4a6274; }
.spot-item-info { flex: 1; }
.spot-item-name { font-size: 14px; font-weight: 500; }
.spot-item-desc { font-size: 11px; color: #bdc3c7; margin-top: 2px; }
.spot-item-rating { color: #f1c40f; font-size: 12px; }
.spot-delete {
  background: none; border: none; color: #e74c3c; cursor: pointer;
  font-size: 14px; margin-left: 8px; padding: 2px 6px; border-radius: 4px;
}
.spot-delete:hover { background: rgba(231,76,60,.2); }

/* 路线信息 */
.route-info { padding: 12px 20px; font-size: 13px; color: #bdc3c7; line-height: 1.6; }
.route-info .stat { margin-top: 6px; }
.route-info .stat-value { color: #3498db; font-weight: 600; font-size: 16px; }

/* 地图 */
#map { position: fixed; top: 0; left: 300px; right: 0; bottom: 0; z-index: 1; }
#map.expanded { left: 0; }

/* 弹窗 */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.5); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: #fff; border-radius: 10px; padding: 24px; width: 360px;
  max-width: 90vw; color: #2c3e50;
}
.modal-content h3 { margin-bottom: 16px; font-size: 18px; }
.modal-content label {
  display: block; margin-bottom: 12px; font-size: 13px; color: #7f8c8d;
}
.modal-content input, .modal-content textarea, .modal-content select {
  width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #bdc3c7;
  border-radius: 6px; font-size: 14px; font-family: inherit;
}
.modal-content textarea { resize: vertical; min-height: 60px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-primary {
  flex: 1; padding: 10px; background: #3498db; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
.btn-primary:hover { background: #2e86c1; }
.btn-secondary {
  flex: 1; padding: 10px; background: #ecf0f1; color: #2c3e50; border: none;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
.btn-secondary:hover { background: #d5dbdb; }

/* Leaflet popup 自定义 */
.leaflet-popup-content { margin: 12px 16px; }
.popup-name { font-size: 15px; font-weight: 600; color: #2c3e50; }
.popup-desc { font-size: 12px; color: #7f8c8d; margin-top: 4px; }
.popup-rating { color: #f1c40f; font-size: 13px; margin-top: 4px; }
.popup-coord { font-size: 10px; color: #95a5a6; margin-top: 6px; }

/* 响应式 */
@media (max-width: 640px) {
  #sidebar { width: 260px; }
  #sidebar.collapsed { transform: translateX(-260px); }
  #map { left: 0; }
  #map:not(.expanded) { left: 260px; }
}
