/* WhatsApp Section — Kunden-Kommunikation via WhatsApp */
const WhatsAppSection = () => {
  // Animated car position on mini-map — follows real streets.
  // Map canvas is 300×180. Roads (in px, on SVG grid):
  //   Horizontal: y=48 (minor), y=110 (major)
  //   Vertical:   x=108 (minor), x=196 (major)
  // Pin at (90, 60) → 30%, 33%.
  // Waypoints in PERCENT so they map directly to CSS left/top on the 300×180 map.
  //   % = px/3 for x, px/1.8 for y
  const WAYPOINTS = [
    { x: 65.3, y: 88 },   // start on major V road (x=196), near bottom edge
    { x: 65.3, y: 61 },   // up to major H road (y=110)
    { x: 36,   y: 61 },   // left along major H road to minor V intersection (x=108)
    { x: 36,   y: 33 },   // up minor V road to height of pin (y=60)
    { x: 30,   y: 33 },   // short hop west to pin (90,60)
  ];
  // Cumulative segment lengths for constant-speed traversal
  const segLens = WAYPOINTS.slice(1).map((p, i) => {
    const a = WAYPOINTS[i];
    return Math.hypot(p.x - a.x, p.y - a.y);
  });
  const totalLen = segLens.reduce((s, v) => s + v, 0);

  const [t, setT] = React.useState(0);
  React.useEffect(() => {
    const id = setInterval(() => setT(v => (v + 1) % 100), 120);
    return () => clearInterval(id);
  }, []);

  // Fly-in annotations on scroll into view
  const phoneWrapRef = React.useRef(null);
  const [annoIn, setAnnoIn] = React.useState(false);
  React.useEffect(() => {
    if (!phoneWrapRef.current) return;
    const io = new IntersectionObserver((entries) => {
      entries.forEach(e => { if (e.isIntersecting) { setAnnoIn(true); io.disconnect(); } });
    }, { threshold: 0.35 });
    io.observe(phoneWrapRef.current);
    return () => io.disconnect();
  }, []);

  // t: 0..100 → distance travelled along polyline
  const dist = (t / 100) * totalLen;
  let acc = 0;
  let px = WAYPOINTS[0].x, py = WAYPOINTS[0].y;
  for (let i = 0; i < segLens.length; i++) {
    if (dist <= acc + segLens[i]) {
      const f = segLens[i] === 0 ? 0 : (dist - acc) / segLens[i];
      const a = WAYPOINTS[i], b = WAYPOINTS[i + 1];
      px = a.x + (b.x - a.x) * f;
      py = a.y + (b.y - a.y) * f;
      break;
    }
    acc += segLens[i];
    px = WAYPOINTS[i + 1].x;
    py = WAYPOINTS[i + 1].y;
  }
  const eta = Math.max(1, Math.round(8 - t * 0.07));

  const WA_GREEN = '#25D366';
  const WA_GREEN_DEEP = '#128C7E';
  const WA_BG = '#E5DDD5';
  const DOODLE_SVG = `<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'><g fill='none' stroke='%23b8a48a' stroke-width='0.7' stroke-linecap='round' stroke-linejoin='round' opacity='0.35'><g transform='translate(0 0) scale(1.6)'><path d='M18 22 c-3 -4 -9 -4 -9 1 c0 5 9 10 9 10 s9 -5 9 -10 c0 -5 -6 -5 -9 -1z'/></g><circle cx='80' cy='18' r='4'/><path d='M80 9 v3 M80 24 v3 M71 18 h3 M86 18 h3 M74 12 l2 2 M86 24 l-2 -2 M74 24 l2 -2 M86 12 l-2 2'/><g transform='translate(125 10) scale(0.7)'><path d='M5 15 a5 5 0 0 1 10 0 a4 4 0 0 1 6 3 a3 3 0 0 1 -3 3 h-15 a4 4 0 0 1 2 -6z'/></g><g transform='translate(165 15) scale(1.3)'><ellipse cx='10' cy='12' rx='5' ry='6'/><path d='M10 18 l-1 3 M9 21 q1 2 -1 3 M9 21 q-1 2 1 3'/></g><g transform='translate(20 55) scale(0.8)'><path d='M2 5 h10 v7 a3 3 0 0 1 -3 3 h-4 a3 3 0 0 1 -3 -3z'/><path d='M12 7 a2 2 0 0 1 0 4'/></g><g transform='translate(48 55) scale(1.5)'><path d='M7 10 l2 4 l4 1 l-3 3 l1 4 l-4 -2 l-4 2 l1 -4 l-3 -3 l4 -1z'/></g><circle cx='100' cy='70' r='2'/><path d='M100 64 q-3 3 0 6 M100 76 q-3 -3 0 -6 M94 70 q3 -3 6 0 M106 70 q-3 -3 -6 0'/><g transform='translate(122 57) scale(0.65)'><rect x='3' y='3' width='12' height='10'/><path d='M3 6 h12 M9 3 v10 M9 3 q-3 -3 -1 -4 q2 -0.5 1 4 M9 3 q3 -3 1 -4 q-2 -0.5 1 4'/></g><g transform='translate(155 55) scale(1.4)'><path d='M5 7 q6 -9 15 -3 q-6 9 -15 3z'/></g><g transform='translate(10 95) scale(0.75)'><rect x='5' y='5' width='13' height='9' rx='1'/><circle cx='11' cy='9' r='2'/><path d='M8 5 l1 -2 h5 l1 2'/></g><g transform='translate(40 90) scale(1.3)'><path d='M10 15 q0 -6 5 -6 q5 0 5 6 v5 l2 2 h-14 l2 -2z M14 23 a1 1 0 0 0 2 0'/></g><path d='M85 105 v11 a2 2 0 1 1 -2 -2 M85 105 q3 -1 4 1'/><g transform='translate(108 92) scale(0.9)'><path d='M7 8 a7 7 0 0 1 14 0 v4 M7 12 v-4 M7 12 h2 v5 h-2z M19 12 h2 v5 h-2z'/></g><g transform='translate(145 88) scale(1.2)'><path d='M5 7 h5 q2 0 2 2 v8 h-7z M5 7 v10 M5 17 h7'/></g><path d='M185 110 v-11 M185 102 q-4 0 -4 -4 v-2 M185 102 q4 0 4 -4 v-3 M183 110 h4'/><g transform='translate(12 125) scale(1.4)'><path d='M13 15 l-9 4 l4 2 l2 4 z M4 19 l4 2'/></g><path d='M62 135 v10 M62 135 q2 -1 3 0 M62 135 q-2 -1 -3 0'/><circle cx='95' cy='140' r='2'/><path d='M90 138 q5 -2 10 0 M90 142 q5 2 10 0'/><g transform='translate(118 128) scale(0.85)'><path d='M12 8 c-2 -3 -6 -3 -6 1 c0 3 6 7 6 7 s6 -4 6 -7 c0 -4 -4 -4 -6 -1z'/></g><g transform='translate(152 128) scale(1.3)'><circle cx='13' cy='12' r='4'/><path d='M13 3 v3 M13 18 v3 M4 12 h3 M19 12 h3'/></g><g transform='translate(14 165) scale(0.85)'><path d='M6 5 h9 v6 a2 2 0 0 1 -2 2 h-5 a2 2 0 0 1 -2 -2z'/><path d='M15 7 a2 2 0 0 1 0 3'/></g><g transform='translate(48 163) scale(1.1)'><path d='M7 7 q5 -7 12 -2 q-5 7 -12 2z'/></g><g transform='translate(78 155) scale(1.4)'><path d='M12 13 l2 4 l4 0.5 l-3 3 l1 4 l-4 -2 l-4 2 l1 -4 l-3 -3 l4 -0.5z'/></g><g transform='translate(115 160) scale(0.75)'><path d='M10 10 a5 5 0 0 1 10 0 a4 4 0 0 1 6 3 a3 3 0 0 1 -3 3 h-15 a4 4 0 0 1 2 -6z'/></g><g transform='translate(158 162) scale(1.2)'><ellipse cx='10' cy='8' rx='4' ry='5'/><path d='M10 13 l-1 2'/></g><circle cx='45' cy='40' r='0.7'/><circle cx='115' cy='45' r='0.7'/><circle cx='155' cy='50' r='0.7'/><circle cx='10' cy='85' r='0.7'/><circle cx='75' cy='90' r='0.7'/><circle cx='145' cy='85' r='0.7'/><circle cx='190' cy='80' r='0.7'/><circle cx='35' cy='125' r='0.7'/><circle cx='75' cy='125' r='0.7'/><circle cx='105' cy='125' r='0.7'/><circle cx='140' cy='125' r='0.7'/><circle cx='180' cy='130' r='0.7'/><circle cx='40' cy='158' r='0.7'/><circle cx='108' cy='158' r='0.7'/><circle cx='150' cy='158' r='0.7'/><circle cx='5' cy='175' r='0.7'/><circle cx='45' cy='185' r='0.7'/><circle cx='78' cy='190' r='0.7'/><circle cx='110' cy='188' r='0.7'/><circle cx='150' cy='188' r='0.7'/><circle cx='190' cy='190' r='0.7'/><circle cx='12' cy='10' r='0.7'/><circle cx='48' cy='8' r='0.7'/><circle cx='100' cy='5' r='0.7'/><circle cx='180' cy='5' r='0.7'/></g></svg>`;
  const DOODLE_URL = `url("data:image/svg+xml;utf8,${DOODLE_SVG}")`;

  return (
    <section id="whatsapp" className="section paper" style={{background:'var(--paper)',color:'var(--ink)',position:'relative',overflow:'hidden'}}>
      <div className="wrap">
        <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:80,alignItems:'center'}} className="wa-grid">
          {/* LEFT — copy */}
          <div>
            <span className="eyebrow" style={{color:WA_GREEN_DEEP}}>
              <span style={{background:WA_GREEN_DEEP,width:6,height:6,borderRadius:'50%',boxShadow:'0 0 12px '+WA_GREEN}}></span>
              Für Ihre Kunden · WhatsApp
            </span>
            <h2 className="h-section" style={{marginTop:24}}>
              Jede Fahrt direkt in <span style={{color:WA_GREEN_DEEP,fontStyle:'italic'}}>WhatsApp.</span>
            </h2>
            <p className="lede" style={{marginTop:32,color:'rgba(10,11,8,0.7)'}}>
              Statt SMS oder App-Download: Ihre Kunden erhalten Bestätigung, Live-Position des Fahrers und Ankunftszeit direkt auf WhatsApp — da, wo sie ohnehin sind.
            </p>

            <div style={{marginTop:40,display:'flex',flexDirection:'column',gap:2,borderTop:'1px solid var(--paper-line)'}}>
              {[
                {t:'Buchungsbestätigung in Sekunden', d:'Sobald AIVENT disponiert, geht die Nachricht raus — mit Adresse, Uhrzeit und Fahrer.'},
                {t:'Live-Karte mit Fahrer-Position',  d:'Eingebettete Web-Ansicht zeigt in Echtzeit, wo der Wagen ist und wann er eintrifft.'},
                {t:'Updates ohne Nachfrage',          d:'„Fahrer ist in 2 Minuten da", „Fahrer ist angekommen" — automatische Push-Nachrichten statt nervöser Rückrufe.'},
                {t:'Offizielle WhatsApp Business API', d:'Zertifiziertes Template-Messaging, End-to-End verschlüsselt, DSGVO-konform.'},
              ].map((row,i)=>(
                <div key={i} style={{display:'grid',gridTemplateColumns:'auto 1fr',gap:20,padding:'20px 0',borderBottom:'1px solid var(--paper-line)',alignItems:'flex-start'}}>
                  <div style={{width:28,height:28,borderRadius:'50%',background:WA_GREEN,display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0,marginTop:2}}>
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
                  </div>
                  <div>
                    <div style={{fontFamily:'var(--f-display)',fontSize:18,fontWeight:500,letterSpacing:'-0.01em',marginBottom:4}}>{row.t}</div>
                    <div style={{fontSize:14,color:'rgba(10,11,8,0.6)',lineHeight:1.5}}>{row.d}</div>
                  </div>
                </div>
              ))}
            </div>
          </div>

          {/* RIGHT — WhatsApp chat mockup */}
          <div ref={phoneWrapRef} style={{display:'flex',justifyContent:'center',position:'relative'}}>
            {/* Green glow */}
            <div style={{position:'absolute',width:420,height:420,background:'radial-gradient(circle, rgba(37,211,102,0.28) 0%, transparent 65%)',filter:'blur(60px)',opacity:0.8,pointerEvents:'none'}}></div>

            {/* Chat frame */}
            <div style={{
              position:'relative',
              width:360,
              background:WA_BG,
              boxShadow:'0 30px 70px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.1)',
              border:'1px solid rgba(0,0,0,0.06)',
              display:'flex',flexDirection:'column',
              fontFamily:'-apple-system,"SF Pro",system-ui',
              overflow:'hidden',
            }}>
              {/* Header */}
              <div style={{background:WA_GREEN_DEEP,color:'#fff',padding:'14px 16px',display:'flex',alignItems:'center',gap:12}}>
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><polyline points="15 18 9 12 15 6"/></svg>
                <div style={{width:36,height:36,borderRadius:'50%',background:'#fff',color:WA_GREEN_DEEP,display:'flex',alignItems:'center',justifyContent:'center',fontFamily:'var(--f-display)',fontSize:14,fontWeight:600}}>TR</div>
                <div style={{flex:1}}>
                  <div style={{fontSize:15,fontWeight:500}}>Taxi Ruf</div>
                  <div style={{fontSize:11,opacity:0.85,display:'flex',alignItems:'center',gap:5}}>
                    <span style={{width:6,height:6,borderRadius:'50%',background:'#8EFFA0'}}></span>
                    online · Business
                  </div>
                </div>
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/></svg>
                <svg width="4" height="18" viewBox="0 0 4 16" fill="#fff"><circle cx="2" cy="2" r="1.6"/><circle cx="2" cy="8" r="1.6"/><circle cx="2" cy="14" r="1.6"/></svg>
              </div>

              {/* Chat body */}
              <div style={{padding:'16px 12px',display:'flex',flexDirection:'column',gap:8,position:'relative',background:WA_BG,backgroundImage:DOODLE_URL,backgroundSize:'140px 140px',backgroundRepeat:'repeat'}}>
                {/* Date divider */}
                <div style={{alignSelf:'center',background:'rgba(255,255,255,0.85)',color:'rgba(0,0,0,0.55)',padding:'4px 10px',borderRadius:6,fontSize:11,fontWeight:500,marginBottom:4,boxShadow:'0 1px 0 rgba(0,0,0,0.05)'}}>HEUTE</div>

                {/* Bubble — confirmation */}
                <div style={{alignSelf:'flex-start',maxWidth:'86%',background:'#fff',padding:'8px 10px 6px',borderRadius:'8px 8px 8px 2px',boxShadow:'0 1px 1px rgba(0,0,0,0.08)',fontSize:13,lineHeight:1.4,color:'#111'}}>
                  <div style={{fontSize:12,fontWeight:600,color:WA_GREEN_DEEP,marginBottom:4}}>Buchung bestätigt ✓</div>
                  <div>Morgen <b>06:30 Uhr</b><br/>Mozartstr. 42 → Hauptbahnhof</div>
                  <div style={{fontSize:10,color:'rgba(0,0,0,0.4)',textAlign:'right',marginTop:4}}>gestern 18:32 ✓✓</div>
                </div>

                {/* Bubble — driver assigned */}
                <div style={{alignSelf:'flex-start',maxWidth:'86%',background:'#fff',padding:'8px 10px 6px',borderRadius:'8px 8px 8px 2px',boxShadow:'0 1px 1px rgba(0,0,0,0.08)',fontSize:13,lineHeight:1.4,color:'#111'}}>
                  Ihr Fahrer <b>Max</b> ist unterwegs. Kennzeichen <b>B-TX 4711</b> · Mercedes E-Klasse
                  <div style={{fontSize:10,color:'rgba(0,0,0,0.4)',textAlign:'right',marginTop:4}}>06:22 ✓✓</div>
                </div>

                {/* Bubble — LIVE MAP */}
                <div style={{alignSelf:'flex-start',maxWidth:'92%',background:'#fff',borderRadius:'8px 8px 8px 2px',boxShadow:'0 1px 1px rgba(0,0,0,0.08)',overflow:'hidden'}}>
                  {/* Map — Uber-style: cool neutral base, bold white roads, minimal detail */}
                  <div style={{position:'relative',width:300,height:180,background:'#E9EEEB',overflow:'hidden'}}>
                    <svg width="300" height="180" viewBox="0 0 300 180" style={{position:'absolute',inset:0}}>
                      {/* Base */}
                      <rect width="300" height="180" fill="#E9EEEB"/>

                      {/* Block tiles — slightly lighter than base, like Uber's parcel polygons */}
                      <g fill="#F3F5F2">
                        <rect x="0"   y="0"   width="104" height="46"/>
                        <rect x="110" y="0"   width="82"  height="46"/>
                        <rect x="200" y="0"   width="100" height="46"/>
                        <rect x="0"   y="50"  width="104" height="58"/>
                        <rect x="110" y="50"  width="82"  height="58"/>
                        <rect x="200" y="50"  width="100" height="58"/>
                        <rect x="0"   y="114" width="104" height="66"/>
                        <rect x="110" y="114" width="82"  height="66"/>
                        <rect x="200" y="114" width="100" height="66"/>
                      </g>

                      {/* Park — sage green, Uber-style */}
                      <rect x="4" y="4" width="98" height="40" fill="#D7E4D0"/>

                      {/* Water — soft cool blue, only in SE corner */}
                      <path d="M 300 120 C 270 122, 248 138, 230 154 C 216 168, 208 174, 198 180 L 300 180 Z"
                            fill="#C5D9E2"/>

                      {/* A handful of large, simple building blocks — subtle gray fill, no outlines */}
                      {/* Kept very sparse and rectangular-but-big, like Uber footprints at this zoom */}
                      <g fill="#DCE2DD">
                        {/* Block B */}
                        <rect x="118" y="8"  width="30" height="32" rx="1"/>
                        <rect x="156" y="10" width="32" height="30" rx="1"/>
                        {/* Block C */}
                        <rect x="208" y="8"  width="38" height="18" rx="1"/>
                        <rect x="208" y="30" width="22" height="14" rx="1"/>
                        <rect x="254" y="10" width="40" height="32" rx="1"/>
                        {/* Block D */}
                        <rect x="4"   y="54" width="44" height="22" rx="1"/>
                        <rect x="54"  y="54" width="48" height="16" rx="1"/>
                        <rect x="4"   y="82" width="28" height="22" rx="1"/>
                        <rect x="40"  y="82" width="62" height="24" rx="1"/>
                        {/* Block E */}
                        <rect x="114" y="54" width="44" height="22" rx="1"/>
                        <rect x="164" y="54" width="26" height="22" rx="1"/>
                        <rect x="114" y="82" width="74" height="24" rx="1"/>
                        {/* Block F */}
                        <rect x="204" y="54" width="54" height="20" rx="1"/>
                        <rect x="264" y="54" width="32" height="20" rx="1"/>
                        <rect x="204" y="80" width="40" height="26" rx="1"/>
                        <rect x="250" y="80" width="46" height="26" rx="1"/>
                        {/* Block G */}
                        <rect x="4"   y="118" width="54" height="22" rx="1"/>
                        <rect x="62"  y="118" width="40" height="30" rx="1"/>
                        <rect x="4"   y="146" width="40" height="30" rx="1"/>
                        <rect x="50"  y="154" width="52" height="22" rx="1"/>
                        {/* Block H */}
                        <rect x="114" y="118" width="36" height="26" rx="1"/>
                        <rect x="154" y="118" width="38" height="18" rx="1"/>
                        <rect x="114" y="150" width="78" height="26" rx="1"/>
                      </g>

                      {/* ROADS — Uber-style bold white with no casing */}
                      {/* Minor streets */}
                      <line x1="0"   y1="48"  x2="300" y2="48"  stroke="#FFFFFF" strokeWidth="4"/>
                      <line x1="108" y1="0"   x2="108" y2="180" stroke="#FFFFFF" strokeWidth="4"/>
                      {/* Major roads — a touch thicker */}
                      <line x1="0"   y1="110" x2="300" y2="110" stroke="#FFFFFF" strokeWidth="7"/>
                      <line x1="196" y1="0"   x2="196" y2="180" stroke="#FFFFFF" strokeWidth="7"/>

                      {/* Route — black line underneath for Uber-style contrast, then accent on top */}
                      <polyline
                        points={WAYPOINTS.map(p => `${p.x*3},${p.y*1.8}`).join(' ')}
                        stroke="#6B7280" strokeWidth="3" fill="none"
                        strokeDasharray="6 5"
                        strokeLinecap="round" strokeLinejoin="round" opacity="0.85"/>
                    </svg>

                    {/* Destination pin (pickup) */}
                    <div style={{position:'absolute',left:'30%',top:'34%',transform:'translate(-50%,-100%)'}}>
                      <svg width="26" height="32" viewBox="0 0 24 32">
                        <path d="M12 0 C5.5 0 0 5.5 0 12 C0 22 12 32 12 32 C12 32 24 22 24 12 C24 5.5 18.5 0 12 0 Z" fill={WA_GREEN_DEEP}/>
                        <circle cx="12" cy="12" r="4.5" fill="#fff"/>
                      </svg>
                    </div>

                    {/* Car (moving) */}
                    <div style={{position:'absolute',left:px+'%',top:py+'%',transform:'translate(-50%,-50%)',transition:'all 0.3s linear'}}>
                      <div style={{width:32,height:32,borderRadius:'50%',background:WA_GREEN,border:'3px solid #fff',boxShadow:'0 2px 8px rgba(0,0,0,0.25)',display:'flex',alignItems:'center',justifyContent:'center'}}>
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="#fff"><path d="M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"/></svg>
                      </div>
                      <div style={{position:'absolute',inset:-6,borderRadius:'50%',border:'2px solid '+WA_GREEN,animation:'ringPulse 1.8s ease-out infinite',opacity:0.6}}></div>
                    </div>

                    {/* Arrival pill */}
                    <div style={{position:'absolute',top:10,left:10,background:'#fff',padding:'6px 10px',borderRadius:20,boxShadow:'0 2px 6px rgba(0,0,0,0.15)',display:'flex',alignItems:'center',gap:6,fontSize:12,fontWeight:600,color:'#111'}}>
                      <span style={{width:7,height:7,borderRadius:'50%',background:WA_GREEN,boxShadow:'0 0 0 0 '+WA_GREEN,animation:'liveDot 1.4s ease-out infinite'}}></span>
                      Ankunft in {eta} Min
                    </div>

                    {/* Attribution */}
                    <div style={{position:'absolute',bottom:4,right:6,fontSize:8,color:'rgba(0,0,0,0.4)'}}>TAXI RUF · LIVE</div>
                  </div>

                  {/* Map caption */}
                  <div style={{padding:'10px 12px 8px'}}>
                    <div style={{fontSize:13,fontWeight:500,color:'#111',marginBottom:2}}>Fahrer: Max · B-TX 4711</div>
                    <div style={{fontSize:11,color:'rgba(0,0,0,0.55)'}}>{eta} Minuten entfernt · Karte öffnen →</div>
                    <div style={{fontSize:10,color:'rgba(0,0,0,0.4)',textAlign:'right',marginTop:6}}>06:24 ✓✓</div>
                  </div>
                </div>

                {/* Typing indicator */}
                <div style={{alignSelf:'flex-start',background:'#fff',padding:'10px 14px',borderRadius:'8px 8px 8px 2px',boxShadow:'0 1px 1px rgba(0,0,0,0.08)',display:'inline-flex',alignItems:'center',gap:4,marginTop:2}}>
                  {[0,0.15,0.3].map((d,i)=>(
                    <span key={i} style={{width:6,height:6,borderRadius:'50%',background:'rgba(0,0,0,0.3)',animation:'waDot 1.2s ease-in-out infinite',animationDelay:d+'s'}}></span>
                  ))}
                </div>
              </div>

              {/* Input bar */}
              <div style={{padding:'8px 10px',background:'#F0F0F0',display:'flex',gap:6,alignItems:'center',borderTop:'1px solid rgba(0,0,0,0.05)'}}>
                <div style={{flex:1,background:'#fff',borderRadius:20,padding:'8px 14px',fontSize:12,color:'rgba(0,0,0,0.4)',display:'flex',alignItems:'center',gap:8}}>
                  <span>😊</span>
                  <span>Nachricht schreiben...</span>
                </div>
                <div style={{width:36,height:36,borderRadius:'50%',background:WA_GREEN_DEEP,display:'flex',alignItems:'center',justifyContent:'center'}}>
                  <svg width="16" height="16" viewBox="0 0 24 24" fill="#fff"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"/></svg>
                </div>
              </div>
            </div>

            {/* Floating annotations — fly in when scrolled into view */}
            <div style={{position:'absolute',right:-20,top:60,background:'#fff',border:'1px solid var(--ink)',padding:'12px 16px',fontFamily:'var(--f-mono)',fontSize:12,color:'var(--ink)',letterSpacing:'0.08em',fontWeight:600,textAlign:'right',boxShadow:'4px 4px 0 var(--ink)',zIndex:2,opacity: annoIn ? 1 : 0, transform: annoIn ? 'translate(0,0) scale(1)' : 'translate(24px,-24px) scale(0.92)', transition:'opacity 0.7s cubic-bezier(0.22,1,0.36,1) 0.15s, transform 0.7s cubic-bezier(0.22,1,0.36,1) 0.15s'}} className="wa-anno">
              ↙ EINGEBETTETE<br/>LIVE-KARTE
            </div>
            <div style={{position:'absolute',left:-20,bottom:140,background:'#fff',border:'1px solid var(--ink)',padding:'12px 16px',fontFamily:'var(--f-mono)',fontSize:12,color:'var(--ink)',letterSpacing:'0.08em',fontWeight:600,boxShadow:'4px 4px 0 var(--ink)',zIndex:2,opacity: annoIn ? 1 : 0, transform: annoIn ? 'translate(0,0) scale(1)' : 'translate(-24px,24px) scale(0.92)', transition:'opacity 0.7s cubic-bezier(0.22,1,0.36,1) 0.5s, transform 0.7s cubic-bezier(0.22,1,0.36,1) 0.5s'}} className="wa-anno">
              AUTOMATISCHE<br/>UPDATES
            </div>
          </div>
        </div>
      </div>

      <style>{`
        @keyframes ringPulse { 0%{transform:scale(1);opacity:0.6} 100%{transform:scale(2.2);opacity:0} }
        @keyframes liveDot { 0%{box-shadow:0 0 0 0 rgba(37,211,102,0.6)} 100%{box-shadow:0 0 0 8px rgba(37,211,102,0)} }
        @keyframes waDot { 0%,60%,100%{transform:translateY(0);opacity:0.3} 30%{transform:translateY(-3px);opacity:0.7} }
        @media(max-width:960px){
          .wa-grid{grid-template-columns:1fr !important;gap:48px !important}
          .wa-anno{display:none}
        }
      `}</style>
    </section>
  );
};

window.WhatsAppSection = WhatsAppSection;
