// Legal / About pages — static placeholder content for /#/legal/about, /#/legal/privacy, /#/legal/terms.
// Real legal text should be reviewed by counsel before going live; until then the wording below is a
// reasonable bilingual template that won't surprise a user clicking the footer.

const __LegalShell = ({ eyebrow, title, sub, children }) => (
  <div className="pb-scroll">
    <PBNav />
    <section style={{ padding: '64px 48px 32px', background: 'var(--pb-paper)', borderBottom: '1px solid var(--pb-border)' }}>
      <div style={{ maxWidth: 880, margin: '0 auto' }}>
        <div className="pb-eyebrow" style={{ marginBottom: 16 }}>{eyebrow}</div>
        <h1 className="pb-h1" style={{ fontSize: 48, marginBottom: 14 }}>{title}</h1>
        {sub && <p style={{ fontSize: 16, color: 'var(--pb-fg-muted)', maxWidth: 640, lineHeight: 1.6 }}>{sub}</p>}
      </div>
    </section>
    <section style={{ padding: '48px 48px 96px' }}>
      <div style={{ maxWidth: 880, margin: '0 auto', fontSize: 15, lineHeight: 1.85 }}>
        {children}
      </div>
    </section>
    <PBFooter />
  </div>
);

const __H = ({ children }) => (
  <h2 style={{ fontFamily: 'var(--pb-serif)', fontSize: 24, fontWeight: 600, margin: '36px 0 14px' }}>{children}</h2>
);

const __P = ({ children }) => (
  <p style={{ margin: '0 0 16px', color: 'var(--pb-fg)' }}>{children}</p>
);

const __Updated = ({ lang }) => (
  <div className="pb-mono" style={{ fontSize: 12, color: 'var(--pb-fg-muted)', marginTop: 32, paddingTop: 24, borderTop: '1px solid var(--pb-border)' }}>
    {lang === 'zh' ? '最近更新：2026 年 5 月 7 日' : 'Last updated: 2026-05-07'}
  </div>
);

// ─────────────────────────────────────────────────────────────────────────────
// About
// ─────────────────────────────────────────────────────────────────────────────
const AboutPage = () => {
  const lang = useLang();
  return (
    <__LegalShell
      eyebrow={lang === 'zh' ? '关于启桥 · ABOUT' : 'About PathBridge · 关于启桥'}
      title={lang === 'zh' ? '一座桥\n一程路\n一种确定' : 'A bridge\nA path\nA certainty'}
      sub={lang === 'zh'
        ? '启桥成立于 2018 年。十年间，我们陪伴 12,000+ 名学生从中国高中走向全国乃至全球的大学课堂。'
        : 'PathBridge was founded in 2018. Over the past decade we have walked with 12,000+ students from Chinese high schools into university classrooms across the country and around the world.'}
    >
      <__H>{lang === 'zh' ? '我们做什么' : 'What we do'}</__H>
      <__P>
        {lang === 'zh'
          ? '我们把高考志愿与海外申请这两件原本割裂的事，放在同一个数据底座上，帮学生在更大的版图里看清自己，也看清下一步。'
          : 'Most agencies treat Gaokao placement and overseas admissions as separate worlds. We put them on a single data spine, so students can see themselves — and their next step — on a wider map.'}
      </__P>

      <__H>{lang === 'zh' ? '我们如何工作' : 'How we work'}</__H>
      <__P>
        {lang === 'zh'
          ? '每位学生都会匹配到一名主顾问 + 文书顾问 + 面试教练。所有顾问都来自清北、藤校、G5、港新前三的院校，平均行业经验 8 年。'
          : 'Every student is matched with a lead counselor, a writing coach, and an interview coach. All counselors hold degrees from Tsinghua, Peking, the Ivy League, Oxbridge, or HKU/NUS — average industry experience of 8 years.'}
      </__P>
      <__P>
        {lang === 'zh'
          ? '我们公开每一笔费用、每一位顾问的简历、近三个申请季所有签约学生的录取结果。这是我们和"中介"最大的区别。'
          : 'We publish every fee, every counselor\'s CV, and every admission outcome from the last three application seasons. That is what separates us from a typical agency.'}
      </__P>

      <__H>{lang === 'zh' ? '联系我们' : 'Contact'}</__H>
      <__P>
        {lang === 'zh'
          ? '工作日 9:00–22:00、周末 10:00–20:00 实时响应。海外学生可指定时区。'
          : 'Weekdays 9:00–22:00, weekends 10:00–20:00 (Beijing). Overseas students can request their own timezone.'}
      </__P>
      <__Updated lang={lang} />
    </__LegalShell>
  );
};

