// Restante das seções

function CollectionsBand() {
  return (
    <section id="colecoes" style={{ padding: '100px 0', background: 'white' }}>
      <div className="container">
        <SectionHead
          eyebrow="Coleções"
          title={<>Quatro mundos,<br/><em style={{ fontStyle: 'italic', background: 'var(--grad)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>um único céu</em>.</>}
          sub="Cada coleção nasce de uma história, uma paisagem, um instante de luz que vale a pena guardar."
        />

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 18, marginTop: 56 }} className="four-up reveal">
          {COLLECTIONS.map((c, i) => (
            <a key={c.id} href="#produtos" style={{
              borderRadius: 20, overflow: 'hidden', position: 'relative',
              aspectRatio: '3/4', display: 'block',
              transition: 'transform .35s ease',
            }}
            onMouseEnter={(e)=> e.currentTarget.style.transform = 'translateY(-6px)'}
            onMouseLeave={(e)=> e.currentTarget.style.transform = 'translateY(0)'}>
              <JewelArt cat={['Brincos','Colares','Pulseiras','Chokers'][i]} hue={c.hue} tone="deep"/>
              <div style={{
                position: 'absolute', inset: 0,
                background: 'linear-gradient(to top, rgba(8,20,50,0.85) 0%, transparent 50%)',
              }}/>
              <div style={{ position: 'absolute', left: 20, right: 20, bottom: 18, color: 'white' }}>
                <div style={{ fontSize: 11, fontFamily: 'var(--mono)', letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.8 }}>{c.subtitle} · {c.count} peças</div>
                <div className="serif" style={{ fontSize: 28, marginTop: 4, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
                  {c.name}
                  <span style={{ width: 32, height: 32, borderRadius: '50%', background: 'rgba(255,255,255,0.15)', backdropFilter: 'blur(8px)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
                    <Icon name="arrow" size={14}/>
                  </span>
                </div>
              </div>
            </a>
          ))}
        </div>
      </div>
    </section>
  );
}

function SectionHead({ eyebrow, title, sub, align = 'center' }) {
  return (
    <div className="reveal" style={{ textAlign: align, maxWidth: align === 'center' ? 720 : 720, margin: align === 'center' ? '0 auto' : 0 }}>
      <div className="eyebrow">{eyebrow}</div>
      <h2 className="serif" style={{ fontSize: 'clamp(38px, 4vw, 60px)', lineHeight: 1.02, margin: '14px 0 18px', fontWeight: 400, letterSpacing: '-0.02em' }}>
        {title}
      </h2>
      {sub && <p style={{ fontSize: 17, lineHeight: 1.55, color: 'var(--ink-2)', margin: 0 }}>{sub}</p>}
    </div>
  );
}

// ----- Produtos -----
const CAT_SLUG = { 'Tudo': 'todos', 'Brincos': 'brincos', 'Colares': 'colares', 'Pulseiras': 'pulseiras', 'Chokers': 'chokers' };
const CAT_ORDER = ['Pulseiras', 'Brincos', 'Colares', 'Chokers'];

function ProductsSection({ visibleCategories }) {
  const [cat, setCat] = useState('Tudo');
  const [dbProducts, setDbProducts] = useState(null);
  const cart = useCart();
  const visible = Array.isArray(visibleCategories) && visibleCategories.length
    ? visibleCategories
    : null;

  useEffect(() => {
    requestAnimationFrame(() => {
      const els = document.querySelectorAll('.reveal:not(.in)');
      const io = new IntersectionObserver((entries) => {
        entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } });
      }, { threshold: 0.12 });
      els.forEach(el => io.observe(el));
    });
  }, [cat, dbProducts]);

  useEffect(() => {
    let cancelled = false;
    fetch('/api/products?_=' + Date.now(), { cache: 'no-store' })
      .then(r => r.ok ? r.json() : null)
      .then(data => {
        if (cancelled || !data || !Array.isArray(data.products)) return;
        // Mostra produtos sazonais aqui também — eles aparecem no grid
        // do tema ativo (acima do hero) e no catálogo geral.
        setDbProducts(data.products);
      })
      .catch(() => {});
    return () => { cancelled = true; };
  }, []);

  const rawSource = dbProducts || [];
  const source = visible
    ? rawSource.filter(p => !p.cat || visible.includes(p.cat))
    : rawSource;

  const catsInData = Array.from(new Set(source.map(p => p.cat).filter(Boolean)));
  let cats = ['Tudo', ...new Set([
    ...CATEGORIES.filter(c => c !== 'Tudo' && catsInData.includes(c)),
    ...catsInData.filter(c => !CATEGORIES.includes(c)),
  ])];
  if (visible) cats = cats.filter(c => c === 'Tudo' || visible.includes(c));

  const PAGE_SIZE = 8;
  let visibleItems, hasMore;

  if (cat === 'Tudo') {
    // Round-robin entre categorias na ordem CAT_ORDER. Vai mesclando 1 por
    // vez até atingir PAGE_SIZE ou esgotar o catálogo. Se uma categoria
    // tem só 1 produto, mostra esse 1 e segue. Nunca inventa.
    const byCat = new Map(CAT_ORDER.map(c => [c, source.filter(p => p.cat === c)]));
    // categorias extras que apareceram no DB mas não estão em CAT_ORDER
    source.forEach(p => {
      if (p.cat && !byCat.has(p.cat)) byCat.set(p.cat, source.filter(x => x.cat === p.cat));
    });
    const queues = Array.from(byCat.values()).map(arr => arr.slice());
    const mixed = [];
    let progress = true;
    while (mixed.length < PAGE_SIZE && progress) {
      progress = false;
      for (const q of queues) {
        if (mixed.length >= PAGE_SIZE) break;
        if (q.length) { mixed.push(q.shift()); progress = true; }
      }
    }
    visibleItems = mixed;
    hasMore = source.length > visibleItems.length;
  } else {
    const filtered = source.filter(p => p.cat === cat);
    visibleItems = filtered.slice(0, PAGE_SIZE);
    hasMore = filtered.length > PAGE_SIZE;
  }

  const catSlug = CAT_SLUG[cat] || 'todos';

  return (
    <section id="produtos" style={{ padding: '100px 0', background: 'var(--cream)' }}>
      <div className="container">
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'end', flexWrap: 'wrap', gap: 20 }}>
          <div>
            <div className="eyebrow">Best-sellers</div>
            <h2 className="serif" style={{ fontSize: 'clamp(38px, 4vw, 56px)', lineHeight: 1.02, margin: '14px 0 0', fontWeight: 400 }}>
              As preferidas da casa
            </h2>
          </div>
          <a href={`categoria.html?cat=${catSlug}`} style={{ fontSize: 14, color: 'var(--blue-700)', display: 'inline-flex', alignItems: 'center', gap: 6 }}>
            Ver tudo <Icon name="arrow" size={14}/>
          </a>
        </div>

        {/* category pills */}
        <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', marginTop: 32 }}>
          {cats.map(c => (
            <button key={c} onClick={()=> setCat(c)} style={{
              border: '1px solid ' + (cat === c ? 'transparent' : 'var(--line)'),
              background: cat === c ? 'var(--grad)' : 'white',
              color: cat === c ? 'white' : 'var(--ink-2)',
              padding: '10px 18px', borderRadius: 999, fontSize: 13, fontWeight: 500,
              transition: 'all .15s ease',
              boxShadow: cat === c ? '0 8px 20px -8px rgba(6,182,212,0.5)' : 'none',
            }}>{c}</button>
          ))}
        </div>

        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 22, marginTop: 32,
        }} className="four-up">
          {visibleItems.map(p => (
            <ProductCard key={p.id} p={p} onAdd={()=> cart.add(p)} onBuy={()=> cart.buyNow(p)}/>
          ))}
        </div>

        {hasMore && (
          <div style={{ textAlign: 'center', marginTop: 40 }}>
            <a href={`categoria.html?cat=${catSlug}`} className="btn btn-ghost" style={{ height: 52, padding: '0 32px', fontSize: 14 }}>
              Ver mais peças <Icon name="arrow" size={14}/>
            </a>
          </div>
        )}
      </div>
    </section>
  );
}

