// ============================================================
// Evidia · Mockups v2 · Seção 04 — opções de redesenho (comunidade)
// Menos texto solto; a tese vira elemento visual.
//   Opção A · Cadeia de valor (pipeline visual)
//   Opção B · Editorial split (lista numerada compacta)
// ============================================================

const ci = { fill: "none", stroke: "var(--cyan-400)", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round" };

const NODES = [
{ label: "Médicos selecionados", icon: <svg viewBox="0 0 24 24" {...ci}><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /><circle cx="9" cy="7" r="4" /><path d="M22 21v-2a4 4 0 0 0-3-3.87" /><path d="M16 3.13a4 4 0 0 1 0 7.75" /></svg> },
{ label: "Protocolos & evidência", icon: <svg viewBox="0 0 24 24" {...ci}><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><path d="M14 2v6h6" /><path d="m9 15 2 2 4-4" /></svg> },
{ label: "Melhores desfechos", icon: <svg viewBox="0 0 24 24" {...ci}><path d="M22 12h-4l-3 9L9 3l-3 9H2" /></svg> },
{ label: "Menos desperdício", icon: <svg viewBox="0 0 24 24" {...ci}><polyline points="22 17 13.5 8.5 8.5 13.5 2 7" /><polyline points="16 17 22 17 22 11" /></svg> }];


// -----------------------------------------------------------
// OPÇÃO A · Cadeia de valor (pipeline visual)
// -----------------------------------------------------------
const CommunityFlow = () =>
<div className="ab-comm-a" style={{ width: 1440, height: 760, background: "#050a14", color: "#fff", position: "relative", overflow: "hidden" }}>
    <div className="ev-dark-bg"><i className="b1"></i><i className="b2"></i><i className="b3"></i></div>
    <div className="ev-grain"></div>

    <div style={{ position: "relative", zIndex: 2, padding: "84px 96px", height: "100%", display: "flex", flexDirection: "column" }}>
      <div style={{ textAlign: "center" }}>
        <div className="ev-eyebrow ev-eyebrow--dark" style={{ marginBottom: 24, justifyContent: "center" }}>
          <span className="num">A comunidade com voz</span>
        </div>
        <h2 style={{ fontFamily: "var(--font-display)", fontSize: 50, lineHeight: 1.05, fontWeight: 600, letterSpacing: "-0.024em", margin: "0 auto", color: "#fff", maxWidth: "20ch" }}>
          A comunidade não entrega só consultas. Entrega <em style={{ fontStyle: "normal", background: "var(--grad-arc)", WebkitBackgroundClip: "text", backgroundClip: "text", color: "transparent" }}>evidência</em>.
        </h2>
      </div>

      {/* pipeline */}
      <div style={{ margin: "auto 0", display: "flex", alignItems: "flex-start", justifyContent: "space-between", maxWidth: 1080, marginLeft: "auto", marginRight: "auto", width: "100%" }}>
        {NODES.map((n, i) =>
      <React.Fragment key={i}>
            <div style={{ display: "flex", flexDirection: "column", alignItems: "center", width: 180 }}>
              <div style={{ position: "relative", width: 104, height: 104, borderRadius: "50%", background: "rgba(255,255,255,0.05)", border: "1px solid rgba(0,163,224,0.45)", display: "flex", alignItems: "center", justifyContent: "center", boxShadow: "0 0 36px rgba(0,163,224,0.18)" }}>
                <span style={{ width: 40, height: 40 }}>{n.icon}</span>
                <span style={{ position: "absolute", top: -10, right: -10, width: 26, height: 26, borderRadius: "50%", background: "var(--cyan-400)", color: "var(--ink-950)", fontFamily: "var(--font-eyebrow)", fontSize: 12, fontWeight: 700, display: "flex", alignItems: "center", justifyContent: "center" }}>{i + 1}</span>
              </div>
              <div style={{ marginTop: 22, fontFamily: "var(--font-display)", fontSize: 18, fontWeight: 600, letterSpacing: "-0.01em", color: "#fff", textAlign: "center", lineHeight: 1.25, maxWidth: "12ch" }}>{n.label}</div>
            </div>
            {i < NODES.length - 1 &&
        <div style={{ flex: 1, display: "flex", alignItems: "center", justifyContent: "center", paddingTop: 44 }}>
                <div style={{ position: "relative", width: "100%", height: 2, background: "linear-gradient(90deg, rgba(0,163,224,0.15), rgba(0,163,224,0.6))" }}>
                  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--cyan-400)" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" style={{ position: "absolute", right: -6, top: -7 }}><polyline points="9 18 15 12 9 6" /></svg>
                </div>
              </div>
        }
          </React.Fragment>
      )}
      </div>

      {/* fecho */}
      <div style={{ textAlign: "center" }}>
        <div style={{ display: "inline-flex", alignItems: "center", gap: 12, padding: "14px 26px", borderRadius: 999, background: "rgba(0,163,224,0.10)", border: "1px solid rgba(0,163,224,0.35)" }}>
          <span style={{ width: 8, height: 8, borderRadius: "50%", background: "var(--cyan-400)" }}></span>
          <span style={{ fontSize: 16, color: "rgba(255,255,255,0.86)" }}>É isso que dá à rede <strong style={{ color: "#fff", fontWeight: 600 }}>voz e relevância junto às operadoras</strong>.</span>
        </div>
      </div>
    </div>
  </div>;


