<!-- Calculator Section -->
            <section class="!bg-gray-50 !py-16 lg:!py-24">
                <div class="!max-w-6xl !mx-auto !px-6 lg:!px-8">
                    <div class="grid grid-cols-1 lg:grid-cols-5 !gap-8">

                        <!-- Calculator Form -->
                        <div class="lg:col-span-3 !bg-white !rounded-2xl !shadow-xl !p-8">
                            <h2 class="!text-2xl !font-bold !text-[#004D7A] !mb-8" style="font-family: 'Montserrat', sans-serif">
                                Configura tu prestamo
                            </h2>

                            <!-- Loan Type Selector -->
                            <div class="!mb-8">
                                <label class="!block !text-sm !font-semibold !text-gray-700 !mb-3" style="font-family: 'Lato', sans-serif">Tipo de prestamo</label>
                                <div class="grid grid-cols-2 !gap-4">
                                    <button type="button" id="btn-personal" onclick="selectLoanType('personal')" class="!py-4 !px-6 !rounded-xl !border-2 !border-[#004D7A] !bg-[#004D7A] !text-white !font-semibold !transition-all hover:!shadow-lg">
                                        <svg class="!w-6 !h-6 !mx-auto !mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                                        Personal
                                    </button>
                                    <button type="button" id="btn-pyme" onclick="selectLoanType('pyme')" class="!py-4 !px-6 !rounded-xl !border-2 !border-gray-300 !bg-white !text-gray-700 !font-semibold !transition-all hover:!border-[#004D7A] hover:!shadow-lg">
                                        <svg class="!w-6 !h-6 !mx-auto !mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path></svg>
                                        PYME
                                    </button>
                                </div>
                            </div>

                            <!-- Loan Amount Slider -->
                            <div class="!mb-8">
                                <div class="flex justify-between items-center !mb-3">
                                    <label class="!text-sm !font-semibold !text-gray-700" style="font-family: 'Lato', sans-serif">Monto del prestamo</label>
                                    <span id="amount-display" class="!text-2xl !font-bold !text-[#004D7A]" style="font-family: 'Montserrat', sans-serif">$50,000</span>
                                </div>
                                <input type="range" id="amount-slider" min="5000" max="300000" value="50000" step="5000"
                                    class="!w-full !h-3 !bg-gray-200 !rounded-lg !appearance-none !cursor-pointer slider-thumb"
                                    oninput="updateCalculation()">
                                <div class="flex justify-between !text-xs !text-gray-500 !mt-2" style="font-family: 'Lato', sans-serif">
                                    <span id="min-amount">$5,000</span>
                                    <span id="max-amount">$300,000</span>
                                </div>
                            </div>

                            <!-- Term Slider -->
                            <div class="!mb-8">
                                <div class="flex justify-between items-center !mb-3">
                                    <label class="!text-sm !font-semibold !text-gray-700" style="font-family: 'Lato', sans-serif">Plazo</label>
                                    <span id="term-display" class="!text-2xl !font-bold !text-[#004D7A]" style="font-family: 'Montserrat', sans-serif">12 meses</span>
                                </div>
                                <input type="range" id="term-slider" min="3" max="36" value="12" step="3"
                                    class="!w-full !h-3 !bg-gray-200 !rounded-lg !appearance-none !cursor-pointer slider-thumb"
                                    oninput="updateCalculation()">
                                <div class="flex justify-between !text-xs !text-gray-500 !mt-2" style="font-family: 'Lato', sans-serif">
                                    <span id="min-term">3 meses</span>
                                    <span id="max-term">36 meses</span>
                                </div>
                            </div>

                            <!-- Interest Rate Display -->
                            <div class="!bg-gray-50 !rounded-xl !p-6 !mb-8">
                                <div class="grid grid-cols-2 !gap-6">
                                    <div>
                                        <p class="!text-sm !text-gray-500 !mb-1" style="font-family: 'Lato', sans-serif">Tasa de interes anual</p>
                                        <p id="interest-rate" class="!text-xl !font-bold !text-[#004D7A]" style="font-family: 'Montserrat', sans-serif">35.00%</p>
                                    </div>
                                    <div>
                                        <p class="!text-sm !text-gray-500 !mb-1" style="font-family: 'Lato', sans-serif">CAT (sin IVA)</p>
                                        <p id="cat-rate" class="!text-xl !font-bold !text-[#C84C3C]" style="font-family: 'Montserrat', sans-serif">45.80%</p>
                                    </div>
                                </div>
                            </div>

                            <!-- CTA Button -->
                            <a href="#" class="!block !w-full !text-center !rounded-lg !bg-[#E0B345] !px-8 !py-4 !text-lg !font-semibold !text-[#004D7A] hover:!bg-yellow-400 !transition-colors !shadow-lg">
                                Solicitar este prestamo
                                <svg class="!inline !ml-2 !w-5 !h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path></svg>
                            </a>
                        </div>

                        <!-- Results Panel -->
                        <div class="lg:col-span-2">
                            <div class="!bg-[#004D7A] !rounded-2xl !shadow-xl !p-8 !text-white sticky !top-8">
                                <h3 class="!text-xl !font-bold !mb-6" style="font-family: 'Montserrat', sans-serif">Tu pago estimado</h3>

                                <div class="!text-center !mb-8">
                                    <p class="!text-sm !text-gray-300 !mb-2" style="font-family: 'Lato', sans-serif">Pago mensual</p>
                                    <p id="monthly-payment" class="!text-5xl !font-bold !text-[#E0B345]" style="font-family: 'Montserrat', sans-serif">$4,861</p>
                                    <p class="!text-sm !text-gray-300 !mt-2" style="font-family: 'Lato', sans-serif">MXN / mes</p>
                                </div>

                                <div class="!space-y-4 !border-t !border-white/20 !pt-6">
                                    <div class="flex justify-between">
                                        <span class="!text-gray-300" style="font-family: 'Lato', sans-serif">Monto solicitado</span>
                                        <span id="summary-amount" class="!font-semibold">$50,000</span>
                                    </div>
                                    <div class="flex justify-between">
                                        <span class="!text-gray-300" style="font-family: 'Lato', sans-serif">Intereses totales</span>
                                        <span id="total-interest" class="!font-semibold">$8,332</span>
                                    </div>
                                    <div class="flex justify-between">
                                        <span class="!text-gray-300" style="font-family: 'Lato', sans-serif">Comision por apertura</span>
                                        <span id="opening-fee" class="!font-semibold">$1,500</span>
                                    </div>
                                    <div class="flex justify-between !pt-4 !border-t !border-white/20">
                                        <span class="!text-lg !font-semibold" style="font-family: 'Lato', sans-serif">Total a pagar</span>
                                        <span id="total-payment" class="!text-lg !font-bold !text-[#E0B345]">$59,832</span>
                                    </div>
                                </div>

                                <p class="!text-xs !text-gray-400 !mt-6" style="font-family: 'Lato', sans-serif">
                                    *Calculo estimado con fines informativos. Las condiciones finales dependen de tu perfil crediticio.
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Amortization Table Section -->
            <section class="!bg-white !py-16 lg:!py-24">
                <div class="!max-w-6xl !mx-auto !px-6 lg:!px-8">
                    <div class="!text-center !mb-12">
                        <h2 class="!text-3xl !font-bold !text-[#004D7A] !mb-4" style="font-family: 'Montserrat', sans-serif">
                            Tabla de amortizacion
                        </h2>
                        <p class="!text-lg !text-gray-600" style="font-family: 'Lato', sans-serif">
                            Conoce el desglose de cada uno de tus pagos mensuales
                        </p>
                    </div>

                    <div class="!overflow-x-auto !bg-gray-50 !rounded-xl !shadow-lg">
                        <table class="!w-full !min-w-[600px]">
                            <thead class="!bg-[#004D7A] !text-white">
                                <tr>
                                    <th class="!py-4 !px-6 !text-left !font-semibold" style="font-family: 'Montserrat', sans-serif">Mes</th>
                                    <th class="!py-4 !px-6 !text-right !font-semibold" style="font-family: 'Montserrat', sans-serif">Pago mensual</th>
                                    <th class="!py-4 !px-6 !text-right !font-semibold" style="font-family: 'Montserrat', sans-serif">Capital</th>
                                    <th class="!py-4 !px-6 !text-right !font-semibold" style="font-family: 'Montserrat', sans-serif">Interes</th>
                                    <th class="!py-4 !px-6 !text-right !font-semibold" style="font-family: 'Montserrat', sans-serif">Saldo</th>
                                </tr>
                            </thead>
                            <tbody id="amortization-table" style="font-family: 'Lato', sans-serif">
                                <!-- Generated by JavaScript -->
                            </tbody>
                        </table>
                    </div>

                    <div class="!text-center !mt-8">
                        <button id="toggle-table" onclick="toggleFullTable()" class="!inline-flex !items-center !text-[#004D7A] !font-semibold hover:!underline" style="font-family: 'Lato', sans-serif">
                            <span id="toggle-text">Ver tabla completa</span>
                            <svg id="toggle-icon" class="!ml-2 !w-5 !h-5 !transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
                        </button>
                    </div>
                </div>
            </section>

            <!-- Info Section -->
            <section class="!bg-gray-50 !py-16 lg:!py-24">
                <div class="!max-w-6xl !mx-auto !px-6 lg:!px-8">
                    <div class="grid grid-cols-1 md:grid-cols-3 !gap-8">
                        <div class="!bg-white !rounded-xl !p-6 !shadow-lg">
                            <div class="!w-12 !h-12 !bg-[#004D7A] !rounded-full flex items-center justify-center !mb-4">
                                <svg class="!w-6 !h-6 !text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"></path></svg>
                            </div>
                            <h3 class="!text-lg !font-bold !text-[#004D7A] !mb-2" style="font-family: 'Montserrat', sans-serif">Que es el CAT?</h3>
                            <p class="!text-gray-600 !text-sm" style="font-family: 'Lato', sans-serif">
                                El Costo Anual Total (CAT) incluye la tasa de interes, comisiones y seguros. Es la mejor forma de comparar creditos de diferentes instituciones.
                            </p>
                        </div>
                        <div class="!bg-white !rounded-xl !p-6 !shadow-lg">
                            <div class="!w-12 !h-12 !bg-[#E0B345] !rounded-full flex items-center justify-center !mb-4">
                                <svg class="!w-6 !h-6 !text-[#004D7A]" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                            </div>
                            <h3 class="!text-lg !font-bold !text-[#004D7A] !mb-2" style="font-family: 'Montserrat', sans-serif">Sin costos ocultos</h3>
                            <p class="!text-gray-600 !text-sm" style="font-family: 'Lato', sans-serif">
                                En MXLending no cobramos penalizacion por pago anticipado. Puedes liquidar tu credito antes y solo pagaras los intereses generados.
                            </p>
                        </div>
                        <div class="!bg-white !rounded-xl !p-6 !shadow-lg">
                            <div class="!w-12 !h-12 !bg-green-500 !rounded-full flex items-center justify-center !mb-4">
                                <svg class="!w-6 !h-6 !text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path></svg>
                            </div>
                            <h3 class="!text-lg !font-bold !text-[#004D7A] !mb-2" style="font-family: 'Montserrat', sans-serif">Calculo informativo</h3>
                            <p class="!text-gray-600 !text-sm" style="font-family: 'Lato', sans-serif">
                                Este simulador es una herramienta de referencia. Las condiciones finales del credito se determinan tras evaluar tu perfil crediticio.
                            </p>
                        </div>
                    </div>
                </div>
            </section>

            <!-- CTA Section -->
            <section class="!bg-gradient-to-r !from-[#004D7A] !to-[#003D5A] !py-16 lg:!py-20">
                <div class="!max-w-4xl !mx-auto !px-6 lg:!px-8 !text-center">
                    <h2 class="!text-3xl sm:!text-4xl !font-bold !text-white !mb-6" style="font-family: 'Montserrat', sans-serif">
                        Listo para solicitar tu prestamo?
                    </h2>
                    <p class="!text-xl !text-gray-200 !mb-8" style="font-family: 'Lato', sans-serif">
                        El calculo que acabas de hacer es solo el primer paso. Solicita ahora y recibe una respuesta en horas.
                    </p>
                    <div class="flex flex-col sm:flex-row !gap-4 justify-center">
                        <a href="/prestamos-personales/" class="!inline-flex !items-center !justify-center !rounded-lg !bg-[#E0B345] !px-8 !py-4 !text-lg !font-semibold !text-[#004D7A] hover:!bg-yellow-400 !transition-colors !shadow-lg">
                            Prestamo Personal
                        </a>
                        <a href="/creditos-pymes/" class="!inline-flex !items-center !justify-center !rounded-lg !border-2 !border-white !px-8 !py-4 !text-lg !font-semibold !text-white hover:!bg-white hover:!text-[#004D7A] !transition-colors">
                            Credito PYME
                        </a>
                    </div>
                </div>
            </section>

        </main>
    </div>
</div>