* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f7;
  color: #333;
  overflow: hidden;
}

/* 顶部栏 */
.topbar {
  height: 52px;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: relative;
  z-index: 100;
}

.logo { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.subtitle { font-size: 12px; color: #888; margin-left: 4px; flex: 1; }

.icon-btn {
  background: none; border: none; color: #888; font-size: 18px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px; transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* 设置弹窗 */
.modal {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5); align-items: center; justify-content: center;
}
.modal.active { display: flex; }

.modal-content {
  background: #fff; border-radius: 12px; padding: 24px; width: 420px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-content h3 { margin-bottom: 12px; font-size: 16px; }
.modal-content p { font-size: 13px; color: #666; margin-bottom: 8px; }
.modal-content ol { font-size: 13px; color: #555; margin-left: 18px; margin-bottom: 16px; line-height: 1.8; }
.modal-content ol a { color: #1677ff; }
.modal-content input {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 14px; margin-bottom: 16px;
}
.modal-content input:focus { outline: none; border-color: #1677ff; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* 主布局 */
.main-layout { display: flex; height: calc(100vh - 52px); }

/* 侧边栏 */
.sidebar {
  width: 340px; min-width: 300px; background: #fff;
  border-right: 1px solid #e8e8e8; display: flex; flex-direction: column;
  overflow-y: auto;
}

.panel { padding: 16px 16px 0; }
.panel h4 { font-size: 14px; color: #666; margin-bottom: 12px; font-weight: 600; }

.input-group { margin-bottom: 12px; }
.input-group label { display: block; font-size: 12px; color: #888; margin-bottom: 4px; }
.input-group input {
  width: 100%; padding: 10px 12px; border: 1px solid #e0e0e0; border-radius: 8px;
  font-size: 14px; transition: border-color 0.2s;
}
.input-group input:focus { outline: none; border-color: #1677ff; }

.btn-primary {
  background: #1677ff; color: #fff; border: none; padding: 10px 20px;
  border-radius: 8px; font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: #0958d9; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }
.btn-primary.full { width: 100%; margin-bottom: 12px; }

.btn-secondary {
  background: #f0f0f0; color: #333; border: none; padding: 10px 20px;
  border-radius: 8px; font-size: 14px; cursor: pointer;
}

/* POI类型选择 */
.poi-types {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px;
}

.poi-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid #e0e0e0;
  font-size: 13px; cursor: pointer; transition: all 0.2s; user-select: none;
  background: #fff; color: #555;
}
.poi-chip:hover { border-color: #1677ff; }
.poi-chip.active {
  background: #e6f4ff; border-color: #1677ff; color: #1677ff;
}
.poi-chip .icon { font-size: 16px; }

/* 范围滑块 */
.range-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.range-row label { font-size: 12px; color: #888; white-space: nowrap; }
.range-row input[type="range"] { flex: 1; }
.range-row span { font-size: 12px; color: #1677ff; font-weight: 500; min-width: 50px; }

/* 结果面板 */
.results-panel { flex: 1; display: flex; flex-direction: column; min-height: 200px; }
.results-panel h4 { position: sticky; top: 0; background: #fff; padding: 12px 0; margin: 0; z-index: 10; }

.results-list {
  flex: 1; overflow-y: auto; padding-bottom: 16px;
}

.empty-state {
  text-align: center; padding: 40px 20px; color: #999; font-size: 13px;
}

.result-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border-radius: 10px; margin-bottom: 6px;
  cursor: pointer; transition: all 0.2s; border: 1px solid transparent;
}
.result-item:hover { background: #f5f5f7; border-color: #e0e0e0; }
.result-item.active { background: #e6f4ff; border-color: #1677ff; }

.result-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.result-icon.cafe { background: #fff2e8; }
.result-icon.ktv { background: #f9f0ff; }
.result-icon.cinema { background: #e6fffb; }
.result-icon.food { background: #fff7e6; }
.result-icon.store { background: #f0f5ff; }
.result-icon.hotel { background: #fff0f6; }
.result-icon.gas { background: #f6ffed; }
.result-icon.parking { background: #f0f0f0; }

.result-info { flex: 1; min-width: 0; }
.result-name { font-size: 14px; font-weight: 500; color: #333; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-addr { font-size: 11px; color: #999; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #888; }
.result-tag { background: #f0f0f0; padding: 1px 6px; border-radius: 4px; font-size: 10px; }

/* 地图区域 */
.map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

.map-controls {
  position: absolute; top: 16px; right: 16px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px;
}
.ctrl-btn {
  width: 40px; height: 40px; background: #fff; border: none;
  border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.ctrl-btn:hover { background: #f5f5f7; transform: scale(1.05); }

.map-legend {
  position: absolute; bottom: 16px; right: 16px; z-index: 50;
  background: rgba(255,255,255,0.95); padding: 10px 14px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); font-size: 12px;
}
.legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.legend-item:last-child { margin-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.start { background: #52c41a; }
.dot.end { background: #f5222d; }
.dot.poi { background: #1677ff; }

/* 信息窗体 */
.amap-info-window {
  border-radius: 8px !important; overflow: hidden;
}
.info-window {
  padding: 8px; min-width: 180px;
}
.info-window h5 { font-size: 14px; margin-bottom: 4px; color: #333; }
.info-window p { font-size: 12px; color: #666; margin-bottom: 4px; }
.info-window .info-tag { font-size: 11px; color: #1677ff; background: #e6f4ff; padding: 2px 6px; border-radius: 4px; display: inline-block; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: absolute; z-index: 80; height: 100%; }
  .main-layout { flex-direction: column; }
}

/* 滚动条 */
.sidebar::-webkit-scrollbar, .results-list::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb, .results-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
