/* ============================================================
 * layout.css —— 顶栏 / 三栏骨架 / 面板 / 响应式
 * ============================================================ */

/* ---------- 顶栏 ---------- */
.topbar {
  height: 58px; flex: none;
  display: flex; align-items: center; gap: 22px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 1100;
}

.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand .seal-logo {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--seal), var(--seal-deep));
  color: #f7efe9; display: grid; place-items: center;
  font-family: var(--serif); font-size: 19px; font-weight: 700;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22), 0 2px 6px rgba(142, 43, 33, .3);
  user-select: none;
}
.brand .t { font-family: var(--serif); font-size: 17.5px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.brand .t em { font-style: normal; color: var(--seal); }

/* 主导航 */
.nav { display: flex; gap: 2px; height: 100%; }
.nav button {
  position: relative; padding: 0 15px; height: 100%;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: color var(--t-fast) var(--ease-out);
}
.nav button::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 2.5px; border-radius: 2px; background: var(--seal);
  transform: scaleX(0); transition: transform var(--t-med) var(--ease-out);
}
.nav button:hover { color: var(--ink); }
.nav button.on { color: var(--seal); }
.nav button.on::after { transform: scaleX(1); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* 全局搜索框 */
.g-search {
  display: flex; align-items: center; gap: 8px;
  width: 250px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink-3);
  font-size: 13px; cursor: text;
  transition: all var(--t-fast) var(--ease-out);
}
.g-search:hover, .g-search.on { border-color: var(--line-strong); background: var(--card); box-shadow: var(--shadow-1); }
.g-search .kbd {
  margin-left: auto; font-size: 11px; padding: 1px 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--card); color: var(--ink-3);
}

/* ---------- 应用骨架 ---------- */
.shell { display: flex; flex-direction: column; height: 100%; }
.workspace { flex: 1; min-height: 0; display: flex; }

/* 左侧筛选栏 */
.sidebar {
  width: 252px; flex: none;
  background: color-mix(in srgb, var(--card) 75%, transparent);
  border-right: 1px solid var(--line);
  overflow-y: auto; padding: 16px 14px 26px;
  display: flex; flex-direction: column; gap: 4px;
  transition: margin-left var(--t-med) var(--ease-out);
}
.sidebar.collapsed { margin-left: -252px; }

/* 中央地图区 */
.map-stage { flex: 1; min-width: 0; position: relative; background: #eee9dd; }
#map { position: absolute; inset: 0; background: #eee9dd; }

/* 右侧结果+详情栏 */
.rightbar {
  width: 388px; flex: none;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  display: flex; flex-direction: column; min-height: 0;
}

/* 结果列表区（上半） */
.results {
  flex: 0 1 46%;
  min-height: 112px;
  display: flex; flex-direction: column;
}
.results.collapsed { flex: 0 0 auto; }
.results.collapsed .results-list { display: none; }
.results-head {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 8px; cursor: pointer; user-select: none;
}
.results-head b { font-size: 14px; }
.results-head .cnt { color: var(--ink-3); font-size: 12.5px; }
.results-head .sort { margin-left: auto; font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.results-head .caret { transition: transform var(--t-med) var(--ease-out); color: var(--ink-3); font-size: 10px; }
.results.collapsed .results-head .caret { transform: rotate(-90deg); }
.results-list { overflow-y: auto; min-height: 0; padding: 2px 10px 10px; }

/* 结果与详情分割线 */
.detail-sep { flex: none; border-top: 1px solid var(--line); }

/* 详情区（下半） */
.detail { flex: 1 1 0; min-height: 200px; overflow-y: auto; display: flex; flex-direction: column; }

/* ---------- 通用面板卡片 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

/* ---------- 浮动控件（地图上） ---------- */
.map-ctrl { position: absolute; z-index: 900; }
.map-ctrl.tl { top: 14px; left: 14px; }
.map-ctrl.tr { top: 14px; right: 14px; }
.map-ctrl.bl { bottom: 24px; left: 14px; }
.map-ctrl.br { bottom: 24px; right: 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* ---------- 页面视图（非地图页） ---------- */
.page {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 26px clamp(18px, 4vw, 48px) 60px;
  scroll-behavior: smooth;
}
.page-inner { max-width: 1060px; margin: 0 auto; }
.page-head { margin-bottom: 22px; }
.page-head h2 { font-family: var(--serif); font-size: 26px; letter-spacing: .03em; }
.page-head p { color: var(--ink-2); margin-top: 6px; max-width: 760px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .rightbar { width: 344px; }
  .sidebar { width: 232px; }
  .sidebar.collapsed { margin-left: -232px; }
}
@media (max-width: 1060px) {
  .g-search { width: 170px; }
  .g-search .hint { display: none; }
}
@media (max-width: 960px) {
  body { overflow: auto; }
  .workspace { flex-direction: column; }
  .sidebar {
    position: fixed; z-index: 1200; top: 58px; bottom: 0; left: 0;
    margin-left: 0; transform: translateX(-105%);
    transition: transform var(--t-med) var(--ease-out);
    box-shadow: var(--shadow-pop);
    width: 272px;
  }
  .sidebar.collapsed { margin-left: 0; transform: translateX(-105%); }
  .sidebar.open { transform: none; }
  .map-stage { min-height: 62vh; }
  .rightbar { width: 100%; border-left: none; border-top: 1px solid var(--line); max-height: 50vh; }
  .results-list { max-height: 30vh; }
}
