{"id":2310,"date":"2026-06-13T18:56:12","date_gmt":"2026-06-13T21:56:12","guid":{"rendered":"https:\/\/ucachamaquinarias.com.ar\/wp\/?page_id=2310"},"modified":"2026-06-13T19:30:00","modified_gmt":"2026-06-13T22:30:00","slug":"catalogo-1-4","status":"publish","type":"page","link":"https:\/\/ucachamaquinarias.com.ar\/wp\/catalogo-1-4\/","title":{"rendered":"Catalogo 1.4"},"content":{"rendered":"\n<meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Cat\u00e1logo de Maquinarias Agr\u00edcolas &#8211; Marcelo Delfino<\/title>\n    <script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\n    <script src=\"https:\/\/unpkg.com\/lucide@latest\"><\/script>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xlsx\/0.18.5\/xlsx.full.min.js\"><\/script>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"><\/script>\n    \n    <style>\n        @media print {\n            @page { margin: 0; } \n            body { \n                padding: 1cm 1.5cm !important; \n                -webkit-print-color-adjust: exact !important; \n                print-color-adjust: exact !important; \n                background-color: white !important;\n                font-family: Arial, sans-serif !important;\n            }\n            .product-card { \n                break-inside: avoid; \n                page-break-inside: avoid; \n                border: 1px solid #d1d5db !important;\n                border-radius: 12px !important;\n                box-shadow: none !important;\n                background-color: white !important;\n                margin-bottom: 0 !important;\n            }\n            .product-image-container {\n                height: 200px !important; \n                background-color: #f3f4f6 !important;\n                border-bottom: 1px solid #e5e7eb !important;\n                border-radius: 12px 12px 0 0 !important;\n            }\n            .product-image-container img, .product-image-container video {\n                object-fit: cover !important;\n            }\n            .print-hidden, .backdrop-blur-md, button { display: none !important; }\n            \n            .print-grid {\n                display: grid !important;\n                grid-template-columns: repeat(2, 1fr) !important;\n                gap: 20px !important;\n            }\n        }\n        \/* Custom scrollbar for categories *\/\n        .scrollbar-hide::-webkit-scrollbar { display: none; }\n        .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }\n    <\/style>\n\n    <!-- SCRIPT TRAMPA DE SEGURIDAD -->\n    <script type=\"text\/javascript\">\n        \/* <![CDATA[ *\/\n        window.onerror = function(mensaje, url, linea) {\n            console.error(\"ERROR GLOBAL: \" + mensaje + \" en linea \" + linea);\n            return false;\n        };\n        \/* ]]> *\/\n    <\/script>\n\n\n\n    <!-- Encabezado corporativo de alta gama de Ucacha Maquinarias -->\n    <header class=\"bg-gradient-to-r from-emerald-950 via-[#133c1d] to-[#0f2d17] text-white shadow-lg sticky top-0 z-10 print:shadow-none print:relative print:rounded-2xl print:mb-4 border-b-4 border-[#ffeb3b]\">\n        <div class=\"max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8\">\n            <div class=\"flex flex-col md:flex-row justify-between items-center gap-4\">\n                <div class=\"flex items-center gap-4\">\n                    <!-- Isotipo del Logo Vectorizado (Alas Amarilla y Verde) -->\n                    <div class=\"flex items-center\">\n                        <svg class=\"h-10 w-auto\" viewBox=\"0 0 140 50\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <!-- Ala Amarilla Superior -->\n                            <path d=\"M5 25 L85 5 C105 3, 115 8, 125 12 L35 27 L110 32 C125 33, 130 40, 132 45 L10 29 Z\" fill=\"#ffeb3b\"><\/path>\n                            <!-- Ala Verde Inferior -->\n                            <path d=\"M25 26 L80 12 C92 11, 102 15, 108 19 L48 28 L95 31 C105 32, 108 37, 110 40 L30 28 Z\" fill=\"#4caf50\"><\/path>\n                        <\/svg>\n                    <\/div>\n                    <div>\n                        <div class=\"flex items-center gap-2\">\n                            <span class=\"bg-[#ffeb3b] text-stone-900 text-[10px] font-black px-1.5 py-0.5 rounded tracking-wider\">UCACHA<\/span>\n                            <h1 class=\"text-xl font-black tracking-tight leading-none drop-shadow-sm text-white\">MAQUINARIAS<\/h1>\n                        <\/div>\n                        <p class=\"text-green-300 font-bold text-xs tracking-wide mt-1\">MARCELO DELFINO<\/p>\n                    <\/div>\n                <\/div>\n                \n                <div class=\"flex flex-wrap items-center gap-4 text-sm print:hidden\">\n                    <label class=\"flex items-center gap-2 cursor-pointer bg-red-600\/90 hover:bg-red-500 px-4 py-2 rounded-xl transition-all duration-300 shadow-sm hover:shadow-md border border-red-500\/30\" id=\"adminToggleContainer\">\n                        <span id=\"adminIconWrapper\"><i data-lucide=\"shield-alert\" class=\"w-4 h-4 text-white\"><\/i><\/span>\n                        <input type=\"checkbox\" class=\"hidden\" id=\"adminToggle\">\n                        <span id=\"adminToggleText\" class=\"font-bold tracking-wide\">Modo Admin: OFF<\/span>\n                    <\/label>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/header>\n\n    <main class=\"max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8 flex-grow print:p-0 print:m-0 w-full\">\n        \n        <div class=\"hidden print:flex justify-between items-end mb-6 pb-2 border-b-2 border-stone-200\">\n            <div class=\"text-stone-600 font-medium\">\n                <p>Cotizaci\u00f3n \/ Opciones de Cat\u00e1logo<\/p>\n            <\/div>\n            <div class=\"text-right text-sm text-stone-600 font-medium\">\n                <p>Generado el: <span id=\"printDate\"><\/span><\/p>\n            <\/div>\n        <\/div>\n\n        <!-- BUSCADOR Y FILTROS PREMIUM -->\n        <div class=\"flex flex-col md:flex-row gap-3 justify-between items-center mb-4 print:hidden\">\n            <!-- Search -->\n            <div class=\"relative w-full md:w-1\/3 lg:w-1\/3 group\">\n                <div class=\"absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none\">\n                    <i data-lucide=\"search\" class=\"h-4 w-4 text-stone-400 group-focus-within:text-green-700 transition-colors\"><\/i>\n                <\/div>\n                <input type=\"text\" id=\"searchInput\" placeholder=\"Buscar maquinaria...\" class=\"w-full pl-10 pr-4 py-2 bg-white border border-stone-200 rounded-full shadow-sm placeholder-stone-400 focus:outline-none focus:ring-2 focus:ring-green-600 focus:border-transparent text-sm transition-all duration-300 text-stone-800\">\n            <\/div>\n            \n            <!-- Controls -->\n            <div class=\"flex flex-wrap items-center gap-2 w-full md:w-auto justify-start md:justify-end\">\n                <!-- Select All -->\n                <button id=\"selectAllBtn\" class=\"flex items-center gap-1.5 px-4 py-2 bg-white border border-stone-200 rounded-full text-sm font-medium text-stone-600 hover:bg-stone-50 hover:text-green-700 transition-all shadow-sm whitespace-nowrap\">\n                    <i data-lucide=\"check-square\" class=\"w-4 h-4\"><\/i>\n                    <span id=\"selectAllText\">Seleccionar Todos<\/span>\n                <\/button>\n\n                <!-- Estado Disponibilidad (Disponibles vs Vendidos) -->\n                <div class=\"relative\">\n                    <select id=\"availabilitySelect\" class=\"appearance-none pl-9 pr-8 py-2 bg-white border border-stone-200 rounded-full text-sm font-medium text-stone-600 hover:bg-stone-50 focus:outline-none focus:ring-2 focus:ring-green-600 transition-all shadow-sm cursor-pointer whitespace-nowrap text-stone-700\">\n                        <option value=\"all\">Todas las M\u00e1quinas<\/option>\n                        <option value=\"disponible\" selected=\"\">Solo Disponibles<\/option>\n                        <option value=\"vendido\">Solo Vendidas<\/option>\n                    <\/select>\n                    <i data-lucide=\"check-circle-2\" class=\"absolute left-3 top-1\/2 transform -translate-y-1\/2 w-4 h-4 text-stone-400 pointer-events-none\"><\/i>\n                    <i data-lucide=\"chevron-down\" class=\"absolute right-3 top-1\/2 transform -translate-y-1\/2 w-4 h-4 text-stone-400 pointer-events-none\"><\/i>\n                <\/div>\n\n                <!-- Condicion (Stock vs A Convenir) -->\n                <div class=\"relative\">\n                    <select id=\"conditionSelect\" class=\"appearance-none pl-9 pr-8 py-2 bg-white border border-stone-200 rounded-full text-sm font-medium text-stone-600 hover:bg-stone-50 focus:outline-none focus:ring-2 focus:ring-green-600 transition-all shadow-sm cursor-pointer whitespace-nowrap text-stone-700\">\n                        <option value=\"all\">Stock y A Convenir<\/option>\n                        <option value=\"stock\">Solo en Stock<\/option>\n                        <option value=\"convenir\">Solo A Convenir<\/option>\n                    <\/select>\n                    <i data-lucide=\"package\" class=\"absolute left-3 top-1\/2 transform -translate-y-1\/2 w-4 h-4 text-stone-400 pointer-events-none\"><\/i>\n                    <i data-lucide=\"chevron-down\" class=\"absolute right-3 top-1\/2 transform -translate-y-1\/2 w-4 h-4 text-stone-400 pointer-events-none\"><\/i>\n                <\/div>\n\n                <!-- Sort -->\n                <div class=\"relative\">\n                    <select id=\"sortSelect\" class=\"appearance-none pl-9 pr-8 py-2 bg-white border border-stone-200 rounded-full text-sm font-medium text-stone-600 hover:bg-stone-50 focus:outline-none focus:ring-2 focus:ring-green-600 transition-all shadow-sm cursor-pointer whitespace-nowrap text-stone-700\">\n                        <option value=\"default\">Orden<\/option>\n                        <option value=\"price_asc\">Menor a Mayor $<\/option>\n                        <option value=\"price_desc\">Mayor a Menor $<\/option>\n                    <\/select>\n                    <i data-lucide=\"arrow-up-down\" class=\"absolute left-3 top-1\/2 transform -translate-y-1\/2 w-4 h-4 text-stone-400 pointer-events-none\"><\/i>\n                    <i data-lucide=\"chevron-down\" class=\"absolute right-3 top-1\/2 transform -translate-y-1\/2 w-4 h-4 text-stone-400 pointer-events-none\"><\/i>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <!-- CATEGOR\u00cdAS -->\n        <div class=\"flex justify-start md:justify-center flex-wrap gap-4 mb-8 print:hidden pt-10 pb-4 px-2\" id=\"categoryFilters\">\n            <div class=\"relative group\">\n                <button onclick=\"setCategory('Todas')\" data-cat=\"Todas\" class=\"cat-btn w-14 h-14 flex items-center justify-center rounded-2xl border-2 border-green-700 bg-green-700 text-white transition-all shadow-md hover:-translate-y-1\">\n                    <i data-lucide=\"layout-grid\" class=\"w-6 h-6\"><\/i>\n                <\/button>\n                <div class=\"absolute -top-10 left-1\/2 transform -translate-x-1\/2 bg-stone-900 text-white text-[11px] font-bold px-3 py-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap z-20 shadow-xl\">\n                    Todas\n                    <div class=\"absolute -bottom-1 left-1\/2 transform -translate-x-1\/2 w-2 h-2 bg-stone-900 rotate-45\"><\/div>\n                <\/div>\n            <\/div>\n            \n            <div class=\"relative group\">\n                <button onclick=\"setCategory('Tractores')\" data-cat=\"Tractores\" class=\"cat-btn w-14 h-14 flex items-center justify-center rounded-2xl border border-stone-200 bg-white text-stone-500 hover:text-green-700 hover:border-green-300 hover:bg-green-50 transition-all shadow-sm hover:shadow-md hover:-translate-y-1\">\n                    <i data-lucide=\"tractor\" class=\"w-6 h-6\"><\/i>\n                <\/button>\n                <div class=\"absolute -top-10 left-1\/2 transform -translate-x-1\/2 bg-stone-900 text-white text-[11px] font-bold px-3 py-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap z-20 shadow-xl\">\n                    Tractores\n                    <div class=\"absolute -bottom-1 left-1\/2 transform -translate-x-1\/2 w-2 h-2 bg-stone-900 rotate-45\"><\/div>\n                <\/div>\n            <\/div>\n            \n            <div class=\"relative group\">\n                <button onclick=\"setCategory('Sembradoras')\" data-cat=\"Sembradoras\" class=\"cat-btn w-14 h-14 flex items-center justify-center rounded-2xl border border-stone-200 bg-white text-stone-500 hover:text-green-700 hover:border-green-300 hover:bg-green-50 transition-all shadow-sm hover:shadow-md hover:-translate-y-1\">\n                    <i data-lucide=\"sprout\" class=\"w-6 h-6\"><\/i>\n                <\/button>\n                <div class=\"absolute -top-10 left-1\/2 transform -translate-x-1\/2 bg-stone-900 text-white text-[11px] font-bold px-3 py-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap z-20 shadow-xl\">\n                    Sembradoras\n                    <div class=\"absolute -bottom-1 left-1\/2 transform -translate-x-1\/2 w-2 h-2 bg-stone-900 rotate-45\"><\/div>\n                <\/div>\n            <\/div>\n            \n            <div class=\"relative group\">\n                <button onclick=\"setCategory('Tolvas')\" data-cat=\"Tolvas\" class=\"cat-btn w-14 h-14 flex items-center justify-center rounded-2xl border border-stone-200 bg-white text-stone-500 hover:text-green-700 hover:border-green-300 hover:bg-green-50 transition-all shadow-sm hover:shadow-md hover:-translate-y-1\">\n                    <i data-lucide=\"truck\" class=\"w-6 h-6\"><\/i>\n                <\/button>\n                <div class=\"absolute -top-10 left-1\/2 transform -translate-x-1\/2 bg-stone-900 text-white text-[11px] font-bold px-3 py-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap z-20 shadow-xl\">\n                    Tolvas y Acoplados\n                    <div class=\"absolute -bottom-1 left-1\/2 transform -translate-x-1\/2 w-2 h-2 bg-stone-900 rotate-45\"><\/div>\n                <\/div>\n            <\/div>\n            \n            <div class=\"relative group\">\n                <button onclick=\"setCategory('Forraje')\" data-cat=\"Forraje\" class=\"cat-btn w-14 h-14 flex items-center justify-center rounded-2xl border border-stone-200 bg-white text-stone-500 hover:text-green-700 hover:border-green-300 hover:bg-green-50 transition-all shadow-sm hover:shadow-md hover:-translate-y-1\">\n                    <i data-lucide=\"wheat\" class=\"w-6 h-6\"><\/i>\n                <\/button>\n                <div class=\"absolute -top-10 left-1\/2 transform -translate-x-1\/2 bg-stone-900 text-white text-[11px] font-bold px-3 py-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap z-20 shadow-xl\">\n                    Forraje y Ganader\u00eda\n                    <div class=\"absolute -bottom-1 left-1\/2 transform -translate-x-1\/2 w-2 h-2 bg-stone-900 rotate-45\"><\/div>\n                <\/div>\n            <\/div>\n            \n            <div class=\"relative group\">\n                <button onclick=\"setCategory('Implementos')\" data-cat=\"Implementos\" class=\"cat-btn w-14 h-14 flex items-center justify-center rounded-2xl border border-stone-200 bg-white text-stone-500 hover:text-green-700 hover:border-green-300 hover:bg-green-50 transition-all shadow-sm hover:shadow-md hover:-translate-y-1\">\n                    <i data-lucide=\"settings-2\" class=\"w-6 h-6\"><\/i>\n                <\/button>\n                <div class=\"absolute -top-10 left-1\/2 transform -translate-x-1\/2 bg-stone-900 text-white text-[11px] font-bold px-3 py-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap z-20 shadow-xl\">\n                    Implementos \/ Otros\n                    <div class=\"absolute -bottom-1 left-1\/2 transform -translate-x-1\/2 w-2 h-2 bg-stone-900 rotate-45\"><\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <div id=\"adminNotification\" class=\"hidden mb-8 bg-red-50 border border-red-100 p-5 rounded-2xl shadow-sm print:hidden\">\n            <div class=\"flex items-start\">\n                <div class=\"bg-red-100 p-2 rounded-lg mr-4 flex-shrink-0\"><i data-lucide=\"shield-check\" class=\"h-6 w-6 text-red-600\"><\/i><\/div>\n                <div>\n                    <h3 class=\"text-base font-bold text-red-900\">Modo Administrador Activado<\/h3>\n                    <p class=\"text-sm text-red-700 mt-1 leading-relaxed\">Est\u00e1s viendo los precios internos. <strong>El p\u00fablico general solo ve la foto y el nombre de la m\u00e1quina.<\/strong> Al generar PDF o compartir m\u00faltiples en este modo, ir\u00e1n con precio.<\/p>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <div id=\"loadingIndicator\" class=\"py-16 text-center text-stone-500 hidden print:hidden\">\n            <i data-lucide=\"loader-2\" class=\"h-10 w-10 mx-auto text-green-700 mb-4 animate-spin\"><\/i>\n            <p class=\"text-base font-medium text-stone-600\">Sincronizando cat\u00e1logo con el servidor&#8230;<\/p>\n        <\/div>\n\n        <!-- Banner de M\u00e1quina \u00danica -->\n        <div id=\"singleItemBanner\" class=\"hidden mb-6 bg-green-50 border border-green-200 p-4 rounded-2xl flex flex-col sm:flex-row justify-between items-center gap-4 print:hidden\">\n            <div>\n                <h3 class=\"text-green-900 font-extrabold text-lg\">Viendo una m\u00e1quina en espec\u00edfico<\/h3>\n                <p class=\"text-sm text-green-700 font-medium mt-1\">Se te ha compartido este enlace directo.<\/p>\n            <\/div>\n            <a href=\"?\" class=\"bg-green-700 hover:bg-green-800 text-white px-5 py-2.5 rounded-xl font-bold text-sm transition-all shadow-sm flex items-center gap-2 w-full sm:w-auto justify-center hover:-translate-y-0.5\">\n                <i data-lucide=\"list\" class=\"w-4 h-4\"><\/i> Ver todo el cat\u00e1logo\n            <\/a>\n        <\/div>\n\n        <div id=\"productGrid\" class=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 print-grid\">\n            <!-- La cuadr\u00edcula se llena con JS -->\n        <\/div>\n\n        <div id=\"paginationContainer\" class=\"flex justify-center items-center gap-4 mt-10 mb-4 print:hidden\">\n            <!-- Paginaci\u00f3n se llena con JS -->\n        <\/div>\n\n    <\/main>\n\n    <footer id=\"adminFooter\" class=\"bg-stone-900 text-stone-400 text-sm py-6 text-center mt-auto print:hidden shadow-inner border-t border-stone-850 w-full\">\n        <p>Sincronizaci\u00f3n autom\u00e1tica activa <strong class=\"text-green-400 tracking-wide\">\ud83d\udfe2 Online<\/strong><\/p>\n    <\/footer>\n\n    <div id=\"floatingActions\" class=\"fixed bottom-8 left-1\/2 transform -translate-x-1\/2 flex gap-4 z-40 hidden print:hidden\">\n        <button onclick=\"shareSelection()\" class=\"bg-green-700 hover:bg-green-600 text-white px-5 md:px-6 py-3 rounded-full shadow-2xl font-bold flex items-center gap-2 transition-all hover:-translate-y-1 ring-4 ring-white\/50 backdrop-blur-sm\">\n            <i data-lucide=\"share-2\" class=\"w-5 h-5\"><\/i>\n            <span class=\"text-sm md:text-base\">Enviar Opciones<\/span>\n        <\/button>\n        <button onclick=\"generateSelectedPDF()\" class=\"bg-red-700 hover:bg-red-600 text-white px-5 md:px-6 py-3 rounded-full shadow-2xl font-bold flex items-center gap-2 transition-all hover:-translate-y-1 ring-4 ring-white\/50 backdrop-blur-sm\">\n            <i data-lucide=\"file-text\" class=\"w-5 h-5\"><\/i>\n            <span class=\"text-sm md:text-base\">Cat\u00e1logo (<span id=\"pdfCount\">0<\/span>)<\/span>\n        <\/button>\n    <\/div>\n\n    <!-- MODAL GALER\u00cdA MULTIMEDIA (FOTOS Y VIDEOS) - CERRADO OPTIMIZADO CON Z-INDEX FLOTANTE SUPERIOR -->\n    <div id=\"imageModal\" onclick=\"closeImageModal()\" class=\"fixed inset-0 z-[99990] hidden bg-black\/95 flex items-center justify-center p-4 backdrop-blur-md transition-opacity duration-300 cursor-pointer print:hidden\">\n        <!-- Bot\u00f3n de Cerrar ultra visible, fixed, con z-index 99999 absoluto y desplazado verticalmente para no quedar oculto por barras de WordPress o Admin -->\n        <button onclick=\"event.stopPropagation(); closeImageModal()\" class=\"fixed top-20 right-4 sm:right-6 text-white bg-red-600 hover:bg-red-700 px-5 py-2.5 rounded-full font-bold flex items-center gap-2 transition-all z-[99999] shadow-2xl cursor-pointer\" title=\"Cerrar galer\u00eda\">\n            <svg class=\"w-5 h-5 animate-pulse\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" viewBox=\"0 0 24 24\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\"><\/path>\n            <\/svg>\n            <span class=\"text-xs uppercase tracking-wider font-extrabold hidden sm:inline\">Cerrar<\/span>\n        <\/button>\n        \n        <button id=\"modalPrevBtn\" onclick=\"prevModalImage(event)\" class=\"absolute left-4 md:left-8 top-1\/2 transform -translate-y-1\/2 text-white\/70 hover:text-white bg-white\/10 hover:bg-white\/20 p-3 rounded-full transition-all backdrop-blur-sm hidden z-[210]\">\n            <svg class=\"w-6 h-6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" viewBox=\"0 0 24 24\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M15 19l-7-7 7-7\"><\/path>\n            <\/svg>\n        <\/button>\n        <button id=\"modalNextBtn\" onclick=\"nextModalImage(event)\" class=\"absolute right-4 md:right-8 top-1\/2 transform -translate-y-1\/2 text-white\/70 hover:text-white bg-white\/10 hover:bg-white\/20 p-3 rounded-full transition-all backdrop-blur-sm hidden z-[210]\">\n            <svg class=\"w-6 h-6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" viewBox=\"0 0 24 24\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5l7 7-7 7\"><\/path>\n            <\/svg>\n        <\/button>\n\n        <div class=\"relative max-w-6xl w-full h-full flex flex-col items-center justify-center cursor-default\" onclick=\"event.stopPropagation()\">\n            <div id=\"modalMediaContainer\" class=\"flex items-center justify-center w-full h-[80vh]\"><\/div>\n            <div class=\"flex flex-col sm:flex-row items-center gap-4 mt-6\">\n                <p id=\"modalTitle\" class=\"text-white text-xl font-bold text-center px-4 tracking-wide\"><\/p>\n                <span id=\"modalCounter\" class=\"bg-white\/20 text-white px-3 py-1 rounded-full text-sm font-bold hidden backdrop-blur-sm\"><\/span>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <!-- PASSWORD MODAL -->\n    <div id=\"passwordModal\" class=\"fixed inset-0 z-[200] hidden bg-stone-900\/60 flex items-center justify-center p-4 backdrop-blur-sm transition-opacity print:hidden\">\n        <div class=\"bg-white rounded-3xl shadow-2xl p-8 w-full max-w-sm transform transition-all scale-100\">\n            <div class=\"flex justify-center mb-6\"><div class=\"bg-green-50 p-4 rounded-full\"><i data-lucide=\"lock\" class=\"w-8 h-8 text-green-700\"><\/i><\/div><\/div>\n            <h3 class=\"text-xl font-extrabold text-stone-900 mb-2 text-center\">Acceso Restringido<\/h3>\n            <p class=\"text-sm text-stone-500 mb-6 text-center\">Ingresa la clave para ver precios y datos internos.<\/p>\n            <input type=\"password\" id=\"adminPasswordInput\" class=\"w-full px-5 py-3 border border-stone-200 rounded-xl focus:ring-2 focus:ring-green-600 focus:border-green-600 mb-6 bg-stone-50 transition-all font-medium text-center tracking-widest text-lg\" placeholder=\"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\">\n            <div class=\"flex justify-end gap-3\">\n                <button onclick=\"closePasswordModal()\" class=\"flex-1 px-4 py-2.5 text-stone-600 bg-stone-100 hover:bg-stone-200 rounded-xl transition-colors font-bold\">Cancelar<\/button>\n                <button onclick=\"verifyPassword()\" class=\"flex-1 px-4 py-2.5 bg-green-700 hover:bg-green-800 text-white rounded-xl transition-colors font-bold shadow-md shadow-green-700\/30\">Ingresar<\/button>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <div id=\"toast\" class=\"fixed bottom-6 right-6 bg-stone-900\/95 text-white px-6 py-4 rounded-2xl shadow-2xl transform transition-all duration-300 translate-y-24 opacity-0 z-[300] flex items-center gap-3 backdrop-blur-md border border-stone-800 print:hidden\">\n        <i data-lucide=\"check-circle-2\" class=\"text-green-400 w-5 h-5\"><\/i><span id=\"toastMsg\" class=\"font-medium tracking-wide text-sm\"><\/span>\n    <\/div>\n\n    <script type=\"text\/javascript\">\n    \/* <![CDATA[ *\/\n        \/\/ ==========================================================================================\n        \/\/ \ud83d\uded1 ZONA DE CONFIGURACI\u00d3N: CLAVE DE ACCESO ADMINISTRADOR \ud83d\uded1\n        \/\/ ==========================================================================================\n        const CLAVE_ADMINISTRADOR = \"B1c2$123\";\n        \/\/ ==========================================================================================\n\n        let appData = [];\n        let state = { \n            searchTerm: '', \n            isAdmin: false, \n            availabilityFilter: 'disponible', \/\/ 'all', 'disponible', 'vendido'\n            sortBy: 'default',\n            conditionFilter: 'all', \n            selectedItems: new Set(),\n            currentPage: 1,      \n            itemsPerPage: 12,\n            activeCategory: 'Todas'\n        };\n        let toastTimeout;\n\n        \/\/ Variables de Diagn\u00f3stico\n        let detectedStatusColumnIndex = 6; \/\/ Por defecto columna G\n        let isMockDataActive = false;\n\n        const CATEGORIES = {\n            'Todas': [],\n            'Tractores': ['tractor', 'tractores'],\n            'Sembradoras': ['sembradora', 'sembradoras'],\n            'Tolvas': ['tolva', 'acoplado', 'mixer', 'racionador', 'carro', 'silera', 'extractor', 'embolsadora', 'descargadora', 'batan'],\n            'Forraje': ['moledora', 'desmalezadora', 'rotoenfardadora', 'enfardadora', 'segadora', 'rastrillo', 'baima', 'picadora', 'hileradora', 'enrolladora'],\n            'Implementos': ['pala', 'chimango', 'escardillo', 'rastra', 'pulverizadora', 'fertilizadora', 'cargadora', 'cinta', 'niveladora', 'hoyadora', 'disco', 'rolo', 'tanque']\n        };\n\n        let activeModalId = null;\n        let currentGallery = [];\n        let currentGalleryIndex = 0;\n\n        \/\/ --- DETECCION SEGURA DE IFRAME EN WORDPRESS SIN DISPARAR ERRORES CORS ---\n        let referrerId = null;\n        try {\n            if (document.referrer) {\n                const referrerUrl = new URL(document.referrer);\n                referrerId = referrerUrl.searchParams.get('id');\n            }\n        } catch(e) {\n            console.warn(\"Referrer no disponible para par\u00e1metros directos\");\n        }\n        \n        const urlParams = new URLSearchParams(window.location.search);\n        const singleMachineId = urlParams.get('id') || referrerId;\n\n        \/\/ Declarar variables globales para los elementos del DOM\n        let searchInput, sortSelect, conditionSelect, availabilitySelect, selectAllBtn, selectAllText;\n        let adminToggleContainer, adminToggle, adminToggleText, adminNotification, productGrid;\n        let paginationContainer, loadingIndicator, toast, toastMsg;\n        let imageModal, modalTitle, modalPrevBtn, modalNextBtn, modalCounter;\n        let passwordModal, adminPasswordInput, floatingActions, pdfCount;\n\n        const escapeHTML = (str) => {\n            if (str === null || str === undefined) return '';\n            return String(str).replace(\/&\/g, '&amp;').replace(\/<\/g, '&lt;').replace(\/>\/g, '&gt;').replace(\/\"\/g, '&quot;').replace(\/'\/g, '&#039;');\n        };\n\n        const formatCurrency = (value, currency = 'ARS') => {\n            if (!value) return currency === 'USD' ? 'U$D 0' : '$ 0';\n            return new Intl.NumberFormat('es-AR', { style: 'currency', currency: currency, maximumFractionDigits: 0 }).format(value);\n        };\n\n        const showToast = (message) => {\n            clearTimeout(toastTimeout);\n            if (toastMsg && toast) {\n                toastMsg.textContent = message;\n                toast.classList.remove('translate-y-24', 'opacity-0');\n                toastTimeout = setTimeout(() => { toast.classList.add('translate-y-24', 'opacity-0'); }, 4000);\n            }\n        };\n\n        window.toggleSelection = (encId) => { \n            const id = decodeURIComponent(encId);\n            state.selectedItems.has(id) ? state.selectedItems.delete(id) : state.selectedItems.add(id); \n            render(); \n        };\n\n        window.goToPage = (pageNumber) => {\n            state.currentPage = pageNumber;\n            render();\n            window.scrollTo({ top: 0, behavior: 'smooth' });\n        };\n\n        window.setCategory = (cat) => {\n            state.activeCategory = cat;\n            state.currentPage = 1;\n\n            document.querySelectorAll('.cat-btn').forEach(btn => {\n                if (btn.getAttribute('data-cat') === cat) {\n                    btn.classList.remove('bg-white', 'text-gray-500', 'border-gray-200', 'hover:border-green-300', 'hover:bg-green-50', 'hover:text-green-700');\n                    btn.classList.add('bg-green-700', 'text-white', 'border-green-700', 'border-2');\n                } else {\n                    btn.classList.remove('bg-green-700', 'text-white', 'border-green-700', 'border-2');\n                    btn.classList.add('bg-white', 'text-gray-500', 'border-gray-200', 'hover:border-green-300', 'hover:bg-green-50', 'hover:text-green-700');\n                }\n            });\n            render();\n        };\n\n        \/\/ --- ENLACE COMPARTIBLE INTELIGENTE (HEREDA LA URL DEL PADRE EN WORDPRESS DE FORMA SEGURA) ---\n        const getShareableLink = (id) => {\n            let baseUrl = window.location.origin + window.location.pathname;\n            try {\n                if (document.referrer) {\n                    baseUrl = document.referrer.split('?')[0];\n                }\n            } catch(e) {}\n            return baseUrl + '?id=' + encodeURIComponent(id);\n        };\n\n        const getFilteredData = () => {\n            return appData.filter(item => {\n                \/\/ Si el cliente viene por link directo para ver una m\u00e1quina espec\u00edfica, ignoramos filtros de categor\u00eda o stock para que la vea directo\n                if (singleMachineId) {\n                    return String(item.id) === String(singleMachineId);\n                }\n\n                const safeName = (item.name || '').toLowerCase();\n                const safeId = (item.id || '').toString();\n                const safeSearch = state.searchTerm.toLowerCase();\n                \n                const matchesSearch = safeName.includes(safeSearch) || safeId.includes(safeSearch);\n                \n                \/\/ Filtro por Disponibilidad: all, disponible, vendido\n                let matchesAvailability = true;\n                if (state.availabilityFilter === 'disponible') {\n                    matchesAvailability = (item.status === 'DISPONIBLE');\n                } else if (state.availabilityFilter === 'vendido') {\n                    matchesAvailability = (item.status === 'VENDIDO');\n                }\n                \n                if (state.conditionFilter === 'stock' && item.isToAgree) return false;\n                if (state.conditionFilter === 'convenir' && !item.isToAgree) return false;\n\n                let matchesCategory = true;\n                if (state.activeCategory !== 'Todas') {\n                    const keywords = CATEGORIES[state.activeCategory] || [];\n                    matchesCategory = keywords.some(kw => safeName.includes(kw));\n                    \n                    if (state.activeCategory === 'Implementos' && !matchesCategory) {\n                        const otherKeywords = [\n                            ...CATEGORIES['Tractores'], ...CATEGORIES['Sembradoras'], \n                            ...CATEGORIES['Tolvas'], ...CATEGORIES['Forraje']\n                        ];\n                        const belongsToOther = otherKeywords.some(kw => safeName.includes(kw));\n                        if (!belongsToOther) matchesCategory = true; \n                    }\n                }\n\n                return matchesSearch && matchesAvailability && matchesCategory;\n            });\n        };\n\n        \/\/ --- CARGADOR DE LOGOTIPO RESILIENTE CONTRA CAMBIOS DE RUTA EN WORDPRESS ---\n        const loadLogoImage = async () => {\n            const paths = [\n                'logouca.jpg',\n                '\/logouca.jpg',\n                '\/maquinarias\/logouca.jpg',\n                'logo.jpg',\n                '\/logo.jpg'\n            ];\n            for (const path of paths) {\n                try {\n                    const img = await new Promise((resolve, reject) => {\n                        const l = new Image();\n                        l.crossOrigin = \"Anonymous\";\n                        l.onload = () => resolve(l);\n                        l.onerror = () => reject();\n                        l.src = path + '?t=' + new Date().getTime(); \/\/ Prevent cache lock issues\n                    });\n                    return img; \/\/ Logo loaded successfully!\n                } catch (e) {\n                    \/\/ Fail silently and try next path\n                }\n            }\n            return null; \/\/ All paths failed\n        };\n\n        \/\/ --- GALER\u00cdA CON SOPORTE PARA VIDEO ---\n        window.openImageModal = (encId, encName) => { \n            const id = decodeURIComponent(encId);\n            const name = decodeURIComponent(encName);\n            \n            activeModalId = id; \n            if (modalTitle) modalTitle.textContent = name; \n            if (imageModal) imageModal.classList.remove('hidden'); \n            document.body.style.overflow = 'hidden'; \n            \n            currentGallery = [{ type: 'image', src: `\/maquinarias\/${id}.jpg`, originalIndex: 0 }];\n            currentGalleryIndex = 0;\n            renderModalGallery();\n\n            for (let i = 1; i <= 10; i++) {\n                let imgUrl = `\/maquinarias\/${id}.${i}.jpg`;\n                let img = new Image();\n                img.onload = () => {\n                    if (activeModalId === id && !currentGallery.some(m => m.src === imgUrl)) {\n                        currentGallery.push({ type: 'image', src: imgUrl, originalIndex: i });\n                        currentGallery.sort((a, b) => a.originalIndex - b.originalIndex);\n                        renderModalGallery(); \n                    }\n                };\n                img.src = imgUrl; \n\n                let vidUrl = `\/maquinarias\/${id}.${i}.mp4`;\n                let vid = document.createElement('video');\n                vid.onloadedmetadata = () => {\n                    if (activeModalId === id && !currentGallery.some(m => m.src === vidUrl)) {\n                        currentGallery.push({ type: 'video', src: vidUrl, originalIndex: i });\n                        currentGallery.sort((a, b) => a.originalIndex - b.originalIndex);\n                        renderModalGallery(); \n                    }\n                };\n                vid.src = vidUrl;\n            }\n            try { lucide.createIcons(); } catch(e){} \n        };\n\n        window.nextModalImage = (e) => {\n            if(e) e.stopPropagation();\n            if (currentGallery.length <= 1) return;\n            currentGalleryIndex = (currentGalleryIndex + 1) % currentGallery.length;\n            renderModalGallery();\n        };\n\n        window.prevModalImage = (e) => {\n            if(e) e.stopPropagation();\n            if (currentGallery.length <= 1) return;\n            currentGalleryIndex = (currentGalleryIndex - 1 + currentGallery.length) % currentGallery.length;\n            renderModalGallery();\n        };\n\n        function renderModalGallery() {\n            const container = document.getElementById('modalMediaContainer');\n            if (!container) return;\n            container.innerHTML = '';\n            const media = currentGallery[currentGalleryIndex];\n            \n            if (media) {\n                if (media.type === 'video') {\n                    const v = document.createElement('video');\n                    v.src = media.src;\n                    v.controls = true;\n                    v.autoplay = true;\n                    v.playsInline = true;\n                    v.className = \"max-h-[80vh] max-w-full object-contain rounded-2xl shadow-2xl ring-1 ring-white\/10 transition-all duration-300\";\n                    container.appendChild(v);\n                } else {\n                    const i = document.createElement('img');\n                    i.src = media.src;\n                    i.className = \"max-h-[80vh] max-w-full object-contain rounded-2xl shadow-2xl ring-1 ring-white\/10 transition-all duration-300\";\n                    container.appendChild(i);\n                }\n            }\n            \n            if (currentGallery.length > 1) {\n                if (modalPrevBtn) modalPrevBtn.classList.remove('hidden');\n                if (modalNextBtn) modalNextBtn.classList.remove('hidden');\n                if (modalCounter) {\n                    modalCounter.classList.remove('hidden');\n                    modalCounter.textContent = `${currentGalleryIndex + 1} \/ ${currentGallery.length}`;\n                }\n            } else {\n                if (modalPrevBtn) modalPrevBtn.classList.add('hidden');\n                if (modalNextBtn) modalNextBtn.classList.add('hidden');\n                if (modalCounter) modalCounter.classList.add('hidden');\n            }\n        }\n\n        window.closeImageModal = () => { \n            activeModalId = null; \n            if (imageModal) imageModal.classList.add('hidden'); \n            document.body.style.overflow = 'auto'; \n            setTimeout(() => { \n                const container = document.getElementById('modalMediaContainer');\n                if (container) container.innerHTML = ''; \n            }, 300); \n        };\n\n        \/\/ --- GENERADOR DE CAT\u00c1LOGO (M\u00daLTIPLE SIN PRECIOS - CON NUEVO LOGO AUTO-DETECTADO) ---\n        window.generateSelectedPDF = async () => {\n            if (state.selectedItems.size === 0) return;\n            showToast(\"Generando Cat\u00e1logo PDF, aguard\u00e1 un momento...\");\n            const itemsToPrint = appData.filter(item => state.selectedItems.has(item.id));\n            const { jsPDF } = window.jspdf;\n            const pdf = new jsPDF({ orientation: \"portrait\", unit: \"px\", format: [1240, 1754] });\n            let logoImg = null;\n            try {\n                logoImg = await loadLogoImage();\n            } catch(e) {}\n\n            for (let i = 0; i < itemsToPrint.length; i++) {\n                const item = itemsToPrint[i];\n                const id = item.id;\n                if (i > 0) pdf.addPage();\n                const canvas = document.createElement('canvas');\n                canvas.width = 1240; canvas.height = 1754;\n                const ctx = canvas.getContext('2d');\n                ctx.fillStyle = '#ffffff'; ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n                try {\n                    let img = null;\n                    try {\n                        img = await new Promise((resolve, reject) => {\n                            const imgObj = new Image(); imgObj.crossOrigin = \"Anonymous\";\n                            imgObj.onload = () => resolve(imgObj); imgObj.onerror = () => reject();\n                            imgObj.src = `\/maquinarias\/${id}.jpg`;\n                        });\n                    } catch(e) {}\n\n                    ctx.fillStyle = '#f8fafc'; ctx.fillRect(0, 0, canvas.width, 250);\n                    ctx.fillStyle = '#15803d'; ctx.fillRect(0, 250, canvas.width, 10);\n\n                    if (logoImg) {\n                        const logoH = 150;\n                        const logoW = logoImg.width * (logoH \/ logoImg.height);\n                        ctx.drawImage(logoImg, 80, 50, logoW, logoH);\n                    } else {\n                        ctx.fillStyle = '#14532d'; ctx.font = 'bold 60px Arial'; ctx.textAlign = 'left';\n                        ctx.fillText('UCACHA MAQUINARIAS', 80, 120);\n                        ctx.fillStyle = '#15803d'; ctx.font = '30px Arial';\n                        ctx.fillText('Marcelo Delfino', 80, 170);\n                    }\n\n                    ctx.textAlign = 'right'; ctx.fillStyle = '#1e293b'; ctx.font = 'bold 50px Arial';\n                    ctx.fillText('CAT\u00c1LOGO', 1160, 110);\n                    ctx.fillStyle = '#64748b'; ctx.font = '30px Arial';\n                    const dateStr = new Date().toLocaleDateString('es-AR');\n                    ctx.fillText(`Fecha: ${dateStr}`, 1160, 160);\n                    ctx.fillText(`C\u00f3d. Referencia: #${id}`, 1160, 200);\n\n                    ctx.textAlign = 'left'; ctx.fillStyle = '#0f172a'; ctx.font = 'bold 55px Arial';\n                    const words = item.name.split(' ');\n                    let line = ''; let lineY = 350;\n                    for(let n = 0; n < words.length; n++) {\n                        const testLine = line + words[n] + ' ';\n                        if (ctx.measureText(testLine).width > 1080 && n > 0) {\n                            ctx.fillText(line, 80, lineY);\n                            line = words[n] + ' '; lineY += 70;\n                        } else { line = testLine; }\n                    }\n                    ctx.fillText(line, 80, lineY);\n\n                    const imgY = lineY + 60; const imgH = 950; const imgW = 1080;\n                    ctx.fillStyle = '#f1f5f9'; ctx.fillRect(80, imgY, imgW, imgH);\n                    if (img) {\n                        const scale = Math.min(imgW \/ img.width, imgH \/ img.height);\n                        const w = img.width * scale; const h = img.height * scale;\n                        const x = 80 + (imgW - w) \/ 2; const y = imgY + (imgH - h) \/ 2;\n                        ctx.drawImage(img, x, y, w, h);\n                    }\n                    ctx.strokeStyle = '#e2e8f0'; ctx.lineWidth = 2; ctx.strokeRect(80, imgY, imgW, imgH);\n\n                    ctx.fillStyle = '#1e293b'; ctx.fillRect(0, 1554, canvas.width, 200);\n                    ctx.fillStyle = '#f8fafc'; ctx.font = 'bold 35px Arial'; ctx.textAlign = 'center';\n                    ctx.fillText('Ucacha Maquinarias', canvas.width \/ 2, 1630);\n                    ctx.font = '28px Arial'; ctx.fillStyle = '#94a3b8';\n                    ctx.fillText('Tel \/ WhatsApp: 3535084927 | Web: ucachamaquinarias.com.ar', canvas.width \/ 2, 1680);\n\n                    const pdfData = canvas.toDataURL('image\/jpeg', 0.8);\n                    pdf.addImage(pdfData, 'JPEG', 0, 0, 1240, 1754);\n                } catch (err) { console.error(\"Error al renderizar p\u00e1gina de PDF:\", err); }\n            }\n            pdf.save(`Catalogo_Ucacha_Maquinarias.pdf`);\n            showToast(\"\u00a1Cat\u00e1logo PDF descargado exitosamente!\");\n        };\n\n        \/\/ --- GENERADOR DE PRESUPUESTO PDF FORMAL (INDIVIDUAL - ADMIN - CON NUEVO LOGO RESILIENTE) ---\n        window.generatePDF = async (encId) => {\n            const id = decodeURIComponent(encId);\n            const item = appData.find(i => String(i.id) === id);\n            if (!item) return;\n            showToast(\"Generando Presupuesto Formal (PDF)...\");\n\n            const canvas = document.createElement('canvas');\n            canvas.width = 1240; canvas.height = 1754;\n            const ctx = canvas.getContext('2d');\n            ctx.fillStyle = '#ffffff'; ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n            try {\n                const img = await new Promise((resolve, reject) => {\n                    const i = new Image(); i.crossOrigin = \"Anonymous\";\n                    i.onload = () => resolve(i); i.onerror = () => reject(new Error(\"Error imagen.\"));\n                    i.src = `\/maquinarias\/${id}.jpg`;\n                });\n\n                let logoImg = null;\n                try {\n                    logoImg = await loadLogoImage();\n                } catch(e) {}\n\n                ctx.fillStyle = '#f8fafc'; ctx.fillRect(0, 0, canvas.width, 250);\n                ctx.fillStyle = '#15803d'; ctx.fillRect(0, 250, canvas.width, 10);\n\n                if (logoImg) {\n                    const logoH = 150;\n                    const logoW = logoImg.width * (logoH \/ logoImg.height);\n                    ctx.drawImage(logoImg, 80, 50, logoW, logoH);\n                } else {\n                    ctx.fillStyle = '#14532d'; ctx.font = 'bold 60px Arial'; ctx.textAlign = 'left';\n                    ctx.fillText('UCACHA MAQUINARIAS', 80, 120);\n                    ctx.fillStyle = '#15803d'; ctx.font = '30px Arial';\n                    ctx.fillText('Marcelo Delfino', 80, 170);\n                }\n\n                ctx.textAlign = 'right'; ctx.fillStyle = '#1e293b'; ctx.font = 'bold 50px Arial';\n                ctx.fillText('PRESUPUESTO', 1160, 110);\n                ctx.fillStyle = '#64748b'; ctx.font = '30px Arial';\n                const dateStr = new Date().toLocaleDateString('es-AR');\n                ctx.fillText(`Fecha: ${dateStr}`, 1160, 160);\n                ctx.fillText(`C\u00f3d. Referencia: #${id}`, 1160, 200);\n\n                ctx.textAlign = 'left'; ctx.fillStyle = '#0f172a'; ctx.font = 'bold 55px Arial';\n                const words = item.name.split(' ');\n                let line = ''; let lineY = 350;\n                for(let n = 0; n < words.length; n++) {\n                    const testLine = line + words[n] + ' ';\n                    if (ctx.measureText(testLine).width > 1080 && n > 0) {\n                        ctx.fillText(line, 80, lineY);\n                        line = words[n] + ' '; lineY += 70;\n                    } else { line = testLine; }\n                }\n                ctx.fillText(line, 80, lineY);\n\n                const imgY = lineY + 60; const imgH = 600; const imgW = 1080;\n                const scale = Math.min(imgW \/ img.width, imgH \/ img.height);\n                const w = img.width * scale; const h = img.height * scale;\n                const x = 80 + (imgW - w) \/ 2; const y = imgY + (imgH - h) \/ 2;\n                \n                ctx.fillStyle = '#f1f5f9'; ctx.fillRect(80, imgY, imgW, imgH);\n                ctx.drawImage(img, x, y, w, h);\n                ctx.strokeStyle = '#e2e8f0'; ctx.lineWidth = 2; ctx.strokeRect(80, imgY, imgW, imgH);\n\n                const boxY = imgY + imgH + 80;\n                ctx.fillStyle = '#f0fdf4'; ctx.fillRect(80, boxY, 1080, 200);\n                ctx.strokeStyle = '#bbf7d0'; ctx.lineWidth = 4; ctx.strokeRect(80, boxY, 1080, 200);\n\n                ctx.fillStyle = '#166534'; ctx.font = 'bold 40px Arial';\n                ctx.fillText('INVERSI\u00d3N ESTIMADA', 120, boxY + 70);\n\n                const priceText = item.priceUsd > 0 ? new Intl.NumberFormat('es-AR', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(item.priceUsd) : 'Consultar';\n                ctx.font = 'bold 80px Arial'; ctx.fillText(priceText, 120, boxY + 155);\n\n                if (item.finance > 0) {\n                    ctx.textAlign = 'right'; ctx.fillStyle = '#1e40af'; ctx.font = 'bold 35px Arial';\n                    ctx.fillText('Opci\u00f3n Financiada:', 1120, boxY + 80);\n                    ctx.font = 'bold 55px Arial';\n                    ctx.fillText(new Intl.NumberFormat('es-AR', { style: 'currency', currency: 'ARS', maximumFractionDigits: 0 }).format(item.finance), 1120, boxY + 155);\n                    ctx.textAlign = 'left';\n                }\n\n                if (item.details && item.details.trim() !== \"\") {\n                    ctx.fillStyle = '#334155'; ctx.font = 'bold 35px Arial';\n                    ctx.fillText('Observaciones Generales:', 80, boxY + 280);\n                    ctx.font = '30px Arial'; ctx.fillStyle = '#475569';\n                    ctx.fillText(item.details.substring(0, 150), 80, boxY + 330);\n                }\n\n                ctx.fillStyle = '#1e293b'; ctx.fillRect(0, 1554, canvas.width, 200);\n                ctx.fillStyle = '#f8fafc'; ctx.font = 'bold 35px Arial'; ctx.textAlign = 'center';\n                ctx.fillText('Ucacha Maquinarias', canvas.width \/ 2, 1630);\n                ctx.font = '28px Arial'; ctx.fillStyle = '#94a3b8';\n                ctx.fillText('Tel \/ WhatsApp: 3535084927 | Web: ucachamaquinarias.com.ar', canvas.width \/ 2, 1680);\n\n                const pdfData = canvas.toDataURL('image\/jpeg', 0.8);\n                const { jsPDF } = window.jspdf;\n                const pdf = new jsPDF({ orientation: \"portrait\", unit: \"px\", format: [1240, 1754] });\n                pdf.addImage(pdfData, 'JPEG', 0, 0, 1240, 1754);\n                pdf.save(`Presupuesto_${id}.pdf`);\n\n                showToast(\"\u00a1Presupuesto PDF descargado exitosamente!\");\n            } catch (err) {\n                console.error(err);\n                showToast(\"Error al generar PDF. Verifique la imagen.\");\n            }\n        };\n\n        \/\/ --- FLYER INSTAGRAM - CON NUEVO LOGO RESILIENTE Y WHATSAPP ---\n        window.generateFlyer = async (encId, encName, priceUsd) => {\n            const id = decodeURIComponent(encId);\n            const name = decodeURIComponent(encName);\n            const item = appData.find(i => String(i.id) === id);\n            const estadoText = item && item.isToAgree ? \"A CONVENIR\" : \"DISPONIBLE\";\n\n            showToast(\"Generando flyer con logo, aguard\u00e1 un segundo...\");\n\n            const canvas = document.createElement('canvas');\n            canvas.width = 1080; canvas.height = 1080;\n            const ctx = canvas.getContext('2d');\n            \n            \/\/ Fondo claro neutro para descanso visual\n            ctx.fillStyle = '#fbfcf9'; \n            ctx.fillRect(0, 0, 1080, 1080);\n\n            try {\n                const img = await new Promise((resolve, reject) => {\n                    const i = new Image(); i.crossOrigin = \"Anonymous\";\n                    i.onload = () => resolve(i); i.onerror = () => reject(new Error(\"Error imagen.\"));\n                    i.src = `\/maquinarias\/${id}.jpg`;\n                });\n\n                \/\/ Cargar imagen de logotipo con logouca.jpg a trav\u00e9s del buscador adaptativo\n                let logoImg = null;\n                try {\n                    logoImg = await loadLogoImage();\n                } catch(errLogo) {\n                    console.warn(\"No se pudo cargar el logo corporativo para el flyer, se usar\u00e1 fallback vectorial.\");\n                }\n\n                \/\/ Helper local para dIbujar rect\u00e1ngulos redondeados con precisi\u00f3n y sin fallas\n                const drawRoundRect = (x, y, w, h, r) => {\n                    ctx.beginPath();\n                    ctx.moveTo(x + r, y);\n                    ctx.lineTo(x + w - r, y);\n                    ctx.quadraticCurveTo(x + w, y, x + w, y + r);\n                    ctx.lineTo(x + w, y + h - r);\n                    ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);\n                    ctx.lineTo(x + r, y + h);\n                    ctx.quadraticCurveTo(x, y + h, x, y + h - r);\n                    ctx.lineTo(x, y + r);\n                    ctx.quadraticCurveTo(x, y, x + r, y);\n                    ctx.closePath();\n                    ctx.fill();\n                };\n\n                \/\/ 1. DIBUJAR LA FOTO DE FONDO (Ocupando todo el lado derecho del flyer, s\u00faper n\u00edtida)\n                const imgX = 390; \n                const imgW = 1080 - imgX;\n                const imgH = 1080;\n                \n                const imgRatio = img.width \/ img.height;\n                const targetRatio = imgW \/ imgH;\n                let sx, sy, sw, h_cropped;\n                if (imgRatio > targetRatio) {\n                    h_cropped = img.height;\n                    sw = img.height * targetRatio;\n                    sx = (img.width - sw) \/ 2;\n                    sy = 0;\n                } else {\n                    sw = img.width;\n                    h_cropped = img.width \/ targetRatio;\n                    sx = 0;\n                    sy = (img.height - h_cropped) \/ 2;\n                }\n                ctx.drawImage(img, sx, sy, sw, h_cropped, imgX, 0, imgW, imgH);\n\n                \/\/ 2. COLUMNA ANGULAR PREMIUM A LA IZQUIERDA (Verde Bosque Ucacha)\n                ctx.fillStyle = '#08170d'; \n                ctx.beginPath();\n                ctx.moveTo(0, 0);\n                ctx.lineTo(440, 0);\n                ctx.lineTo(360, 1080);\n                ctx.lineTo(0, 1080);\n                ctx.closePath();\n                ctx.fill();\n\n                \/\/ L\u00ednea separadora brillante de acento (Amarillo Ucacha)\n                ctx.fillStyle = '#ffeb3b'; \n                ctx.beginPath();\n                ctx.moveTo(440, 0);\n                ctx.lineTo(452, 0);\n                ctx.lineTo(372, 1080);\n                ctx.lineTo(360, 1080);\n                ctx.closePath();\n                ctx.fill();\n\n                \/\/ 3. LOGO DE UCACHA MAQUINARIAS (Renderizado con logouca.jpg o fallback vectorial)\n                if (logoImg) {\n                    const logoH = 80;\n                    const logoW = logoImg.width * (logoH \/ logoImg.height);\n                    ctx.drawImage(logoImg, 40, 50, logoW, logoH);\n                } else {\n                    ctx.fillStyle = '#ffeb3b';\n                    ctx.beginPath();\n                    drawRoundRect(40, 50, 120, 36, 6);\n                    \n                    ctx.fillStyle = '#000000';\n                    ctx.font = 'bold 20px Arial, sans-serif';\n                    ctx.textAlign = 'center';\n                    ctx.fillText('UCACHA', 100, 75);\n\n                    ctx.fillStyle = '#ffffff';\n                    ctx.font = '900 30px Arial, sans-serif';\n                    ctx.textAlign = 'left';\n                    ctx.fillText('MAQUINARIAS', 170, 77);\n\n                    ctx.fillStyle = '#4caf50'; \/\/ Verde brillante del Isotipo\n                    ctx.font = 'bold 16px Arial, sans-serif';\n                    ctx.fillText('MARCELO DELFINO', 40, 114);\n                }\n\n                \/\/ 4. BADGE DE DISPONIBILIDAD (Sutil y elegante)\n                const isSold = item && item.status === 'VENDIDO';\n                ctx.fillStyle = isSold ? '#ef4444' : '#15803d'; \n                ctx.beginPath();\n                drawRoundRect(40, 140, 180, 34, 8);\n                \n                ctx.fillStyle = '#ffffff';\n                ctx.font = 'bold 14px Arial, sans-serif';\n                ctx.textAlign = 'center';\n                ctx.fillText(isSold ? '\u274c VENDIDO' : '\u2705 DISPONIBLE', 130, 162);\n\n                \/\/ 5. NOMBRE DE LA MAQUINARIA (Grande, blanco y adaptativo en el lateral izquierdo)\n                ctx.fillStyle = '#ffffff';\n                ctx.font = 'bold 36px Arial, sans-serif';\n                ctx.textAlign = 'left';\n                const words = name.split(' ');\n                let line = '', lineY = 230;\n                for(let n = 0; n < words.length; n++) {\n                    const testLine = line + words[n] + ' ';\n                    const metrics = ctx.measureText(testLine);\n                    if (metrics.width > 310 && n > 0) {\n                        ctx.fillText(line, 40, lineY);\n                        line = words[n] + ' '; lineY += 46;\n                    } else { line = testLine; }\n                }\n                ctx.fillText(line, 40, lineY);\n\n                \/\/ 6. PRECIO EN D\u00d3LARES (Muy destacado en amarillo vibrante)\n                const priceText = priceUsd > 0 ? new Intl.NumberFormat('es-AR', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(priceUsd) : 'Consultar';\n                ctx.fillStyle = '#ffeb3b'; \n                ctx.font = '900 52px Arial, sans-serif';\n                ctx.fillText(priceText, 40, lineY + 65);\n\n                \/\/ 7. TARJETA BLANCA SOBREPUESTA (Estructurada como la John Deere de Cantoro)\n                const cardY = lineY + 110;\n                \n                \/\/ Efecto de sombra proyectada premium para dar volumen y realismo\n                ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';\n                ctx.shadowBlur = 20;\n                ctx.shadowOffsetX = 0;\n                ctx.shadowOffsetY = 6;\n                \n                ctx.fillStyle = '#ffffff';\n                drawRoundRect(40, cardY, 300, 230, 16);\n                \n                \/\/ Desactivamos la sombra para que no manche los textos internos\n                ctx.shadowColor = 'transparent';\n                ctx.shadowBlur = 0;\n                ctx.shadowOffsetX = 0;\n                ctx.shadowOffsetY = 0;\n\n                \/\/ T\u00edtulo de la Ficha\n                ctx.fillStyle = '#08170d';\n                ctx.font = 'bold 15px Arial, sans-serif';\n                ctx.fillText('FICHA DE LA M\u00c1QUINA', 60, cardY + 32);\n\n                \/\/ L\u00ednea divisoria interna\n                ctx.strokeStyle = '#f1f5f9';\n                ctx.lineWidth = 2;\n                ctx.beginPath();\n                ctx.moveTo(60, cardY + 45);\n                ctx.lineTo(320, cardY + 45);\n                ctx.stroke();\n\n                \/\/ Ficha Dato 1: C\u00f3digo\n                ctx.fillStyle = '#64748b';\n                ctx.font = 'bold 11px Arial, sans-serif';\n                ctx.fillText('C\u00d3DIGO DE REFERENCIA', 60, cardY + 70);\n                ctx.fillStyle = '#1e293b';\n                ctx.font = 'black 17px Arial, sans-serif';\n                ctx.fillText(`#${id}`, 60, cardY + 90);\n\n                \/\/ Ficha Dato 2: Financiaci\u00f3n (Importe de Financiaci\u00f3n real y en pesos)\n                if (item && item.finance > 0) {\n                    ctx.fillStyle = '#64748b';\n                    ctx.font = 'bold 11px Arial, sans-serif';\n                    ctx.fillText('OPCI\u00d3N FINANCIACI\u00d3N (ARS)', 60, cardY + 122);\n                    ctx.fillStyle = '#15803d'; \/\/ Verde financiado\n                    ctx.font = 'black 17px Arial, sans-serif';\n                    ctx.fillText(new Intl.NumberFormat('es-AR', { style: 'currency', currency: 'ARS', maximumFractionDigits: 0 }).format(item.finance), 60, cardY + 142);\n                } else {\n                    ctx.fillStyle = '#64748b';\n                    ctx.font = 'bold 11px Arial, sans-serif';\n                    ctx.fillText('TIPO DE NEGOCIACI\u00d3N', 60, cardY + 122);\n                    ctx.fillStyle = '#1e293b';\n                    ctx.font = 'black 17px Arial, sans-serif';\n                    ctx.fillText(item && item.isToAgree ? 'A Convenir' : 'Entrega Directa', 60, cardY + 142);\n                }\n\n                \/\/ Ficha Dato 3: Estado General\n                ctx.fillStyle = '#64748b';\n                ctx.font = 'bold 11px Arial, sans-serif';\n                ctx.fillText('ESTADO REVISADO', 60, cardY + 175);\n                ctx.fillStyle = '#15803d';\n                ctx.font = 'bold 16px Arial, sans-serif';\n                ctx.fillText('MUY BUENO \/ LISTO', 60, cardY + 195);\n\n                \/\/ 8. PIE DE P\u00c1GINA (Contacto directo del vendedor y la web)\n                ctx.fillStyle = '#ffffff';\n                ctx.font = 'bold 22px Arial, sans-serif';\n                ctx.fillText('\ud83d\udcde WhatsApp: 3535084927', 40, 990);\n\n                ctx.fillStyle = '#ffeb3b'; \n                ctx.font = 'bold 18px Arial, sans-serif';\n                ctx.fillText('\ud83d\udcbb ucachamaquinarias.com.ar', 40, 1025);\n\n                \/\/ Descarga autom\u00e1tica de la pieza terminada\n                const dataUrl = canvas.toDataURL('image\/jpeg', 0.95);\n                const link = document.createElement('a');\n                link.download = `Flyer_Ucacha_${id}.jpg`;\n                link.href = dataUrl; \n                link.click();\n                showToast(\"\u00a1Flyer premium generado exitosamente!\");\n            } catch (err) { \n                console.error(err);\n                showToast(\"Error de renderizado. Comprueba que la imagen exista.\"); \n            }\n        };\n\n        window.deleteProduct = (encId) => {\n            const id = decodeURIComponent(encId);\n            if (confirm(`\u00bfOcultar maquinaria C\u00f3d: ${id} de esta vista?`)) {\n                appData = appData.filter(item => item.id !== id);\n                state.selectedItems.delete(id);\n                render();\n                showToast('Maquinaria ocultada temporalmente.');\n            }\n        };\n\n        window.shareSelection = () => {\n            if (state.selectedItems.size === 0) return;\n            let text = `\u00a1Hola! Te comparto estas opciones de maquinaria de Ucacha Maquinarias:\\n\\n`;\n            const itemsToShare = appData.filter(item => state.selectedItems.has(item.id));\n            itemsToShare.forEach((item) => {\n                const estadoText = item.isToAgree ? \"A Convenir\" : \"Disponible\";\n                text += `\ud83d\ude9c *${item.name}* (C\u00f3d: ${item.id} - ${estadoText})\\n`;\n                if (state.isAdmin && item.priceUsd) text += `\ud83d\udcb5 Precio: USD ${item.priceUsd}\\n`;\n                text += `\\n`;\n            });\n            text += `\u00bfTe interesa alguna? Avisame y te paso fotos o detalles.`;\n            window.open(`https:\/\/wa.me\/?text=${encodeURIComponent(text)}`, '_blank');\n        };\n\n        window.copyForMarketplace = (encId, encName, priceUsd) => {\n            const id = decodeURIComponent(encId); const name = decodeURIComponent(encName);\n            const item = appData.find(i => String(i.id) === id);\n            const estadoText = item && item.isToAgree ? \"A Convenir (Por Pedido)\" : \"Disponible F\u00edsicamente\";\n            const text = `\ud83d\ude9c VENDO: ${name}\\n\u2705 Estado: ${estadoText}\\n\ud83d\udcb5 Precio: USD ${priceUsd}\\n\ud83d\udd16 C\u00f3d: ${id}\\n\ud83d\udc64 Ucacha Maquinarias (Marcelo Delfino)\\n\ud83d\udce9 Env\u00edame un mensaje.\\n#MaquinariaAgricola`;\n            const textArea = document.createElement(\"textarea\"); textArea.value = text; document.body.appendChild(textArea); textArea.select();\n            try { document.execCommand('copy'); showToast('\u00a1Texto copiado para Marketplace!'); } catch (err) {}\n            document.body.removeChild(textArea);\n        };\n\n        window.shareDirectLink = (encId, encName) => {\n            const id = decodeURIComponent(encId); const name = decodeURIComponent(encName);\n            const item = appData.find(i => String(i.id) === id);\n            const estadoText = item && item.isToAgree ? \"A Convenir (Por Pedido)\" : \"Disponible F\u00edsicamente\";\n            const link = getShareableLink(id);\n            const text = `\u00a1Hola! Te comparto esta maquinaria que te puede interesar:\\n\\n\ud83d\ude9c *${name}*\\n\ud83d\udd16 C\u00f3d: ${id}\\n\ud83d\udccc Estado: ${estadoText}\\n\\n\ud83d\udc49 Pod\u00e9s ver fotos, videos y detalles entrando a este enlace directo:\\n${link}\\n\\nUcacha Maquinarias - Marcelo Delfino`;\n            window.open(`https:\/\/wa.me\/?text=${encodeURIComponent(text)}`, '_blank');\n        };\n\n        \/\/ --- RENDERIZADO PRINCIPAL (FIEL AL TUYO ORIGINAL) ---\n        const render = () => {\n            let filteredData = getFilteredData();\n\n            if (singleItemBanner) {\n                if (singleMachineId) {\n                    singleItemBanner.classList.remove('hidden');\n                    const catFiltersEl = document.getElementById('categoryFilters');\n                    if (catFiltersEl) catFiltersEl.style.display = 'none';\n                    if (paginationContainer) paginationContainer.style.display = 'none';\n                } else {\n                    singleItemBanner.classList.add('hidden');\n                    const catFiltersEl = document.getElementById('categoryFilters');\n                    if (catFiltersEl) catFiltersEl.style.display = 'flex';\n                    if (paginationContainer) paginationContainer.style.display = 'flex';\n                }\n            }\n\n            if (state.sortBy === 'price_asc') filteredData.sort((a, b) => (a.priceUsd || 0) - (b.priceUsd || 0));\n            else if (state.sortBy === 'price_desc') filteredData.sort((a, b) => (b.priceUsd || 0) - (a.priceUsd || 0));\n\n            if (adminToggleText) adminToggleText.textContent = state.isAdmin ? 'Modo Admin: ON' : 'Modo Admin: OFF';\n            \n            if (adminNotification && adminToggleContainer) {\n                if (state.isAdmin) {\n                    adminNotification.classList.remove('hidden');\n                    adminToggleContainer.classList.replace('bg-red-600\/90', 'bg-green-700');\n                    adminToggleContainer.classList.replace('hover:bg-red-500', 'hover:bg-green-600');\n                    adminToggleContainer.classList.replace('border-red-500\/30', 'border-green-600\/30');\n                    const iconWrap = document.getElementById('adminIconWrapper');\n                    if (iconWrap) iconWrap.innerHTML = '<i data-lucide=\"unlock\" class=\"w-4 h-4 text-white\"><\/i>';\n                } else {\n                    adminNotification.classList.add('hidden');\n                    adminToggleContainer.classList.replace('bg-green-700', 'bg-red-600\/90');\n                    adminToggleContainer.classList.replace('hover:bg-green-600', 'hover:bg-red-500');\n                    adminToggleContainer.classList.replace('border-green-600\/30', 'border-red-500\/30');\n                    const iconWrap = document.getElementById('adminIconWrapper');\n                    if (iconWrap) iconWrap.innerHTML = '<i data-lucide=\"shield-alert\" class=\"w-4 h-4 text-white\"><\/i>';\n                }\n            }\n\n            if (floatingActions && pdfCount) {\n                if (state.selectedItems.size > 0) { \n                    floatingActions.classList.remove('hidden'); \n                    pdfCount.textContent = state.selectedItems.size; \n                } else { \n                    floatingActions.classList.add('hidden'); \n                }\n            }\n\n            if (selectAllText) {\n                const allSelected = filteredData.length > 0 && filteredData.every(item => state.selectedItems.has(item.id));\n                if(allSelected) {\n                    selectAllText.textContent = \"Deseleccionar Todos\";\n                } else {\n                    selectAllText.textContent = \"Seleccionar Todos\";\n                }\n            }\n\n            const totalPages = Math.ceil(filteredData.length \/ state.itemsPerPage);\n            if (state.currentPage > totalPages) state.currentPage = totalPages || 1;\n            \n            const startIndex = (state.currentPage - 1) * state.itemsPerPage;\n            const paginatedData = filteredData.slice(startIndex, startIndex + state.itemsPerPage);\n\n            if (paginationContainer) {\n                let paginationHTML = '';\n                if (totalPages > 1) {\n                    paginationHTML += `<button onclick=\"goToPage(${state.currentPage - 1})\" class=\"px-5 py-2.5 rounded-xl bg-white border border-stone-200 text-stone-700 font-bold disabled:opacity-50 hover:bg-green-50 hover:text-green-700 transition-colors shadow-sm\" ${state.currentPage === 1 ? 'disabled' : ''}>Anterior<\/button>`;\n                    paginationHTML += `<span class=\"text-stone-600 font-medium px-4\">P\u00e1gina <span class=\"font-bold text-stone-900\">${state.currentPage}<\/span> de ${totalPages}<\/span>`;\n                    paginationHTML += `<button onclick=\"goToPage(${state.currentPage + 1})\" class=\"px-5 py-2.5 rounded-xl bg-white border border-stone-200 text-stone-700 font-bold disabled:opacity-50 hover:bg-green-50 hover:text-green-700 transition-colors shadow-sm\" ${state.currentPage === totalPages ? 'disabled' : ''}>Siguiente<\/button>`;\n                }\n                paginationContainer.innerHTML = paginationHTML;\n            }\n\n            if (productGrid) {\n                if (filteredData.length === 0) {\n                    productGrid.innerHTML = `\n                        <div class=\"col-span-full py-20 text-center text-stone-400 print:hidden\">\n                            <i data-lucide=\"tractor\" class=\"h-16 w-16 mx-auto mb-4 opacity-30 text-green-700\"><\/i>\n                            <p class=\"text-xl font-medium text-stone-500\">No se encontraron maquinarias.<\/p>\n                        <\/div>`;\n                } else {\n                    productGrid.innerHTML = paginatedData.map(item => {\n                        const isSelected = state.selectedItems.has(item.id);\n                        const printVisibilityClass = (state.selectedItems.size > 0 && !isSelected) ? 'print:hidden' : 'print:flex';\n                        \n                        const safeId = escapeHTML(item.id);\n                        const safeName = escapeHTML(item.name);\n                        const safeStatus = escapeHTML(item.status);\n                        \n                        const encId = encodeURIComponent(item.id).replace(\/'\/g, \"%27\");\n                        const encName = encodeURIComponent(item.name).replace(\/'\/g, \"%27\");\n                        \n                        return `\n                        <div class=\"product-card bg-white rounded-2xl shadow-sm hover:shadow-md border border-stone-100 overflow-hidden flex flex-col relative group transition-all duration-300 ${printVisibilityClass} ${isSelected ? 'ring-2 ring-green-600 bg-green-50\/20' : ''}\">\n                            \n                            <div class=\"absolute top-3 left-3 z-30 print:hidden\">\n                                <label class=\"cursor-pointer\">\n                                    <input type=\"checkbox\" class=\"peer sr-only\" ${isSelected ? 'checked' : ''} onclick=\"event.stopPropagation(); toggleSelection('${encId}')\" \/>\n                                    <div class=\"w-6 h-6 rounded-md bg-white\/90 border-2 border-stone-300 peer-checked:bg-green-700 peer-checked:border-green-700 backdrop-blur-sm transition-all flex items-center justify-center shadow-sm hover:border-green-500\">\n                                        <i data-lucide=\"check\" class=\"w-4 h-4 text-white opacity-0 peer-checked:opacity-100 transition-opacity\"><\/i>\n                                    <\/div>\n                                <\/label>\n                            <\/div>\n\n                            <!-- BOTONES FLOTANTES COMPARTIR \/ ADMIN ACCIONES -->\n                            <div class=\"absolute top-3 right-3 flex flex-col gap-2 z-20 print:hidden opacity-0 group-hover:opacity-100 transition-opacity duration-300\">\n                                ${!state.isAdmin ? `\n                                <button onclick=\"event.stopPropagation(); shareDirectLink('${encId}', '${encName}')\" class=\"bg-white\/90 hover:bg-green-700 text-stone-600 hover:text-white p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" title=\"Compartir enlace directo a esta m\u00e1quina\">\n                                    <i data-lucide=\"share-2\" class=\"w-4 h-4\"><\/i>\n                                <\/button>\n                                <!-- BOTON WHATSAPP DE CONSULTA CONFIGURADO DIRECTO A MARCELO (CORRECCION 1) -->\n                                <a href=\"https:\/\/wa.me\/5493535084927?text=${encodeURIComponent(`Hola Marcelo! Me interesa esta maquinaria:\\n*${item.name}*\\nC\u00f3d: ${item.id}\\n\u00bfPodr\u00edas darme precio y detalles?`)}\" target=\"_blank\" class=\"bg-white\/90 hover:bg-green-500 text-stone-600 hover:text-white p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" onclick=\"event.stopPropagation()\" title=\"Consultar por WhatsApp\">\n                                    <i data-lucide=\"message-circle\" class=\"w-4 h-4\"><\/i>\n                                <\/a>\n                                ` : `\n                                <button onclick=\"event.stopPropagation(); shareDirectLink('${encId}', '${encName}')\" class=\"bg-white\/90 hover:bg-green-700 text-stone-600 hover:text-white p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" title=\"Compartir enlace directo al cliente\">\n                                    <i data-lucide=\"share-2\" class=\"w-4 h-4\"><\/i>\n                                <\/button>\n                                \n                                <a href=\"https:\/\/wa.me\/?text=${encodeURIComponent(`Hola Marcelo! Consulta:\\n*${item.name}*\\nC\u00f3d: ${item.id}\\nPrecio: USD ${item.priceUsd}`)}\" target=\"_blank\" class=\"bg-white\/90 hover:bg-green-500 text-stone-600 hover:text-white p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" onclick=\"event.stopPropagation()\" title=\"WhatsApp\">\n                                    <i data-lucide=\"message-circle\" class=\"w-4 h-4\"><\/i>\n                                <\/a>\n                                \n                                <button onclick=\"event.stopPropagation(); generatePDF('${encId}')\" class=\"bg-white\/90 hover:bg-red-600 text-stone-600 hover:text-white p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" title=\"Descargar Presupuesto PDF Formal\">\n                                    <i data-lucide=\"file-text\" class=\"w-4 h-4\"><\/i>\n                                <\/button>\n\n                                <button onclick=\"event.stopPropagation(); generateFlyer('${encId}', '${encName}', ${item.priceUsd})\" class=\"bg-white\/90 hover:bg-amber-500 text-stone-600 hover:text-stone-900 p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" title=\"Descargar Flyer para Instagram\/WhatsApp\">\n                                    <i data-lucide=\"image-down\" class=\"w-4 h-4\"><\/i>\n                                <\/button>\n\n                                <button onclick=\"event.stopPropagation(); copyForMarketplace('${encId}', '${encName}', ${item.priceUsd})\" class=\"bg-white\/90 hover:bg-stone-800 text-stone-600 hover:text-white p-2 rounded-xl shadow-sm transition-all transform hover:-translate-y-1 backdrop-blur-md border border-stone-200\/50\" title=\"Copiar texto para Marketplace\">\n                                    <i data-lucide=\"copy\" class=\"w-4 h-4\"><\/i>\n                                <\/button>\n                                `}\n                            <\/div>\n\n                            <div class=\"product-image-container bg-stone-50 h-64 w-full relative flex items-center justify-center text-stone-300 overflow-hidden cursor-pointer group\/image border-b border-stone-100\" onclick=\"openImageModal('${encId}', '${encName}')\">\n                                <i data-lucide=\"image\" class=\"w-12 h-12 opacity-20 absolute z-0 print:hidden\"><\/i>\n                                \n                                <div class=\"absolute inset-0 bg-black\/0 group-hover\/image:bg-black\/20 transition-all duration-300 z-10 flex items-center justify-center opacity-0 group-hover\/image:opacity-100 print:hidden backdrop-blur-[1px]\">\n                                    <span class=\"bg-white\/95 text-stone-800 px-4 py-2 rounded-full font-bold text-sm shadow-lg flex items-center gap-2 transform translate-y-4 group-hover\/image:translate-y-0 transition-all\">\n                                        <i data-lucide=\"zoom-in\" class=\"w-4 h-4 text-green-700\"><\/i> Ver Galer\u00eda\n                                    <\/span>\n                                <\/div>\n\n                                <img decoding=\"async\" src=\"\/maquinarias\/${encodeURIComponent(item.id)}.jpg\" alt=\"${safeName}\" class=\"object-cover w-full h-full absolute inset-0 z-0 bg-white transition-transform duration-700 group-hover\/image:scale-105\" onerror=\"this.style.display='none';\" \/>\n                                \n                                ${item.isToAgree ? `\n                                <div class=\"absolute top-3 left-1\/2 transform -translate-x-1\/2 bg-indigo-600\/95 text-white px-3 py-1.5 rounded-full text-[10px] font-bold tracking-wider z-20 backdrop-blur-sm shadow-md flex items-center gap-1.5 print:bg-indigo-100 print:text-indigo-800 print:border print:border-indigo-300\">\n                                    <i data-lucide=\"sparkles\" class=\"w-3.5 h-3.5\"><\/i> A CONVENIR\n                                <\/div>` : ''}\n\n                                <!-- Etiqueta de estado de disponibilidad para Todos (P\u00fablico y Admin) -->\n                                ${safeStatus === 'VENDIDO' ? `\n                                <div class=\"absolute bottom-3 left-3 bg-red-600 text-white px-3 py-1 rounded-md text-[10px] font-bold tracking-wider z-20 backdrop-blur-sm shadow-sm flex items-center gap-1\">\n                                    <i data-lucide=\"alert-circle\" class=\"w-3 h-3\"><\/i> VENDIDO\n                                <\/div>` : `\n                                <div class=\"absolute bottom-3 left-3 bg-green-600 text-white px-3 py-1 rounded-md text-[10px] font-bold tracking-wider z-20 backdrop-blur-sm shadow-sm flex items-center gap-1\">\n                                    <i data-lucide=\"check\" class=\"w-3 h-3\"><\/i> DISPONIBLE\n                                <\/div>`}\n\n                                ${state.isAdmin ? `\n                                <div class=\"absolute bottom-3 right-3 bg-stone-900\/80 text-white px-2.5 py-1 rounded-md text-[11px] font-bold tracking-wider z-20 print:hidden backdrop-blur-sm shadow-sm\">\n                                    C\u00f3d: ${safeId}\n                                <\/div>` : ''}\n                            <\/div>\n                            \n                            <div class=\"p-5 flex-1 flex flex-col ${!state.isAdmin ? 'items-center justify-center' : ''} print:p-4\">\n                                \n                                <div class=\"flex justify-between items-center mb-3 w-full\">\n                                    <span class=\"inline-flex items-center px-2.5 py-1 rounded-md text-[10px] font-bold bg-stone-100 text-stone-600 border border-stone-200 tracking-wide uppercase\">\n                                        C\u00f3d: ${safeId}\n                                    <\/span>\n                                    <div class=\"flex gap-1.5\">\n                                        ${item.isToAgree \n                                            ? `<span class=\"px-2 py-1 rounded-md text-[10px] uppercase tracking-wide font-bold text-indigo-700 bg-indigo-50 border border-indigo-200\">A Convenir<\/span>`\n                                            : `<span class=\"px-2 py-1 rounded-md text-[10px] uppercase tracking-wide font-bold text-green-700 bg-green-50 border border-green-150\">En Stock<\/span>`\n                                        }\n                                    <\/div>\n                                <\/div>\n\n                                <h3 class=\"text-lg font-bold text-stone-800 leading-tight ${state.isAdmin ? 'mb-4 flex-1 line-clamp-2' : 'text-center'} print:text-lg\">\n                                    ${safeName}\n                                <\/h3>\n\n                                ${state.isAdmin ? `\n                                <div class=\"space-y-1 mb-5 print:mb-2 border-t border-stone-100 pt-4 w-full\">\n                                    <div class=\"flex items-baseline text-stone-900 gap-1.5\">\n                                        <span class=\"text-2xl font-black text-green-700 print:text-2xl tracking-tight\">${formatCurrency(item.priceUsd, 'USD')}<\/span>\n                                    <\/div>\n                                    <div class=\"inline-block bg-stone-50 text-stone-500 text-[11px] font-semibold px-2 py-0.5 rounded-md border border-stone-200\">\n                                        ${formatCurrency(item.priceArs, 'ARS')}\n                                    <\/div>\n                                <\/div>\n                                \n                                ${item.finance > 0 ? `\n                                <div class=\"bg-green-50\/50 border border-green-100 rounded-xl p-3 flex items-center justify-between mt-auto mb-4 w-full print:border-stone-300 print:bg-transparent print:p-2\">\n                                    <div class=\"flex items-center text-green-800 text-[11px] uppercase tracking-wide font-bold print:text-stone-800\"><i data-lucide=\"calendar-days\" class=\"w-3.5 h-3.5 mr-1.5\"><\/i> Financiaci\u00f3n<\/div>\n                                    <div class=\"text-green-800 font-black text-sm print:text-stone-900\">${formatCurrency(item.finance, 'ARS')}<\/div>\n                                <\/div>` : '<div class=\"mt-auto mb-4\"><\/div>'}\n                                \n                                <div class=\"bg-stone-50\/80 rounded-xl p-3.5 border border-stone-200 print:hidden relative mt-2 w-full\">\n                                    <div class=\"flex justify-between items-center mb-2\">\n                                        <p class=\"text-[11px] font-extrabold text-stone-500 uppercase tracking-wider flex items-center gap-1.5\"><i data-lucide=\"lock\" class=\"w-3.5 h-3.5\"><\/i> Info Interna<\/p>\n                                        <button onclick=\"deleteProduct('${encId}')\" class=\"text-stone-400 hover:text-red-600 transition-colors\" title=\"Ocultar de la vista\">\n                                            <i data-lucide=\"eye-off\" class=\"w-4 h-4\"><\/i>\n                                        <\/button>\n                                    <\/div>\n                                    <div class=\"flex justify-between items-end mb-1\">\n                                        <span class=\"text-stone-500 text-xs font-medium\">Costo L\u00edmite:<\/span>\n                                        <span class=\"font-bold text-stone-800 text-sm\">${formatCurrency(item.priceLimit, 'ARS')}<\/span>\n                                    <\/div>\n                                <\/div>\n                                ` : ''}\n                        <\/div>\n                    <\/div>\n                    `;\n                    }).join('');\n                }\n            }\n\n            try { lucide.createIcons(); } catch(e){}\n        };\n\n        window.closePasswordModal = () => {\n            if (passwordModal) passwordModal.classList.add('hidden');\n        };\n\n        window.verifyPassword = () => {\n            if (adminPasswordInput) {\n                if (adminPasswordInput.value === CLAVE_ADMINISTRADOR) {\n                    state.isAdmin = true;\n                    if (adminToggle) adminToggle.checked = true;\n                    closePasswordModal();\n                    state.currentPage = 1;\n                    \n                    state.availabilityFilter = 'all';\n                    if (availabilitySelect) availabilitySelect.value = 'all';\n                    \n                    render();\n                    showToast('Modo administrador activado');\n                } else {\n                    showToast('Clave incorrecta');\n                    adminPasswordInput.value = '';\n                    adminPasswordInput.focus();\n                }\n            }\n        };\n\n        const loadCentralExcel = async () => {\n            if (productGrid) productGrid.innerHTML = '';\n            if (loadingIndicator) loadingIndicator.classList.remove('hidden');\n\n            try {\n                const url = '\/maquinarias\/datos.xlsx?t=' + new Date().getTime();\n                const response = await fetch(url, { cache: 'no-store' });\n                if (!response.ok) throw new Error('Archivo no encontrado');\n\n                const arrayBuffer = await response.arrayBuffer();\n                const data = new Uint8Array(arrayBuffer);\n                const workbook = XLSX.read(data, { type: 'array' });\n                const firstSheetName = workbook.SheetNames[0];\n                const worksheet = workbook.Sheets[firstSheetName];\n                const rows = XLSX.utils.sheet_to_json(worksheet, { header: 1 });\n                \n                isMockDataActive = false;\n                \n                let colCounts = {};\n                for (let r = 0; r < Math.min(rows.length, 50); r++) {\n                    const row = rows[r];\n                    if (!row) continue;\n                    for (let c = 0; c < row.length; c++) {\n                        const val = String(row[c] || '').replace(\/[\\s\\u00A0\\r\\n]\/g, '').toUpperCase();\n                        if (val === 'V' || val === 'B' || val === 'D') {\n                            colCounts[c] = (colCounts[c] || 0) + 1;\n                        }\n                    }\n                }\n                \n                let maxCount = 0;\n                let detectedColIdx = 6;\n                for (const colIdx in colCounts) {\n                    if (colCounts[colIdx] > maxCount) {\n                        maxCount = colCounts[colIdx];\n                        detectedColIdx = parseInt(colIdx);\n                    }\n                }\n                detectedStatusColumnIndex = detectedColIdx;\n                console.log(\"Columna de estado auto-detectada:\", detectedStatusColumnIndex);\n\n                const parsedData = [];\n                for (let i = 0; i < rows.length; i++) {\n                    const row = rows[i];\n                    if (!row || row.length < 2) continue;\n\n                    const id = String(row[0] || '').trim();\n                    const name = String(row[1] || '').trim();\n                    if (!id || !name) continue;\n\n                    if (isNaN(Number(id))) continue;\n\n                    const nameUpper = name.toUpperCase();\n                    const colG = row[detectedStatusColumnIndex] !== undefined ? String(row[detectedStatusColumnIndex]).replace(\/[\\s\\u00A0\\r\\n]\/g, '').toUpperCase() : '';\n                    \n                    const isToAgree = colG.includes('CONVENIR') || nameUpper.includes('CONVENIR');\n                    const isSold = (colG === 'V' || colG === 'B');\n\n                    parsedData.push({\n                        id: id,\n                        name: name,\n                        priceArs: parseFloat(row[2]) || 0,\n                        priceUsd: parseFloat(row[3]) || 0,\n                        priceLimit: parseFloat(row[4]) || 0,\n                        finance: parseFloat(row[5]) || 0,\n                        status: isSold ? 'VENDIDO' : 'DISPONIBLE',\n                        isToAgree: isToAgree,\n                        details: colG\n                    });\n                }\n                \n                if (parsedData.length > 0) appData = parsedData;\n                else throw new Error('Archivo vac\u00edo o corrupto');\n\n            } catch (error) {\n                console.log(\"Cargando datos simulados por falta de archivo f\u00edsico o CORS en este visor.\");\n                isMockDataActive = true;\n                detectedStatusColumnIndex = 6;\n                appData = [\n                    { id: \"1\", name: \"PALA CARGADORA ARRASTRE 1,5 MTS\", priceArs: 4000000, priceUsd: 2797, priceLimit: 3600000, finance: 3200000, status: \"DISPONIBLE\", isToAgree: false, details: \"D\" },\n                    { id: \"2\", name: \"DESMALEZADORA E HILERADO BAIMA 3 MTS\", priceArs: 9500000, priceUsd: 6643, priceLimit: 9025000, finance: 7600000, status: \"VENDIDO\", isToAgree: false, details: \"V\" },\n                    { id: \"3\", name: \"MOLEDORA ROLLO\", priceArs: 5000000, priceUsd: 3496, priceLimit: 4750000, finance: 4000000, status: \"VENDIDO\", isToAgree: false, details: \"V\" },\n                    { id: \"4\", name: 'CHIMANGO 160\" MOTOR EXPLOSI\u00d3N', priceArs: 2000000, priceUsd: 1398, priceLimit: 1900000, finance: 1600000, status: \"DISPONIBLE\", isToAgree: false, details: \"D\" },\n                    { id: \"5\", name: 'TRACTOR NUEVO A PEDIR', priceArs: 0, priceUsd: 15000, priceLimit: 14000, finance: 0, status: \"DISPONIBLE\", isToAgree: true, details: \"D\" }\n                ];\n            } finally {\n                if (loadingIndicator) loadingIndicator.classList.add('hidden');\n                render();\n            }\n        };\n\n        document.addEventListener(\"DOMContentLoaded\", function() {\n            searchInput = document.getElementById('searchInput');\n            sortSelect = document.getElementById('sortSelect');\n            conditionSelect = document.getElementById('conditionSelect');\n            availabilitySelect = document.getElementById('availabilitySelect');\n            selectAllBtn = document.getElementById('selectAllBtn');\n            selectAllText = document.getElementById('selectAllText');\n            adminToggleContainer = document.getElementById('adminToggleContainer');\n            adminToggle = document.getElementById('adminToggle');\n            adminToggleText = document.getElementById('adminToggleText');\n            adminNotification = document.getElementById('adminNotification');\n            productGrid = document.getElementById('productGrid');\n            paginationContainer = document.getElementById('paginationContainer'); \n            loadingIndicator = document.getElementById('loadingIndicator');\n            toast = document.getElementById('toast');\n            toastMsg = document.getElementById('toastMsg');\n            \n            imageModal = document.getElementById('imageModal');\n            modalTitle = document.getElementById('modalTitle');\n            modalPrevBtn = document.getElementById('modalPrevBtn');\n            modalNextBtn = document.getElementById('modalNextBtn');\n            modalCounter = document.getElementById('modalCounter');\n\n            passwordModal = document.getElementById('passwordModal');\n            adminPasswordInput = document.getElementById('adminPasswordInput');\n            floatingActions = document.getElementById('floatingActions');\n            pdfCount = document.getElementById('pdfCount');\n\n            const printDateEl = document.getElementById('printDate');\n            if (printDateEl) {\n                const dateObj = new Date();\n                printDateEl.textContent = dateObj.toLocaleDateString('es-AR');\n            }\n\n            if (searchInput) searchInput.addEventListener('input', (e) => { state.searchTerm = e.target.value; state.currentPage = 1; render(); });\n            if (sortSelect) sortSelect.addEventListener('change', (e) => { state.sortBy = e.target.value; state.currentPage = 1; render(); });\n            if (conditionSelect) conditionSelect.addEventListener('change', (e) => { state.conditionFilter = e.target.value; state.currentPage = 1; render(); });\n            if (availabilitySelect) availabilitySelect.addEventListener('change', (e) => { state.availabilityFilter = e.target.value; state.currentPage = 1; render(); });\n\n            if (selectAllBtn) {\n                selectAllBtn.addEventListener('click', () => {\n                    let filteredData = getFilteredData();\n                    const allSelected = filteredData.length > 0 && filteredData.every(item => state.selectedItems.has(item.id));\n                    if (allSelected) filteredData.forEach(item => state.selectedItems.delete(item.id));\n                    else filteredData.forEach(item => state.selectedItems.add(item.id));\n                    render();\n                });\n            }\n\n            if (adminToggleContainer) {\n                adminToggleContainer.addEventListener('click', (e) => {\n                    e.preventDefault(); \n                    if (!state.isAdmin) {\n                        if (passwordModal) passwordModal.classList.remove('hidden');\n                        if (adminPasswordInput) {\n                            adminPasswordInput.value = '';\n                            setTimeout(() => adminPasswordInput.focus(), 100);\n                        }\n                    } else {\n                        state.isAdmin = false;\n                        if (adminToggle) adminToggle.checked = false;\n                        state.selectedItems.clear(); \n                        state.currentPage = 1;\n                        state.availabilityFilter = 'disponible';\n                        if (availabilitySelect) availabilitySelect.value = 'disponible';\n                        render();\n                        showToast('Modo p\u00fablico activado');\n                    }\n                });\n            }\n\n            if (adminPasswordInput) {\n                adminPasswordInput.addEventListener('keydown', (e) => {\n                    if (e.key === 'Enter') verifyPassword();\n                    if (e.key === 'Escape') closePasswordModal();\n                });\n            }\n\n            \/\/ --- MANEJADOR GLOBAL DE LA TECLA ESCAPE PARA CERRAR MODALES ---\n            document.addEventListener('keydown', (e) => {\n                if (e.key === 'Escape') {\n                    closeImageModal();\n                    closePasswordModal();\n                }\n            });\n\n            try {\n                lucide.createIcons();\n            } catch(e) {\n                console.warn(\"Lucide Icons no se carg\u00f3 a tiempo:\", e);\n            }\n\n            loadCentralExcel();\n        });\n    \/* ]]> *\/\n    <\/script>\n","protected":false},"excerpt":{"rendered":"<p>Cat\u00e1logo de Maquinarias Agr\u00edcolas &#8211; Marcelo Delfino UCACHA MAQUINARIAS MARCELO DELFINO Modo Admin: OFF Cotizaci\u00f3n \/ Opciones de Cat\u00e1logo Generado el: Seleccionar Todos Todas las M\u00e1quinasSolo DisponiblesSolo Vendidas Stock y &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2310","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/pages\/2310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/comments?post=2310"}],"version-history":[{"count":6,"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/pages\/2310\/revisions"}],"predecessor-version":[{"id":2317,"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/pages\/2310\/revisions\/2317"}],"wp:attachment":[{"href":"https:\/\/ucachamaquinarias.com.ar\/wp\/wp-json\/wp\/v2\/media?parent=2310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}