// Icon library for НАЦЗДРАВ
// All icons are 24x24 stroke icons; consistent stroke width 1.5

const Icon = ({ name, size = 24, strokeWidth = 1.5, className = '', style }) => {
  const path = ICON_PATHS[name];
  if (!path) return null;
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth={strokeWidth}
      strokeLinecap="round"
      strokeLinejoin="round"
      className={className}
      style={style}
      aria-hidden="true"
    >
      {path}
    </svg>
  );
};

const ICON_PATHS = {
  // UI
  search:   <><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></>,
  arrow:    <><path d="M5 12h14" /><path d="m13 6 6 6-6 6" /></>,
  arrowR:   <><path d="m9 6 6 6-6 6" /></>,
  arrowL:   <><path d="m15 6-6 6 6 6" /></>,
  arrowDown:<><path d="M12 5v14" /><path d="m6 13 6 6 6-6" /></>,
  close:    <><path d="m6 6 12 12" /><path d="m6 18 12-12" /></>,
  menu:     <><path d="M3 6h18" /><path d="M3 12h18" /><path d="M3 18h18" /></>,
  check:    <><path d="M4 12l5 5L20 6" /></>,
  plus:     <><path d="M12 5v14" /><path d="M5 12h14" /></>,
  chevR:    <><path d="m9 6 6 6-6 6" /></>,
  chevD:    <><path d="m6 9 6 6 6-6" /></>,

  // Contact
  phone:    <><path d="M5 4h3l2 5-2.5 1.5a11 11 0 0 0 6 6L15 14l5 2v3a2 2 0 0 1-2 2 16 16 0 0 1-15-15 2 2 0 0 1 2-2z" /></>,
  mail:     <><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></>,
  whatsapp: <><path d="M3 21l1.7-5A9 9 0 1 1 8 19.3L3 21z" /><path d="M8.5 9.5c.5 2.5 3 5 5.5 5.5l1.5-1.2c.4-.3 1-.3 1.4 0L18 14.5" /></>,
  pin:      <><path d="M12 22s7-7 7-12a7 7 0 0 0-14 0c0 5 7 12 7 12z" /><circle cx="12" cy="10" r="2.5" /></>,
  clock:    <><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></>,

  // User / nav
  user:     <><circle cx="12" cy="8" r="4" /><path d="M4 20a8 8 0 0 1 16 0" /></>,
  doctor:   <><circle cx="12" cy="7" r="3.5" /><path d="M5 21a7 7 0 0 1 14 0" /><path d="M9 12.5v3a3 3 0 0 0 6 0v-3" /></>,
  pill:     <><rect x="3" y="9" width="18" height="6" rx="3" transform="rotate(-30 12 12)" /><path d="M9.5 8.5l6 6" /></>,
  stethoscope: <><path d="M6 4v6a4 4 0 0 0 8 0V4" /><path d="M10 14v3a4 4 0 0 0 8 0v-3" /><circle cx="18" cy="11" r="2" /></>,

  // Directions icons
  heart:    <><path d="M12 20s-7-4.5-7-10a4 4 0 0 1 7-2.5A4 4 0 0 1 19 10c0 5.5-7 10-7 10z" /><path d="M8.5 11.5h2l1-2 1.5 4 1-2h1.5" /></>,
  brain:    <><path d="M9 6a2.5 2.5 0 0 0-2.5 2.5v1A2.5 2.5 0 0 0 4 12a2.5 2.5 0 0 0 2.5 2.5v1A2.5 2.5 0 0 0 9 18h.5V6H9z" /><path d="M15 6a2.5 2.5 0 0 1 2.5 2.5v1A2.5 2.5 0 0 1 20 12a2.5 2.5 0 0 1-2.5 2.5v1A2.5 2.5 0 0 1 15 18h-.5V6H15z" /><path d="M12 6v12" /></>,
  ribbon:   <><path d="M9 4l3 6 3-6" /><path d="M12 10l-4 8 4-2 4 2-4-8" /></>,
  bone:     <><path d="M6 7a2 2 0 1 1 3-2 2 2 0 0 1 2 2v1l5 5h1a2 2 0 1 1 2 3 2 2 0 0 1-3 2 2 2 0 0 1-2-2v-1l-5-5H7a2 2 0 1 1-2-3" /></>,
  liver:    <><path d="M5 9c0-3 3-5 7-5s7 2 7 5c0 6-4 10-7 10S5 15 5 9z" /><path d="M9 11c1-1 3-1 4 0" /><path d="M11 14c1-1 3-1 4 0" /></>,
  female:   <><circle cx="12" cy="8" r="5" /><path d="M12 13v8" /><path d="M9 18h6" /></>,
  kidney:   <><path d="M8 4c-3 0-5 3-5 7s2 9 5 9c2 0 3-2 4-2s2 2 4 2c3 0 5-5 5-9s-2-7-5-7c-2 0-3 2-4 2s-2-2-4-2z" /></>,
  endo:     <><circle cx="12" cy="6" r="2" /><path d="M9 10c0-1 1-2 3-2s3 1 3 2v3a3 3 0 0 1-6 0z" /><path d="M10 14v4l-2 2" /><path d="M14 14v4l2 2" /></>,
  scalpel:  <><path d="M14 4l6 6-9 9H5v-6z" /><path d="M14 4l-9 9" /></>,
  scan:     <><path d="M4 8V6a2 2 0 0 1 2-2h2" /><path d="M16 4h2a2 2 0 0 1 2 2v2" /><path d="M20 16v2a2 2 0 0 1-2 2h-2" /><path d="M8 20H6a2 2 0 0 1-2-2v-2" /><path d="M4 12h16" /></>,
  rehab:    <><circle cx="9" cy="5" r="2" /><path d="M9 8v5l-3 8" /><path d="M9 11l4 1 1 4 3 1" /><path d="M9 13l3-2" /></>,
  lung:     <><path d="M12 4v10" /><path d="M12 14c-1-3-3-4-5-4s-3 2-3 5 1 5 3 5 4-2 5-6z" /><path d="M12 14c1-3 3-4 5-4s3 2 3 5-1 5-3 5-4-2-5-6z" /></>,

  // Misc
  shield:    <><path d="M12 3l8 3v6c0 5-4 8-8 9-4-1-8-4-8-9V6z" /></>,
  award:     <><circle cx="12" cy="9" r="5" /><path d="m8.5 13-1 8 4.5-3 4.5 3-1-8" /></>,
  star:      <><path d="m12 3 2.5 5.5L20 9.5l-4 4L17 20l-5-3-5 3 1-6.5-4-4 5.5-1z" /></>,
  upload:    <><path d="M12 4v12" /><path d="m6 10 6-6 6 6" /><path d="M4 18v2h16v-2" /></>,
  paper:     <><path d="M6 3h8l4 4v14H6z" /><path d="M14 3v4h4" /><path d="M9 12h6M9 16h6" /></>,
  globe:     <><circle cx="12" cy="12" r="9" /><path d="M3 12h18" /><path d="M12 3c2.5 3 4 6 4 9s-1.5 6-4 9c-2.5-3-4-6-4-9s1.5-6 4-9z" /></>,
  spark:     <><path d="M12 3v4" /><path d="M12 17v4" /><path d="M3 12h4" /><path d="M17 12h4" /><path d="m6 6 2.5 2.5" /><path d="m15.5 15.5 2.5 2.5" /><path d="m6 18 2.5-2.5" /><path d="m15.5 8.5 2.5-2.5" /></>,
  gear:      <><circle cx="12" cy="12" r="3" /><path d="M12 2.5l1.3 2.2 2.5-.4.4 2.5 2.2 1.3-1 2.3 1 2.3-2.2 1.3-.4 2.5-2.5-.4L12 21.5l-1.3-2.2-2.5.4-.4-2.5-2.2-1.3 1-2.3-1-2.3 2.2-1.3.4-2.5 2.5.4z" /></>,
};

