/* ============================================================
   《传递幸福美好》H5版 · 全站样式
   ============================================================ */

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

:root {
  --primary: #ff5e7e;
  --primary-2: #ff8a4c;
  --primary-grad: linear-gradient(135deg, #ff8a4c, #ff5e7e);
  --text: #38302e;
  --text-light: #948b86;
  --bg: #f5f5f7;
  --card: #ffffff;
  --border: #efe6e1;
  --ok: #1fa658;
  --err: #e5484d;
  --radius: 16px;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }

/* ================= 顾客端 ================= */
.customer-page {
  background: linear-gradient(160deg, #fff4e6 0%, #ffe9ec 55%, #fdeef7 100%);
  min-height: 100vh;
}
.c-wrap { max-width: 560px; margin: 0 auto; padding: 30px 16px 56px; }

.c-header { text-align: center; margin-bottom: 22px; }
.c-logo {
  display: inline-block;
  font-size: 26px; font-weight: 700; letter-spacing: 2px;
  background: var(--primary-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.c-sub { margin-top: 8px; color: var(--text-light); font-size: 13px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 6px 24px rgba(255, 120, 120, 0.08);
}
.card-title {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px;
  background: var(--primary-grad); display: inline-block;
}

/* 上一条祝福 */
.latest-meta { color: var(--text-light); font-size: 13px; margin-bottom: 10px; }
.latest-phone {
  display: inline-block; font-weight: 600; color: var(--primary);
  background: #fff0f3; border-radius: 999px; padding: 2px 12px; margin-right: 8px;
}
.latest-content { line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.latest-photo { border-radius: 12px; display: block; margin-top: 4px; }
.guide-text { color: var(--text-light); line-height: 1.8; }

/* 表单 */
.tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 10px 0; border-radius: 10px;
  background: #f7f1ef; color: var(--text-light); font-size: 14px;
  transition: all .2s;
}
.tab.active { background: var(--primary-grad); color: #fff; font-weight: 600; }

textarea {
  width: 100%; min-height: 110px; padding: 12px;
  border: 1px solid var(--border); border-radius: 12px;
  resize: vertical; outline: none; line-height: 1.6;
}
textarea:focus { border-color: var(--primary); }
.char-count { text-align: right; color: var(--text-light); font-size: 12px; margin-top: 6px; }

.upload-box {
  display: block; text-align: center; padding: 26px 12px;
  border: 1.5px dashed #f0c3b4; border-radius: 12px;
  color: var(--primary); font-size: 14px; cursor: pointer;
  background: #fffafa;
}
.upload-box small { display: block; color: var(--text-light); margin-top: 6px; font-size: 12px; }
#photoPreview { border-radius: 12px; margin-top: 10px; display: block; }

.form-item { margin-top: 16px; }
.form-item label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.form-item label .tip { font-weight: 400; color: var(--text-light); font-size: 12px; margin-left: 6px; }
.form-item input[type="tel"], .form-item input[type="text"], .form-item input[type="password"],
.form-item input[type="date"], .form-item select {
  width: 100%; padding: 12px;
  border: 1px solid var(--border); border-radius: 12px; outline: none;
  background: #fff;
}
.form-item input:focus, .form-item select:focus { border-color: var(--primary); }
.err-msg { color: var(--err); font-size: 12px; margin-top: 6px; }

.btn-primary {
  display: block; width: 100%; margin-top: 20px;
  padding: 14px 0; border-radius: 999px;
  background: var(--primary-grad); color: #fff;
  font-size: 16px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(255, 94, 126, 0.25);
  transition: opacity .2s;
}
.btn-primary:disabled { opacity: .6; }
.btn-primary:active { opacity: .85; }

.c-footer { text-align: center; color: #c9b3ac; font-size: 12px; margin-top: 10px; }

/* 提交成功页 */
.success-page { text-align: center; }
.success-icon {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--primary-grad); margin: 40px auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.success-icon::after {
  content: ""; width: 30px; height: 16px;
  border-left: 5px solid #fff; border-bottom: 5px solid #fff;
  transform: rotate(-45deg) translate(2px, -4px);
  border-radius: 2px;
}
.success-title { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.success-desc { color: var(--text-light); line-height: 1.8; padding: 0 20px; }

/* ================= 登录页 ================= */
.login-wrap { max-width: 400px; margin: 0 auto; padding: 60px 16px 40px; }

/* ================= 后台管理 ================= */
.admin-page { background: var(--bg); min-height: 100vh; }

.a-topbar {
  background: #fff; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.a-brand { font-weight: 700; font-size: 16px; }
.a-brand span { color: var(--primary); }
.a-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-light); }
.a-link-btn { color: var(--primary); font-size: 13px; }

.a-nav {
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; gap: 4px; padding: 0 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.a-tab {
  padding: 12px 14px; font-size: 14px; color: var(--text-light);
  white-space: nowrap; border-bottom: 2px solid transparent;
}
.a-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

.a-main { max-width: 1000px; margin: 0 auto; padding: 16px; }

.a-card {
  background: #fff; border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.a-card-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .form-item { margin-top: 0; min-width: 150px; flex: 1; }
.toolbar .form-item.tight { flex: 0 0 auto; min-width: 130px; }

.btn {
  padding: 10px 20px; border-radius: 10px; font-size: 14px;
  background: #f1eeec; color: var(--text);
}
.btn-primary-sm {
  padding: 10px 20px; border-radius: 10px; font-size: 14px;
  background: var(--primary-grad); color: #fff; font-weight: 600;
}
.btn-danger {
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
  background: #fdecec; color: var(--err);
}
.btn-plain {
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
  background: #f1eeec; color: var(--text);
}

.table-wrap { overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.a-table th, .a-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.a-table th { color: var(--text-light); font-weight: 500; font-size: 13px; background: #faf8f7; }
.a-table td.wrap { white-space: normal; max-width: 320px; word-break: break-word; }
.a-table tr:hover td { background: #fffafa; }
.a-table .thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }

.summary-bar {
  background: #fff7f0; border: 1px solid #ffe3c9;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 14px;
  font-size: 14px; color: #b45f1d;
}
.summary-bar b { font-size: 18px; margin: 0 2px; }

.empty { text-align: center; color: var(--text-light); padding: 40px 0; font-size: 14px; }
.ok-tip { background: #e9f8ef; color: var(--ok); border-radius: 10px; padding: 12px; margin-top: 14px; font-size: 14px; }
.error-tip { background: #fdecec; color: var(--err); border-radius: 10px; padding: 12px; margin-top: 14px; font-size: 14px; }

.back-link { display: inline-block; margin-bottom: 12px; font-size: 14px; color: var(--text-light); }

/* 时间线条目 */
.tl-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-badge {
  flex: 0 0 36px; height: 36px; border-radius: 50%;
  background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.tl-meta b { color: var(--text); }
.tl-content { line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.tl-photo { border-radius: 10px; margin-top: 6px; max-height: 220px; object-fit: cover; }

/* 扫码区域 */
#scanArea { width: 100%; max-width: 320px; margin: 10px auto; border-radius: 12px; overflow: hidden; }

/* 弹窗 */
dialog {
  border: none; border-radius: var(--radius); padding: 20px;
  width: min(92vw, 460px);
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.dlg-actions { display: flex; gap: 10px; margin-top: 18px; }
.dlg-actions button { flex: 1; padding: 11px 0; border-radius: 10px; font-size: 14px; }
.dlg-cancel { background: #f1eeec; color: var(--text); }
.dlg-save { background: var(--primary-grad); color: #fff; font-weight: 600; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; color: var(--text-light); }

/* 首页 */
.home-wrap { max-width: 560px; margin: 0 auto; padding: 60px 16px 40px; text-align: center; }
.home-entry {
  display: block; background: #fff; border-radius: var(--radius);
  padding: 24px 18px; margin-top: 16px; text-align: left;
  box-shadow: 0 6px 24px rgba(255,120,120,.08);
}
.home-entry b { display: block; font-size: 16px; margin-bottom: 6px; color: var(--text); }
.home-entry span { color: var(--text-light); font-size: 13px; line-height: 1.6; }

@media (max-width: 640px) {
  .a-main { padding: 12px; }
  .a-card { padding: 14px; }
  .a-table th, .a-table td { padding: 9px 8px; font-size: 13px; }
}

/* ================= v2：顾客端底部固定按钮（安全区适配） ================= */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 -4px 20px rgba(255, 120, 120, .10);
}
.bottom-bar a {
  flex: 1; text-align: center; padding: 13px 0; border-radius: 999px;
  font-size: 15px; font-weight: 600;
}
.bb-pass { background: var(--primary-grad); color: #fff; box-shadow: 0 6px 16px rgba(255, 94, 126, .25); }
.bb-search { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
body.has-bottom-bar .c-wrap { padding-bottom: 120px; }

/* 活动规则卡 */
.rules-list { line-height: 2; color: var(--text); font-size: 14px; }
.rules-list .rule-no {
  display: inline-block; width: 20px; height: 20px; line-height: 20px;
  border-radius: 50%; background: #fff0f3; color: var(--primary);
  font-size: 12px; text-align: center; margin-right: 8px; font-weight: 600;
}
.rules-slogan { margin-top: 8px; color: var(--primary); font-weight: 600; text-align: center; letter-spacing: 2px; }

/* 令牌暂停提示 */
.paused-tip {
  background: #fff7f0; border: 1px solid #ffd9c2; color: #c05621;
  border-radius: 12px; padding: 14px; line-height: 1.8; text-align: center;
}

/* 提交成功页内反馈 */
.success-feedback {
  background: #e9f8ef; border: 1px solid #bfe8cf; color: var(--ok);
  border-radius: 12px; padding: 14px; margin-top: 14px; line-height: 1.8;
}

/* 顶部主题形象图（替换活动规则区） */
.hero-section {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 6px 24px rgba(255, 120, 120, 0.10);
  background: #fff;
}
.hero-img { display: block; width: 100%; }

/* 传给下一桌：随机桌号 */
.random-num {
  font-size: 88px; font-weight: 800; line-height: 1.1; margin: 14px 0 4px;
  background: var(--primary-grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.random-unit { color: var(--text-light); font-size: 18px; }
.desk-tip { color: var(--text); line-height: 1.9; margin-top: 10px; }
.desk-tip b { color: var(--primary); font-size: 18px; }

/* 搜索祝福页 */
.search-bar { display: flex; gap: 10px; }
.search-bar input {
  flex: 1; padding: 12px; border: 1px solid var(--border);
  border-radius: 12px; outline: none; min-width: 0;
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar button {
  flex: 0 0 auto; padding: 0 22px; border-radius: 12px;
  background: var(--primary-grad); color: #fff; font-weight: 600; font-size: 15px;
}
.result-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.result-item:last-child { border-bottom: none; }
.result-meta { font-size: 12px; color: var(--text-light); margin-bottom: 6px; }
.result-content { line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.result-photo { border-radius: 10px; margin-top: 6px; max-height: 200px; object-fit: cover; }
.load-more {
  display: block; width: 100%; margin-top: 14px; padding: 11px 0;
  border-radius: 999px; background: #f7f1ef; color: var(--text); font-size: 14px;
}

/* 令牌状态徽标 */
.badge-ok { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #e9f8ef; color: var(--ok); font-size: 12px; white-space: nowrap; }
.badge-paused { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #fdecec; color: var(--err); font-size: 12px; white-space: nowrap; }
