/* ============================================================
   INDIC LEAGUE NEWS — Icons (hand-crafted SVG paths)
   All 24×24, stroke-based, follow plan §4.6 spec.
   ============================================================ */

function Icon({ name, size = 22, stroke = 1.8, color = 'currentColor', fill = 'none', ...rest }) {
  const common = {
    width: size,
    height: size,
    viewBox: '0 0 24 24',
    fill: fill,
    stroke: color,
    strokeWidth: stroke,
    strokeLinecap: 'round',
    strokeLinejoin: 'round',
    ...rest,
  };

  switch (name) {
    case 'bell':
      return <svg {...common}><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>;
    case 'moon':
      return <svg {...common}><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>;
    case 'sun':
      return <svg {...common}><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>;
    case 'heart':
      return <svg {...common} fill={fill}><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>;
    case 'share':
      return <svg {...common}><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="M8.59 13.51l6.83 3.98M15.41 6.51L8.59 10.49"/></svg>;
    case 'bookmark':
      return <svg {...common} fill={fill}><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/></svg>;
    case 'x':
      return <svg {...common}><path d="M18 6L6 18M6 6l12 12"/></svg>;
    case 'flame':
      return <svg {...common} fill={fill}><path d="M8.5 14.5A2.5 2.5 0 0 0 11 17v0a2.5 2.5 0 0 0 2.5-2.5c0-1.5-.5-2.5-2-3.5-1-2-1.5-3 1-5C9 6 6 9 6 12c0 3.5 2 6 6 6s6-2.5 6-6c0-2-1-3-2-4"/></svg>;
    case 'check':
      return <svg {...common}><path d="M20 6L9 17l-5-5"/></svg>;
    case 'check-thick':
      return <svg {...common} strokeWidth="2.6"><path d="M20 6L9 17l-5-5"/></svg>;
    case 'chevron-left':
      return <svg {...common}><path d="M15 18l-6-6 6-6"/></svg>;
    case 'chevron-right':
      return <svg {...common}><path d="M9 18l6-6-6-6"/></svg>;
    case 'arrow-right':
      return <svg {...common}><path d="M5 12h14M13 5l7 7-7 7"/></svg>;
    case 'arrow-left':
      return <svg {...common}><path d="M19 12H5M11 19l-7-7 7-7"/></svg>;
    case 'menu':
      return <svg {...common}><path d="M4 7h16M4 17h10"/></svg>;
    case 'filter':
      return <svg {...common}><path d="M4 6h16M7 12h10M10 18h4"/></svg>;
    case 'sliders':
      return <svg {...common}><path d="M4 6h10M18 6h2M4 18h2M10 18h10M4 12h6M14 12h6"/><circle cx="16" cy="6" r="2"/><circle cx="8" cy="12" r="2"/><circle cx="12" cy="18" r="2"/></svg>;
    case 'compass':
      return <svg {...common}><circle cx="12" cy="12" r="9"/><path d="M16 8l-2 6-6 2 2-6z"/></svg>;
    case 'home':
      return <svg {...common} fill={fill}><path d="M3 12l9-9 9 9M5 10v10h14V10"/></svg>;
    case 'home-filled':
      return <svg {...common} fill={color} stroke="none"><path d="M12 2.5L2 12h3v9h5v-6h4v6h5v-9h3z"/></svg>;
    case 'user':
      return <svg {...common}><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/></svg>;
    case 'sparkle':
      return <svg {...common}><path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z"/><path d="M19 4l.6 1.4L21 6l-1.4.6L19 8l-.6-1.4L17 6l1.4-.6z"/></svg>;
    case 'globe':
      return <svg {...common}><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/></svg>;
    case 'flag':
      return <svg {...common}><path d="M5 21V4M5 4h12l-2 4 2 4H5"/></svg>;
    case 'gavel':
      return <svg {...common}><path d="M14 4l6 6M11 7l6 6M9 9l-5 5 3 3 5-5M14 4l3 3M3 21h12"/></svg>;
    case 'briefcase':
      return <svg {...common}><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2M3 13h18"/></svg>;
    case 'chip':
      return <svg {...common}><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6"/><path d="M9 3v2M15 3v2M9 19v2M15 19v2M3 9h2M3 15h2M19 9h2M19 15h2"/></svg>;
    case 'flask':
      return <svg {...common}><path d="M9 3h6M10 3v6L4 19a2 2 0 0 0 2 3h12a2 2 0 0 0 2-3l-6-10V3"/></svg>;
    case 'palette':
      return <svg {...common}><path d="M12 22a10 10 0 1 1 10-10c0 2-2 3-4 3h-2a2 2 0 0 0-2 2v1a3 3 0 0 1-2 3z"/><circle cx="8" cy="10" r="1.2"/><circle cx="16" cy="10" r="1.2"/><circle cx="9" cy="15" r="1.2"/></svg>;
    case 'leaf':
      return <svg {...common}><path d="M11 20a8 8 0 0 1 0-16h6a2 2 0 0 1 2 2v6a8 8 0 0 1-8 8zM3 21l9-9"/></svg>;
    case 'heartbeat':
      return <svg {...common}><path d="M3 12h4l2-4 4 8 2-4h6"/></svg>;
    case 'brain':
      return <svg {...common}><path d="M9 5a3 3 0 0 0-3 3v1a3 3 0 0 0-2 3 3 3 0 0 0 2 3v1a3 3 0 0 0 3 3M15 5a3 3 0 0 1 3 3v1a3 3 0 0 1 2 3 3 3 0 0 1-2 3v1a3 3 0 0 1-3 3M9 5v14M15 5v14"/></svg>;
    case 'trophy':
      return <svg {...common}><path d="M8 21h8M12 17v4M7 4h10v4a5 5 0 0 1-10 0zM5 4h2v3a3 3 0 0 1-3-3M19 4h-2v3a3 3 0 0 0 3-3"/></svg>;
    case 'mic':
      return <svg {...common}><rect x="9" y="3" width="6" height="12" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 19v3"/></svg>;
    case 'eye':
      return <svg {...common}><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/></svg>;
    case 'eye-off':
      return <svg {...common}><path d="M3 3l18 18M10.6 6.1A10 10 0 0 1 12 6c6 0 10 6 10 6a18 18 0 0 1-2.4 3M6.6 6.6A18 18 0 0 0 2 12s4 6 10 6a10 10 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg>;
    case 'volume':
      return <svg {...common}><path d="M11 5L6 9H3v6h3l5 4zM15 9a4 4 0 0 1 0 6M18 6a8 8 0 0 1 0 12"/></svg>;
    case 'volume-off':
      return <svg {...common}><path d="M11 5L6 9H3v6h3l5 4zM16 9l5 6M21 9l-5 6"/></svg>;
    case 'mail':
      return <svg {...common}><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 7 9-7"/></svg>;
    case 'lock':
      return <svg {...common}><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>;
    case 'apple':
      return <svg {...common} fill={color} stroke="none"><path d="M17.05 12.84c-.02-2.18 1.78-3.23 1.86-3.28-1.01-1.48-2.59-1.69-3.16-1.71-1.35-.13-2.63.79-3.31.79-.69 0-1.74-.77-2.86-.75-1.47.02-2.83.85-3.59 2.17-1.53 2.65-.39 6.57 1.1 8.73.72 1.06 1.59 2.25 2.72 2.21 1.09-.04 1.5-.71 2.83-.71 1.32 0 1.69.71 2.85.69 1.18-.02 1.92-1.07 2.64-2.14.83-1.23 1.18-2.41 1.2-2.47-.03-.01-2.3-.88-2.32-3.52zM14.86 6.27c.6-.73 1.01-1.74.9-2.75-.87.04-1.93.58-2.55 1.3-.56.64-1.05 1.67-.92 2.66.97.07 1.96-.49 2.57-1.21z"/></svg>;
    case 'google':
      return <svg width={size} height={size} viewBox="0 0 24 24"><path d="M12 10v4h6c-.6 2.8-3 4.5-6 4.5-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5c1.7 0 3.2.6 4.4 1.7l3-3C17.5 2.4 14.9 1.5 12 1.5 6.2 1.5 1.5 6.2 1.5 12S6.2 22.5 12 22.5c5.6 0 10-4.4 10-10 0-.7-.1-1.7-.2-2.5H12z" fill="#4285F4"/></svg>;
    case 'dot':
      return <svg {...common}><circle cx="12" cy="12" r="3" fill={color}/></svg>;
    case 'hand-up':
      return <svg {...common}><path d="M12 4v10M9 8l3-4 3 4M5 14a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-4l-2 2"/></svg>;
    case 'arrow-up':
      return <svg {...common}><path d="M12 19V5M5 12l7-7 7 7"/></svg>;
    default:
      return null;
  }
}

Object.assign(window, { Icon });
