// Reusable visual atoms — wave decorations, brand mark, sample data

const SAMPLE_PERSONAS = [
  {
    id: 'product',
    label: 'Analista de Produto · Nubank · 3 anos',
    form: {
      brTitle: 'Analista de Produto',
      company: 'Nubank',
      industry: 'Fintech',
      years: '3',
      scope: 'Time de produto com 8 pessoas, sem reportes diretos',
      tools: 'Jira, Figma, Excel, Confluence',
      duties: 'Responsável por apoiar o time de produto, levantamento de requisitos, contato com stakeholders, acompanhamento de entregas, testes de funcionalidades, apoio ao time de design e tecnologia. Participação em reuniões com áreas internas.',
      outcomes: 'Ajudei a lançar 2 features novas no app. Acho que reduzimos bugs reportados depois que comecei a fazer testes mais sistemáticos.',
      targetCountry: 'Ireland',
      targetCity: 'dublin',
      targetRole: 'Product Analyst / Associate PM',
    },
  },
  {
    id: 'pharmacy',
    label: 'Atendente de Farmácia · Drogasil · 4 anos',
    form: {
      brTitle: 'Atendente de Farmácia',
      company: 'Drogasil',
      industry: 'Varejo / Saúde',
      years: '4',
      scope: 'Loja com 6 atendentes, sem gestão de equipe',
      tools: 'PDV interno, sistema de controle de estoque, balança digital',
      duties: 'Atendimento ao cliente, orientação sobre medicamentos, organização de estoque, operação de caixa, contato com equipe, controle de validade dos produtos.',
      outcomes: 'Ganhei prêmio de melhor atendente do trimestre 2x. Loja teve menos perdas por validade depois que assumi o controle.',
      targetCountry: 'Ireland',
      targetCity: 'dublin',
      targetRole: '',
    },
  },
  {
    id: 'admin',
    label: 'Assistente Administrativo · Logística · 5 anos',
    form: {
      brTitle: 'Assistente Administrativo',
      company: 'Empresa de logística médio porte em São Paulo',
      industry: 'Logística',
      years: '5',
      scope: 'Escritório de 12 pessoas, apoio direto a 3 gerentes',
      tools: 'Excel avançado, SAP, sistema de notas fiscais, Outlook',
      duties: 'Controle de planilhas, suporte ao financeiro, emissão de notas fiscais, contato com fornecedores, organização de documentos, apoio geral ao escritório.',
      outcomes: 'Criei um controle novo de notas que reduziu erros. Ajudei a renegociar 2 contratos com fornecedores.',
      targetCountry: 'United Kingdom',
      targetCity: 'london',
      targetRole: 'Office Coordinator',
    },
  },
  {
    id: 'designer',
    label: 'UX/UI Designer · Saúde · 6 anos',
    form: {
      brTitle: 'UX/UI Designer',
      company: 'Empresa de saúde (tipo Eurofins)',
      industry: 'Saúde / SaaS',
      years: '6',
      scope: 'Time de design com 4 pessoas, ownership do app principal',
      tools: 'Figma, Maze, Hotjar, Miro, Notion',
      duties: 'Pesquisa com usuários, criação de interfaces, colaboração com produto e engenharia, melhoria de fluxos, testes de usabilidade, design de sistemas.',
      outcomes: 'Refiz o fluxo de agendamento e a taxa de conclusão subiu bastante. Construí a primeira versão do design system da empresa.',
      targetCountry: 'Germany',
      targetCity: 'berlin',
      targetRole: 'Senior Product Designer',
    },
  },
];

const COUNTRY_LABELS = {
  Ireland: 'Irlanda',
  'United Kingdom': 'Reino Unido',
  Germany: 'Alemanha',
  Netherlands: 'Países Baixos',
  Portugal: 'Portugal',
  Spain: 'Espanha',
  France: 'França',
  Sweden: 'Suécia',
  Denmark: 'Dinamarca',
  'Other EU': 'Outro país da União Europeia',
};
const TARGET_COUNTRIES = Object.keys(COUNTRY_LABELS);

