// signup-influencer.jsx — Înscriere influenceri (formular complet)

const { useState: useStateSi } = React;

const SI_NICHES = ['Lifestyle', 'Beauty', 'Fashion', 'Gaming', 'Food', 'Tech', 'Sport', 'Travel', 'Family', 'Music', 'Comedy', 'Educație'];
const SI_COLLAB_TYPES = [
  { id: 'brand',      ico: '🤝', t: 'Colaborări cu branduri' },
  { id: 'live',       ico: '🔴', t: 'Promovare pe TikTok Live' },
  { id: 'paid_posts', ico: '💸', t: 'Postări plătite' },
  { id: 'ambassador', ico: '⭐', t: 'Ambasador de brand' },
  { id: 'event',      ico: '🎤', t: 'Evenimente' },
];
const SI_FOLLOWER_RANGES = ['Sub 1.000', '1k - 10k', '10k - 50k', '50k - 100k', '100k - 500k', '500k - 1M', 'Peste 1M'];
const SI_RATE_RANGES = ['0 - 500 RON', '500 - 2.000 RON', '2.000 - 5.000 RON', '5.000 - 15.000 RON', 'Peste 15.000 RON', 'Negociabil'];

// ─── Logo SVG inline pentru platforme ─────────────────────────
function SiPlatformLogo({ type }) {
  const wrap = { width: 40, height: 40, borderRadius: 10, display: 'grid', placeItems: 'center', border: '.5px solid var(--line)' };
  if (type === 'tiktok') {
    return (
      <div style={{ ...wrap, background: '#000' }}>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="#fff">
          <path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5.8 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1.84-.1z"/>
        </svg>
      </div>
    );
  }
  if (type === 'instagram') {
    return (
      <div style={{ ...wrap, background: 'linear-gradient(135deg, #F58529 0%, #DD2A7B 50%, #8134AF 100%)' }}>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="#fff">
          <path d="M12 2.16c3.2 0 3.58.01 4.85.07 1.17.05 1.81.25 2.23.41.56.22.96.48 1.38.9.42.42.68.82.9 1.38.16.42.36 1.06.41 2.23.06 1.27.07 1.65.07 4.85s-.01 3.58-.07 4.85c-.05 1.17-.25 1.81-.41 2.23-.22.56-.48.96-.9 1.38-.42.42-.82.68-1.38.9-.42.16-1.06.36-2.23.41-1.27.06-1.65.07-4.85.07s-3.58-.01-4.85-.07c-1.17-.05-1.81-.25-2.23-.41-.56-.22-.96-.48-1.38-.9-.42-.42-.68-.82-.9-1.38-.16-.42-.36-1.06-.41-2.23-.06-1.27-.07-1.65-.07-4.85s.01-3.58.07-4.85c.05-1.17.25-1.81.41-2.23.22-.56.48-.96.9-1.38.42-.42.82-.68 1.38-.9.42-.16 1.06-.36 2.23-.41 1.27-.06 1.65-.07 4.85-.07M12 0C8.74 0 8.33.01 7.05.07 5.78.13 4.9.33 4.14.63c-.79.31-1.46.72-2.13 1.39C1.34 2.69.93 3.36.62 4.14.32 4.9.13 5.78.07 7.05.01 8.33 0 8.74 0 12s.01 3.67.07 4.95c.06 1.27.26 2.15.56 2.91.31.79.72 1.46 1.39 2.13.67.67 1.34 1.08 2.13 1.39.76.3 1.64.5 2.91.56C8.33 23.99 8.74 24 12 24s3.67-.01 4.95-.07c1.27-.06 2.15-.26 2.91-.56.79-.31 1.46-.72 2.13-1.39.67-.67 1.08-1.34 1.39-2.13.3-.76.5-1.64.56-2.91.06-1.28.07-1.69.07-4.95s-.01-3.67-.07-4.95c-.06-1.27-.26-2.15-.56-2.91-.31-.79-.72-1.46-1.39-2.13C21.31 1.34 20.64.93 19.86.62c-.76-.3-1.64-.5-2.91-.56C15.67.01 15.26 0 12 0zm0 5.84c-3.4 0-6.16 2.76-6.16 6.16s2.76 6.16 6.16 6.16 6.16-2.76 6.16-6.16S15.4 5.84 12 5.84zm0 10.16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm6.41-11.85c-.8 0-1.44.65-1.44 1.44s.65 1.44 1.44 1.44 1.44-.65 1.44-1.44-.64-1.44-1.44-1.44z"/>
        </svg>
      </div>
    );
  }
  if (type === 'facebook') {
    return (
      <div style={{ ...wrap, background: '#1877F2' }}>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="#fff">
          <path d="M24 12.07C24 5.41 18.63 0 12 0S0 5.41 0 12.07C0 18.1 4.39 23.1 10.13 24v-8.44H7.08v-3.49h3.05V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.96.93-1.96 1.89v2.26h3.33l-.53 3.49h-2.8V24C19.61 23.1 24 18.1 24 12.07z"/>
        </svg>
      </div>
    );
  }
  if (type === 'youtube') {
    return (
      <div style={{ ...wrap, background: '#FF0000' }}>
        <svg width="22" height="22" viewBox="0 0 24 24" fill="#fff">
          <path d="M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z"/>
        </svg>
      </div>
    );
  }
  return null;
}

