/* ======================================================
   沙埫村地图导航 —— H5 样式
   配色取自沙埫村宣传网页：深绿 + 茶褐 + 暖米
   ====================================================== */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5efe3;
  color: #2b2b2b;
  overscroll-behavior: none;
}

#map { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; }
/* 关键：#map 必须有 z-index 形成独立层叠上下文，
   否则腾讯 GL JS 内部 z-index:1000 的全屏渲染层会盖住所有 UI、吞掉点击 */

/* ---------- 顶部栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1500;
  background: linear-gradient(180deg, #2e5d3a 0%, #3a7148 100%);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.topbar-row {
  display: flex; align-items: center;
  padding: 10px 14px;
  gap: 8px;
}
.brand { flex: 1; display: flex; align-items: center; gap: 8px; }
.brand-leaf { font-size: 22px; }
.brand-title { font-size: 18px; font-weight: 600; letter-spacing: 1px; }

.icon-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 18px;
  cursor: pointer;
}

.search-row { padding-top: 0; padding-bottom: 12px; }
.search-row input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 19px;
  background: rgba(255,255,255,0.95);
  color: #2b2b2b;
  font-size: 15px;
  outline: none;
}
.primary-btn {
  background: #c8954c;
  color: #fff;
  border: 0;
  border-radius: 19px;
  padding: 0 18px;
  height: 38px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.primary-btn:active { background: #a87838; }
/* 顶栏「沙埫村主页」按钮：茶金描边幽灵款 */
.village-home-btn {
  background: rgba(200, 149, 76, 0.15);
  color: #f0d9b5;
  border: 1px solid rgba(200, 149, 76, 0.65);
  border-radius: 19px;
  padding: 0 14px;
  height: 38px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.village-home-btn:hover { background: rgba(200, 149, 76, 0.3); }
.village-home-btn:active { background: rgba(200, 149, 76, 0.4); }
.ghost-btn {
  background: rgba(255,255,255,0.1);
  color: #2e5d3a;
  border: 1px solid #2e5d3a;
  border-radius: 18px;
  padding: 0 14px;
  height: 34px;
  font-size: 13px;
  cursor: pointer;
}
.block { width: 100%; }

/* ---------- 底部分类条 ---------- */
.category-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 1500;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  display: flex; gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid #e8d9b8;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px;
  border-radius: 18px;
  border: 1px solid #d6c8a4;
  background: #fff;
  color: #5b4a2c;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.cat-chip.active {
  background: #2e5d3a;
  color: #fff;
  border-color: #2e5d3a;
}