// ─────────────────────────────────────────────────────────────────────────────
// Privacy
// ─────────────────────────────────────────────────────────────────────────────
const PrivacyPage = () => {
  const lang = useLang();
  return (
    <__LegalShell
      eyebrow={lang === 'zh' ? '隐私政策 · PRIVACY' : 'Privacy Policy · 隐私政策'}
      title={lang === 'zh' ? '我们怎么处理\n你的个人信息' : 'How we handle\nyour personal data'}
      sub={lang === 'zh'
        ? '本政策说明启桥（PathBridge Education）在你使用本网站和服务时，会收集哪些信息、如何使用、以及你对自己数据的权利。'
        : 'This policy explains what data PathBridge Education collects when you use this website and our services, how we use it, and what rights you have over your own data.'}
    >
      <__H>{lang === 'zh' ? '1. 我们收集的信息' : '1. What we collect'}</__H>
      <__P>
        {lang === 'zh'
          ? '注册账号时：邮箱、姓名、可选的电话、当前学生类型与年级。修改个人资料时：以上字段的更新值。使用测算与评估工具时：你输入的分数、成绩、活动、目标方向等表单数据。预约咨询时：联系姓名、电话、微信、备注。'
          : 'When you register: email, name, optional phone, student type and grade year. When you update your profile: the new values of those fields. When you use our calculator / evaluator: the scores, grades, activities, and goals you enter. When you book a consult: contact name, phone, WeChat ID, and any notes you add.'}
      </__P>
      <__P>
        {lang === 'zh' ? '我们使用 cookie 维持登录状态（pb_token，httpOnly，7 天有效期）。除此之外不使用第三方追踪 cookie。' : 'We use a single cookie (pb_token, httpOnly, 7-day expiry) to keep you signed in. We do not use third-party tracking cookies.'}
      </__P>

      <__H>{lang === 'zh' ? '2. 我们如何使用' : '2. How we use it'}</__H>
      <__P>
        {lang === 'zh'
          ? '为你提供登录、保存测算结果、生成匹配报告、安排顾问咨询。不会未经你同意把上述信息用于产品功能之外的用途。'
          : 'To sign you in, save your assessment results, generate match reports, and schedule counselor consultations. We do not use this data for any purpose outside the product features without your consent.'}
      </__P>

      <__H>{lang === 'zh' ? '3. 存储与保护' : '3. Storage and security'}</__H>
      <__P>
        {lang === 'zh'
          ? '密码使用 bcrypt 哈希存储，服务端永远看不到明文。会话使用 JWT (HS256) 签名，cookie 标记为 httpOnly + Secure + SameSite=Lax。数据持久化在 Upstash Redis（Vercel 集成）。'
          : 'Passwords are hashed with bcrypt; we never see your plaintext. Sessions are signed JWT (HS256) tokens delivered as httpOnly + Secure + SameSite=Lax cookies. Persistent data lives in Upstash Redis via the Vercel integration.'}
      </__P>

      <__H>{lang === 'zh' ? '4. 第三方分享' : '4. Third-party sharing'}</__H>
      <__P>
        {lang === 'zh'
          ? '不向任何第三方出售你的个人信息。只有当法律明确要求或你明确同意时，才会披露相关信息。'
          : 'We never sell your personal data to any third party. We only disclose data when required by law or with your explicit consent.'}
      </__P>

      <__H>{lang === 'zh' ? '5. 你的权利' : '5. Your rights'}</__H>
      <__P>
        {lang === 'zh'
          ? '你可以在「个人资料」页随时查看、修改你的信息；可以申请删除账号（请发邮件到 hello@pathbridge.cn，我们会在 30 天内完成）。'
          : 'You can view and edit your data on the Profile page at any time. To request account deletion, email hello@pathbridge.cn — we will complete the request within 30 days.'}
      </__P>

      <__H>{lang === 'zh' ? '6. 联系方式' : '6. Contact'}</__H>
      <__P>
        {lang === 'zh'
          ? '隐私问题或申诉：hello@pathbridge.cn'
          : 'For privacy questions or complaints: hello@pathbridge.cn'}
      </__P>
      <__Updated lang={lang} />
    </__LegalShell>
  );
};