function SignupInfluencerPage({ onNav }) {
  const [done, setDone] = useStateSi(false);
  const [loading, setLoading] = useStateSi(false);
  const [errorMsg, setErrorMsg] = useStateSi('');
  const [data, setData] = useStateSi({
    fullName: '', email: '', phone: '', address: '',
    country: 'România', county: '', city: '',
    tiktokHandle: '',  tiktokFollowers: '',
    instaHandle: '',   instaFollowers: '',
    fbHandle: '',      fbFollowers: '',
    ytHandle: '',      ytFollowers: '',
    niches: [], collabTypes: [],
    rateRange: '', message: '', terms: false,
    website_url: '',
  });

  React.useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://cdn.iubenda.com/iubenda.js';
    script.async = true;
    document.body.appendChild(script);
    return () => {
      if (script.parentNode) script.parentNode.removeChild(script);
    };
  }, []);

  const set = (k, v) => setData(d => ({ ...d, [k]: v }));
  const toggle = (k, v) => setData(d => ({ ...d, [k]: d[k].includes(v) ? d[k].filter(x => x !== v) : [...d[k], v] }));

  const hasFullPlatform = (data.tiktokHandle && data.tiktokFollowers) ||
                          (data.instaHandle && data.instaFollowers) ||
                          (data.fbHandle && data.fbFollowers) ||
                          (data.ytHandle && data.ytFollowers);
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  const geoOk = data.country && (data.country !== 'România' || (data.county && data.city));
  const canSubmit = data.fullName && data.email && emailRegex.test(data.email) && data.phone && data.address &&
                    geoOk &&
                    hasFullPlatform &&
                    data.niches.length > 0 && data.collabTypes.length > 0 &&
                    data.rateRange && data.terms;

  const submit = async () => {
    if (!canSubmit) return;
    // Honeypot — bot a completat câmpul invizibil; afișăm success silent fără să trimitem nimic
    if (data.website_url) {
      setDone(true);
      return;
    }
    setLoading(true);
    setErrorMsg('');
    const toInt = (val) => {
      const n = parseInt(val, 10);
      return isNaN(n) ? null : n;
    };
    try {
      const { error } = await window.sb.from('influencer_applications').insert({
        full_name: data.fullName,
        email: data.email.trim().toLowerCase(),
        phone: data.phone,
        address: data.address,
        country: data.country || null,
        county: data.county || null,
        city: data.city || null,
        tiktok_handle: data.tiktokHandle || null,
        tiktok_followers: toInt(data.tiktokFollowers),
        insta_handle: data.instaHandle || null,
        insta_followers: toInt(data.instaFollowers),
        fb_handle: data.fbHandle || null,
        fb_followers: toInt(data.fbFollowers),
        yt_handle: data.ytHandle || null,
        yt_followers: toInt(data.ytFollowers),
        niches: data.niches,
        collab_types: data.collabTypes,
        rate_range: data.rateRange,
        message: data.message || null,
        terms_accepted: data.terms,
      });
      if (error) {
        console.error('[4U Media] Eroare submit influencer:', error);
        setErrorMsg('A apărut o eroare la trimitere. Te rugăm să încerci din nou sau să ne contactezi pe email.');
        setLoading(false);
        return;
      }
      setLoading(false);
      setDone(true);
      setTimeout(() => window.fireConfetti?.(), 200);
    } catch (e) {
      console.error('[4U Media] Network error submit influencer:', e);
      setErrorMsg('Conexiune eșuată. Verifică internetul și încearcă din nou.');
      setLoading(false);
    }
  };

  return (
    <div className="page" style={{ minHeight: '100vh', position: 'relative', overflow: 'hidden', paddingTop: 100, paddingBottom: 80 }}>
      <Mesh /><Particles count={28} />
      <div className="container" style={{ position: 'relative', zIndex: 2, maxWidth: 920 }}>
        <SiHero onNav={onNav} />

        {!done ? (
          <Reveal delay={100}>
            <div className="card-glass" style={{ padding: 'clamp(28px, 4vw, 48px)', marginTop: 24 }}>

              {/* 01 — Date personale */}
              <SiSection title="01" label="Date personale" />
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 16, marginBottom: 16 }}>
                <SiField label="Nume complet" placeholder="Maria Popescu" value={data.fullName} onChange={v => set('fullName', v)} />
                <SiField label="Email"        type="email" placeholder="maria@email.ro" value={data.email} onChange={v => set('email', v)}
                  error={data.email && !emailRegex.test(data.email) ? 'Format email invalid' : ''} />
                <SiField label="Telefon"        placeholder="+40 7XX XXX XXX" value={data.phone} onChange={v => set('phone', v)} />
              </div>
              <div style={{ marginBottom: 16 }}>
                <window.CountryCascade
                  country={data.country}
                  county={data.county}
                  city={data.city}
                  setCountry={v => set('country', v)}
                  setCounty={v => set('county', v)}
                  setCity={v => set('city', v)}
                  required={true}
                />
              </div>
              <div style={{ marginBottom: 32 }}>
                <SiField label="Adresă completă (stradă, număr, bloc, scară, apartament)"
                  placeholder="Str. Exemplu nr. 12, bl. 5, sc. A, ap. 24"
                  value={data.address} onChange={v => set('address', v)} />
              </div>

              {/* 02 — Platforme */}
              <SiSection title="02" label="Platforme & urmăritori" hint="Completează cel puțin o platformă" />
              <div style={{ display: 'grid', gap: 12, marginBottom: 32 }}>
                <SiPlatformRow type="tiktok"    name="TikTok"
                  handle={data.tiktokHandle}  followers={data.tiktokFollowers}
                  onHandle={v => set('tiktokHandle', v)} onFollowers={v => set('tiktokFollowers', v)} />
                <SiPlatformRow type="instagram" name="Instagram"
                  handle={data.instaHandle}   followers={data.instaFollowers}
                  onHandle={v => set('instaHandle', v)} onFollowers={v => set('instaFollowers', v)} />
                <SiPlatformRow type="facebook"  name="Facebook"
                  handle={data.fbHandle}      followers={data.fbFollowers}
                  onHandle={v => set('fbHandle', v)} onFollowers={v => set('fbFollowers', v)} />
                <SiPlatformRow type="youtube"   name="YouTube"
                  handle={data.ytHandle}      followers={data.ytFollowers}
                  onHandle={v => set('ytHandle', v)} onFollowers={v => set('ytFollowers', v)} />
              </div>

              {/* 03 — Niches */}
              <SiSection title="03" label="Categorii / niche" hint="Selectează 1-3" />
              <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8, marginBottom: 32 }}>
                {SI_NICHES.map(n => (
                  <SiChip key={n} active={data.niches.includes(n)} onClick={() => toggle('niches', n)}>{n}</SiChip>
                ))}
              </div>

              {/* 04 — Tipuri colaborări */}
              <SiSection title="04" label="Tipuri de colaborări dorite" />
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))', gap: 12, marginBottom: 32 }}>
                {SI_COLLAB_TYPES.map(c => (
                  <SiCard key={c.id} active={data.collabTypes.includes(c.id)}
                    onClick={() => toggle('collabTypes', c.id)} icon={c.ico} label={c.t} />
                ))}
              </div>

              {/* 05 — Onorariu */}
              <SiSection title="05" label="Onorariu per colaborare" />
              <div style={{ marginBottom: 16, padding: '12px 14px', borderRadius: 10, background: 'rgba(255,215,0,.06)', border: '.5px solid rgba(255,215,0,.25)', display: 'flex', gap: 10, alignItems: 'flex-start' }}>
                <span style={{ fontSize: 16, lineHeight: 1.4 }}>⚠️</span>
                <span style={{ fontSize: 12, color: 'var(--txt-2)', lineHeight: 1.5 }}>
                  <strong style={{ color: 'var(--accent-2)' }}>Important:</strong> Alege o sumă realistă, în concordanță cu numărul tău de urmăritori și engagement-ul real. Suma este folosită ca filtru pentru colaborările pe care ți le propunem — selectarea unei sume nepotrivite cu profilul tău reduce drastic ofertele primite.
                </span>
              </div>
              <div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, marginBottom: 32 }}>
                {SI_RATE_RANGES.map(b => (
                  <SiChip key={b} active={data.rateRange === b} onClick={() => set('rateRange', b)} compact>{b}</SiChip>
                ))}
              </div>

              {/* 06 — Mesaj */}
              <SiSection title="06" label="Mesaj pentru echipa 4U" hint="Opțional" />
              <textarea
                value={data.message}
                onChange={e => set('message', e.target.value)}
                placeholder="Spune-ne pe scurt despre tine, despre publicul tău, ce te motivează să colaborezi cu 4U..."
                rows={4}
                className="input"
                style={{ width: '100%', resize: 'vertical', marginBottom: 24, minHeight: 96, padding: 14, fontFamily: 'inherit' }}
              />

              {/* Terms */}
              <label style={{ display: 'flex', alignItems: 'flex-start', gap: 12, cursor: 'pointer', marginBottom: 24, fontSize: 13, color: 'var(--txt-2)', lineHeight: 1.5 }}>
                <input type="checkbox" checked={data.terms} onChange={e => set('terms', e.target.checked)}
                  style={{ marginTop: 3, accentColor: 'var(--accent-1)', width: 16, height: 16 }} />
                <span>
                  Sunt de acord cu{' '}
                  <a href="https://www.iubenda.com/terms-and-conditions/26919297"
                     className="iubenda-nostyle iubenda-noiframe iubenda-embed hov"
                     title="Termeni și condiții"
                     style={{ color: 'var(--accent-1)', cursor: 'pointer' }}>Termenii și condițiile</a>
                  {' '}și{' '}
                  <a href="https://www.iubenda.com/privacy-policy/49632785"
                     className="iubenda-nostyle iubenda-noiframe iubenda-embed hov"
                     title="Politică de Confidențialitate"
                     style={{ color: 'var(--accent-1)', cursor: 'pointer' }}>Politica de confidențialitate</a>. Datele vor fi folosite exclusiv pentru evaluarea aplicației mele.
                </span>
              </label>

              {/* Honeypot — câmp invizibil pentru detectare boți */}
              <input
                type="text"
                name="website_url"
                value={data.website_url}
                onChange={e => set('website_url', e.target.value)}
                tabIndex={-1}
                autoComplete="off"
                aria-hidden="true"
                style={{ position: 'absolute', left: -9999, width: 1, height: 1, opacity: 0, pointerEvents: 'none' }}
              />

              {/* Error message */}
              {errorMsg && (
                <div style={{ marginBottom: 16, padding: '12px 14px', borderRadius: 10, background: 'rgba(255,90,90,.06)', border: '.5px solid rgba(255,100,100,.3)', display: 'flex', gap: 10, alignItems: 'flex-start' }}>
                  <span style={{ fontSize: 16, lineHeight: 1.4 }}>⚠️</span>
                  <span style={{ fontSize: 13, color: 'var(--txt-2)', lineHeight: 1.5 }}>{errorMsg}</span>
                </div>
              )}

              {/* Actions */}
              <div style={{ display: 'flex', gap: 12, justifyContent: 'flex-end', flexWrap: 'wrap' }}>
                <button className="btn btn-glass" onClick={() => onNav('home')} disabled={loading}
                  style={{ opacity: loading ? 0.6 : 1, cursor: loading ? 'not-allowed' : 'pointer' }}>Anulează</button>
                <button className="btn btn-primary" onClick={submit} disabled={loading || !canSubmit}
                  style={{ opacity: (loading || !canSubmit) ? 0.45 : 1, cursor: (loading || !canSubmit) ? 'not-allowed' : 'pointer' }}>
                  {loading ? (
                    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
                      <span style={{ width: 14, height: 14, border: '2px solid rgba(0,0,0,.2)', borderTopColor: 'currentColor', borderRadius: '50%', animation: 'si-spin .8s linear infinite', display: 'inline-block' }} />
                      Se trimite...
                    </span>
                  ) : 'Trimite aplicația →'}
                </button>
              </div>
              <style>{`@keyframes si-spin { to { transform: rotate(360deg); } }`}</style>
              {!canSubmit && !loading && (
                <div style={{ marginTop: 12, fontSize: 12, color: 'var(--txt-3)', textAlign: 'right' }}>
                  Toate secțiunile sunt obligatorii — completează tot și acceptă termenii.
                </div>
              )}
            </div>
          </Reveal>
        ) : <SiSuccess onNav={onNav} name={data.fullName} />}

        {!done && <SiBenefits />}
      </div>
    </div>
  );
}

