// Shared navigation header
const Nav = ({ route, go }) => {
  const link = (path, label) => (
    <a href={'#' + path} onClick={(e) => { e.preventDefault(); go(path); }} className={route === path ? 'active' : ''}>{label}</a>
  );
  return (
    <header className="nav">
      <div className="container nav-inner">
        <a href="#/" onClick={(e) => { e.preventDefault(); go('/'); }} className="brand">
          <span className="brand-mark">信</span>
          <span>广西信合<span className="brand-sub">团队的 AI 执行工作台</span></span>
        </a>
        <nav className="nav-links">
          {link('/product', '产品')}
          {link('/guangxi', '广西本地服务')}
          {link('/contact', '联系 / 下载')}
          <a href="#/contact" onClick={(e) => { e.preventDefault(); go('/contact'); }} className="btn btn-primary">下载桌面版</a>
        </nav>
      </div>
    </header>
  );
};

const Footer = ({ go }) => (
  <footer>
    <div className="container">
      <div className="foot-grid">
        <div>
          <div className="brand" style={{ color: '#fff' }}>
            <span className="brand-mark">信</span>
            <span style={{ color: '#fff' }}>广西信合</span>
          </div>
          <p style={{ color: '#8C8778', maxWidth: '40ch', marginTop: 12, fontSize: 14 }}>
            广西地区 AI 执行工作台授权服务商，为政企客户提供部署、培训与长期支持。
          </p>
        </div>
        <div>
          <h4>产品</h4>
          <a href="#/product" onClick={(e) => { e.preventDefault(); go('/product'); }}>功能</a>
          <a href="#/product" onClick={(e) => { e.preventDefault(); go('/product'); }}>技术架构</a>
          <a href="#/contact" onClick={(e) => { e.preventDefault(); go('/contact'); }}>下载</a>
        </div>
        <div>
          <h4>资源</h4>
          <a href="#">帮助中心</a>
          <a href="#">快速入门</a>
          <a href="#">更新日志</a>
        </div>
        <div>
          <h4>公司</h4>
          <a href="#/guangxi" onClick={(e) => { e.preventDefault(); go('/guangxi'); }}>广西本地服务</a>
          <a href="#/contact" onClick={(e) => { e.preventDefault(); go('/contact'); }}>联系我们</a>
          <a href="mailto:support@gxxh.tech">support@gxxh.tech</a>
        </div>
      </div>
      <div className="foot-bottom">
        <span>© 2026 广西信合 · gxxh.tech</span>
        <span>桂 ICP 备案申请中 · 服务范围：广西壮族自治区</span>
      </div>
    </div>
  </footer>
);

Object.assign(window, { Nav, Footer });