function ProductCard({ p, onAdd, onBuy }) {
  const [hover, setHover] = useState(false);
  const [imgError, setImgError] = useState(false);
  const auth = useAuth();
  const isFav = auth?.isFavorite ? auth.isFavorite(p.id) : false;
  const [favBusy, setFavBusy] = useState(false);

  async function onFavClick(e){
    e.preventDefault();
    e.stopPropagation();
    if (favBusy) return;
    setFavBusy(true);
    try {
      await auth.toggleFavorite(p.id, p.name);
    } finally {
      setFavBusy(false);
    }
  }

  return (
    <a className="reveal product-card" href={`/produto?slug=${encodeURIComponent(p.slug || p.id)}`}
      onMouseEnter={()=> setHover(true)} onMouseLeave={()=> setHover(false)}
      style={{
        background: 'white', borderRadius: 20, overflow: 'hidden',
        border: '1px solid ' + (hover ? 'rgba(212,175,106,0.4)' : 'var(--line)'),
        transition: 'transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .25s ease',
        transform: hover ? 'translateY(-6px)' : 'translateY(0)',
        boxShadow: hover
          ? '0 30px 60px -20px rgba(10,31,61,0.22), 0 4px 12px -4px rgba(212,175,106,0.18)'
          : '0 2px 6px rgba(10,31,61,0.04)',
        display: 'flex', flexDirection: 'column',
        color: 'inherit', textDecoration: 'none',
      }}>
      <div style={{ position: 'relative', aspectRatio: '1/1', background: '#f6f2ec', overflow: 'hidden' }}>
        {p.image && !imgError ? (
          <>
            <img
              src={p.image}
              alt={p.name}
              loading="lazy"
              onError={() => setImgError(true)}
              style={{
                position: 'absolute', inset: 0,
                width: '100%', height: '100%',
                objectFit: 'cover',
                transition: 'opacity .4s ease, transform .5s ease',
                transform: hover ? 'scale(1.04)' : 'scale(1)',
                opacity: hover && p.images && p.images[1] ? 0 : 1,
              }}
            />
            {p.images && p.images[1] && (
              <img
                src={p.images[1].url}
                alt={p.images[1].alt || p.name}
                loading="lazy"
                style={{
                  position: 'absolute', inset: 0,
                  width: '100%', height: '100%',
                  objectFit: 'cover',
                  transition: 'opacity .4s ease, transform .5s ease',
                  transform: hover ? 'scale(1.04)' : 'scale(1)',
                  opacity: hover ? 1 : 0,
                  pointerEvents: 'none',
                }}
              />
            )}
          </>
        ) : (
          <JewelArt cat={p.cat} hue={p.hue} tone="soft"/>
        )}
        {p.badge && (
          <span style={{
            position: 'absolute', top: 12, left: 12,
            background: p.badge.startsWith('-')
              ? 'linear-gradient(135deg, #ef4444, #b91c1c)'
              : (p.badge === 'Novo' ? 'var(--grad-navy)' : 'var(--grad-gold)'),
            color: p.badge.startsWith('-') || p.badge === 'Novo' ? 'white' : 'var(--navy)',
            fontSize: 10, fontFamily: 'var(--mono)',
            letterSpacing: '0.12em', textTransform: 'uppercase', fontWeight: 700,
            padding: '6px 11px', borderRadius: 999,
            boxShadow: '0 6px 14px -6px rgba(0,0,0,0.25)',
          }}>{p.badge}</span>
        )}
        <button onClick={onFavClick} aria-label={isFav ? 'Remover dos favoritos' : 'Favoritar'} disabled={favBusy} style={{
          position: 'absolute', top: 10, right: 10,
          width: 36, height: 36, borderRadius: '50%',
          background: 'white', border: 'none',
          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          color: isFav ? '#ef4444' : 'var(--ink-2)',
          boxShadow: '0 4px 12px -4px rgba(8,51,68,0.18)',
          cursor: favBusy ? 'wait' : 'pointer',
          transition: 'transform .15s ease, color .15s ease',
          transform: isFav ? 'scale(1.06)' : 'scale(1)',
        }}>
          <svg width="16" height="16" viewBox="0 0 24 24"
               fill={isFav ? 'currentColor' : 'none'}
               stroke="currentColor" strokeWidth="1.8"
               strokeLinecap="round" strokeLinejoin="round">
            <path d="M12 21s-7-4.5-7-10a4 4 0 0 1 7-2.7A4 4 0 0 1 19 11c0 5.5-7 10-7 10z"/>
          </svg>
        </button>
        {/* hover quick actions */}
        <div style={{
          position: 'absolute', left: 12, right: 12, bottom: 12,
          display: 'flex', gap: 8,
          transform: hover ? 'translateY(0)' : 'translateY(12px)',
          opacity: hover ? 1 : 0,
          transition: 'all .25s ease',
        }}>
          <button onClick={(e)=> { e.preventDefault(); e.stopPropagation(); onAdd(); }} aria-label="Adicionar à sacola" style={{
            width: 42, height: 42, borderRadius: 999,
            background: 'white', color: 'var(--ink)',
            border: '1px solid var(--line)',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            flexShrink: 0,
          }}>
            <Icon name="bag" size={16}/>
          </button>
          <button onClick={(e)=> { e.preventDefault(); e.stopPropagation(); onBuy(); }} style={{
            flex: 1, height: 42, borderRadius: 999,
            background: 'var(--grad-navy)', color: 'white',
            border: 'none', fontSize: 13, fontWeight: 600, letterSpacing: '0.02em',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 6,
            boxShadow: '0 8px 20px -8px rgba(10,31,61,0.5)',
          }}>
            Comprar agora <Icon name="arrow" size={14}/>
          </button>
        </div>
      </div>
      <div style={{ padding: '18px 20px 20px', display: 'flex', flexDirection: 'column', gap: 4 }}>
        <div style={{ fontSize: 10, fontFamily: 'var(--mono)', color: 'var(--gold-deep)', letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 600 }}>{p.cat}</div>
        <div className="serif" style={{ fontSize: 20, fontWeight: 500, color: 'var(--navy)', letterSpacing: '-0.005em' }}>{p.name}</div>
        <div style={{ display: 'flex', alignItems: 'baseline', gap: 8, marginTop: 6 }}>
          <span className="serif" style={{ fontSize: 22, fontWeight: 600, color: 'var(--navy)', letterSpacing: '-0.01em' }}>{brl(p.price)}</span>
          {p.old && <span style={{ fontSize: 13, color: 'var(--ink-3)', textDecoration: 'line-through' }}>{brl(p.old)}</span>}
        </div>
        <div style={{ fontSize: 11, color: 'var(--ink-2)', marginTop: 4, fontWeight: 500 }}>
          ou <strong style={{ color: 'var(--gold-deep)', fontFamily: 'var(--mono)' }}>6x</strong> de <strong style={{ color: 'var(--navy-2)' }}>{brl(p.price / 6)}</strong>
        </div>
        {/* always-visible mobile actions */}
        <div style={{ display: 'flex', gap: 8, marginTop: 12 }} className="card-actions-mobile cta-row">
          <button onClick={(e)=> { e.preventDefault(); e.stopPropagation(); onAdd(); }} className="btn btn-ghost cta-sacola" style={{ flex: '1 1 0', minWidth: 0, height: 40, fontSize: 12, padding: '0 8px', whiteSpace: 'nowrap' }}>
            <Icon name="bag" size={13}/> Sacola
          </button>
          <button onClick={(e)=> { e.preventDefault(); e.stopPropagation(); onBuy(); }} className="btn btn-primary cta-buy" style={{ flex: '1 1 0', minWidth: 0, height: 40, fontSize: 12, padding: '0 8px', whiteSpace: 'nowrap' }}>
            Comprar
          </button>
        </div>
      </div>
    </a>
  );
}