// ─── Hero ─────────────────────────────────────────────────────
function SiHero({ onNav }) {
  return (
    <Reveal>
      <div style={{ textAlign: 'center', marginBottom: 24 }}>
        <div className="pill" style={{ marginBottom: 20, display: 'inline-flex' }}>
          <span className="dot" />
          <span className="mono" style={{ fontSize: 11, letterSpacing: '0.05em' }}>ÎNSCRIERE INFLUENCERI</span>
        </div>
        <h1 className="display" style={{ fontSize: 'clamp(34px, 5vw, 64px)', margin: '0 0 16px', lineHeight: 1.05 }}>
          Aplică să devii influencer 4U.
        </h1>
        <div style={{ maxWidth: 620, margin: '0 auto 24px', padding: '12px 16px', borderRadius: 10, background: 'rgba(255,215,0,.06)', border: '.5px solid rgba(255,215,0,.25)', display: 'flex', gap: 10, alignItems: 'flex-start', textAlign: 'left' }}>
          <span style={{ fontSize: 16, lineHeight: 1.4 }}>⚠️</span>
          <span style={{ fontSize: 13, color: 'var(--txt-2)', lineHeight: 1.5 }}>
            <strong style={{ color: 'var(--accent-2)' }}>Atenție:</strong> Formularul este disponibil exclusiv creatorilor 4U Agency care colaborează cu noi pe TikTok Live. Dacă nu ești încă creator 4U, înscrie-te mai întâi în agenție pentru a putea aplica la programul de influenceri.
          </span>
        </div>
        <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 20 }}>
          <BackButton onNav={onNav} />
        </div>
        <div style={{ display: 'flex', gap: 12, justifyContent: 'center', flexWrap: 'wrap' }}>
          {[['5.000+','creatori în rețea'],['8','țări'],['48h','răspuns mediu']].map(([n, l]) => (
            <div key={l} className="card-glass" style={{ padding: '10px 16px', display: 'flex', alignItems: 'baseline', gap: 8 }}>
              <span className="display mono" style={{ fontSize: 18, color: 'var(--accent-1)' }}>{n}</span>
              <span style={{ fontSize: 12, color: 'var(--txt-2)' }}>{l}</span>
            </div>
          ))}
        </div>
      </div>
    </Reveal>
  );
}