/* ---------- 浮层按钮 ---------- */
.floating-actions {
  position: fixed;
  right: 12px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 1400;
  display: flex; flex-direction: column;
  gap: 8px;
}
.float-btn {
  height: 36px;
  min-width: 56px;
  padding: 0 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #e8d9b8;
  font-size: 13px;
  color: #5b4a2c;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
}
.float-btn:active { background: #f0e5cf; }
.float-btn.active { background: #2e5d3a; color: #fff; border-color: #2e5d3a; }

/* ---------- 抽屉菜单 ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1600;
  display: none;
}
.drawer.open { display: block; }
.drawer-mask {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.4);
  animation: fade 0.2s;
}
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 75%; max-width: 320px;
  background: #faf6ec;
  padding: 24px 20px env(safe-area-inset-bottom);
  box-shadow: -4px 0 16px rgba(0,0,0,0.2);
  animation: slideIn 0.25s;
  overflow-y: auto;
}
.drawer-panel h3 {
  margin: 0 0 16px;
  color: #2e5d3a;
  border-bottom: 2px solid #c8954c;
  padding-bottom: 8px;
}
.drawer-panel ul {
  list-style: none; padding: 0; margin: 0;
}
.drawer-panel li {
  padding: 14px 8px;
  border-bottom: 1px dashed #d6c8a4;
  font-size: 15px;
  cursor: pointer;
}
.drawer-panel li:active { background: rgba(46,93,58,0.08); }
.close-btn {
  margin-top: 24px;
  background: #c8954c;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

/* ---------- POI 详情弹窗 ---------- */
.poi-modal, .about-modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1700;
  display: none;
}
.poi-modal.open, .about-modal.open { display: block; }
.poi-modal-mask {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.5);
}
.poi-modal-body, .about-body {
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  max-height: 80vh;
  background: #faf6ec;
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: slideUp 0.25s;
}
.about-body {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  bottom: auto;
  border-radius: 16px;
  max-width: 360px;
  width: calc(100% - 40px);
}
.poi-modal-close {
  position: absolute;
  top: 8px; right: 12px;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #5b4a2c;
  cursor: pointer;
}
.poi-modal-header {
  display: flex; align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.poi-modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: #2e5d3a;
}
.poi-icon { font-size: 26px; }
.poi-cat {
  background: #c8954c;
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.poi-modal-images {
  display: flex; gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}
.poi-modal-images::-webkit-scrollbar { display: none; }
.poi-modal-images img {
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
}
.poi-modal-intro {
  font-size: 14px;
  line-height: 1.7;
  color: #4a3e2a;
  white-space: pre-wrap;
  word-break: break-word;
}
.poi-modal-meta {
  margin-top: 12px;
  font-size: 13px;
  color: #7a6a48;
  border-top: 1px dashed #d6c8a4;
  padding-top: 10px;
}
.poi-modal-meta div { margin: 4px 0; }
.poi-modal-meta b {
  display: inline-block;
  margin-right: 8px;
  color: #c8954c;
  font-weight: 600;
}
.poi-modal-actions {
  margin-top: 16px;
  display: flex; gap: 10px;
}
.poi-modal-actions .primary-btn { flex: 1; }
.poi-modal-actions .ghost-btn { flex: 1; }

/* ---------- 路径规划面板 ---------- */
.route-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1650;
  background: #faf6ec;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
  max-height: 70vh;
  overflow-y: auto;
}
.route-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.route-panel-head h3 {
  margin: 0; color: #2e5d3a;
}
.route-panel-head .close-btn {
  margin: 0; width: 32px; height: 32px;
  padding: 0; border-radius: 16px;
}
.route-row {
  display: flex; align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.route-row label {
  font-size: 13px;
  color: #5b4a2c;
  width: 36px;
}
.route-row input, .route-row select {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d6c8a4;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  outline: none;
}
.route-result {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1px dashed #d6c8a4;
  border-radius: 8px;
  font-size: 13px;
  color: #4a3e2a;
  min-height: 40px;
  display: none;
}
.route-result.show { display: block; }
.nav-start-btn { margin-top: 10px; }

/* ---------- 导航模式（高德式）---------- */
/* 顶部转向提示条 */
.nav-top {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 12px; right: 12px;
  z-index: 1800;
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.nav-top[hidden] { display: none; }
.nav-turn-icon { flex: 0 0 34px; display: flex; }
.nav-turn-icon svg { width: 34px; height: 34px; }
.nav-turn-col { flex: 1; min-width: 0; }
.nav-turn-text { font-size: 17px; font-weight: 600; line-height: 1.3; }
.nav-turn-sub { font-size: 12px; opacity: .85; margin-top: 2px; min-height: 14px; }

/* 底部剩余距离/时间栏 */
.nav-bar {
  position: fixed;
  left: 12px; right: 12px; bottom: 90px;
  z-index: 1800;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.28);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-bar[hidden] { display: none; }
.nav-remain-box { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.nav-remain-line b { font-size: 26px; color: #1b5e20; font-weight: 700; }
.nav-remain-line i { font-style: normal; font-size: 13px; color: #4a3e2a; margin-left: 3px; }
.nav-remain-min { font-size: 13px; color: #4a3e2a; }
.nav-voice-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border: 1px solid #d9cdb8;
  border-radius: 50%;
  background: #faf7f0;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.nav-voice-btn:active { background: #efe8da; }
.nav-exit-btn {
  flex: 0 0 auto;
  background: #c62828;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}
.nav-exit-btn:hover { background: #8e1d1d; }

/* ---------- 地图选点状态条 ---------- */
.pick-bar {
  position: fixed;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1900;
  background: rgba(46,93,58,0.95);
  color: #fff;
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 13px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  cursor: pointer;
  max-width: calc(100% - 24px);
}
.pick-bar[hidden] { display: none; }

/* ---------- 加载提示 ---------- */
.loading {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2000;
  background: rgba(245,239,227,0.95);
  display: none;
  align-items: center; justify-content: center;
}
.loading.show { display: flex; }
.loading-inner { text-align: center; }
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid #d6c8a4;
  border-top-color: #2e5d3a;
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 1s linear infinite;
}

/* ---------- 响应式 ---------- */
@media (min-width: 768px) {
  .topbar { padding-left: 20px; padding-right: 20px; }
  .drawer-panel { width: 360px; }
}

/* ---------- 动画 ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
/* ---------- ICP 备案号页脚 ---------- */
.icp-footer {
  position: fixed;
  left: 8px; bottom: 6px;
  z-index: 1500;              /* 高于地图内部渲染层(1000)，低于弹窗 */
  pointer-events: none;       /* 整体不挡地图操作 */
  font-size: 10px;
  line-height: 1.2;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.icp-footer a {
  pointer-events: auto;       /* 只有链接本身可点 */
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}
.icp-footer a:hover { text-decoration: underline; }
