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

:root {
  --primary: #ff6b35;
  --primary-dark: #e0551f;
  --bg: #f6f7f9;
  --card-bg: #ffffff;
  --text: #26272b;
  --text-sub: #8a8f99;
  --border: #eceef1;
  --shadow: 0 2px 10px rgba(0,0,0,0.06);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ===== 顶部栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  background: linear-gradient(120deg, #ff6b35, #ff9142);
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon { font-size: 26px; }
.brand h1 { font-size: 20px; font-weight: 700; white-space: nowrap; }
.brand-sub { font-size: 12px; opacity: 0.85; white-space: nowrap; }

.search-box { display: flex; flex: 1; max-width: 520px; }
.search-box input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border: none;
  border-radius: 19px 0 0 19px;
  font-size: 14px;
  outline: none;
}
.search-box button {
  width: 80px;
  height: 38px;
  border: none;
  border-radius: 0 19px 19px 0;
  background: #fff3ec;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.search-box button:hover { background: #ffe5d6; }

/* ===== 分类筛选条 ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  position: relative;
  z-index: 10;
}
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-sub);
  background: var(--card-bg);
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ===== 主体布局 ===== */
.layout {
  display: flex;
  height: calc(100% - 60px - 49px);
}
.sidebar {
  width: 400px;
  min-width: 320px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-sub);
}
.sidebar-head select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}

/* ===== 附近随机面板 ===== */
.nearby-panel {
  padding: 10px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
.nearby-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.nearby-row:first-child { margin-top: 0; }
.nearby-btn {
  flex: 1;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.nearby-btn:hover { border-color: var(--primary); color: var(--primary); }
.nearby-btn.primary {
  flex: 1.4;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.nearby-btn.primary:hover { background: var(--primary-dark); color: #fff; }
.locate-status {
  margin-top: 8px;
  min-height: 16px;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 16px;
}
.locate-status.ok { color: #27ae60; }
.locate-status.err { color: #e74c3c; }
.nearby-panel select {
  flex: 1;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}

.shop-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 12px 20px;
}
.shop-list::-webkit-scrollbar, .filter-bar::-webkit-scrollbar { height: 6px; width: 6px; }
.shop-list::-webkit-scrollbar-thumb, .filter-bar::-webkit-scrollbar-thumb { background: #d8dce2; border-radius: 3px; }

.shop-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.shop-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.shop-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(255,107,53,.15); }

.shop-thumb {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f1f3;
}

.shop-info { flex: 1; min-width: 0; }
.shop-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.shop-rating { color: #ff8f00; font-weight: 700; font-size: 13px; }
.shop-cost { color: var(--primary-dark); font-weight: 600; }
.shop-addr {
  font-size: 12px;
  color: var(--text-sub);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.shop-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff3ec;
  color: var(--primary-dark);
}

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

.legend {
  position: absolute;
  left: 12px;
  bottom: 16px;
  background: rgba(255,255,255,.95);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  max-width: 280px;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ===== 详情弹窗 ===== */
.detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.detail-modal.open { display: flex; }
.detail-card {
  width: 420px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.detail-photo { width: 100%; height: 220px; object-fit: cover; display: block; border-radius: 16px 16px 0 0; background: #f0f1f3; }
.detail-body { padding: 18px 20px 22px; }
.detail-title { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.detail-rows { margin-top: 12px; font-size: 13px; color: var(--text); }
.detail-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 66px; flex-shrink: 0; color: var(--text-sub); }
.detail-value { flex: 1; word-break: break-all; }
.detail-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.empty-tip { text-align: center; padding: 40px 0; color: var(--text-sub); font-size: 14px; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  body { overflow: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .brand-sub { display: none; }
  .search-box { max-width: none; order: 3; flex-basis: 100%; }
  .layout { flex-direction: column; height: auto; }
  .sidebar { width: 100%; order: 2; }
  .map-wrap { height: 56vh; order: 1; flex: none; }
  .shop-list { max-height: none; }
  .filter-bar { padding: 8px 14px; }

  /* 移动端细节优化 */
  .sidebar-head { padding: 10px 12px; }
  .nearby-panel { padding: 10px 12px; }
  .nearby-btn { height: 36px; }
  .shop-list { padding: 0 10px 16px; }
  .shop-thumb { width: 64px; height: 64px; }
  .detail-card { width: 94vw; max-width: 94vw; border-radius: 14px; }
  .detail-close { top: 10px; right: 10px; background: rgba(0,0,0,.45); }
  .legend { left: 8px; bottom: 8px; max-width: 200px; padding: 8px 10px; }
  .locate-status { font-size: 11px; }
}
