/* ============================================
   位置分享 - 前台样式
   ============================================ */
* { 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; }

/* 首页底部备案信息 */
.footer-icp { margin-top: 6px; font-size: 12px; color: var(--muted); }
.footer-icp a { color: var(--muted); text-decoration: none; }
.footer-icp a:hover { color: var(--primary); text-decoration: underline; }
.footer-icp-sep { margin: 0 8px; }
.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); }

/* ---------- 成功页 ---------- */
.success-card { text-align: center; }
.success-title { color: var(--ok); font-size: 26px; 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; }

/* ---------- 查询授权码（创建成功页） ---------- */
.query-code-box {
  margin: 18px 0;
  padding: 16px;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  background: #eef2ff;
  text-align: left;
}
.query-code-head { display: flex; align-items: center; gap: 8px; }
.query-code-label { font-size: 13px; font-weight: 600; color: #4338ca; }
.tag-free {
  font-size: 11px; font-weight: 600;
  background: #f59e0b; color: #fff;
  border-radius: 999px; padding: 2px 8px;
}
.query-code-value {
  margin: 10px 0 6px;
  font-size: 22px; font-weight: 700; letter-spacing: 2px;
  color: #1e293b; font-family: Consolas, "Courier New", monospace;
  user-select: all;
}
.query-code-tip { font-size: 12px; color: #64748b; margin-bottom: 12px; }
.query-code-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.query-code-actions .btn { margin: 0; }

/* ---------- 分享海报（创建成功页） ---------- */
.poster-wrap { margin: 22px 0 10px; text-align: center; }
.poster {
  width: 300px;
  max-width: 100%;
  margin: 0 auto 14px;
  padding: 26px 14px 22px;
  border-radius: 18px;
  background: linear-gradient(160deg, #f59e0b, #ef4444 55%, #7c3aed);
  color: #fff;
  text-align: center;
  box-shadow: 0 10px 24px rgba(124, 58, 237, .28);
}
.poster-title {
  font-size: 20px; font-weight: 700; line-height: 1.4;
  margin: 0 0 20px; word-break: break-all;
}
.poster-qr {
  width: 190px; height: 190px;
  margin: 0 auto;
  padding: 8px;
  background: #fff;
  border-radius: 14px;
}
.poster-qr canvas, .poster-qr img { width: 100% !important; height: 100% !important; display: block; }
.poster-preview {
  display: none;
  max-width: 240px;
  width: 100%;
  margin: 12px auto 0;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
}

/* ---------- 访客分享页 ---------- */
.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-video { margin-bottom: 16px; border-radius: 10px; overflow: hidden; background: #000; }
.share-video video { width: 100%; display: block; max-height: 440px; object-fit: contain; }
.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; }
}