// ─── Section header ───────────────────────────────────────────
function SiSection({ title, label, hint }) {
  return (
    <div style={{ marginBottom: 16, display: 'flex', alignItems: 'baseline', gap: 12, flexWrap: 'wrap' }}>
      <span className="mono" style={{ fontSize: 11, color: 'var(--accent-1)', letterSpacing: '0.1em' }}>{title}</span>
      <h3 style={{ margin: 0, fontSize: 18, fontWeight: 600, letterSpacing: '-0.01em' }}>{label}</h3>
      {hint && <span style={{ fontSize: 12, color: 'var(--txt-3)' }}>· {hint}</span>}
    </div>
  );
}

// ─── Field ────────────────────────────────────────────────────
function SiField({ label, type = 'text', placeholder, value, onChange, error }) {
  return (
    <label style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
      <span style={{ fontSize: 12, color: 'var(--txt-2)', fontWeight: 500 }}>{label}</span>
      <input className="input" type={type} placeholder={placeholder} value={value} onChange={e => onChange(e.target.value)} />
      {error && <span style={{ fontSize: 11, color: 'var(--txt-3)', marginTop: 2 }}>{error}</span>}
    </label>
  );
}

// ─── Platform row ─────────────────────────────────────────────
function SiPlatformRow({ type, name, handle, followers, onHandle, onFollowers }) {
  return (
    <div style={{ display: 'grid', gridTemplateColumns: '40px 1fr 1fr', gap: 12, alignItems: 'center' }} className="si-platform">
      <SiPlatformLogo type={type} />
      <input className="input" placeholder={`@handle ${name}`} value={handle} onChange={e => onHandle(e.target.value)} />
      <input className="input" type="text" inputMode="numeric" pattern="[0-9]*"
        placeholder="Urmăritori — completează (ex: 13485)"
        value={followers}
        onChange={e => onFollowers(e.target.value.replace(/\D/g, ''))} />
      <style>{`.si-platform > * { min-width: 0; } @media (max-width: 600px) { .si-platform { grid-template-columns: 40px 1fr !important; } .si-platform > *:nth-child(3) { grid-column: 1 / -1; } }`}</style>
    </div>
  );
}