// -----------------------------------------------------------
// OPÇÃO B · Editorial split (lista numerada compacta)
// -----------------------------------------------------------
const CommunityEditorial = () => {
  const items = [
  { n: "01", t: "Cuidado baseado em evidências", note: "protocolos compartilhados pela comunidade" },
  { n: "02", t: "Melhores desfechos", note: "decisões padronizadas, melhor resultado clínico" },
  { n: "03", t: "Menos desperdício", note: "menos retrabalho, exame redundante e glosa" }];

  return (
    <div className="ab-comm-b" style={{ width: 1440, height: 760, background: "#050a14", color: "#fff", position: "relative", overflow: "hidden" }}>
      <div className="ev-dark-bg"><i className="b1"></i><i className="b2"></i><i className="b3"></i></div>
      <div className="ev-grain"></div>

      <div style={{ position: "relative", zIndex: 2, padding: "84px 96px", height: "100%", display: "grid", gridTemplateColumns: "1.05fr 1fr", gap: 88, alignItems: "center" }}>
        <div>
          <div className="ev-eyebrow ev-eyebrow--dark" style={{ marginBottom: 28 }}>
            <span className="num">A comunidade com voz</span>
            <span className="rule" style={{ flex: 1, maxWidth: 70 }}></span>
          </div>
          <h2 style={{ fontFamily: "var(--font-display)", fontSize: 56, lineHeight: 1.03, fontWeight: 600, letterSpacing: "-0.026em", margin: 0, color: "#fff", maxWidth: "16ch" }}>
            Não entrega só consultas. Entrega <em style={{ fontStyle: "normal", background: "var(--grad-arc)", WebkitBackgroundClip: "text", backgroundClip: "text", color: "transparent" }}>evidência</em>.
          </h2>
          <div className="ev-arc-rule" style={{ width: 96, marginTop: 36 }}></div>
        </div>

        <div>
          {items.map((it, i) =>
          <div key={i} style={{ display: "grid", gridTemplateColumns: "auto 1fr", gap: 26, alignItems: "baseline", padding: "30px 0", borderTop: "1px solid rgba(255,255,255,0.16)" }}>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 34, fontWeight: 600, letterSpacing: "-0.02em", color: "var(--cyan-400)", lineHeight: 1 }}>{it.n}</div>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 26, fontWeight: 600, letterSpacing: "-0.018em", color: "#fff", lineHeight: 1.18 }}>{it.t}</div>
                <div style={{ marginTop: 8, fontFamily: "var(--font-eyebrow)", fontSize: 11, letterSpacing: "0.14em", textTransform: "uppercase", color: "rgba(255,255,255,0.5)", fontWeight: 600 }}>{it.note}</div>
              </div>
            </div>
          )}
        </div>
      </div>
    </div>);

};

