// Stashly Support page. window.StashlySupport.
const { SectionLabel, Card, Icon, Button } = window.StashlyDesignSystem_821802;
const PHs = ({ children }) => <span style={{ background: 'var(--orange-50)', color: 'var(--orange-700)', borderRadius: 6, padding: '1px 7px', fontWeight: 600 }}>{children}</span>;
const proseS = { fontFamily: 'var(--font-body)', fontSize: 16.5, lineHeight: 1.65, color: 'var(--text-body)' };

const FAQ = [
  ['What is Stashly?', <span>Stashly is your stash-care friend — a beauty app that helps you track what you own, rediscover forgotten favorites, track expirations, and make the most of every product you own.</span>],
  ['Is Stashly free?', <span>Yes! Stashly is free to download and use. Stashly Premium removes ads and unlocks unlimited barcode scans and product search for $2.99/month or $9.99/year.</span>],
  ['Which devices are supported?', <span>Stashly is available on iOS via the App Store, and coming soon to Google Play.</span>],
  ['How do I manage or delete my account?', <span>You can manage your account in the app's settings. To request deletion of your account and data, email <PHs>[SUPPORT EMAIL]</PHs>.</span>],
  ['How do I report a problem or suggest a feature?', <span>Email <PHs>[SUPPORT EMAIL]</PHs> — early feedback genuinely shapes the app.</span>],
];

function FaqItem({ q, a, open, onClick }) {
  return (
    <div style={{ borderBottom: '1px solid var(--border-subtle)' }}>
      <button onClick={onClick} style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16, background: 'none', border: 'none', cursor: 'pointer', padding: '20px 4px', textAlign: 'left' }}>
        <span style={{ fontFamily: 'var(--font-display)', fontSize: 20, color: 'var(--text-strong)' }}>{q}</span>
        <Icon name={open ? 'minus' : 'plus'} size={22} style={{ color: 'var(--color-primary)', flex: '0 0 auto' }} />
      </button>
      {open && <div style={{ ...proseS, padding: '0 4px 22px' }}>{a}</div>}
    </div>
  );
}

function Support() {
  const [open, setOpen] = React.useState(0);
  return (
    <div style={{ background: 'var(--bg-page)' }}>
      <window.Nav />
      <section style={{ background: 'var(--burgundy-500)', color: 'var(--cream-200)', padding: '64px 0 60px', position: 'relative', overflow: 'hidden' }}>
        <div style={{ position: 'absolute', top: -30, right: -20, fontFamily: 'var(--font-stroke)', fontSize: 200, color: 'rgba(238,115,36,0.12)', lineHeight: 1, pointerEvents: 'none' }}>?</div>
        <div style={{ maxWidth: 820, margin: '0 auto', padding: '0 28px', position: 'relative' }}>
          <SectionLabel color="var(--orange-400)">stashly.life/support</SectionLabel>
          <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 56, margin: '14px 0 12px', lineHeight: 1 }}>We're here to help</h1>
          <p style={{ fontFamily: 'var(--font-body)', fontSize: 18, color: 'var(--cream-300)', margin: 0, maxWidth: 560, lineHeight: 1.55 }}>
            Got a question, found a bug, or want to share feedback? We'd love to hear from you.
          </p>
        </div>
      </section>

      <section style={{ padding: '52px 0 20px' }}>
        <div style={{ maxWidth: 820, margin: '0 auto', padding: '0 28px' }}>
          <Card padding="lg" style={{ display: 'flex', gap: 20, alignItems: 'center', flexWrap: 'wrap' }}>
            <span style={{ width: 60, height: 60, borderRadius: 'var(--radius-lg)', background: 'var(--orange-50)', display: 'grid', placeItems: 'center', flex: '0 0 auto' }}>
              <Icon name="mail" size={30} style={{ color: 'var(--color-primary)' }} />
            </span>
            <div style={{ flex: 1, minWidth: 240 }}>
              <div style={{ fontFamily: 'var(--font-display)', fontSize: 22, color: 'var(--text-strong)' }}>Contact us</div>
              <p style={{ ...proseS, margin: '4px 0 0' }}>Email <PHs>[SUPPORT EMAIL]</PHs> — we usually reply within <b>1–2 business days</b>.</p>
            </div>
            <a href="mailto:"><Button variant="primary" iconLeft="mail">Email support</Button></a>
          </Card>
        </div>
      </section>

      <section style={{ padding: '32px 0 40px' }}>
        <div style={{ maxWidth: 820, margin: '0 auto', padding: '0 28px' }}>
          <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 34, color: 'var(--text-strong)', margin: '0 0 8px' }}>FAQ</h2>
          <div>
            {FAQ.map(([q, a], i) => (
              <FaqItem key={i} q={q} a={a} open={open === i} onClick={() => setOpen(open === i ? -1 : i)} />
            ))}
          </div>
        </div>
      </section>

      <section style={{ padding: '20px 0 80px' }}>
        <div style={{ maxWidth: 820, margin: '0 auto', padding: '0 28px' }}>
          <Card padding="lg" tone="orange" style={{ textAlign: 'center' }}>
            <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 26, margin: '0 0 8px' }}>Stay connected</h3>
            <p style={{ fontFamily: 'var(--font-body)', fontSize: 16.5, margin: '0 0 4px', opacity: 0.95 }}>
              Follow us at <PHs>[@handles]</PHs> for updates and beauty inspiration.
            </p>
          </Card>
        </div>
      </section>
      <window.Footer />
    </div>
  );
}
window.StashlySupport = Support;