// ─── Chip ─────────────────────────────────────────────────────
function SiChip({ active, onClick, children, compact }) {
  return (
    <button onClick={onClick} className="hov" style={{
      padding: compact ? '7px 12px' : '8px 14px', borderRadius: 999, fontSize: compact ? 12 : 13,
      background: active ? 'rgba(82,242,15,.12)' : 'rgba(255,255,255,.03)',
      border: `.5px solid ${active ? 'var(--accent-1)' : 'var(--line)'}`,
      color: active ? 'var(--accent-1)' : 'var(--txt-1)',
      cursor: 'pointer', fontFamily: 'inherit', transition: 'all .15s',
    }}>
      {children}
    </button>
  );
}

// ─── Card (collab type) ───────────────────────────────────────
function SiCard({ active, onClick, icon, label }) {
  return (
    <button onClick={onClick} className="hov" style={{
      padding: '14px 16px', borderRadius: 12,
      background: active ? 'rgba(82,242,15,.08)' : 'rgba(255,255,255,.03)',
      border: `.5px solid ${active ? 'var(--accent-1)' : 'var(--line)'}`,
      display: 'flex', alignItems: 'center', gap: 12, cursor: 'pointer',
      fontFamily: 'inherit', textAlign: 'left', transition: 'all .15s',
    }}>
      <span style={{ fontSize: 20 }}>{icon}</span>
      <span style={{ fontSize: 13, color: active ? 'var(--accent-1)' : 'var(--txt-1)', fontWeight: 500 }}>{label}</span>
    </button>
  );
}