// -----------------------------------------------------------
// OPÇÃO C · Estrutura melhorada (MANTÉM todo o conteúdo da base,
// porém em cards contidos + faixa de fluxo — menos texto solto)
// -----------------------------------------------------------
const CommunityStructured = ({ showChain = true, accent }) => {
  const results = [
  { t: "Cuidado baseado em evidências.", d: "Protocolos clínicos compartilhados e revisados pela própria comunidade médica. Padrão claro, não opinião isolada.",
    icon: <svg viewBox="0 0 24 24" {...ci}><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><path d="M14 2v6h6" /><path d="m9 15 2 2 4-4" /></svg> },
  { t: "Melhores desfechos.", d: "Decisões baseadas em evidências e bem documentadas melhoram o resultado clínico para o paciente.",
    icon: <svg viewBox="0 0 24 24" {...ci}><path d="M22 12h-4l-3 9L9 3l-3 9H2" /></svg> },
  { t: "Menos desperdício.", d: "Menos retrabalho, menos exame redundante, menos glosa. O sistema de saúde passa a gastar melhor.",
    icon: <svg viewBox="0 0 24 24" {...ci}><polyline points="22 17 13.5 8.5 8.5 13.5 2 7" /><polyline points="16 17 22 17 22 11" /></svg> }];

  const chain = ["Médicos selecionados", "Evidência & protocolos", "Melhores desfechos · menos custo", "Voz junto às operadoras"];
  return (
    <div className="ab-comm-c" style={{ width: 1440, height: showChain ? 660 : 556, background: "#050a14", color: "#fff", position: "relative", overflow: "hidden" }}>
      <div className="ev-dark-bg"><i className="b1"></i><i className="b2"></i><i className="b3"></i></div>
      <div className="ev-grain"></div>

      <div style={{ position: "relative", zIndex: 2, padding: "76px 96px", height: "100%", display: "flex", flexDirection: "column" }}>
        <div style={{ display: "grid", gridTemplateColumns: "1.1fr 1fr", gap: 80, alignItems: "end", marginBottom: 44 }}>
          <div>
            <div className="ev-eyebrow ev-eyebrow--dark" style={{ marginBottom: 24 }}>
              <span className="num"></span>
              <span className="rule" style={{ flex: 1, maxWidth: 80 }}></span>
            </div>
            <h2 style={{ fontFamily: "var(--font-display)", fontSize: 48, lineHeight: 1.05, fontWeight: 600, letterSpacing: "-0.024em", margin: 0, color: "#fff", maxWidth: "18ch" }}>
              Quando bons médicos se organizam a <em style={accent ? { fontStyle: "normal", color: accent } : { fontStyle: "normal", background: "var(--grad-arc)", WebkitBackgroundClip: "text", backgroundClip: "text", color: "transparent" }}>saúde ganha</em>.
            </h2>
          </div>
          <p style={{ margin: 0, fontSize: 16, lineHeight: 1.6, color: "rgba(255,255,255,0.72)", maxWidth: "44ch", paddingBottom: 4 }}>Quando os melhores médicos do país compartilham protocolos e padrão clínico, todo o ecossistema de saúde ganha, e é isso que dá à rede relevância junto às operadoras.

          </p>
        </div>

        {/* 3 cards contidos */}
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 22, margin: "5px 0px 0px" }}>
          {results.map((r, i) =>
          <div key={i} style={{ background: "rgba(255,255,255,0.045)", border: "1px solid rgba(255,255,255,0.10)", borderRadius: 18, padding: "30px 30px 32px" }}>
              <div style={{ width: 46, height: 46, borderRadius: 12, background: "rgba(0,163,224,0.14)", border: "1px solid rgba(0,163,224,0.4)", display: "flex", alignItems: "center", justifyContent: "center", marginBottom: 22 }}>
                <span style={{ width: 24, height: 24, display: "block" }}>{r.icon}</span>
              </div>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 22, fontWeight: 600, color: "#fff", letterSpacing: "-0.016em", lineHeight: 1.2, marginBottom: 12 }}>{r.t}</div>
              <div style={{ fontSize: 14.5, lineHeight: 1.6, color: "rgba(255,255,255,0.64)" }}>{r.d}</div>
            </div>
          )}
        </div>

        {/* faixa de fluxo (footer) */}
        {showChain &&
        <div style={{ marginTop: "auto", display: "flex", alignItems: "center", justifyContent: "center", gap: 14, paddingTop: 34, borderTop: "1px solid rgba(255,255,255,0.12)", fontFamily: "var(--font-eyebrow)", fontSize: 11, letterSpacing: "0.14em", textTransform: "uppercase", fontWeight: 600 }}>
          {chain.map((s, i, arr) =>
          <React.Fragment key={i}>
              <span style={{ padding: "10px 16px", borderRadius: 999, color: i === arr.length - 1 ? "#fff" : "#fff", background: i === arr.length - 1 ? "var(--indigo-600)" : "rgba(255,255,255,0.05)", border: i === arr.length - 1 ? "none" : "1px solid rgba(255,255,255,0.16)" }}>{s}</span>
              {i < arr.length - 1 &&
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--cyan-400)" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" style={{ flexShrink: 0 }}><line x1="5" y1="12" x2="19" y2="12" /><polyline points="12 5 19 12 12 19" /></svg>
            }
            </React.Fragment>
          )}
        </div>
        }
      </div>
    </div>);

};

Object.assign(window, { CommunityFlow, CommunityEditorial, CommunityStructured });