// ----- Sobre / Como Funciona -----
function HowItWorks() {
  return (
    <section id="sobre" style={{ padding: '110px 0', background: 'white' }}>
      <div className="container two-up" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 80, alignItems: 'center' }}>
        <div style={{ position: 'relative', aspectRatio: '4/5' }}>
          <div style={{
            position: 'absolute', inset: 0,
            borderRadius: 24, overflow: 'hidden',
            background: 'var(--grad-deep)',
          }}>
            <JewelArt cat="Brincos" hue={183} tone="deep"/>
          </div>
          {/* signature badge */}
          <div style={{
            position: 'absolute', bottom: 24, left: 24, right: 24,
            background: 'rgba(255,255,255,0.95)', backdropFilter: 'blur(10px)',
            borderRadius: 16, padding: '18px 20px',
            display: 'flex', alignItems: 'center', gap: 16,
          }}>
            <div style={{ width: 48, height: 48, borderRadius: '50%', background: 'var(--grad)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: 'white' }}>
              <Icon name="moon" size={22}/>
            </div>
            <div>
              <div className="serif" style={{ fontSize: 18 }}>Lua Azul Joias</div>
              <div style={{ fontSize: 12, color: 'var(--ink-3)' }}>Salvador · Bahia · Desde 2025</div>
            </div>
          </div>
        </div>

        <div className="reveal">
          <div className="eyebrow">Como funciona</div>
          <h2 className="serif" style={{ fontSize: 'clamp(36px, 4vw, 56px)', lineHeight: 1.02, margin: '14px 0 28px', fontWeight: 400 }}>
            Da nossa mesa <em style={{ fontStyle: 'italic', color: 'var(--blue-600)' }}>até sua janela</em>.
          </h2>
          <p style={{ fontSize: 16, lineHeight: 1.65, color: 'var(--ink-2)', marginBottom: 36 }}>
            Cada peça passa por 14 etapas — do desenho à mão à embalagem final — feita à mão, com calma, em Salvador. Sem intermediários, sem pressa.
          </p>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 0 }}>
            {STEPS.map((s,i)=>(
              <div key={s.n} style={{
                display: 'grid', gridTemplateColumns: 'auto 1fr',
                gap: 20, padding: '22px 0',
                borderTop: i === 0 ? '1px solid var(--line)' : 'none',
                borderBottom: '1px solid var(--line)',
              }}>
                <div className="serif" style={{ fontSize: 32, color: 'var(--blue-500)', lineHeight: 1, fontWeight: 500 }}>{s.n}</div>
                <div>
                  <div className="serif" style={{ fontSize: 22, marginBottom: 4 }}>{s.title}</div>
                  <div style={{ fontSize: 14, color: 'var(--ink-2)', lineHeight: 1.55 }}>{s.text}</div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ----- Benefits -----
function Benefits() {
  return (
    <section style={{
      padding: '100px 0',
      background: 'linear-gradient(180deg, var(--blue-50) 0%, white 100%)',
    }}>
      <div className="container">
        <SectionHead
          eyebrow="Por quê Lua Azul"
          title={<>Beleza que <em style={{ fontStyle: 'italic', background: 'var(--grad)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>não enferruja</em> com o tempo.</>}
          sub="Quatro motivos pra usar uma joia Lua Azul todos os dias da sua vida."
        />
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 18, marginTop: 56 }} className="four-up">
          {BENEFITS.map((b,i)=>(
            <div key={i} className="reveal" style={{
              background: 'white', borderRadius: 20,
              padding: '32px 26px',
              border: '1px solid var(--line)',
              transition: 'transform .25s ease, box-shadow .25s ease',
            }}
            onMouseEnter={(e)=>{ e.currentTarget.style.transform='translateY(-4px)'; e.currentTarget.style.boxShadow = '0 24px 40px -16px rgba(8,51,68,0.18)'; }}
            onMouseLeave={(e)=>{ e.currentTarget.style.transform='translateY(0)'; e.currentTarget.style.boxShadow = 'none'; }}>
              <div style={{
                width: 52, height: 52, borderRadius: 14,
                background: 'var(--grad-soft)',
                color: 'var(--blue-700)',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                marginBottom: 22,
              }}>
                <Icon name={b.icon} size={22}/>
              </div>
              <div className="serif" style={{ fontSize: 22, marginBottom: 8 }}>{b.title}</div>
              <div style={{ fontSize: 14, color: 'var(--ink-2)', lineHeight: 1.55 }}>{b.text}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ----- Testimonials -----
function Testimonials({ testimonials }) {
  const [idx, setIdx] = useState(0);
  // testimonials===null   → admin nunca configurou → usa fallback hardcoded.
  // testimonials===[]     → admin configurou mas escondeu todos → respeita.
  // testimonials===[...]  → usa só os que vieram (já filtrados de hidden no API).
  const isConfigured = Array.isArray(testimonials);
  const fromConfig = isConfigured
    ? testimonials.filter(t => !t.hidden).map(t => ({
        name: t.name, city: t.city, rating: t.rating || 5,
        photo: t.photo || null, text: t.text,
      }))
    : null;
  const cta = TESTIMONIALS.find(t => t.isCta);
  const list = fromConfig
    ? (cta ? [...fromConfig, cta] : fromConfig)
    : TESTIMONIALS;
  const realsLen = list.filter(t => !t.isCta).length;
  const realCount = realsLen || 1;
  const showArrows = realsLen >= 4; // só rotaciona quando há mais do que cabe no grid
  return (
    <section style={{ padding: '110px 0', background: 'white' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.2fr', gap: 80, alignItems: 'center' }} className="two-up">
          <div className="reveal">
            <div className="eyebrow">Depoimentos</div>
            <h2 className="serif" style={{ fontSize: 'clamp(36px, 4vw, 56px)', lineHeight: 1.02, margin: '14px 0 24px', fontWeight: 400 }}>
              Histórias que<br/>
              <em style={{ fontStyle: 'italic', background: 'var(--grad)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>viraram joia</em>.
            </h2>
            <div style={{ display: 'flex', alignItems: 'center', gap: 16, marginBottom: 24 }}>
              <div style={{ display: 'flex', gap: 2, color: '#f59e0b' }}>
                {[1,2,3,4,5].map(n=> <Icon key={n} name="star" size={18}/>)}
              </div>
              <div style={{ fontSize: 14, color: 'var(--ink-2)' }}>
                Avaliações <strong>5 estrelas</strong> de quem já presenteou
              </div>
            </div>
            {showArrows ? (
              <div style={{ display: 'flex', gap: 10 }}>
                <button onClick={()=> setIdx((idx - 1 + realCount) % realCount)} style={navArrow}>
                  <Icon name="arrow" size={16} stroke={1.8}/>
                </button>
                <button onClick={()=> setIdx((idx + 1) % realCount)} style={navArrow}>
                  <span style={{ transform: 'rotate(180deg)', display: 'inline-flex' }}><Icon name="arrow" size={16} stroke={1.8}/></span>
                </button>
                <span style={{ alignSelf: 'center', marginLeft: 12, fontFamily: 'var(--mono)', fontSize: 12, color: 'var(--ink-3)' }}>
                  {String(idx+1).padStart(2,'0')} / {String(realCount).padStart(2,'0')}
                </span>
              </div>
            ) : (
              <a
                href="https://wa.me/5571999181376?text=Ol%C3%A1!%20Quero%20deixar%20meu%20depoimento%20da%20pe%C3%A7a%20Lua%20Azul."
                target="_blank" rel="noreferrer"
                style={{
                  display: 'inline-flex', alignItems: 'center', gap: 8,
                  fontSize: 13, color: 'var(--blue-700)',
                  borderBottom: '1px solid var(--blue-200)', paddingBottom: 2,
                  textDecoration: 'none',
                }}>
                Quero deixar meu depoimento
                <Icon name="arrow" size={14}/>
              </a>
            )}
          </div>

          <div>
            <div className="testi-grid" style={{
              display: 'grid',
              gridTemplateColumns: realsLen === 0 ? '1fr' : 'repeat(2, 1fr)',
              gap: 18,
            }}>
              {(() => {
                const reals = list.filter(t => !t.isCta);
                const ctaItem = list.find(t => t.isCta) || TESTIMONIALS.find(t => t.isCta);
                const n = reals.length || 1;
                const visible = reals.length ? [
                  reals[idx % n],
                  reals[(idx+1) % n],
                  reals[(idx+2) % n],
                  ctaItem,
                ].filter(Boolean) : [ctaItem].filter(Boolean);
                return visible.map((item,k)=>{
                if (item.isCta){
                  return (
                    <a key={'cta'+k} href="https://wa.me/5571999181376?text=Ol%C3%A1!%20Quero%20deixar%20meu%20depoimento%20da%20pe%C3%A7a%20Lua%20Azul."
                       target="_blank" rel="noreferrer"
                       className="reveal testi-card"
                       style={{
                         background: 'var(--cream)',
                         color: 'var(--ink-2)',
                         borderRadius: 18,
                         padding: 24,
                         border: '2px dashed var(--blue-300)',
                         position: 'relative',
                         display: 'flex', flexDirection: 'column',
                         justifyContent: 'space-between',
                         minHeight: 180,
                         transition: 'background .15s ease, border-color .15s ease',
                         textDecoration: 'none',
                       }}
                       onMouseEnter={(e)=>{ e.currentTarget.style.background = 'var(--blue-50)'; e.currentTarget.style.borderColor = 'var(--blue-600)'; }}
                       onMouseLeave={(e)=>{ e.currentTarget.style.background = 'var(--cream)'; e.currentTarget.style.borderColor = 'var(--blue-300)'; }}>
                      <div>
                        <div style={{ fontSize: 38, lineHeight: 1, marginBottom: 8, opacity: 0.25, fontFamily: 'var(--serif)', color: 'var(--blue-600)' }}>"</div>
                        <p style={{ fontSize: 14, lineHeight: 1.55, margin: '0 0 18px', color: 'var(--ink-2)' }}>
                          {item.text}
                        </p>
                      </div>
                      <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
                        <span style={{
                          width: 40, height: 40, borderRadius: '50%',
                          background: 'linear-gradient(135deg, #25d366, #128c7e)',
                          color: 'white',
                          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                          flexShrink: 0,
                          boxShadow: '0 6px 14px -4px rgba(18,140,126,0.5)',
                        }}>
                          <Icon name="whatsapp" size={20}/>
                        </span>
                        <div style={{ minWidth: 0 }}>
                          <div style={{ fontSize: 13, fontWeight: 600, color: 'var(--blue-700)' }}>{item.name}</div>
                          <div style={{ fontSize: 11, color: 'var(--ink-3)', fontFamily: 'var(--mono)', letterSpacing: '0.04em' }}>{item.city}</div>
                        </div>
                      </div>
                    </a>
                  );
                }
                return (
                  <div key={k} className="reveal testi-card" style={{
                    background: k === 0 ? 'var(--grad)' : 'var(--blue-50)',
                    color: k === 0 ? 'white' : 'var(--ink)',
                    borderRadius: 18,
                    padding: 24,
                    border: k === 0 ? 'none' : '1px solid var(--line)',
                    position: 'relative',
                  }}>
                    <div style={{ fontSize: 38, lineHeight: 1, marginBottom: 8, opacity: k === 0 ? 0.4 : 0.18, fontFamily: 'var(--serif)' }}>"</div>
                    <p style={{ fontSize: 14, lineHeight: 1.55, margin: '0 0 18px' }}>{item.text}</p>
                    <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
                      {item.photo ? (
                        <img
                          src={item.photo}
                          alt={item.name}
                          style={{
                            width: 40, height: 40, borderRadius: '50%',
                            objectFit: 'cover', objectPosition: 'center top',
                            border: k === 0 ? '2px solid rgba(255,255,255,0.5)' : '2px solid white',
                            boxShadow: '0 4px 12px -4px rgba(8,51,68,0.25)',
                            flexShrink: 0,
                          }}
                        />
                      ) : (
                        <div style={{
                          width: 40, height: 40, borderRadius: '50%',
                          background: k === 0 ? 'rgba(255,255,255,0.2)' : 'var(--grad)',
                          color: 'white',
                          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                          fontSize: 14, fontWeight: 600,
                          flexShrink: 0,
                        }}>{item.name[0]}</div>
                      )}
                      <div style={{ minWidth: 0 }}>
                        <div style={{ fontSize: 13, fontWeight: 600 }}>{item.name}</div>
                        <div style={{ fontSize: 11, opacity: 0.7 }}>{item.city}</div>
                      </div>
                    </div>
                  </div>
                );
              });
              })()}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}
const navArrow = {
  width: 46, height: 46, borderRadius: '50%',
  background: 'white', border: '1px solid var(--line)',
  color: 'var(--ink)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
};

// ----- Plans -----
function Plans() {
  return (
    <section id="planos" style={{
      padding: '110px 0',
      background: 'linear-gradient(180deg, #083344 0%, #0e7490 70%, #0891b2 100%)',
      color: 'white', position: 'relative', overflow: 'hidden',
    }}>
      <div style={{
        position: 'absolute', top: '20%', left: '-10%',
        width: 500, height: 500, borderRadius: '50%',
        background: 'radial-gradient(circle, rgba(103,232,249,0.25), transparent 65%)', filter: 'blur(30px)',
      }}/>
      <div className="container" style={{ position: 'relative' }}>
        <SectionHead
          eyebrow="Planos"
          title={<>Compre uma vez ou<br/>vire <em style={{ fontStyle: 'italic', background: 'linear-gradient(135deg, #a5f3fc, #fff)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>cliente do clube</em>.</>}
          sub={<span style={{ color: 'rgba(255,255,255,0.75)' }}>Três formas de fazer parte do nosso universo. Sem fidelidade, pause quando quiser.</span>}
        />
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 18, marginTop: 64 }} className="three-up">
          {PLANS.map((p,i)=>(
            <div key={i} className="reveal" style={{
              background: p.highlight ? 'white' : 'rgba(255,255,255,0.04)',
              color: p.highlight ? 'var(--ink)' : 'white',
              border: '1px solid ' + (p.highlight ? 'transparent' : 'rgba(255,255,255,0.12)'),
              borderRadius: 24,
              padding: '36px 30px 30px',
              position: 'relative',
              boxShadow: p.highlight ? '0 30px 60px -20px rgba(6,182,212,0.5)' : 'none',
              transform: p.highlight ? 'translateY(-12px)' : 'translateY(0)',
              backdropFilter: p.highlight ? 'none' : 'blur(8px)',
            }}>
              {p.tag && (
                <div style={{
                  position: 'absolute', top: -14, left: '50%', transform: 'translateX(-50%)',
                  background: 'var(--grad)', color: 'white', padding: '6px 14px',
                  borderRadius: 999, fontSize: 11, fontFamily: 'var(--mono)',
                  letterSpacing: '0.12em', textTransform: 'uppercase', fontWeight: 500,
                }}>{p.tag}</div>
              )}
              <div className="serif" style={{ fontSize: 28, fontWeight: 500 }}>{p.name}</div>
              <div style={{ fontSize: 14, color: p.highlight ? 'var(--ink-2)' : 'rgba(255,255,255,0.7)', marginTop: 6, minHeight: 40 }}>{p.blurb}</div>
              <div style={{ margin: '24px 0 28px', display: 'flex', alignItems: 'baseline', gap: 6 }}>
                <span className="serif" style={{ fontSize: 52, fontWeight: 500, lineHeight: 1 }}>
                  {p.price === 0 ? 'R$0' : 'R$' + p.price}
                </span>
                <span style={{ fontSize: 14, color: p.highlight ? 'var(--ink-3)' : 'rgba(255,255,255,0.6)' }}>{p.period}</span>
              </div>
              <button className={p.highlight ? 'btn btn-primary' : 'btn'} style={{
                width: '100%', height: 50, marginBottom: 28,
                ...(p.highlight ? {} : { background: 'white', color: 'var(--blue-800)' }),
              }}>
                {p.cta} <Icon name="arrow" size={14}/>
              </button>
              <ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 12 }}>
                {p.perks.map((perk,k)=>(
                  <li key={k} style={{ display: 'flex', gap: 10, alignItems: 'flex-start', fontSize: 13.5, lineHeight: 1.5 }}>
                    <span style={{
                      width: 22, height: 22, borderRadius: '50%', flexShrink: 0,
                      background: p.highlight ? 'var(--blue-50)' : 'rgba(255,255,255,0.12)',
                      color: p.highlight ? 'var(--blue-700)' : '#a5f3fc',
                      display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                      marginTop: 1,
                    }}><Icon name="check" size={12} stroke={2.4}/></span>
                    {perk}
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ----- FAQ -----
function FaqSection() {
  const [open, setOpen] = useState(0);
  return (
    <section style={{ padding: '110px 0', background: 'white' }}>
      <div className="container two-up" style={{ display: 'grid', gridTemplateColumns: '1fr 1.5fr', gap: 80 }}>
        <div className="reveal">
          <div className="eyebrow">Dúvidas</div>
          <h2 className="serif" style={{ fontSize: 'clamp(36px, 4vw, 52px)', lineHeight: 1.02, margin: '14px 0 18px', fontWeight: 400 }}>
            Perguntas <em style={{ fontStyle: 'italic', color: 'var(--blue-600)' }}>frequentes</em>.
          </h2>
          <p style={{ fontSize: 15, color: 'var(--ink-2)', lineHeight: 1.6, marginBottom: 28 }}>
            Não achou o que procurava? Fale com a gente pelo WhatsApp — respondemos rápido.
          </p>
          <a href="https://wa.me/5571999181376" className="btn btn-ghost" style={{ height: 48 }}>
            <Icon name="whatsapp" size={18}/> Falar no WhatsApp
          </a>
        </div>

        <div>
          {FAQ.map((it,i)=>(
            <div key={i} className="reveal" style={{ borderTop: i === 0 ? '1px solid var(--line)' : 'none', borderBottom: '1px solid var(--line)' }}>
              <button onClick={()=> setOpen(open === i ? -1 : i)} style={{
                width: '100%', textAlign: 'left',
                background: 'transparent', border: 'none', cursor: 'pointer',
                padding: '24px 0', display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 20,
              }}>
                <span className="serif" style={{ fontSize: 22, fontWeight: 500, color: 'var(--ink)' }}>{it.q}</span>
                <span style={{
                  width: 36, height: 36, borderRadius: '50%',
                  background: open === i ? 'var(--grad)' : 'var(--blue-50)',
                  color: open === i ? 'white' : 'var(--blue-700)',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                  transition: 'all .2s ease',
                  flexShrink: 0,
                }}>
                  <Icon name={open === i ? 'minus' : 'plus'} size={16} stroke={2}/>
                </span>
              </button>
              <div style={{
                maxHeight: open === i ? 240 : 0,
                overflow: 'hidden',
                transition: 'max-height .35s ease, opacity .25s ease',
                opacity: open === i ? 1 : 0,
              }}>
                <p style={{ margin: 0, paddingBottom: 24, fontSize: 15, lineHeight: 1.65, color: 'var(--ink-2)', maxWidth: 640 }}>
                  {it.a}
                </p>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ----- Contact -----
function ContactSection() {
  const [submitted, setSubmitted] = useState(false);
  return (
    <section id="contato" style={{ padding: '110px 0', background: 'var(--cream)' }}>
      <div className="container two-up" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 60 }}>
        <div className="reveal">
          <div className="eyebrow">Fale com a gente</div>
          <h2 className="serif" style={{ fontSize: 'clamp(36px, 4vw, 52px)', lineHeight: 1.02, margin: '14px 0 20px', fontWeight: 400 }}>
            Tem uma ideia,<br/>uma encomenda especial,<br/>uma <em style={{ fontStyle: 'italic', color: 'var(--blue-600)' }}>dúvida</em>?
          </h2>
          <p style={{ fontSize: 16, color: 'var(--ink-2)', lineHeight: 1.6, marginBottom: 32 }}>
            Nossa equipe responde dentro do horário de atendimento, com cuidado pessoal — direto no WhatsApp ou por email.
          </p>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 14, fontSize: 14 }}>
            <ContactRow icon="whatsapp" label="WhatsApp" value="(71) 99918-1376"/>
            <ContactRow icon="user" label="Email" value="luaazulacessorios8@gmail.com"/>
            <ContactRow icon="moon" label="Horário de atendimento" value={<><span>Seg a Sex · 7h às 18h</span><br/><span>Sábado · 8h às 12h</span></>}/>
          </div>
        </div>

        <form onSubmit={(e)=>{ e.preventDefault(); setSubmitted(true); }} style={{
          background: 'white', borderRadius: 24,
          padding: '36px 32px',
          border: '1px solid var(--line)',
          boxShadow: '0 20px 50px -20px rgba(8,51,68,0.12)',
        }}>
          {submitted ? (
            <div style={{ textAlign: 'center', padding: '40px 12px' }}>
              <div style={{ width: 64, height: 64, margin: '0 auto 18px', borderRadius: '50%', background: 'var(--grad)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: 'white' }}>
                <Icon name="check" size={28} stroke={2.4}/>
              </div>
              <h3 className="serif" style={{ fontSize: 28, margin: '0 0 8px', fontWeight: 500 }}>Mensagem enviada</h3>
              <p style={{ fontSize: 14, color: 'var(--ink-2)' }}>A gente responde no seu email em até 1 hora útil. Até já!</p>
            </div>
          ) : (
            <>
              <h3 className="serif" style={{ fontSize: 26, margin: '0 0 6px', fontWeight: 500 }}>Envie sua mensagem</h3>
              <p style={{ fontSize: 13, color: 'var(--ink-3)', marginTop: 0, marginBottom: 22 }}>Respondemos em até 1 hora útil.</p>
              <div style={{ display: 'grid', gap: 12 }}>
                <Input label="Nome" placeholder="Como gostaria de ser chamada?"/>
                <div className="contact-2col" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
                  <Input label="Email" type="email" placeholder="voce@email.com"/>
                  <Input label="WhatsApp" placeholder="(11) 99999-9999"/>
                </div>
                <label style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
                  <span style={{ fontSize: 12, color: 'var(--ink-2)', fontWeight: 500 }}>Mensagem</span>
                  <textarea rows="4" placeholder="Conta pra gente como podemos ajudar..." style={{
                    padding: '14px', border: '1px solid var(--line)', borderRadius: 12,
                    fontFamily: 'inherit', fontSize: 14, outline: 'none', resize: 'vertical',
                  }}/>
                </label>
                <button type="submit" className="btn btn-primary" style={{ height: 52, marginTop: 6 }}>
                  Enviar mensagem <Icon name="arrow" size={16}/>
                </button>
              </div>
            </>
          )}
        </form>
      </div>
    </section>
  );
}

function ContactRow({ icon, label, value }) {
  return (
    <div style={{ display: 'grid', gridTemplateColumns: '42px 1fr', alignItems: 'center', gap: 14 }}>
      <div style={{ width: 42, height: 42, borderRadius: 12, background: 'var(--grad-soft)', color: 'var(--blue-700)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
        <Icon name={icon} size={18}/>
      </div>
      <div>
        <div style={{ fontSize: 11, fontFamily: 'var(--mono)', color: 'var(--ink-3)', textTransform: 'uppercase', letterSpacing: '0.1em' }}>{label}</div>
        <div style={{ fontSize: 15, color: 'var(--ink)', fontWeight: 500 }}>{value}</div>
      </div>
    </div>
  );
}

// ----- Final CTA -----
function FinalCTA() {
  const promo = (typeof window !== 'undefined' && window.SITE_CONFIG?.promo) || null;
  // Promo line: usa config se enabled; default desativado (vazio).
  const promoLine = promo?.enabled ? (
    <p style={{ fontSize: 17, color: 'rgba(255,255,255,0.78)', lineHeight: 1.6, margin: '0 0 36px', maxWidth: 560, marginLeft: 'auto', marginRight: 'auto' }}>
      Use o cupom <strong style={{ color: '#d4af6a', background: 'rgba(212,175,106,0.15)', padding: '2px 10px', borderRadius: 6, fontFamily: 'var(--mono)', border: '1px solid rgba(212,175,106,0.4)' }}>{promo.code || 'PRIMEIRACOMPRA'}</strong> {promo.text || 'na primeira compra'} e ganhe {promo.discount || '10% OFF'} na sua joia.
    </p>
  ) : null;
  return (
    <section style={{
      padding: '120px 0',
      background: 'linear-gradient(135deg, #0a1f3d 0%, #142a4f 45%, #1c3a6b 100%)',
      color: 'white', position: 'relative', overflow: 'hidden',
    }}>
      {/* lua crescente decorativa */}
      <svg aria-hidden="true" width="420" height="420" viewBox="0 0 100 100"
        style={{ position: 'absolute', top: '-80px', right: '-60px', opacity: 0.06 }}>
        <path d="M50 10 A40 40 0 1 0 50 90 A30 30 0 1 1 50 10 Z" fill="#d4af6a"/>
      </svg>
      {/* lunar glow gold */}
      <div className="lunar-glow" style={{
        top: '-15%', right: '-8%',
        width: 540, height: 540,
      }}/>
      {/* orbs ciano */}
      <div style={{
        position: 'absolute', top: '-30%', left: '-10%',
        width: 600, height: 600, borderRadius: '50%',
        background: 'radial-gradient(circle, rgba(103,232,249,0.18), transparent 60%)', filter: 'blur(40px)',
      }}/>
      <div className="container" style={{ position: 'relative', textAlign: 'center', maxWidth: 820, margin: '0 auto' }}>
        <div className="eyebrow" style={{ color: 'rgba(165,243,252,0.9)' }}>Última chamada</div>
        <h2 className="serif" style={{ fontSize: 'clamp(48px, 6vw, 88px)', lineHeight: 0.98, margin: '18px 0 20px', fontWeight: 400, letterSpacing: '-0.02em' }}>
          A próxima joia da sua história está te esperando.
        </h2>
        {promoLine || <div style={{ margin: '0 0 36px' }}/>}
        <div style={{ display: 'flex', gap: 12, justifyContent: 'center', flexWrap: 'wrap' }}>
          <a href="#produtos" className="btn silver-shimmer" style={{
            height: 58, padding: '0 32px', fontSize: 15,
            background: 'var(--grad-gold)', color: '#0a1f3d', fontWeight: 600,
            boxShadow: '0 16px 32px -10px rgba(212,175,106,0.55)',
          }}>
            Comprar agora <Icon name="arrow" size={16}/>
          </a>
          <a href="#produtos" className="btn" style={{
            height: 58, padding: '0 30px', fontSize: 15,
            background: 'rgba(255,255,255,0.10)', color: 'white',
            border: '1px solid rgba(255,255,255,0.22)',
            backdropFilter: 'blur(10px)',
          }}>
            Ver tudo
          </a>
        </div>
      </div>
    </section>
  );
}

// ----- Footer -----
function Footer() {
  return (
    <footer style={{
      background: 'linear-gradient(180deg, #0a1f3d 0%, #051327 100%)',
      color: 'rgba(236,254,255,0.7)', padding: '80px 0 32px',
      position: 'relative', overflow: 'hidden',
    }}>
      {/* Crescente decorativo de marca */}
      <svg aria-hidden="true" width="380" height="380" viewBox="0 0 100 100"
        style={{ position: 'absolute', bottom: '-120px', right: '-60px', opacity: 0.05 }}>
        <path d="M50 10 A40 40 0 1 0 50 90 A30 30 0 1 1 50 10 Z" fill="#d4af6a"/>
      </svg>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1.4fr repeat(3, 1fr)', gap: 40, marginBottom: 56 }} className="footer-grid">
          <div>
            <Logo light size={24}/>
            <p style={{ fontSize: 14, lineHeight: 1.6, marginTop: 16, maxWidth: 280 }}>
              Semijoias artesanais finas, feitas à mão em Salvador, Bahia, desde 2025.
            </p>
            <div style={{ display: 'flex', gap: 10, marginTop: 24 }}>
              {[
                { name: 'WhatsApp', href: 'https://wa.me/5571999181376', svg: <path d="M12.04 2C6.58 2 2.13 6.45 2.13 11.91c0 1.93.55 3.74 1.5 5.27L2 22l4.94-1.29c1.45.79 3.12 1.24 4.9 1.24h.01c5.46 0 9.91-4.45 9.91-9.91 0-2.65-1.03-5.14-2.9-7.01A9.834 9.834 0 0 0 12.04 2zm0 18.17h-.01c-1.6 0-3.16-.43-4.51-1.24l-.32-.19-3.36.88.9-3.28-.21-.34a8.224 8.224 0 0 1-1.26-4.38c0-4.54 3.7-8.24 8.25-8.24 2.2 0 4.27.86 5.83 2.42a8.18 8.18 0 0 1 2.41 5.83c0 4.54-3.7 8.24-8.24 8.24zm4.52-6.16c-.25-.12-1.47-.72-1.7-.81-.23-.08-.39-.12-.56.12-.16.25-.64.81-.79.97-.15.16-.29.18-.54.06-.25-.12-1.05-.39-2-1.23-.74-.66-1.24-1.47-1.38-1.72-.14-.25-.02-.38.11-.5.11-.11.25-.29.37-.43.12-.14.16-.25.25-.41.08-.16.04-.31-.02-.43-.06-.12-.56-1.34-.76-1.84-.2-.48-.41-.42-.56-.43h-.48c-.16 0-.43.06-.66.31-.23.25-.86.84-.86 2.06 0 1.22.89 2.55 1.01 2.71.12.16 1.74 2.66 4.21 3.73.59.26 1.05.41 1.41.52.59.19 1.13.16 1.56.1.48-.07 1.47-.6 1.67-1.18.21-.58.21-1.07.14-1.18-.07-.11-.23-.16-.48-.28z"/> },
                { name: 'Instagram', href: 'https://www.instagram.com/lua.azul_acessorios', svg: <><path d="M12 2.2c3.2 0 3.6 0 4.85.07 1.17.05 1.8.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.25.07 1.63.07 4.81s0 3.56-.07 4.81c-.05 1.17-.25 1.8-.41 2.23-.22.56-.48.96-.9 1.38a3.7 3.7 0 0 1-1.38.9c-.42.16-1.06.36-2.23.41-1.25.06-1.63.07-4.85.07s-3.6 0-4.85-.07c-1.17-.05-1.8-.25-2.23-.41a3.7 3.7 0 0 1-1.38-.9 3.7 3.7 0 0 1-.9-1.38c-.16-.42-.36-1.06-.41-2.23C2.2 15.56 2.2 15.18 2.2 12s0-3.56.07-4.81c.05-1.17.25-1.8.41-2.23.22-.56.48-.96.9-1.38.42-.42.82-.68 1.38-.9.42-.16 1.06-.36 2.23-.41C8.44 2.21 8.82 2.2 12 2.2zm0 1.8c-3.13 0-3.5 0-4.73.07-.94.04-1.45.2-1.79.33-.45.18-.77.39-1.11.73-.34.34-.55.66-.73 1.11-.13.34-.29.85-.33 1.79C3.04 9.27 3.03 9.64 3.03 12s0 2.73.07 3.97c.04.94.2 1.45.33 1.79.18.45.39.77.73 1.11.34.34.66.55 1.11.73.34.13.85.29 1.79.33 1.24.06 1.6.07 4.73.07s3.5 0 4.73-.07c.94-.04 1.45-.2 1.79-.33.45-.18.77-.39 1.11-.73.34-.34.55-.66.73-1.11.13-.34.29-.85.33-1.79.06-1.24.07-1.6.07-3.97s0-2.73-.07-3.97c-.04-.94-.2-1.45-.33-1.79a3.07 3.07 0 0 0-.73-1.11 3.07 3.07 0 0 0-1.11-.73c-.34-.13-.85-.29-1.79-.33C15.5 4 15.13 4 12 4z"/><path d="M12 7.13a4.87 4.87 0 1 0 0 9.74 4.87 4.87 0 0 0 0-9.74zm0 8.04A3.17 3.17 0 1 1 12 8.83a3.17 3.17 0 0 1 0 6.34z"/><circle cx="17.06" cy="6.94" r="1.14"/></> },
                { name: 'TikTok', href: 'https://www.tiktok.com/@lua.azul_acessorios', svg: <path d="M19.6 6.85a4.86 4.86 0 0 1-4.06-2.4 4.84 4.84 0 0 1-.74-2.45h-3.45v11.4a2.95 2.95 0 1 1-2.95-3v-3.5a6.45 6.45 0 1 0 6.4 6.45V8.95a8.28 8.28 0 0 0 4.8 1.53V7.04a4.83 4.83 0 0 1 0-.19z"/> },
              ].map((s,i)=>(
                <a key={i} href={s.href} target="_blank" rel="noreferrer" aria-label={s.name} style={{
                  width: 40, height: 40, borderRadius: '50%',
                  background: 'rgba(255,255,255,0.08)',
                  color: 'white',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                  transition: 'background .15s ease, transform .15s ease',
                }}
                onMouseEnter={(e)=> { e.currentTarget.style.background = 'rgba(255,255,255,0.18)'; e.currentTarget.style.transform = 'translateY(-1px)'; }}
                onMouseLeave={(e)=> { e.currentTarget.style.background = 'rgba(255,255,255,0.08)'; e.currentTarget.style.transform = 'none'; }}>
                  <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">{s.svg}</svg>
                </a>
              ))}
              <a href="https://wa.me/5571999181376" target="_blank" rel="noreferrer" style={{
                display: 'inline-flex', alignItems: 'center', gap: 8,
                height: 40, padding: '0 14px', borderRadius: 999,
                background: 'rgba(37,211,102,0.18)', color: '#bbf7d0',
                fontSize: 13, fontFamily: 'var(--mono)', letterSpacing: '0.04em',
              }}>
                (71) 99918-1376
              </a>
            </div>
          </div>

          <FooterCol title="Loja" links={[
            { label: 'Brincos',   href: 'categoria.html?cat=brincos' },
            { label: 'Colares',   href: 'categoria.html?cat=colares' },
            { label: 'Pulseiras', href: 'categoria.html?cat=pulseiras' },
            { label: 'Chokers',   href: 'categoria.html?cat=chokers' },
          ]}/>
          <FooterCol title="Ajuda" links={[
            { label: 'Garantia', href: 'garantia.html' },
            { label: 'Política de trocas', href: 'garantia.html#trocas' },
            { label: 'Tempo de produção', href: 'garantia.html#producao' },
            { label: 'Rastreio', href: 'rastreio.html' },
            { label: 'Tabela de tamanhos', href: 'tamanhos.html' },
            { label: 'Cuidados com a joia', href: 'cuidados.html' },
            { label: 'FAQ', href: 'faq.html' },
          ]}/>
          <FooterCol title="Lua Azul" links={[
            { label: 'Sobre a marca', href: 'sobre.html' },
            ...(window.SITE_CONFIG?.affiliates_enabled === false
              ? []
              : [{ label: 'Trabalhe conosco · Afiliadas', href: 'trabalhe-conosco.html' }]),
          ]}/>
        </div>

        <div style={{
          paddingTop: 28, borderTop: '1px solid rgba(255,255,255,0.08)',
          display: 'flex', justifyContent: 'space-between', flexWrap: 'wrap', gap: 20,
          fontSize: 12, fontFamily: 'var(--mono)', color: 'rgba(255,255,255,0.5)',
        }}>
          <div>© 2026 Lua Azul Joias · CNPJ 00.000.000/0001-00</div>
          <div style={{ display: 'flex', gap: 18 }}>
            <a href="politicas.html#termos" style={{ color: 'inherit' }}>Termos</a>
            <a href="politicas.html#privacidade" style={{ color: 'inherit' }}>Privacidade</a>
            <a href="politicas.html#cookies" style={{ color: 'inherit' }}>Cookies</a>
          </div>
        </div>
      </div>
    </footer>
  );
}

function FooterCol({ title, links }) {
  return (
    <div>
      <div className="eyebrow" style={{ color: 'rgba(165,243,252,0.8)' }}>{title}</div>
      <ul style={{ listStyle: 'none', padding: 0, margin: '18px 0 0', display: 'flex', flexDirection: 'column', gap: 10 }}>
        {links.map(l => {
          const label = typeof l === 'string' ? l : l.label;
          const href = typeof l === 'string' ? '#' : (l.href || '#');
          return <li key={label}><a href={href} style={{ fontSize: 14, color: 'rgba(255,255,255,0.7)' }}>{label}</a></li>;
        })}
      </ul>
    </div>
  );
}

Object.assign(window, {
  CollectionsBand, ProductsSection, HowItWorks, Benefits, Testimonials,
  Plans, FaqSection, ContactSection, FinalCTA, Footer,
});