// ─────────────────────────────────────────────────────────────────────────────
// Terms
// ─────────────────────────────────────────────────────────────────────────────
const TermsPage = () => {
  const lang = useLang();
  return (
    <__LegalShell
      eyebrow={lang === 'zh' ? '用户协议 · TERMS' : 'Terms of Service · 用户协议'}
      title={lang === 'zh' ? '使用启桥 · 用户协议' : 'Using PathBridge'}
      sub={lang === 'zh'
        ? '本协议是你与启桥（PathBridge Education）之间关于使用本网站及其服务的法律协议。注册或继续使用即视为同意。'
        : 'This agreement governs your use of the PathBridge Education website and services. By registering or continuing to use the service, you accept these terms.'}
    >
      <__H>{lang === 'zh' ? '1. 账号' : '1. Your account'}</__H>
      <__P>
        {lang === 'zh'
          ? '你需提供真实有效的邮箱注册账号，并对账号下的活动负责。请妥善保管密码。'
          : 'You must provide a real, valid email address. You are responsible for activity under your account; keep your password safe.'}
      </__P>

      <__H>{lang === 'zh' ? '2. 服务范围' : '2. Scope of service'}</__H>
      <__P>
        {lang === 'zh'
          ? '启桥提供高考志愿测算、留学背景评估、AI 匹配报告、1v1 咨询等教育相关的信息服务。所有结果与建议仅供参考，不构成对录取结果的担保（除非另有书面保录协议）。'
          : 'PathBridge provides Gaokao placement modeling, study-abroad profile evaluation, AI match reports, and 1:1 counseling. Outputs are advisory and do not guarantee any admission outcome unless covered by a separate written guaranteed-admission agreement.'}
      </__P>

      <__H>{lang === 'zh' ? '3. 你的承诺' : '3. Your commitments'}</__H>
      <__P>
        {lang === 'zh'
          ? '不上传虚假分数 / 简历 / 联系方式；不利用本服务进行骚扰、欺诈或其它违反中国法律法规的行为。'
          : 'You will not submit fake scores, resumes, or contact information; you will not use the service for harassment, fraud, or any activity that breaks the law of the jurisdiction in which you live.'}
      </__P>

      <__H>{lang === 'zh' ? '4. 付费与退款' : '4. Payments and refunds'}</__H>
      <__P>
        {lang === 'zh'
          ? '一次性付费功能（如解锁完整报告）按订单金额收取；全程套餐按合同约定。保录协议约定的退款比例以书面合同为准。'
          : 'One-time fees (e.g. unlocking the full report) are charged at the order amount. Full-season packages follow the contract you sign. Refund ratios under guaranteed-admission agreements are governed by their written contracts.'}
      </__P>

      <__H>{lang === 'zh' ? '5. 服务变更与终止' : '5. Changes and termination'}</__H>
      <__P>
        {lang === 'zh'
          ? '我们可能因运维、法律或商业调整修改、暂停或终止部分功能。重要变更会提前通过站内通知或邮件告知。'
          : 'We may modify, suspend, or discontinue features for operational, legal, or business reasons. We will give advance notice of significant changes via in-app notice or email.'}
      </__P>

      <__H>{lang === 'zh' ? '6. 适用法律' : '6. Governing law'}</__H>
      <__P>
        {lang === 'zh'
          ? '本协议适用中华人民共和国法律。如发生争议，提交北京市仲裁委员会仲裁。'
          : 'This agreement is governed by the laws of the People\'s Republic of China. Any dispute will be submitted to the Beijing Arbitration Commission.'}
      </__P>

      <__H>{lang === 'zh' ? '7. 联系方式' : '7. Contact'}</__H>
      <__P>
        {lang === 'zh'
          ? '法律事务联络：hello@pathbridge.cn'
          : 'For legal correspondence: hello@pathbridge.cn'}
      </__P>
      <__Updated lang={lang} />
    </__LegalShell>
  );
};

window.AboutPage = AboutPage;
window.PrivacyPage = PrivacyPage;
window.TermsPage = TermsPage;
