/* ============================================
   位置分享 - 前台样式
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 640px; }

/* ---------- 头部 ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 20px; font-weight: 800; color: var(--primary); text-decoration: none; }
.site-header nav a {
  color: var(--muted); text-decoration: none; font-size: 14px;
}
.site-header nav a:hover { color: var(--primary); }

/* ---------- 主区 ---------- */
main { flex: 1; padding: 28px 0 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.card h1 { font-size: 24px; margin-bottom: 6px; }
.card h2 { font-size: 18px; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 14px; }
.card p.muted { margin-bottom: 14px; }

/* ---------- 表单 ---------- */
.form .form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.req { color: var(--danger); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--primary); }
.textarea { resize: vertical; min-height: 120px; }
input[type="file"].input { padding: 8px; }
.dual-input { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-family: inherit;
  transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 链接行 ---------- */
.link-row { display: flex; gap: 10px; margin-bottom: 16px; }
.link-row .input { flex: 1; }

/* ---------- 提示 ---------- */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--ok); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 首页公告栏 ---------- */
.announcement-bar {
  background: linear-gradient(90deg, #eff6ff, #f8fafc);
  border-bottom: 1px solid #bfdbfe;
  padding: 10px 0;
  font-size: 13.5px;
}
.announcement-inner { display: flex; align-items: center; }
.announcement-label {
  flex: none;
  margin-right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.announcement-text {
  flex: 1;
  color: var(--text);
  word-break: break-word;
  margin-right: 12px;
}
.announcement-close {
  flex: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}
.announcement-close:hover { color: var(--text); }

/* ---------- 首页弹窗广告 ---------- */
.popup-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.popup-mask.show { opacity: 1; visibility: visible; }
.popup-mask.hidden { display: none; }
.popup-open { overflow: hidden; }
.popup-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .4);
  transform: translateY(14px) scale(.97);
  transition: transform .25s;
}
.popup-mask.show .popup-modal { transform: translateY(0) scale(1); }
.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, .4);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-close:hover { background: rgba(15, 23, 42, .7); }
.popup-image { overflow: hidden; border-radius: 18px 18px 0 0; background: #eef2f7; }
.popup-image img { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.popup-inner { padding: 24px 24px 6px; text-align: center; }
.popup-title { font-size: 19px; font-weight: 800; color: #0f172a; margin-bottom: 10px; }
.popup-content {
  font-size: 14px;
  color: #475569;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}
.popup-more {
  display: inline-block;
  margin-top: 14px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.popup-more:hover { text-decoration: underline; }
.popup-actions { padding: 18px 24px 24px; }

/* ---------- 成功页 ---------- */
.success-card { text-align: center; }
.success-title { color: var(--ok); font-size: 26px; margin-bottom: 8px; }
.query-code-block { margin-bottom: 4px; }
.query-code-block .field-label { margin-bottom: 8px; }
.qr-area { margin: 22px 0 8px; }
.qr-area #qrcode { display: inline-block; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.qr-area canvas, .qr-area img { display: block; }
.qr-area p { margin-top: 10px; }

/* ---------- 访客分享页 ---------- */
.share-page { justify-content: center; }
.share-card { padding: 30px; }
.share-title { font-size: 22px; margin-bottom: 16px; }
.share-image { margin-bottom: 16px; border-radius: 10px; overflow: hidden; }
.share-image img { width: 100%; display: block; max-height: 420px; object-fit: cover; }
.share-content { font-size: 15px; white-space: pre-wrap; margin-bottom: 16px; }
.share-audio { margin-bottom: 16px; }
.share-audio audio { width: 100%; }
.share-footer {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px dashed var(--border); padding-top: 14px; margin-top: 6px;
}
.brand-mini { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ---------- 位置上报卡片 ---------- */
.report-card { border: 1px solid #bfdbfe; background: #eff6ff; }
.report-card h2 { color: var(--primary); }
.report-status { margin-top: 14px; font-size: 14px; min-height: 22px; }
.report-status.ok { color: var(--ok); font-weight: 600; }
.report-status.err { color: var(--danger); }
.privacy-note { margin-top: 12px; font-size: 12px; color: var(--muted); }
.free-note { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
}
.site-footer p { font-size: 12px; color: var(--muted); }

/* ---------- 查询行 & 查询表格 ---------- */
.form-row { display: flex; gap: 10px; align-items: center; }
.form-row .input { flex: 1; }
.q-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.q-table th, .q-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.q-table th { color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.q-table .cell-time { white-space: nowrap; }
.q-table .cell-coord { white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-table .cell-addr { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .dual-input { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .link-row { flex-direction: column; }
  .form-row { flex-direction: column; align-items: stretch; }
}