// ─── Benefits ─────────────────────────────────────────────────
function SiBenefits() {
  const items = [
    { ico: '💰', t: 'Câștiguri mai mari',  d: 'Acces la branduri și campanii pe care nu le obții individual.' },
    { ico: '🎬', t: 'Studiouri profesionale', d: 'Spațiu, lumini, echipă tehnică pentru filmări de calitate.' },
    { ico: '🤝', t: 'Echipă dedicată',     d: 'Manager de cont care îți negociază contractele și oportunitățile.' },
  ];
  return (
    <Reveal delay={200}>
      <div style={{ marginTop: 48 }}>
        <h3 style={{ fontSize: 20, fontWeight: 600, marginBottom: 20, textAlign: 'center', letterSpacing: '-0.01em' }}>
          De ce să te alături 4U Agency
        </h3>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 16 }}>
          {items.map(it => (
            <div key={it.t} className="card-glass" style={{ padding: 20 }}>
              <div style={{ fontSize: 28, marginBottom: 10 }}>{it.ico}</div>
              <div style={{ fontWeight: 600, marginBottom: 4 }}>{it.t}</div>
              <div style={{ fontSize: 13, color: 'var(--txt-2)', lineHeight: 1.5 }}>{it.d}</div>
            </div>
          ))}
        </div>
      </div>
    </Reveal>
  );
}

// ─── Success state ────────────────────────────────────────────
function SiSuccess({ onNav, name }) {
  const first = (name || '').split(' ')[0] || 'tu';
  return (
    <Reveal>
      <div className="card-glass" style={{ padding: 'clamp(32px, 5vw, 56px)', textAlign: 'center', marginTop: 24 }}>
        <div style={{ fontSize: 56, marginBottom: 16 }}>🎉</div>
        <h2 className="display" style={{ fontSize: 'clamp(28px, 4vw, 44px)', margin: '0 0 12px', letterSpacing: '-0.02em' }}>
          Aplicația ta a fost trimisă, {first}!
        </h2>
        <p style={{ fontSize: 16, color: 'var(--txt-2)', maxWidth: 520, margin: '0 auto 32px', lineHeight: 1.6 }}>
          Echipa 4U îți va răspunde pe email în maximum 5 zile lucrătoare. Verifică și folderul de Spam, în caz că răspunsul aterizează acolo.
        </p>
        <div style={{ display: 'flex', gap: 12, justifyContent: 'center', flexWrap: 'wrap' }}>
          <button className="btn btn-primary" onClick={() => onNav('home')}>Înapoi acasă</button>
          <button className="btn btn-glass"   onClick={() => onNav('about')}>Despre 4U</button>
        </div>
      </div>
    </Reveal>
  );
}
