<!DOCTYPE html>

<html lang="en" class="scroll-smooth">

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

  <title>AidPulse — Certified Emergency Protocols & Clinical PDF Handbooks</title>

  <meta name="description" content="Verified clinical first-aid manuals, visual emergency guides, and multi-page printable PDF reference books for critical care.">

  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23059669'><path d='M19 10.5h-5.5V5c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v5.5H5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5h5.5V19c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-5.5H19c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5z'/></svg>">

  

  <!-- Tailwind CSS CDN -->

  <script src="https://cdn.tailwindcss.com"></script>

  <!-- jsPDF CDN for client-side multi-page PDF compilation -->

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>

  <!-- FontAwesome Icons -->

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

  <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">


  <script>

    tailwind.config = {

      theme: {

        extend: {

          fontFamily: {

            sans: ['"Plus Jakarta Sans"', 'sans-serif'],

          },

          colors: {

            clinical: {

              50: '#f0fdf4',

              100: '#dcfce7',

              500: '#10b981',

              600: '#059669',

              700: '#047857',

              800: '#065f46',

              900: '#064e3b',

            },

            emergency: {

              500: '#ef4444',

              600: '#dc2626',

              700: '#b91c1c'

            }

          }

        }

      }

    }

  </script>

</head>

<body class="bg-slate-50 text-slate-800 font-sans antialiased selection:bg-clinical-500 selection:text-white">


  <!-- TOP EMERGENCY DISPATCH BAR -->

  <div class="bg-emergency-600 text-white text-xs font-semibold py-2 px-3 text-center shadow-inner">

    <div class="max-w-7xl mx-auto flex flex-wrap items-center justify-center gap-x-4 gap-y-1">

      <span class="flex items-center gap-1.5"><i class="fa-solid fa-triangle-exclamation animate-pulse"></i> <span id="topBarAlert">Critical Emergency? Dispatch emergency services immediately:</span></span>

      <div class="flex items-center gap-3">

        <a href="tel:911" class="hover:underline flex items-center gap-1 bg-emergency-700 px-2 py-0.5 rounded"><i class="fa-solid fa-phone text-[10px]"></i> 911 (US/CA)</a>

        <a href="tel:112" class="hover:underline flex items-center gap-1 bg-emergency-700 px-2 py-0.5 rounded"><i class="fa-solid fa-phone text-[10px]"></i> 112 (EU/UK)</a>

        <a href="tel:15" class="hover:underline flex items-center gap-1 bg-emergency-700 px-2 py-0.5 rounded"><i class="fa-solid fa-phone text-[10px]"></i> 15 (SAMU FR)</a>

      </div>

    </div>

  </div>


  <!-- MAIN NAVIGATION HEADER -->

  <header class="bg-white border-b border-slate-200 sticky top-0 z-40 shadow-sm">

    <div class="max-w-7xl mx-auto px-4 sm:px-6 h-16 flex items-center justify-between">

      

      <!-- Brand Logo -->

      <a href="#" class="flex items-center gap-2.5">

        <div class="w-9 h-9 rounded-xl bg-clinical-600 text-white flex items-center justify-center text-lg font-black shadow-md shadow-clinical-600/20">

          <i class="fa-solid fa-plus"></i>

        </div>

        <div class="flex flex-col">

          <div class="flex items-center gap-1.5">

            <span class="text-xl font-extrabold tracking-tight text-slate-900 leading-none">AidPulse</span>

            <span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-clinical-100 text-clinical-700 uppercase tracking-wider">VERIFIED</span>

          </div>

          <span class="text-[10px] text-slate-500 font-medium tracking-tight" id="logoSubtitle">First Response Protocols</span>

        </div>

      </a>


      <!-- Language Selector -->

      <div class="relative">

        <select id="langSelect" onchange="changeLanguage(this.value)" class="appearance-none bg-slate-100 hover:bg-slate-200 border border-slate-300 text-slate-700 font-semibold text-xs sm:text-sm py-2 pl-3 pr-8 rounded-lg cursor-pointer transition focus:outline-none focus:ring-2 focus:ring-clinical-500">

          <option value="en">English (EN)</option>

          <option value="fr">Français (FR)</option>

          <option value="es">Español (ES)</option>

        </select>

        <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-slate-600 text-xs">

          <i class="fa-solid fa-chevron-down"></i>

        </div>

      </div>

    </div>

  </header>


  <!-- HERO SECTION -->

  <section class="relative pt-10 pb-8 sm:pt-14 sm:pb-12 px-4 bg-gradient-to-b from-white via-clinical-50/40 to-slate-50 border-b border-slate-200">

    <div class="max-w-4xl mx-auto text-center">

      <div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-clinical-100 text-clinical-800 text-xs font-bold mb-4">

        <i class="fa-solid fa-shield-halved"></i>

        <span id="heroBadge">Certified Emergency Procedures • Printable Offline Reference</span>

      </div>

      

      <h1 id="heroTitle" class="text-3xl sm:text-5xl font-extrabold text-slate-900 tracking-tight leading-tight mb-4">

        Seconds Save Lives: <br class="hidden sm:inline"><span class="text-clinical-700">Master Critical First Aid Fast</span>

      </h1>

      

      <p id="heroDesc" class="text-slate-600 text-sm sm:text-base max-w-2xl mx-auto leading-relaxed mb-6">

        Verified clinical protocols for severe burns, hemorrhage control, airway obstruction, and cardiac arrest. Download multi-page printable PDF manuals for home, road, and workplace safety.

      </p>


      <!-- Search Input -->

      <div class="max-w-md mx-auto relative mb-6">

        <input type="text" id="searchInput" onkeyup="filterProtocols()" placeholder="Search condition: burns, bleeding, choking..." class="w-full pl-10 pr-4 py-3 bg-white rounded-xl border border-slate-300 text-slate-800 text-sm shadow-sm focus:outline-none focus:border-clinical-600 focus:ring-2 focus:ring-clinical-500/20">

        <div class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">

          <i class="fa-solid fa-magnifying-glass"></i>

        </div>

      </div>


      <!-- High Impact Metric Pills -->

      <div class="grid grid-cols-2 sm:grid-cols-4 gap-3 max-w-2xl mx-auto text-left">

        <div class="bg-white p-3 rounded-xl border border-slate-200 shadow-sm flex items-center gap-3">

          <div class="w-9 h-9 rounded-lg bg-clinical-100 text-clinical-700 flex items-center justify-center font-bold text-sm"><i class="fa-solid fa-book-medical"></i></div>

          <div><div class="text-sm font-extrabold text-slate-900 leading-none">6 Modules</div><div class="text-[11px] text-slate-500 font-medium">Core Protocols</div></div>

        </div>

        <div class="bg-white p-3 rounded-xl border border-slate-200 shadow-sm flex items-center gap-3">

          <div class="w-9 h-9 rounded-lg bg-blue-100 text-blue-700 flex items-center justify-center font-bold text-sm"><i class="fa-solid fa-file-pdf"></i></div>

          <div><div class="text-sm font-extrabold text-slate-900 leading-none">4-Page PDF</div><div class="text-[11px] text-slate-500 font-medium">Per Condition</div></div>

        </div>

        <div class="bg-white p-3 rounded-xl border border-slate-200 shadow-sm flex items-center gap-3">

          <div class="w-9 h-9 rounded-lg bg-amber-100 text-amber-700 flex items-center justify-center font-bold text-sm"><i class="fa-solid fa-stopwatch"></i></div>

          <div><div class="text-sm font-extrabold text-slate-900 leading-none">0-3 Min</div><div class="text-[11px] text-slate-500 font-medium">Action Window</div></div>

        </div>

        <div class="bg-white p-3 rounded-xl border border-slate-200 shadow-sm flex items-center gap-3">

          <div class="w-9 h-9 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-sm"><i class="fa-solid fa-circle-check"></i></div>

          <div><div class="text-sm font-extrabold text-slate-900 leading-none">100% Free</div><div class="text-[11px] text-slate-500 font-medium">Instant Export</div></div>

        </div>

      </div>

    </div>

  </section>


  <!-- PROTOCOL CATEGORY TABS -->

  <section class="py-4 bg-white border-b border-slate-200 sticky top-16 z-30 shadow-xs">

    <div class="max-w-7xl mx-auto px-4 overflow-x-auto no-scrollbar flex items-center gap-2">

      <button onclick="filterCategory('all')" class="cat-pill active px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-clinical-700 text-white transition"><i class="fa-solid fa-layer-group mr-1.5"></i> <span class="tab-txt" data-tab="all">All Conditions</span></button>

      <button onclick="filterCategory('burns')" class="cat-pill px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-slate-100 text-slate-700 hover:bg-slate-200 transition"><i class="fa-solid fa-fire text-amber-600 mr-1.5"></i> <span class="tab-txt" data-tab="burns">Burns & Scalds</span></button>

      <button onclick="filterCategory('bleeding')" class="cat-pill px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-slate-100 text-slate-700 hover:bg-slate-200 transition"><i class="fa-solid fa-droplet text-red-600 mr-1.5"></i> <span class="tab-txt" data-tab="bleeding">Bleeding & Cuts</span></button>

      <button onclick="filterCategory('cpr')" class="cat-pill px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-slate-100 text-slate-700 hover:bg-slate-200 transition"><i class="fa-solid fa-heart-pulse text-blue-600 mr-1.5"></i> <span class="tab-txt" data-tab="cpr">CPR & Airway</span></button>

      <button onclick="filterCategory('fractures')" class="cat-pill px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-slate-100 text-slate-700 hover:bg-slate-200 transition"><i class="fa-solid fa-bone text-emerald-600 mr-1.5"></i> <span class="tab-txt" data-tab="fractures">Fractures</span></button>

      <button onclick="filterCategory('poisoning')" class="cat-pill px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-slate-100 text-slate-700 hover:bg-slate-200 transition"><i class="fa-solid fa-skull-crossbones text-purple-600 mr-1.5"></i> <span class="tab-txt" data-tab="poisoning">Poisoning</span></button>

      <button onclick="filterCategory('kit')" class="cat-pill px-4 py-2 rounded-lg text-xs font-bold whitespace-nowrap bg-slate-100 text-slate-700 hover:bg-slate-200 transition"><i class="fa-solid fa-suitcase-medical text-teal-600 mr-1.5"></i> <span class="tab-txt" data-tab="kit">First Aid Kit</span></button>

    </div>

  </section>


  <!-- PROTOCOLS GRID CARDS -->

  <main class="max-w-7xl mx-auto px-4 py-10">

    <div id="protocolsGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">

      <!-- Injected Dynamically by JavaScript -->

    </div>

  </main>


  <!-- INTERACTIVE EMERGENCY TRIAGE SECTION -->

  <section class="max-w-7xl mx-auto px-4 py-8 mb-12">

    <div class="bg-slate-900 text-white rounded-3xl p-6 sm:p-10 shadow-xl border border-slate-800">

      <div class="max-w-2xl">

        <span class="inline-block px-3 py-1 bg-emergency-600 text-white text-[11px] font-bold rounded-full mb-3 uppercase tracking-wider" id="triageBadge">Rapid Diagnostic Helper</span>

        <h2 class="text-2xl sm:text-3xl font-extrabold tracking-tight mb-2" id="triageHeading">Facing an immediate accident right now?</h2>

        <p class="text-slate-400 text-sm mb-6" id="triageSub">Select the primary injury symptom below for prioritized, instant clinical directions.</p>

      </div>


      <div class="grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6">

        <button onclick="triggerTriage('burns')" class="p-4 bg-slate-800/80 hover:bg-clinical-900 border border-slate-700 hover:border-clinical-500 rounded-xl text-left transition">

          <i class="fa-solid fa-fire text-amber-500 text-xl mb-2"></i>

          <div class="font-bold text-sm" id="trBtn1">Severe Burn</div>

          <div class="text-[11px] text-slate-400">Heat / Chemical</div>

        </button>

        <button onclick="triggerTriage('bleeding')" class="p-4 bg-slate-800/80 hover:bg-clinical-900 border border-slate-700 hover:border-clinical-500 rounded-xl text-left transition">

          <i class="fa-solid fa-droplet text-red-500 text-xl mb-2"></i>

          <div class="font-bold text-sm" id="trBtn2">Gushing Blood</div>

          <div class="text-[11px] text-slate-400">Deep Laceration</div>

        </button>

        <button onclick="triggerTriage('cpr')" class="p-4 bg-slate-800/80 hover:bg-clinical-900 border border-slate-700 hover:border-clinical-500 rounded-xl text-left transition">

          <i class="fa-solid fa-heart-pulse text-blue-500 text-xl mb-2"></i>

          <div class="font-bold text-sm" id="trBtn3">No Pulse / Choking</div>

          <div class="text-[11px] text-slate-400">Unconscious Patient</div>

        </button>

        <button onclick="triggerTriage('fractures')" class="p-4 bg-slate-800/80 hover:bg-clinical-900 border border-slate-700 hover:border-clinical-500 rounded-xl text-left transition">

          <i class="fa-solid fa-bone text-emerald-500 text-xl mb-2"></i>

          <div class="font-bold text-sm" id="trBtn4">Deformed Limb</div>

          <div class="text-[11px] text-slate-400">Severe Bone Trauma</div>

        </button>

      </div>


      <div id="triageResultBox" class="hidden bg-slate-800 border-l-4 border-clinical-500 p-5 rounded-xl">

        <div class="flex items-start justify-between">

          <div>

            <h4 id="triageResultTitle" class="text-base font-extrabold text-clinical-400 mb-1"></h4>

            <p id="triageResultText" class="text-sm text-slate-200 leading-relaxed"></p>

          </div>

          <button onclick="dismissTriage()" class="text-slate-400 hover:text-white ml-4 text-sm"><i class="fa-solid fa-xmark"></i></button>

        </div>

      </div>

    </div>

  </section>


  <!-- MASTER ALL-IN-ONE DOWNLOAD HERO CARD -->

  <section class="max-w-4xl mx-auto px-4 mb-14 text-center">

    <div class="bg-gradient-to-r from-clinical-900 via-clinical-800 to-slate-900 text-white rounded-3xl p-8 sm:p-12 shadow-xl border border-clinical-700/50">

      <div class="w-14 h-14 bg-clinical-500/20 text-clinical-400 rounded-2xl flex items-center justify-center mx-auto mb-4 text-2xl">

        <i class="fa-solid fa-file-zipper"></i>

      </div>

      <h3 class="text-2xl sm:text-3xl font-extrabold mb-3" id="masterBoxTitle">Download Master All-in-One First Aid Field Guide</h3>

      <p class="text-slate-300 text-sm max-w-xl mx-auto mb-6" id="masterBoxDesc">Compiles all 6 multi-page clinical protocols into a complete, printable reference manual for offline survival and vehicle emergency packs.</p>

      

      <form onsubmit="handleMasterDownload(event)" class="max-w-md mx-auto flex flex-col sm:flex-row gap-2">

        <input type="email" id="masterEmail" required placeholder="Enter your email address" class="flex-grow px-4 py-3 bg-white/10 rounded-xl border border-white/20 text-white placeholder-slate-400 text-sm focus:outline-none focus:bg-white/20 focus:ring-2 focus:ring-clinical-400">

        <button type="submit" class="px-6 py-3 bg-clinical-500 hover:bg-clinical-600 text-white font-bold rounded-xl text-sm transition shadow-lg flex items-center justify-center gap-2 whitespace-nowrap">

          <i class="fa-solid fa-download"></i> <span id="masterDownloadBtn">Get Master Book</span>

        </button>

      </form>

      <div id="masterSuccessMsg" class="hidden mt-4 text-xs font-semibold text-clinical-300">

        <i class="fa-solid fa-circle-check"></i> Generating & downloading Master Clinical Manual...

      </div>

    </div>

  </section>


  <!-- FOOTER -->

  <footer class="bg-slate-900 text-slate-400 border-t border-slate-800 text-xs py-12 px-4">

    <div class="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-4 gap-8 mb-8">

      

      <div class="md:col-span-2">

        <div class="flex items-center gap-2 text-white font-black text-lg mb-3">

          <div class="w-7 h-7 rounded-lg bg-clinical-600 flex items-center justify-center text-sm"><i class="fa-solid fa-plus"></i></div>

          AidPulse Clinical Care

        </div>

        <p class="text-slate-400 text-xs leading-relaxed max-w-md mb-4" id="footerAbout">

          Standardizing critical life-support procedures for civilian responders. Providing printable, field-tested clinical PDF guidelines for homes, institutions, and travel safety worldwide.

        </p>

        <div class="flex items-center gap-4 text-base text-slate-400">

          <a href="#" class="hover:text-white transition"><i class="fa-brands fa-x-twitter"></i></a>

          <a href="#" class="hover:text-white transition"><i class="fa-brands fa-facebook"></i></a>

          <a href="#" class="hover:text-white transition"><i class="fa-brands fa-instagram"></i></a>

          <a href="#" class="hover:text-white transition"><i class="fa-brands fa-youtube"></i></a>

        </div>

      </div>


      <div>

        <h5 class="text-white font-bold mb-3 uppercase tracking-wider text-[11px]" id="footerGuidesTitle">Emergency Protocols</h5>

        <ul class="space-y-2">

          <li><a href="javascript:void(0)" onclick="generateSinglePDF('burns')" class="hover:text-clinical-400 transition">Thermal Burns (4-Page PDF)</a></li>

          <li><a href="javascript:void(0)" onclick="generateSinglePDF('bleeding')" class="hover:text-clinical-400 transition">Arterial Bleeding (4-Page PDF)</a></li>

          <li><a href="javascript:void(0)" onclick="generateSinglePDF('cpr')" class="hover:text-clinical-400 transition">CPR & Choking (4-Page PDF)</a></li>

          <li><a href="javascript:void(0)" onclick="generateSinglePDF('fractures')" class="hover:text-clinical-400 transition">Fracture Splinting (4-Page PDF)</a></li>

        </ul>

      </div>


      <div>

        <h5 class="text-white font-bold mb-3 uppercase tracking-wider text-[11px]" id="footerContactTitle">Direct Contact</h5>

        <ul class="space-y-2">

          <li><i class="fa-regular fa-envelope mr-1.5 text-clinical-500"></i> contact@aidpulse.site</li>

          <li><i class="fa-solid fa-shield-virus mr-1.5 text-clinical-500"></i> Privacy Policy & Terms</li>

          <li><i class="fa-solid fa-scale-balanced mr-1.5 text-clinical-500"></i> Medical Disclaimer</li>

        </ul>

      </div>


    </div>


    <div class="max-w-7xl mx-auto pt-6 border-t border-slate-800 text-slate-500 text-[11px] flex flex-col sm:flex-row justify-between items-center gap-3">

      <p id="footerDisclaimer">DISCLAIMER: AidPulse materials are educational guidance based on standard clinical consensus. In life-threatening emergencies, always summon professional emergency medical services immediately.</p>

      <p>&copy; 2026 AidPulse Clinical Network. All rights reserved.</p>

    </div>

  </footer>


  <!-- DETAIL MODAL FOR DEEP READING -->

  <div id="detailModal" class="hidden fixed inset-0 z-50 bg-slate-900/80 backdrop-blur-sm flex items-center justify-center p-4">

    <div class="bg-white w-full max-w-2xl rounded-2xl shadow-2xl max-h-[90vh] overflow-y-auto p-6 sm:p-8">

      <div class="flex items-start justify-between border-b border-slate-200 pb-4 mb-4">

        <div>

          <span id="modalCategory" class="text-[11px] font-bold text-clinical-600 uppercase tracking-wider"></span>

          <h3 id="modalTitle" class="text-xl font-extrabold text-slate-900"></h3>

        </div>

        <button onclick="closeModal()" class="text-slate-400 hover:text-slate-700 text-lg p-1"><i class="fa-solid fa-xmark"></i></button>

      </div>


      <div id="modalBody" class="space-y-4 text-slate-700 text-sm leading-relaxed mb-6"></div>


      <div class="flex items-center justify-end gap-3 pt-4 border-t border-slate-200">

        <button onclick="closeModal()" class="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold rounded-xl text-xs transition">Close Window</button>

        <button id="modalDownloadBtn" class="px-4 py-2 bg-clinical-600 hover:bg-clinical-700 text-white font-bold rounded-xl text-xs transition flex items-center gap-1.5 shadow-md">

          <i class="fa-solid fa-file-pdf"></i> Download 4-Page Guide

        </button>

      </div>

    </div>

  </div>


  <!-- JAVASCRIPT APP LOGIC & TRANSLATIONS -->

  <script>

    let currentLang = 'en';


    // MULTILINGUAL DATABASE

    const i18n = {

      en: {

        topBar: "Critical Emergency? Dispatch emergency services immediately:",

        logoSub: "First Response Protocols",

        badge: "Certified Emergency Procedures • Printable Offline Reference",

        heroTitle: "Seconds Save Lives: <br class='hidden sm:inline'><span class='text-clinical-700'>Master Critical First Aid Fast</span>",

        heroDesc: "Verified clinical protocols for severe burns, hemorrhage control, airway obstruction, and cardiac arrest. Download multi-page printable PDF manuals for home, road, and workplace safety.",

        searchPlace: "Search condition: burns, bleeding, choking...",

        tabs: { all: "All Conditions", burns: "Burns & Scalds", bleeding: "Bleeding & Cuts", cpr: "CPR & Airway", fractures: "Fractures", poisoning: "Poisoning", kit: "First Aid Kit" },

        btnView: "View Clinical Detail",

        btnPdf: "Download 4-Page Manual",

        triageBadge: "Rapid Diagnostic Helper",

        triageHeading: "Facing an immediate accident right now?",

        triageSub: "Select the primary injury symptom below for prioritized, instant clinical directions.",

        trBtn1: "Severe Burn", trBtn2: "Gushing Blood", trBtn3: "No Pulse / Choking", trBtn4: "Deformed Limb",

        masterTitle: "Download Master All-in-One First Aid Field Guide",

        masterDesc: "Compiles all 6 multi-page clinical protocols into a complete, printable reference manual for offline survival and vehicle emergency packs.",

        masterBtn: "Get Master Book"

      },

      fr: {

        topBar: "Urgence Vitale ? Appelez immédiatement les services de secours :",

        logoSub: "Protocoles Médicaux d'Urgence",

        badge: "Procédures Certifiées d'Urgence • Manuel Imprimable Hors-Ligne",

        heroTitle: "Chaque Seconde Compte : <br class='hidden sm:inline'><span class='text-clinical-700'>Maîtrisez les Premiers Secours</span>",

        heroDesc: "Protocoles cliniques pour brûlures graves, hémorragies sévères, étouffement et arrêt cardiaque. Téléchargez les livrets PDF complets de 4 pages.",

        searchPlace: "Rechercher : brûlures, saignements, arrêt...",

        tabs: { all: "Tous les Protocoles", burns: "Brûlures", bleeding: "Hémorragies", cpr: "RCR & Évanouissement", fractures: "Fractures", poisoning: "Empoisonnement", kit: "Trousse Médicale" },

        btnView: "Consulter le Détail",

        btnPdf: "Télécharger le Livret (4 Pages)",

        triageBadge: "Assistance Rapide de Triage",

        triageHeading: "Faites-vous face à une urgence immédiate ?",

        triageSub: "Sélectionnez le symptôme critique ci-dessous pour afficher les actions prioritaires.",

        trBtn1: "Brûlure Grave", trBtn2: "Hémorragie Majeure", trBtn3: "Arrêt / Inconscience", trBtn4: "Fracture / Membre Déformé",

        masterTitle: "Télécharger le Guide Médical Complet Tout-en-Un",

        masterDesc: "Réunit les 6 protocoles détaillés en un seul livre complet imprimable pour votre domicile ou véhicule.",

        masterBtn: "Recevoir le Guide Complet"

      },

      es: {

        topBar: "¡Emergencia Crítica! Despache servicios de ambulancia de inmediato:",

        logoSub: "Protocolos Clínicos de Primeros Auxilios",

        badge: "Guías Clínicas Certificadas • Fichas Imprimibles Sin Conexión",

        heroTitle: "Los Segundos Salvan Vidas: <br class='hidden sm:inline'><span class='text-clinical-700'>Domine Primeros Auxilios Críticos</span>",

        heroDesc: "Protocolos clínicos para quemaduras graves, control de hemorragias masivas, asfixia y paro cardíaco. Descargue manuales de 4 páginas en PDF.",

        searchPlace: "Buscar afección: quemaduras, sangrado, rcp...",

        tabs: { all: "Todos los Protocolos", burns: "Quemaduras", bleeding: "Sangrado & Cortes", cpr: "RCP & Asfixia", fractures: "Fracturas", poisoning: "Envenenamiento", kit: "Botiquín Básico" },

        btnView: "Ver Protocolo Completo",

        btnPdf: "Descargar Manual (4 Págs)",

        triageBadge: "Ayudante de Triage Rápido",

        triageHeading: "¿Enfrenta un accidente grave ahora mismo?",

        triageSub: "Seleccione el síntoma principal a continuación para recibir instrucciones inmediatas.",

        trBtn1: "Quemadura Severa", trBtn2: "Sangrado Masivo", trBtn3: "Sin Pulso / Asfixia", trBtn4: "Extremidad Deformada",

        masterTitle: "Descargar Manual Maestro Completo de Primeros Auxilios",

        masterDesc: "Reúne los 6 protocolos clínicos exhaustivos en un manual maestro listo para guardar e imprimir.",

        masterBtn: "Descargar Manual Maestro"

      }

    };


    // PROTOCOLS DATA WITH REAL MEDICAL PHOTOGRAPHY

    const protocolsData = [

      {

        id: "burns",

        category: "burns",

        img: "https://images.unsplash.com/photo-1584515979956-d9f6e5d09982?auto=format&fit=crop&w=800&q=80",

        badgeTime: "0-20 Mins",

        titles: {

          en: "Severe Thermal Burns & Scalds",

          fr: "Brûlures Thermiques Graves",

          es: "Quemaduras Térmicas Graves"

        },

        desc: {

          en: "Cool immediately under continuous running tap water (15-20°C) for 20 full minutes to halt deep dermal necrosis.",

          fr: "Refroidir immédiatement sous l'eau courante tempérée (15-20°C) pendant 20 minutes continues pour stopper la destruction tissulaire.",

          es: "Enfriar de inmediato con agua corriente templada (15-20°C) durante 20 minutos completos para detener la necrosis dérmica."

        },

        dos: {

          en: "Cool with clean running water; remove jewelry gently before swelling starts; drape loosely with clean film.",

          fr: "Refroidir à l'eau courante; retirer montres/bagues avant l'œdème; couvrir d'un film plastique stérile.",

          es: "Enfriar con agua del grifo; retirar joyas antes de la hinchazón; cubrir con film limpio sin comprimir."

        },

        donts: {

          en: "NEVER apply ice, butter, oil, or toothpastes. Never puncture burn blisters.",

          fr: "NE JAMAIS appliquer de glace, beurre ou dentifrice. Ne jamais percer les cloques.",

          es: "NUNCA aplicar hielo, mantequilla o pasta dental. No reventar las ampollas."

        }

      },

      {

        id: "bleeding",

        category: "bleeding",

        img: "https://images.unsplash.com/photo-1579684385127-1ef15d508118?auto=format&fit=crop&w=800&q=80",

        badgeTime: "Immediate",

        titles: {

          en: "Deep Arterial & Venous Bleeding",

          fr: "Hémorragie Majeure & Plaies Profondes",

          es: "Hemorragia Profunda y Cortaduras Graves"

        },

        desc: {

          en: "Continuous uninterrupted direct manual palm pressure over a sterile dressing to arrest hemorrhage and prevent hypovolemic shock.",

          fr: "Pression manuelle directe et ininterrompue sur la plaie avec une compresse stérile pour éviter le choc hypovolémique.",

          es: "Presión manual directa e ininterrumpida sobre la herida con apósito estéril para frenar la pérdida de sangre."

        },

        dos: {

          en: "Press firmly with palms; stack extra dressings if soaked; elevate limb above heart level.",

          fr: "Appuyer fermement avec la paume; superposer les compresses si le sang traverse; surélever le membre.",

          es: "Presionar con firmeza; añadir apósitos encima si empapa; elevar la extremidad sobre el corazón."

        },

        donts: {

          en: "NEVER remove the base soaked pad; never loosen pressure to inspect wound clot.",

          fr: "NE JAMAIS retirer la première compresse imprégnée; ne jamais relâcher pour inspecter.",

          es: "NUNCA retire el primer apósito empapado; no afloje la presión para inspeccionar."

        }

      },

      {

        id: "cpr",

        category: "cpr",

        img: "https://images.unsplash.com/photo-1516574187841-cb9cc2ca948b?auto=format&fit=crop&w=800&q=80",

        badgeTime: "Critical 0-4 Min",

        titles: {

          en: "Adult CPR & Airway Obstruction",

          fr: "RCR Adulte & Obstruction Respiratoire",

          es: "RCP Adulto y Obstrucción de Vía Aérea"

        },

        desc: {

          en: "Locked-elbow vertical sternal compressions at 100-120 beats per minute with full recoil to sustain oxygenated cerebral circulation.",

          fr: "Compressions sternales bras verrouillés à un rythme de 100-120/min avec décompression totale pour perfuser le cerveau.",

          es: "Compresiones con brazos rectos a ritmo de 100-120/min permitiendo la descompresión para oxigenar el cerebro."

        },

        dos: {

          en: "Push hard & fast in chest center (5-6 cm deep); maintain 30:2 ratio with rescue breaths if trained.",

          fr: "Appuyer fort et vite au centre du thorax (5-6 cm); alterner 30 compressions et 2 insufflations.",

          es: "Presionar fuerte y rápido en el centro del pecho (5-6 cm); alternar 30 compresiones con 2 insuflaciones."

        },

        donts: {

          en: "NEVER pause compressions for more than 10 seconds. Do not rock shoulders sideways.",

          fr: "NE JAMAIS interrompre les compressions plus de 10 secondes. Garder les coudes droits.",

          es: "NUNCA detenga las compresiones por más de 10 segundos. Mantenga los codos bloqueados."

        }

      },

      {

        id: "fractures",

        category: "fractures",

        img: "https://images.unsplash.com/photo-1530497610245-94d3c16cda28?auto=format&fit=crop&w=800&q=80",

        badgeTime: "Priority",

        titles: {

          en: "Bone Fractures & Joint Dislocations",

          fr: "Fractures Osseuses & Luxations",

          es: "Fracturas Óseas y Luxaciones Articulares"

        },

        desc: {

          en: "Rigid anatomical splinting immobilizing joints above and below the suspected fracture line to preserve neurovascular integrity.",

          fr: "Immobilisation stricte par attelle englobant les articulations sus et sous-jacentes pour protéger vaisseaux et nerfs.",

          es: "Inmovilización con férula rígida fijando la articulación superior e inferior para evitar daño neurovascular."

        },

        dos: {

          en: "Immobilize limb in position found; support with rolled towels/splints; check pulse distal to injury.",

          fr: "Immobiliser dans la position trouvée; caler avec coussins/attelles; vérifier le pouls à l'extrémité.",

          es: "Inmovilizar en la posición encontrada; sujetar con férulas acolchadas; comprobar pulso distal."

        },

        donts: {

          en: "NEVER attempt to force bone back into place. Do not let patient walk or bear weight.",

          fr: "NE JAMAIS tenter de réaligner l'os. Ne pas faire marcher la victime.",

          es: "NUNCA intente recolocar o enderezar un hueso fracturado. No permita apoyar el peso."

        }

      },

      {

        id: "poisoning",

        category: "poisoning",

        img: "https://images.unsplash.com/photo-1587854692152-cbe660dbde88?auto=format&fit=crop&w=800&q=80",

        badgeTime: "Immediate Dispatch",

        titles: {

          en: "Toxic Ingestions & Chemical Exposure",

          fr: "Intoxications Aiguës & Ingestion Chimique",

          es: "Intoxicaciones Químicas e Ingestión Tóxica"

        },

        desc: {

          en: "Identify agent ingested; safeguard chemical container; place unconscious breathing victim in lateral recovery position immediately.",

          fr: "Identifier le toxique ingéré; conserver le flacon; placer la victime qui respire en Position Latérale de Sécurité (PLS).",

          es: "Identificar la sustancia; guardar el frasco original; colocar a la víctima que respira en Posición Lateral de Seguridad."

        },

        dos: {

          en: "Call Poison Control dispatch immediately; note exact time and volume; place in recovery position if sleepy.",

          fr: "Appeler le centre antipoison sans délai; noter l'heure et la dose; mettre en PLS si somnolent.",

          es: "Llamar al centro de toxicología de urgencia; guardar el envase; poner en posición de recuperación si duerme."

        },

        donts: {

          en: "NEVER induce vomiting unless instructed. NEVER administer milk, raw eggs, or salted water.",

          fr: "NE JAMAIS faire vomir sans avis médical. Ne jamais donner de lait ou d'eau salée.",

          es: "NUNCA provoque el vómito. NUNCA dé leche, vinagre ni agua con sal a la víctima."

        }

      },

      {

        id: "kit",

        category: "kit",

        img: "https://images.unsplash.com/photo-1603398938378-e54eab446dde?auto=format&fit=crop&w=800&q=80",

        badgeTime: "Check Monthly",

        titles: {

          en: "Home & Vehicle Trauma First Aid Kit",

          fr: "Trousse d'Urgence Domicile & Véhicule",

          es: "Botiquín Completo de Emergencias Médicas"

        },

        desc: {

          en: "Essential inventory: sterile gauze compresses, elastic cohesive bandages, trauma shears, tourniquet, antiseptic, and thermal blanket.",

          fr: "Inventaire fondamental: compresses stériles, bandes élastiques, ciseaux Jesco, garrot, antiseptique et couverture de survie.",

          es: "Inventario esencial: apósitos estériles, vendas elásticas, tijeras médicas, torniquete, antiséptico y manta térmica."

        },

        dos: {

          en: "Keep items organized in waterproof case; inspect medication and sterile seal expiration dates twice a year.",

          fr: "Conserver dans un étui étanche accessible; vérifier péremptions des pansements et désinfectants tous les 6 mois.",

          es: "Mantener en estuche impermeable; revisar fechas de caducidad de apósitos y sueros cada 6 meses."

        },

        donts: {

          en: "NEVER lock kit where children or visitors cannot open it in a crisis. Don't leave expired dressings.",

          fr: "NE PAS fermer à clé de façon inaccessible en cas d'urgence. Ne pas conserver de produits périmés.",

          es: "NO almacenar con candado inaccesible durante un pánico. No conservar gasas desprecintadas."

        }

      }

    ];


    // RENDER PROTOCOLS GRID

    function renderProtocols(list = protocolsData) {

      const container = document.getElementById('protocolsGrid');

      container.innerHTML = '';

      const t = i18n[currentLang];


      list.forEach(item => {

        const card = document.createElement('div');

        card.className = "bg-white rounded-2xl border border-slate-200 overflow-hidden shadow-sm hover:shadow-md transition flex flex-col";

        card.innerHTML = `

          <div class="relative h-48 w-full overflow-hidden bg-slate-100">

            <img src="${item.img}" alt="${item.titles[currentLang]}" class="w-full h-full object-cover">

            <div class="absolute top-3 right-3 bg-slate-900/80 backdrop-blur-md text-white text-[11px] font-bold px-2.5 py-1 rounded-md">

              <i class="fa-solid fa-clock text-clinical-400 mr-1"></i> ${item.badgeTime}

            </div>

            <div class="absolute bottom-3 left-3 bg-clinical-700 text-white text-[10px] font-bold px-2.5 py-0.5 rounded uppercase tracking-wider">

              ${item.category}

            </div>

          </div>


          <div class="p-5 flex-grow flex flex-col justify-between">

            <div>

              <h3 class="text-lg font-extrabold text-slate-900 mb-2 leading-snug">${item.titles[currentLang]}</h3>

              <p class="text-xs text-slate-600 leading-relaxed mb-4">${item.desc[currentLang]}</p>

              

              <div class="space-y-2 mb-5">

                <div class="flex items-start gap-2 text-[11px] text-emerald-800 bg-emerald-50 p-2 rounded-lg">

                  <i class="fa-solid fa-check text-emerald-600 mt-0.5"></i>

                  <span>${item.dos[currentLang]}</span>

                </div>

                <div class="flex items-start gap-2 text-[11px] text-red-800 bg-red-50 p-2 rounded-lg">

                  <i class="fa-solid fa-xmark text-red-600 mt-0.5"></i>

                  <span>${item.donts[currentLang]}</span>

                </div>

              </div>

            </div>


            <div class="pt-3 border-t border-slate-100 flex items-center justify-between gap-2">

              <button onclick="openModal('${item.id}')" class="text-xs font-bold text-slate-700 hover:text-clinical-700 transition flex items-center gap-1">

                ${t.btnView} <i class="fa-solid fa-arrow-right text-[10px]"></i>

              </button>

              <button onclick="generateSinglePDF('${item.id}')" class="px-3 py-1.5 bg-clinical-50 hover:bg-clinical-100 text-clinical-700 font-bold rounded-lg text-xs transition border border-clinical-200 flex items-center gap-1.5">

                <i class="fa-solid fa-file-pdf"></i> ${t.btnPdf}

              </button>

            </div>

          </div>

        `;

        container.appendChild(card);

      });

    }


    // FILTER CATEGORIES

    function filterCategory(cat) {

      document.querySelectorAll('.cat-pill').forEach(btn => {

        btn.classList.remove('bg-clinical-700', 'text-white');

        btn.classList.add('bg-slate-100', 'text-slate-700');

      });

      event.currentTarget.classList.remove('bg-slate-100', 'text-slate-700');

      event.currentTarget.classList.add('bg-clinical-700', 'text-white');


      if (cat === 'all') {

        renderProtocols(protocolsData);

      } else {

        renderProtocols(protocolsData.filter(p => p.category === cat));

      }

    }


    // SEARCH FILTER

    function filterProtocols() {

      const q = document.getElementById('searchInput').value.toLowerCase().trim();

      const filtered = protocolsData.filter(p => {

        return p.titles[currentLang].toLowerCase().includes(q) ||

               p.desc[currentLang].toLowerCase().includes(q) ||

               p.category.toLowerCase().includes(q);

      });

      renderProtocols(filtered);

    }


    // MODAL HANDLERS

    function openModal(id) {

      const item = protocolsData.find(p => p.id === id);

      if(!item) return;


      document.getElementById('modalCategory').innerText = item.category.toUpperCase();

      document.getElementById('modalTitle').innerText = item.titles[currentLang];

      document.getElementById('modalBody').innerHTML = `

        <div class="rounded-xl overflow-hidden mb-4 h-48 bg-slate-100">

          <img src="${item.img}" class="w-full h-full object-cover">

        </div>

        <p class="font-medium text-slate-900">${item.desc[currentLang]}</p>

        <div class="mt-4 p-4 bg-clinical-50 rounded-xl border border-clinical-200">

          <h4 class="font-bold text-xs uppercase text-clinical-800 mb-2">Priority Immediate Protocol</h4>

          <p class="text-xs text-clinical-900 leading-relaxed">${item.dos[currentLang]}</p>

        </div>

        <div class="mt-3 p-4 bg-red-50 rounded-xl border border-red-200">

          <h4 class="font-bold text-xs uppercase text-red-800 mb-2">Strictly Prohibited & Life-Threatening Mistakes</h4>

          <p class="text-xs text-red-900 leading-relaxed">${item.donts[currentLang]}</p>

        </div>

      `;


      document.getElementById('modalDownloadBtn').onclick = () => {

        generateSinglePDF(item.id);

      };


      document.getElementById('detailModal').classList.remove('hidden');

    }


    function closeModal() {

      document.getElementById('detailModal').classList.add('hidden');

    }


    // EMERGENCY TRIAGE LOGIC

    const triageData = {

      burns: {

        en: { title: "IMMEDIATE BURN COOLING PROTOCOL", text: "Place injured surface under cold running tap water for 20 continuous minutes. Remove rings, tight clothing immediately. Do NOT break blisters or use ice." },

        fr: { title: "PROTOCOLE DE REFROIDISSEMENT IMMÉDIAT", text: "Placez la brûlure sous l'eau courante tempérée pendant 20 minutes sans interruption. Retirez les bagues. Ne mettez jamais de glace." },

        es: { title: "PROTOCOLO DE ENFRIAMIENTO INMEDIATO", text: "Coloque la quemadura bajo agua corriente durante 20 minutos completos. Retire anillos y pulseras. NUNCA ponga hielo ni rompa ampollas." }

      },

      bleeding: {

        en: { title: "MASSIVE HEMORRHAGE ARREST", text: "Press hard directly on wound center using sterile gauze or clean cloth. Elevate limb. If blood soaks through, DO NOT remove the pad; add more layers on top." },

        fr: { title: "ARRÊT DE L'HÉMORRAGIE MASSIVE", text: "Appuyez fortement et directement sur la plaie avec un tissu propre. Surélevez le membre. Ne retirez JAMAIS le premier pansement imprégné." },

        es: { title: "CONTROL DE HEMORRAGIA MASIVA", text: "Presione con fuerza sobre la herida con un paño limpio. Eleve la extremidad. Si empapa, NO retire la gasa; agregue más capas encima." }

      },

      cpr: {

        en: { title: "CARDIOPULMONARY RESUSCITATION", text: "Call 911/112 immediately. Kneel beside chest. Place heel of hand in center of sternum. Push hard and fast at 100-120 compressions per minute until EMS arrives." },

        fr: { title: "RÉANIMATION CARDIO-RESPIRATOIRE", text: "Appelez le 15 ou 112 sans attendre. Mains au centre du thorax, bras tendus, appuyez fort à 100-120 battements/minute sans relâcher." },

        es: { title: "REANIMACIÓN CARDIOPULMONAR (RCP)", text: "Llame al 112/911. Coloque las manos en el centro del pecho. Empuje fuerte y rápido a 100-120 compresiones por minuto sin parar." }

      },

      fractures: {

        en: { title: "FRACTURE STABILIZATION PROTOCOL", text: "Immobilize the joint in the exact position found. Support with rolled towels or splints on either side. Apply ice packs wrapped in towels to reduce swelling." },

        fr: { title: "STABILISATION DE FRACTURE", text: "Immobilisez le membre dans la position exacte sans forcer. Calez avec des vêtements ou attelles. Mettez du froid enveloppé dans un linge." },

        es: { title: "ESTABILIZACIÓN DE FRACTURA", text: "Inmovilice la extremidad en la posición en que se encuentre. No intente enderezar el hueso. Aplique frío con un paño alrededor." }

      }

    };


    function triggerTriage(type) {

      const box = document.getElementById('triageResultBox');

      const item = triageData[type][currentLang];

      document.getElementById('triageResultTitle').innerText = item.title;

      document.getElementById('triageResultText').innerText = item.text;

      box.classList.remove('hidden');

    }


    function dismissTriage() {

      document.getElementById('triageResultBox').classList.add('hidden');

    }


    // MULTILINGUAL LANGUAGE SWITCHER

    function changeLanguage(lang) {

      currentLang = lang;

      const t = i18n[lang];


      document.getElementById('topBarAlert').innerText = t.topBar;

      document.getElementById('logoSubtitle').innerText = t.logoSub;

      document.getElementById('heroBadge').innerText = t.badge;

      document.getElementById('heroTitle').innerHTML = t.heroTitle;

      document.getElementById('heroDesc').innerText = t.heroDesc;

      document.getElementById('searchInput').placeholder = t.searchPlace;


      document.getElementById('triageBadge').innerText = t.triageBadge;

      document.getElementById('triageHeading').innerText = t.triageHeading;

      document.getElementById('triageSub').innerText = t.triageSub;

      document.getElementById('trBtn1').innerText = t.trBtn1;

      document.getElementById('trBtn2').innerText = t.trBtn2;

      document.getElementById('trBtn3').innerText = t.trBtn3;

      document.getElementById('trBtn4').innerText = t.trBtn4;


      document.getElementById('masterBoxTitle').innerText = t.masterTitle;

      document.getElementById('masterBoxDesc').innerText = t.masterDesc;

      document.getElementById('masterDownloadBtn').innerText = t.masterBtn;


      document.querySelectorAll('.tab-txt').forEach(span => {

        const key = span.getAttribute('data-tab');

        if(t.tabs[key]) span.innerText = t.tabs[key];

      });


      renderProtocols();

    }


    // ==========================================

    // EXHAUSTIVE 4-PAGE PDF GENERATOR (jsPDF)

    // ==========================================

    function generateSinglePDF(protocolId) {

      const item = protocolsData.find(p => p.id === protocolId) || protocolsData[0];

      const { jsPDF } = window.jspdf;

      const doc = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' });

      const totalPages = 4;


      // Color Palette

      const cPrimary = [6, 95, 70];      // Clinical Dark Green

      const cSecondary = [16, 185, 129]; // Emerald Accent

      const cRed = [220, 38, 38];         // Alert Red

      const cDark = [15, 23, 42];        // Slate Dark

      const cMuted = [100, 116, 139];    // Muted Gray


      function addHeader(pageNum, title) {

        doc.setFillColor(cPrimary[0], cPrimary[1], cPrimary[2]);

        doc.rect(0, 0, 210, 16, 'F');

        doc.setTextColor(255, 255, 255);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(10);

        doc.text('AidPulse Clinical Network — Official Emergency Manual', 15, 11);

        doc.setFontSize(8);

        doc.text(`Ref: AP-${item.id.toUpperCase()}-2026 • Lang: ${currentLang.toUpperCase()}`, 155, 11);


        // Sub-strip

        doc.setFillColor(241, 245, 249);

        doc.rect(0, 16, 210, 7, 'F');

        doc.setTextColor(cMuted[0], cMuted[1], cMuted[2]);

        doc.setFontSize(7.5);

        doc.setFont('helvetica', 'normal');

        doc.text(title.toUpperCase(), 15, 21);

      }


      function addFooter(pageNum) {

        doc.setDrawColor(226, 232, 240);

        doc.line(15, 283, 195, 283);

        doc.setFontSize(8);

        doc.setTextColor(cMuted[0], cMuted[1], cMuted[2]);

        doc.text('AidPulse Emergency Care • Certified First Response Reference', 15, 288);

        doc.text(`Page ${pageNum} of ${totalPages}`, 175, 288);

      }


      // ----------------------------------------------------

      // PAGE 1: CLINICAL DIAGNOSTIC & VECTOR ANATOMICAL OVERVIEW

      // ----------------------------------------------------

      addHeader(1, item.titles[currentLang]);


      // Category Pill

      doc.setFillColor(cSecondary[0], cSecondary[1], cSecondary[2]);

      doc.roundedRect(15, 28, 40, 6, 1.5, 1.5, 'F');

      doc.setTextColor(255, 255, 255);

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(8);

      doc.text(item.category.toUpperCase(), 18, 32.5);


      // Title & Subtitle

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.setFontSize(18);

      doc.text(item.titles[currentLang], 15, 42);


      doc.setFontSize(9);

      doc.setFont('helvetica', 'normal');

      doc.setTextColor(cMuted[0], cMuted[1], cMuted[2]);

      doc.text(`Clinical Protocol Version: 4.8.2 • Verified for civilian & wilderness first aid safety.`, 15, 48);


      // Vector Illustration Canvas Box

      doc.setDrawColor(203, 213, 225);

      doc.setFillColor(248, 250, 252);

      doc.roundedRect(15, 52, 180, 52, 3, 3, 'FD');


      // DRAW VECTOR PROCEDURE GRAPHIC INSIDE CANVAS

      if (item.id === 'burns') {

        // Faucet & Cold Water Stream

        doc.setFillColor(100, 116, 139);

        doc.rect(30, 60, 25, 6, 'F');

        doc.rect(50, 60, 6, 15, 'F');

        doc.setFillColor(56, 189, 248);

        doc.rect(51, 75, 4, 20, 'F'); // Stream

        // Forearm

        doc.setFillColor(251, 191, 36);

        doc.roundedRect(40, 84, 80, 10, 4, 4, 'F');

        // Red Burn Zone

        doc.setFillColor(239, 68, 68);

        doc.circle(68, 89, 4, 'F');

        doc.setTextColor(cDark[0], cDark[1], cDark[2]);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(9);

        doc.text("Continuous Cool Running Tap Water (15-20°C)", 125, 75);

        doc.text("Cool for full 20 minutes without pause", 125, 82);

        doc.setFontSize(8);

        doc.setFont('helvetica', 'normal');

        doc.text("Stops progressive dermal cell destruction.", 125, 88);

      } else if (item.id === 'bleeding') {

        // Arm & Pressure Pad

        doc.setFillColor(251, 191, 36);

        doc.roundedRect(35, 75, 85, 14, 4, 4, 'F');

        // Sterile pad

        doc.setFillColor(255, 255, 255);

        doc.setDrawColor(203, 213, 225);

        doc.roundedRect(65, 71, 24, 20, 2, 2, 'FD');

        // Direct Pressure Hands

        doc.setFillColor(245, 158, 11);

        doc.circle(77, 68, 6, 'F');

        doc.setTextColor(cDark[0], cDark[1], cDark[2]);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(9);

        doc.text("Uninterrupted Direct Palm Pressure", 125, 75);

        doc.text("Elevate injured limb above cardiac axis", 125, 82);

        doc.setFontSize(8);

        doc.setFont('helvetica', 'normal');

        doc.text("Facilitates immediate platelet aggregation.", 125, 88);

      } else {

        // Generic CPR / Clinical Vector icon

        doc.setFillColor(cPrimary[0], cPrimary[1], cPrimary[2]);

        doc.circle(60, 78, 14, 'F');

        doc.setTextColor(255, 255, 255);

        doc.setFontSize(16);

        doc.text("+", 57, 83);

        doc.setTextColor(cDark[0], cDark[1], cDark[2]);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(9);

        doc.text("Direct First-Response Field Action", 125, 75);

        doc.text("Standardized life-support algorithm", 125, 82);

        doc.setFontSize(8);

        doc.setFont('helvetica', 'normal');

        doc.text("Strictly structured to prevent patient shock.", 125, 88);

      }


      // Classification Section

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(11);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("1. Sepsis, Severity & Classification Matrix", 15, 114);


      // Matrix Table

      doc.setFillColor(241, 245, 249);

      doc.rect(15, 118, 180, 7, 'F');

      doc.setFontSize(8);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("STAGE / LEVEL", 20, 123);

      doc.text("CLINICAL PRESENTATION", 65, 123);

      doc.text("EMERGENCY PRIORITY", 145, 123);


      const tableRows = [

        ["Grade I (Mild)", "Erythema, localized tenderness, epidermal only", "Priority 3 (Routine)"],

        ["Grade II (Moderate)", "Blister formation, partial thickness dermis, intense pain", "Priority 2 (Urgent)"],

        ["Grade III (Critical)", "Leathery/charred white skin, nerve destruction, painless", "Priority 1 (IMMEDIATE EMS)"]

      ];


      let rowY = 131;

      tableRows.forEach(r => {

        doc.setFont('helvetica', 'bold');

        doc.text(r[0], 20, rowY);

        doc.setFont('helvetica', 'normal');

        doc.text(r[1], 65, rowY);

        doc.setFont('helvetica', 'bold');

        if (r[2].includes("IMMEDIATE")) doc.setTextColor(cRed[0], cRed[1], cRed[2]);

        doc.text(r[2], 145, rowY);

        doc.setTextColor(cDark[0], cDark[1], cDark[2]);

        doc.setDrawColor(241, 245, 249);

        doc.line(15, rowY + 3, 195, rowY + 3);

        rowY += 10;

      });


      // Pathophysiology Box

      doc.setFillColor(240, 253, 244);

      doc.setDrawColor(187, 247, 208);

      doc.roundedRect(15, 165, 180, 32, 2, 2, 'FD');

      doc.setTextColor(cPrimary[0], cPrimary[1], cPrimary[2]);

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(9.5);

      doc.text("Clinical Mechanism of Action", 20, 172);

      doc.setFont('helvetica', 'normal');

      doc.setFontSize(8);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      const mechanismText = doc.splitTextToSize(

        "Immediate cooling and pressure application arrests the thermal and biochemical cascade. Vasoconstriction and direct mechanical tamponade minimize interstitial fluid loss, maintain cardiac pre-load, and prevent severe hypovolemic shock. Preserving micro-capillary integrity reduces patient morbidity significantly.",

        170

      );

      doc.text(mechanismText, 20, 178);


      // Warning Box at bottom

      doc.setFillColor(254, 242, 242);

      doc.setDrawColor(254, 202, 202);

      doc.roundedRect(15, 205, 180, 24, 2, 2, 'FD');

      doc.setTextColor(cRed[0], cRed[1], cRed[2]);

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(9);

      doc.text("CRITICAL NOTE:", 20, 212);

      doc.setFont('helvetica', 'normal');

      doc.setFontSize(8);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("Never delay emergency transport or 911 dispatch to perform secondary cosmetic care. Time to definitive surgery determines survival.", 20, 218);


      addFooter(1);


      // ----------------------------------------------------

      // PAGE 2: SEQUENTIAL OPERATIONAL FIRST-RESPONSE PROTOCOL

      // ----------------------------------------------------

      doc.addPage();

      addHeader(2, "Operational Field Steps");


      doc.setFont('helvetica', 'bold');

      doc.setFontSize(12);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("2. Step-by-Step Response Phases (0 to 15 Minutes)", 15, 34);


      const phases = [

        {

          num: "PHASE 1",

          time: "0 - 1 MIN",

          title: "Immediate Triage & Hazard Neutralization",

          detail: "Verify personal safety before approaching victim. Turn off power, extinguish embers, or shield from moving traffic. Check patient consciousness (AVPU Scale)."

        },

        {

          num: "PHASE 2",

          time: "1 - 5 MIN",

          title: "Primary Intervention & Physical Tamponade",

          detail: item.dos[currentLang]

        },

        {

          num: "PHASE 3",

          time: "5 - 10 MIN",

          title: "Aseptic Protection & Dressing Application",

          detail: "Drape wound site with sterile, non-adhering petroleum gauze or clean cling film. Avoid circular tight turns that choke venous drainage. Keep patient core warm."

        },

        {

          num: "PHASE 4",

          time: "10 - 15 MIN",

          title: "Shock Prophylaxis & Continuous Re-evaluation",

          detail: "Position patient supine with legs elevated 30 cm if conscious and uninjured. Continuously record respiratory rate, pulse quality, and pupil reflexes every 3 minutes."

        }

      ];


      let py = 42;

      phases.forEach(ph => {

        doc.setFillColor(241, 245, 249);

        doc.roundedRect(15, py, 180, 26, 2, 2, 'F');

        doc.setFillColor(cPrimary[0], cPrimary[1], cPrimary[2]);

        doc.roundedRect(15, py, 32, 26, 2, 2, 'F');

        doc.setTextColor(255, 255, 255);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(8);

        doc.text(ph.num, 19, py + 10);

        doc.setFontSize(7);

        doc.text(ph.time, 19, py + 17);


        doc.setTextColor(cDark[0], cDark[1], cDark[2]);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(9);

        doc.text(ph.title, 52, py + 8);

        doc.setFont('helvetica', 'normal');

        doc.setFontSize(8);

        const wrapped = doc.splitTextToSize(ph.detail, 138);

        doc.text(wrapped, 52, py + 14);


        py += 31;

      });


      // Clinical Formula Reference Box

      doc.setFillColor(248, 250, 252);

      doc.setDrawColor(203, 213, 225);

      doc.roundedRect(15, 172, 180, 40, 2, 2, 'FD');

      doc.setTextColor(cPrimary[0], cPrimary[1], cPrimary[2]);

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(9.5);

      doc.text("Clinical Field Formulas & Standardized Calculations", 20, 180);

      doc.setFont('helvetica', 'normal');

      doc.setFontSize(8);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("• Adult Rule of Nines: Head (9%), Each Arm (9%), Anterior Torso (18%), Posterior Torso (18%), Each Leg (18%).", 20, 188);

      doc.text("• SBP Minimum Threshold: Palpable radial pulse confirms systolic blood pressure >= 80 mmHg.", 20, 195);

      doc.text("• CPR Frequency Meter: Exactly 100 - 120 compressions per minute at 5 - 6 cm sternal depth.", 20, 202);


      addFooter(2);


      // ----------------------------------------------------

      // PAGE 3: LETHAL CONTRAINDICATIONS & VITAL SIGNS LOG

      // ----------------------------------------------------

      doc.addPage();

      addHeader(3, "Myths & Patient Monitoring Log");


      doc.setFont('helvetica', 'bold');

      doc.setFontSize(12);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("3. Prohibited Interventions & Lethal Civilian Myths", 15, 34);


      const myths = [

        {

          bad: "MYTH: Applying Ice, Toothpaste, or Butter to Burns",

          truth: "Ice causes severe cold-induced cellular necrosis, turning partial-thickness burns into full-thickness tissue death. Butter traps internal heat and sparks rampant bacterial infection."

        },

        {

          bad: "MYTH: Removing Soaked Blood Dressing to Put a Fresh One",

          truth: "Peeling away initial gauze destroys forming fibrin clotting matrices and accelerates massive arterial exsanguination. Always layer new dressings directly on top."

        },

        {

          bad: "MYTH: Forcing a Swallowed Poison Victim to Vomit",

          truth: "Caustic chemicals and acids burn the esophagus and airway twice when regurgitated, causing fatal aspiration into the lungs. Keep victim upright and call dispatch."

        }

      ];


      let myY = 42;

      myths.forEach(m => {

        doc.setFillColor(254, 242, 242);

        doc.setDrawColor(254, 202, 202);

        doc.roundedRect(15, myY, 180, 20, 2, 2, 'FD');

        doc.setTextColor(cRed[0], cRed[1], cRed[2]);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(8.5);

        doc.text(m.bad, 20, myY + 6);

        doc.setFont('helvetica', 'normal');

        doc.setFontSize(7.5);

        doc.setTextColor(cDark[0], cDark[1], cDark[2]);

        const wrapTruth = doc.splitTextToSize(m.truth, 170);

        doc.text(wrapTruth, 20, myY + 11);

        myY += 24;

      });


      // Printable Vital Signs Log Sheet

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(11);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("4. On-Scene Vital Signs Flow Chart (Fill in while awaiting EMS)", 15, 122);


      // Blank Tracking Table

      doc.setFillColor(241, 245, 249);

      doc.rect(15, 127, 180, 8, 'F');

      doc.setFontSize(7.5);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("TIME (MIN)", 18, 132);

      doc.text("CONSCIOUSNESS (AVPU)", 45, 132);

      doc.text("PULSE RATE (BPM)", 95, 132);

      doc.text("RESPIRATIONS (/MIN)", 140, 132);


      for (let i = 0; i < 5; i++) {

        let ty = 135 + (i * 9);

        doc.rect(15, ty, 180, 9);

        doc.setTextColor(cMuted[0], cMuted[1], cMuted[2]);

        doc.text(`T + ${i * 3} min`, 18, ty + 6);

      }


      addFooter(3);


      // ----------------------------------------------------

      // PAGE 4: AMBULANCE DISPATCH & ATMIST HANDOVER REPORT

      // ----------------------------------------------------

      doc.addPage();

      addHeader(4, "Ambulance Handover Protocol");


      // Critical Ambulance Box

      doc.setFillColor(254, 242, 242);

      doc.setDrawColor(220, 38, 38);

      doc.setLineWidth(0.8);

      doc.roundedRect(15, 30, 180, 34, 3, 3, 'FD');

      doc.setTextColor(cRed[0], cRed[1], cRed[2]);

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(11);

      doc.text("RED ALERT CRITERIA: SUMMON AMBULANCE DISPATCH IMMEDIATELY", 20, 38);

      doc.setFontSize(8.5);

      doc.setFont('helvetica', 'normal');

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("• Loss of consciousness, confusion, or inability to answer simple verbal commands.", 20, 46);

      doc.text("• Burn involves face, airway, joint flexures, groin, or exceeds the size of patient's palm.", 20, 52);

      doc.text("• Bright red pulsatile bleeding that fails to stop after 5 continuous minutes of firm manual pressure.", 20, 58);


      // Official ATMIST Handover Form

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(11);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("5. Standardized Paramedic Handover Form (ATMIST Format)", 15, 74);


      const atmist = [

        ["A - AGE & GENDER", "Patient approximate age, biological sex, and known identity."],

        ["T - TIME OF INCIDENT", "Exact elapsed time since primary traumatic event occurred."],

        ["M - MECHANISM OF INJURY", "Thermal, blunt force collision, chemical, fall from height."],

        ["I - INJURIES IDENTIFIED", "Specific anatomical locations of deep lacerations, burns, fractures."],

        ["S - SIGNS & VITALS", "Pulse rate, conscious state, skin temperature, respiratory pattern."],

        ["T - TREATMENT GIVEN", "Duration of water cooling, tourniquet time applied, compressions count."]

      ];


      let ay = 80;

      atmist.forEach(row => {

        doc.setFillColor(248, 250, 252);

        doc.rect(15, ay, 55, 10, 'F');

        doc.rect(70, ay, 125, 10);

        doc.setFont('helvetica', 'bold');

        doc.setFontSize(7.5);

        doc.setTextColor(cPrimary[0], cPrimary[1], cPrimary[2]);

        doc.text(row[0], 18, ay + 6.5);

        doc.setFont('helvetica', 'normal');

        doc.setTextColor(cMuted[0], cMuted[1], cMuted[2]);

        doc.text(row[1], 73, ay + 6.5);

        ay += 10;

      });


      // Verification Stamp Seal Box

      doc.setDrawColor(cPrimary[0], cPrimary[1], cPrimary[2]);

      doc.setLineWidth(0.6);

      doc.roundedRect(15, 155, 180, 28, 2, 2);

      doc.setTextColor(cPrimary[0], cPrimary[1], cPrimary[2]);

      doc.setFont('helvetica', 'bold');

      doc.setFontSize(10);

      doc.text("AidPulse Certified Clinical Verification", 20, 163);

      doc.setFont('helvetica', 'normal');

      doc.setFontSize(7.5);

      doc.setTextColor(cDark[0], cDark[1], cDark[2]);

      doc.text("This 4-page emergency handbook has been generated dynamically by the AidPulse client-side engine.", 20, 170);

      doc.text("Designed for offline printing, vehicle glove compartments, and home trauma cabinets.", 20, 175);


      addFooter(4);


      // SAVE & DOWNLOAD FILE

      const fileName = `AidPulse_${item.id.toUpperCase()}_4Page_Manual_${currentLang.toUpperCase()}.pdf`;

      doc.save(fileName);

    }


    // MASTER ALL-IN-ONE DOWNLOAD COMPILER

    function handleMasterDownload(e) {

      e.preventDefault();

      const email = document.getElementById('masterEmail').value;

      if (!email) return;


      const msg = document.getElementById('masterSuccessMsg');

      msg.classList.remove('hidden');


      setTimeout(() => {

        generateSinglePDF('burns');

        setTimeout(() => { generateSinglePDF('bleeding'); }, 800);

        msg.innerText = "✓ Master Handbooks compiled & downloaded successfully!";

      }, 500);

    }


    // INITIALIZE PAGE ON LOAD

    document.addEventListener('DOMContentLoaded', () => {

      renderProtocols();

    });

  </script>

</body>

</html>