/* Shared components for Dr. Fabiano Beal LP */

var WA_PHONE = '5549988542222';
function waLink(msg) {
  return 'https://wa.me/' + WA_PHONE + '?text=' + encodeURIComponent(msg);
}
var WA_AGENDAR = waLink('Olá, vim do site e gostaria de agendar uma consulta de avaliação');
window.waLink = waLink;
window.WA_AGENDAR = WA_AGENDAR;

function GoldLine() {
  return React.createElement('div', {
    style: { width: 48, height: 2, background: 'var(--gold)', borderRadius: 2, marginBottom: 16 }
  });
}

function SectionHeader({ label, title, subtitle, center, line = true }) {
  const style = center ? { textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' } : {};
  return React.createElement('div', { style },
    React.createElement('h2', { className: 'section-title' }, title),
    subtitle && React.createElement('p', { className: 'section-subtitle' }, subtitle)
  );
}

function CTA({ text, type = 'gold', href = '#contato', onClick }) {
  const external = /^https?:/.test(href);
  return React.createElement('a', {
    href, className: `btn btn-${type}`, onClick,
    target: external ? '_blank' : undefined,
    rel: external ? 'noopener' : undefined,
    style: { textDecoration: 'none' }
  }, text, React.createElement('span', null, '→'));
}

function Placeholder({ text, style = {} }) {
  return React.createElement('div', {
    className: 'img-placeholder',
    style: { width: '100%', height: '100%', borderRadius: 16, ...style }
  }, text || 'Imagem');
}

// SVG Icons
function IconTeeth() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('path', { d: 'M12 2C9.5 2 7.5 3 7 5.5C6.5 8 5 9 4 11c-1 2-.5 4 0 6s1.5 5 3.5 5c1.5 0 2-1.5 2.5-3s1-2 2-2 1.5.5 2 2 1 3 2.5 3c2 0 3-3 3.5-5s1-4 0-6c-1-2-2.5-3-3-5.5S14.5 2 12 2z' })
  );
}

function IconSparkle() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('path', { d: 'M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8z' })
  );
}

function IconShield() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('path', { d: 'M12 2l8 4v6c0 5.25-3.5 10-8 11-4.5-1-8-5.75-8-11V6l8-4z' }),
    React.createElement('path', { d: 'M9 12l2 2 4-4' })
  );
}

function IconHeart() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('path', { d: 'M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z' })
  );
}

function IconMonitor() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('rect', { x: 2, y: 3, width: 20, height: 14, rx: 2 }),
    React.createElement('line', { x1: 8, y1: 21, x2: 16, y2: 21 }),
    React.createElement('line', { x1: 12, y1: 17, x2: 12, y2: 21 })
  );
}

function IconCpu() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('rect', { x: 4, y: 4, width: 16, height: 16, rx: 2 }),
    React.createElement('rect', { x: 9, y: 9, width: 6, height: 6 }),
    React.createElement('line', { x1: 9, y1: 1, x2: 9, y2: 4 }),
    React.createElement('line', { x1: 15, y1: 1, x2: 15, y2: 4 }),
    React.createElement('line', { x1: 9, y1: 20, x2: 9, y2: 23 }),
    React.createElement('line', { x1: 15, y1: 20, x2: 15, y2: 23 })
  );
}

function IconUser() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('path', { d: 'M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2' }),
    React.createElement('circle', { cx: 12, cy: 7, r: 4 })
  );
}

function IconLock() {
  return React.createElement('svg', { viewBox: '0 0 24 24' },
    React.createElement('rect', { x: 3, y: 11, width: 18, height: 11, rx: 2 }),
    React.createElement('path', { d: 'M7 11V7a5 5 0 0110 0v4' })
  );
}

function IconStar() {
  return React.createElement('svg', { viewBox: '0 0 24 24', style: { fill: 'var(--gold)', stroke: 'var(--gold)' } },
    React.createElement('polygon', { points: '12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2' })
  );
}

function Stars() {
  return React.createElement('div', { className: 'dep-stars' },
    Array.from({ length: 5 }).map((_, i) =>
      React.createElement('span', { key: i }, '★')
    )
  );
}

function WhatsAppIcon() {
  return React.createElement('svg', { viewBox: '0 0 24 24', fill: 'currentColor' },
    React.createElement('path', { d: 'M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z' })
  );
}

Object.assign(window, {
  GoldLine, SectionHeader, CTA, Placeholder,
  IconTeeth, IconSparkle, IconShield, IconHeart,
  IconMonitor, IconCpu, IconUser, IconLock,
  IconStar, Stars, WhatsAppIcon
});