const INDUSTRIES = [
  'Fintech', 'Bancos / financeiro', 'Saúde', 'Farmacêutica', 'Varejo', 'E-commerce',
  'Logística', 'Indústria', 'Educação', 'SaaS / Tecnologia', 'Consultoria',
  'Hotelaria', 'Construção civil', 'Setor público', 'Mídia', 'Outro',
];

// Wave SVG — used decoratively, color via currentColor
function Wave({ height = 80, opacity = 1, style = {} }) {
  return (
    <svg className="wave-svg" viewBox="0 0 1200 80" preserveAspectRatio="none" style={{ height, opacity, ...style }}>
      <path d="M0,40 C200,10 400,70 600,40 C800,10 1000,70 1200,40 L1200,80 L0,80 Z" fill="currentColor" />
    </svg>
  );
}

// Compass / star mark from logo
function StarMark({ size = 14, color = 'currentColor' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill={color}>
      <path d="M12 0 L13.5 10.5 L24 12 L13.5 13.5 L12 24 L10.5 13.5 L0 12 L10.5 10.5 Z" />
    </svg>
  );
}

// Maritime blue top bar (editorial is the default everywhere else)
function SiteHeader({ children, label = 'Principal' }) {
  return (
    <header className="adm-header-maritime">
      <div className="wrap">
        <nav className="nav" aria-label={label}>{children}</nav>
      </div>
    </header>
  );
}

// Brand lockup
function Brand({ direction = 'a', size = 'md' }) {
  const dims = size === 'lg' ? 56 : size === 'sm' ? 32 : 40;
  const fontSize = size === 'lg' ? 28 : size === 'sm' ? 18 : 22;
  return (
    <div className="brand" style={{ fontSize }}>
      <img src="/assets/logo.png" alt="" style={{ width: dims, height: dims }} />
      <div style={{ display: 'flex', flexDirection: 'column', lineHeight: 1.05 }}>
        <span>Além do Mar</span>
        <span style={{
          fontFamily: 'var(--sans)',
          fontSize: 11,
          letterSpacing: '0.08em',
          textTransform: 'uppercase',
          fontWeight: 500,
          color: direction === 'a' ? 'var(--a-text-2)' : 'var(--b-text-2)',
          fontStyle: 'normal',
        }}>
          Bolsas de estudo no exterior
        </span>
      </div>
    </div>
  );
}

// Toast helper
function useToast() {
  const [msg, setMsg] = React.useState('');
  const show = React.useCallback((m) => {
    setMsg(m);
    setTimeout(() => setMsg(''), 1800);
  }, []);
  const node = msg ? <div className="toast show">{msg}</div> : null;
  return [show, node];
}

function CityChips({ value, onChange, ariaLabelledBy }) {
  return (
    <div className="destination-switch" role="group"
      aria-label={ariaLabelledBy ? undefined : 'Cidade de destino'} aria-labelledby={ariaLabelledBy}>
      {window.AdM_CITIES.list.map(city => (
        <button key={city.id} type="button" aria-pressed={value === city.id} onClick={() => onChange(city.id)}>
          {city.label}
        </button>
      ))}
    </div>
  );
}

function CityNotes({ city }) {
  const notes = window.AdM_CITIES.cvDiffTips[city];
  return (
    <div className="city-notes" aria-live="polite">
      <h3>{notes.title}</h3>
      <div>
        <ul>{notes.tips.map(tip => <li key={tip}>{tip}</li>)}</ul>
        <a href={notes.source.url}>{notes.source.label} ↗</a>
      </div>
    </div>
  );
}

Object.assign(window, { SAMPLE_PERSONAS, TARGET_COUNTRIES, INDUSTRIES, Wave, StarMark, SiteHeader, Brand, useToast, CityChips, CityNotes });
