/* ============================================================
   product-icons.jsx — meningsfulde ikoner pr. kategori
   Samme varme, runde stil · pastelfyld + guld-streg
   ============================================================ */

function ProdIcon({ name, size = 64 }) {
  const stroke = "var(--gold-deep)";
  const common = { strokeWidth: 1.7, strokeLinejoin: "round", strokeLinecap: "round" };

  const icons = {
    /* Gourmet-is — Kastbergs pink bæger med kugler */
    is: (
      <g stroke={stroke} {...common}>
        <circle cx="26" cy="24" r="10" fill="var(--surface)" />
        <circle cx="38" cy="24" r="10" fill="var(--rose)" />
        <circle cx="32" cy="16" r="9" fill="var(--peach)" />
        <path d="M18 33 h28 l-3 21 a3 3 0 0 1 -3 2.6 h-16 a3 3 0 0 1 -3 -2.6 z" fill="var(--rose)" />
        <path d="M20 39 h24" stroke="var(--surface)" strokeWidth="2.4" opacity=".75" />
      </g>
    ),
    /* Softice — blød swirl i vaffel */
    soft: (
      <g stroke={stroke} {...common}>
        <path d="M23 34 L41 34 L32 60 Z" fill="var(--peach)" />
        <path d="M27 39 L37 39 M29 45 L35 45" strokeWidth="1.1" opacity=".5" />
        <path d="M20 35 Q 19 19 32 6 Q 45 19 44 35 Q 32 40 20 35 Z" fill="var(--surface)" />
        <path d="M23.5 31 Q 32 27.5 40.5 31 M25.5 24.5 Q 32 21.5 38.5 24.5 M27.5 18 Q 32 15.5 36.5 18" strokeWidth="1.3" opacity=".55" fill="none" />
        <path d="M32 6 q 3.6 -1.8 1.4 -4.8" strokeWidth="1.6" fill="none" />
      </g>
    ),
    /* Is til børn & voksne — trippel-kugle vaffel med hjerte */
    familie: (
      <g stroke={stroke} {...common}>
        <path d="M22 31 L42 31 L32 60 Z" fill="var(--peach)" />
        <path d="M26 36 L38 36 M28 42 L36 42" strokeWidth="1.1" opacity=".5" />
        <circle cx="25" cy="25" r="9.5" fill="var(--mint)" />
        <circle cx="39" cy="25" r="9.5" fill="var(--rose)" />
        <circle cx="32" cy="17" r="9.5" fill="var(--gold-soft)" />
        <path d="M32 8.5c1.6-2.4 5.4-1 4.2 1.8C35.4 12.2 32 14 32 14s-3.4-1.8-4.2-3.7c-1.2-2.8 2.6-4.2 4.2-1.8z" fill="var(--rose)" />
      </g>
    ),
    /* Kaffe — kop med damp og underkop */
    kaffe: (
      <g stroke={stroke} {...common}>
        <ellipse cx="30" cy="55" rx="21" ry="3.4" fill="var(--surface-2)" />
        <path d="M13 28 h34 v5 a17 17 0 0 1 -17 17 a17 17 0 0 1 -17 -17 z" fill="var(--surface)" />
        <path d="M18 30 h24 v2.5 a12 12 0 0 1 -12 9 a12 12 0 0 1 -12 -9 z" fill="var(--dark-2)" stroke="none" />
        <path d="M47 30 h3.5 a8 8 0 0 1 0 16 h-2.5" fill="none" />
        <path d="M25 11 q4 4 0 9 M33 11 q4 4 0 9" fill="none" opacity=".55" strokeWidth="1.5" />
      </g>
    ),
    /* Brød & bagværk — croissant */
    broed: (
      <g stroke={stroke} {...common}>
        <path d="M12 41 Q 12 22 32 22 Q 52 22 52 41 Q 43 34 32 34 Q 21 34 12 41 Z" fill="var(--peach)" />
        <path d="M12 41 Q 7.5 38.5 9 33 M52 41 Q 56.5 38.5 55 33" fill="none" strokeWidth="1.6" />
        <path d="M23 24.5 Q 21.5 32 20 39 M30 22.5 Q 29.5 31 29 40 M37 22.5 Q 37.5 31 38 40 M44 24.5 Q 45.5 32 47 39" strokeWidth="1.2" opacity=".5" fill="none" />
      </g>
    ),
    /* Søde desserter — cupcake */
    dessert: (
      <g stroke={stroke} {...common}>
        <path d="M20 37 h24 l-3 17 a3 3 0 0 1 -3 2.4 h-12 a3 3 0 0 1 -3 -2.4 z" fill="var(--gold-soft)" />
        <path d="M25 41 v14 M30 41 v15 M35 41 v15 M40 41 v14" strokeWidth="1.1" opacity=".5" />
        <path d="M17 37 q2 -13 15 -13 q13 0 15 13 z" fill="var(--rose)" />
        <ellipse cx="32" cy="22" rx="8" ry="6" fill="var(--rose-soft)" />
        <circle cx="32" cy="13" r="3.4" fill="var(--gold)" />
      </g>
    ),
    /* Sæsonens smage — ispind */
    saeson: (
      <g stroke={stroke} {...common}>
        <rect x="29" y="44" width="6" height="16" rx="3" fill="var(--gold-soft)" />
        <path d="M20 17 a12 12 0 0 1 24 0 v21 a12 12 0 0 1 -24 0 z" fill="var(--rose)" />
        <path d="M20 27 q12 6 24 0" stroke="var(--surface)" strokeWidth="2.4" opacity=".6" fill="none" />
        <circle cx="26" cy="21" r="2.2" fill="var(--surface)" stroke="none" opacity=".7" />
      </g>
    ),
  };

  return (
    <svg width={size} height={size} viewBox="0 0 64 64" aria-hidden="true">
      {icons[name] || icons.is}
    </svg>
  );
}

Object.assign(window, { ProdIcon });