// Logo: official НАЦЗДРАВ mark (Star of Life with caduceus) + wordmark
// Source: user-provided original SVG, recolored to brand navy
const LogoMark = ({ size = 40, color = 'currentColor' }) => (
  <svg
    viewBox="0 0 130 140"
    width={size}
    height={size * 140 / 130}
    xmlns="http://www.w3.org/2000/svg"
    aria-hidden="true"
  >
    <g transform="translate(0,140) scale(0.1,-0.1)" fill={color} stroke="none">
      <path d="M544 1282 c-38 -30 -44 -56 -44 -186 0 -69 -4 -126 -9 -126 -5 0 -56 27 -114 60 -156 90 -192 82 -260 -54 -48 -95 -32 -122 133 -216 49 -28 90 -55 90 -60 0 -5 -41 -32 -90 -60 -165 -94 -181 -121 -133 -216 68 -136 104 -144 260 -54 58 33 109 60 114 60 5 0 9 -57 9 -126 0 -183 15 -204 150 -204 135 0 150 21 150 204 0 80 4 126 10 126 6 0 57 -27 113 -60 155 -90 192 -82 260 54 48 95 32 122 -133 216 -49 28 -90 55 -90 60 0 5 41 32 90 60 165 94 181 121 133 216 -68 136 -105 144 -260 54 -56 -33 -107 -60 -113 -60 -6 0 -10 46 -10 126 0 183 -15 204 -150 204 -66 0 -90 -4 -106 -18z m136 -402 c24 -24 25 -43 5 -60 -8 -7 -15 -24 -15 -38 l0 -26 20 22 c18 19 31 22 102 22 l81 0 -6 -36 c-3 -20 -14 -46 -24 -57 -21 -24 -80 -50 -93 -42 -17 11 -11 35 9 35 20 0 71 36 71 51 0 5 -23 9 -52 9 -43 0 -56 -5 -78 -27 -28 -27 -28 -27 -6 -38 12 -6 22 -22 24 -38 3 -21 -2 -29 -22 -38 -24 -11 -24 -13 -8 -25 16 -12 16 -14 0 -26 -9 -7 -18 -24 -20 -38 -4 -36 -32 -32 -36 5 -2 16 -12 35 -23 43 -25 17 -24 47 2 66 l21 14 -23 4 c-35 5 -38 38 -4 38 l27 0 -29 30 c-24 26 -35 30 -80 30 -29 0 -53 -4 -53 -9 0 -15 51 -51 71 -51 20 0 26 -24 9 -35 -13 -8 -72 18 -93 42 -10 11 -21 37 -24 57 l-6 36 81 0 c71 0 84 -3 102 -22 l20 -22 0 26 c0 14 -7 31 -15 38 -8 7 -15 19 -15 26 0 16 35 54 50 54 6 0 19 -9 30 -20z" />
      <path d="M640 850 c0 -5 5 -10 10 -10 6 0 10 5 10 10 0 6 -4 10 -10 10 -5 0 -10 -4 -10 -10z" />
    </g>
  </svg>
);

const Logo = ({ width = 230, color = 'currentColor', subColor }) => {
  const sub = subColor || color;
  return (
    <div style={{ display: 'inline-flex', alignItems: 'center', gap: 14, lineHeight: 1, width }}>
      <LogoMark size={58} color={color} />
      <div style={{ minWidth: 0 }}>
        <div style={{
          fontFamily: 'Onest, sans-serif',
          fontSize: 19,
          fontWeight: 800,
          color,
          letterSpacing: '0.02em',
          lineHeight: 1.05,
        }}>
          НАЦЗДРАВ
        </div>
        <div style={{
          fontFamily: 'Onest, sans-serif',
          fontSize: 10.5,
          fontWeight: 400,
          color: sub,
          opacity: 0.72,
          letterSpacing: '0.01em',
          marginTop: 4,
          lineHeight: 1.2,
        }}>
          Центр экспертной медицины
        </div>
      </div>
    </div>
  );
};

Object.assign(window, { Icon, Logo, ICON_PATHS });
