{"id":652,"date":"2025-12-17T10:50:26","date_gmt":"2025-12-17T13:50:26","guid":{"rendered":"https:\/\/serfinanciero.com\/?page_id=652"},"modified":"2025-12-19T09:15:05","modified_gmt":"2025-12-19T12:15:05","slug":"calculadora","status":"publish","type":"page","link":"https:\/\/serfinanciero.com\/index.php\/calculadora\/","title":{"rendered":"Calculadora"},"content":{"rendered":"\n<div class=\"retirement-calculator\">\n  <h2>Calculadora de Planificaci\u00f3n de Retiro<\/h2>\n  <p class=\"subtitle\">Descubr\u00ed cu\u00e1nto necesit\u00e1s ahorrar por mes para jubilarte tranquilo.<\/p>\n\n  <div class=\"inputs\">\n    <div class=\"field\">\n      <label for=\"age\">Tu edad actual<\/label>\n      <input type=\"number\" id=\"age\" min=\"18\" max=\"80\" placeholder=\"Ej: 35\">\n    <\/div>\n    <div class=\"field\">\n      <label for=\"retirementAge\">\u00bfA qu\u00e9 edad te quer\u00e9s retirar?<\/label>\n      <input type=\"number\" id=\"retirementAge\" min=\"50\" max=\"85\" value=\"65\">\n    <\/div>\n    <div class=\"field\">\n      <label for=\"monthlyExpenses\">Jubilaci\u00f3n mensual deseada (USD)<\/label>\n      <input type=\"number\" id=\"monthlyExpenses\" min=\"100\" step=\"100\" placeholder=\"Ej: 3000\">\n    <\/div>\n\n    <button type=\"button\" id=\"calculateBtn\">Calcular mi plan<\/button>\n    <div class=\"error-message\" id=\"errorMessage\"><\/div>\n  <\/div>\n\n  <div class=\"results\" id=\"results\" style=\"display: none;\">\n    <div class=\"cards-grid\">\n      <div class=\"card\">\n        <h3>Capital necesario al retiro<\/h3>\n        <p id=\"requiredCapital\">\u2014<\/p>\n      <\/div>\n      <div class=\"card\">\n        <h3>Tiempo hasta el retiro<\/h3>\n        <p id=\"timeToRetirement\">\u2014<\/p>\n      <\/div>\n      <div class=\"card\">\n        <h3>Inversi\u00f3n mensual requerida<\/h3>\n        <p id=\"monthlyInvestment\">\u2014<\/p>\n      <\/div>\n    <\/div>\n\n    <canvas id=\"projectionChart\" height=\"100\"><\/canvas>\n\n    <p class=\"disclaimer\">\n      * Este c\u00e1lculo est\u00e1 basado en la regla del 4%, estimando una rentabilidad promedio del 6% anual. Proyecci\u00f3n simplificada, no es una promesa de rendimientos futuros; consult\u00e1 con un asesor financiero.\n    <\/p>\n  <\/div>\n<\/div>\n\n<!-- Cargar Chart.js -->\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n\n<style>\n  .retirement-calculator {\n    max-width: 800px;\n    margin: 30px auto;\n    font-family: system-ui, -apple-system, Arial, sans-serif;\n    background: #f8fafc;\n    padding: 32px;\n    border-radius: 16px;\n    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);\n  }\n\n  .retirement-calculator h2 {\n    text-align: center;\n    color: #1e293b;\n    margin-bottom: 8px;\n  }\n\n  .subtitle {\n    text-align: center;\n    color: #64748b;\n    margin-bottom: 32px;\n  }\n\n  .inputs {\n    display: grid;\n    gap: 16px;\n    margin-bottom: 24px;\n  }\n\n  .field {\n    display: flex;\n    flex-direction: column;\n  }\n\n  .field label {\n    margin-bottom: 6px;\n    font-weight: 600;\n    color: #374151;\n  }\n\n  .field input {\n    padding: 12px;\n    border: 1px solid #cbd5e1;\n    border-radius: 8px;\n    font-size: 16px;\n  }\n\n  .field input:focus {\n    outline: none;\n    border-color: #2563eb;\n    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);\n  }\n\n  #calculateBtn {\n    background: #2563eb;\n    color: white;\n    border: none;\n    padding: 14px 24px;\n    font-size: 16px;\n    font-weight: 600;\n    border-radius: 8px;\n    cursor: pointer;\n  }\n\n  #calculateBtn:hover {\n    background: #1d4ed8;\n  }\n\n  .error-message {\n    color: #dc2626;\n    font-size: 14px;\n    min-height: 20px;\n    margin-top: 8px;\n  }\n\n  .cards-grid {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n    gap: 16px;\n    margin: 32px 0;\n  }\n\n  .card {\n    background: white;\n    padding: 20px;\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);\n    text-align: center;\n  }\n\n  .card h3 {\n    color: #475569;\n    margin-bottom: 12px;\n    font-size: 16px;\n  }\n\n  .card p {\n    font-size: 24px;\n    font-weight: bold;\n    color: #1e293b;\n    margin: 0;\n  }\n\n  #projectionChart {\n    margin: 40px 0;\n  }\n\n  .disclaimer {\n    font-size: 14px;\n    color: #64748b;\n    text-align: center;\n    line-height: 1.5;\n  }\n\n  @media (max-width: 600px) {\n    .retirement-calculator {\n      padding: 20px;\n    }\n\n    .cards-grid {\n      grid-template-columns: 1fr;\n    }\n  }\n<\/style>\n\n<!-- Script principal - seguro para WordPress -->\n<script>\n  document.addEventListener(\"DOMContentLoaded\", function() {\n    const btn = document.getElementById(\"calculateBtn\");\n    const errorMsg = document.getElementById(\"errorMessage\");\n    const results = document.getElementById(\"results\");\n    const ANNUAL_RETURN = 0.06;\n    const SAFE_WITHDRAWAL_RATE = 0.04;\n    let chart = null;\n\n    function formatUSD(amount) {\n      return \"USD \" + Math.round(amount).toLocaleString(\"es-ES\");\n    }\n\n    function clearError() {\n      errorMsg.textContent = \"\";\n    }\n\n    function showError(message) {\n      errorMsg.textContent = message;\n    }\n    btn.addEventListener(\"click\", function() {\n      clearError();\n      const age = parseInt(document.getElementById(\"age\").value);\n      const retirementAge = parseInt(document.getElementById(\"retirementAge\").value);\n      const monthlyExpenses = parseFloat(document.getElementById(\"monthlyExpenses\").value);\n      if (isNaN(age) || isNaN(retirementAge) || isNaN(monthlyExpenses)) {\n        showError(\"Por favor, completa todos los campos.\");\n        return;\n      }\n      if (age < 18 || age >= retirementAge) {\n        showError(\"La edad actual debe ser menor que la edad de retiro.\");\n        return;\n      }\n      if (monthlyExpenses < 100) {\n        showError(\"Ingresa gastos mensuales realistas.\");\n        return;\n      }\n      const yearsToRetirement = retirementAge - age;\n      const monthsToRetirement = yearsToRetirement * 12;\n      const requiredCapital = (monthlyExpenses * 12) \/ SAFE_WITHDRAWAL_RATE;\n      const monthlyRate = ANNUAL_RETURN \/ 12;\n      let monthlyInvestment = requiredCapital \/ monthsToRetirement;\n      if (monthlyRate > 0) {\n        monthlyInvestment = requiredCapital * monthlyRate \/ (Math.pow(1 + monthlyRate, monthsToRetirement) - 1);\n      }\n      document.getElementById(\"requiredCapital\").textContent = formatUSD(requiredCapital);\n      document.getElementById(\"timeToRetirement\").textContent = yearsToRetirement + \" a\u00f1os\";\n      document.getElementById(\"monthlyInvestment\").textContent = formatUSD(monthlyInvestment);\n      results.style.display = \"block\";\n      \/\/ Gr\u00e1fico\n      const labels = [];\n      const data = [];\n      for (let m = 0; m <= monthsToRetirement; m += 12) {\n        const year = m \/ 12;\n        labels.push(\"A\u00f1o \" + year);\n        const balance = monthlyInvestment * (Math.pow(1 + monthlyRate, m) - 1) \/ monthlyRate;\n        data.push(Math.round(balance));\n      }\n      if (chart) chart.destroy();\n      const ctx = document.getElementById(\"projectionChart\").getContext(\"2d\");\n      chart = new Chart(ctx, {\n        type: \"line\",\n        data: {\n          labels: labels,\n          datasets: [{\n            label: \"Capital acumulado\",\n            data: data,\n            borderColor: \"#2563eb\",\n            backgroundColor: \"rgba(37, 99, 235, 0.1)\",\n            fill: true,\n            tension: 0.4\n          }]\n        },\n        options: {\n          responsive: true,\n          plugins: {\n            legend: {\n              display: false\n            }\n          },\n          scales: {\n            y: {\n              ticks: {\n                callback: function(value) {\n                  return \"USD \" + value.toLocaleString(\"es-ES\");\n                }\n              }\n            }\n          }\n        }\n      });\n    });\n  });\n<\/script>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-buttons has-custom-font-size has-medium-font-size is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-ec11c414 wp-block-buttons-is-layout-flex\" style=\"border-style:none;border-width:0px;border-radius:0px;padding-top:0;padding-bottom:0\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-medium-font-size has-custom-font-size wp-element-button\" href=\"https:\/\/wa.me\/1138970430\" style=\"border-width:7px;border-radius:11px\">S\u00f3mos especialistas en planificar Tu Retiro. Comencemos!<\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_joinchat":[],"footnotes":""},"class_list":["post-652","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/pages\/652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/comments?post=652"}],"version-history":[{"count":22,"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/pages\/652\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/pages\/652\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/serfinanciero.com\/index.php\/wp-json\/wp\/v2\/media?parent=652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}