.calc-container {
max-width: 480px;
margin: 40px auto;
width: 100%;
background: #141a24;
border-radius: 28px;
padding: 36px 32px 40px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.04);
color: #f0f2f7;
font-family: ‘Inter’, -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, sans-serif;
}
.calc-container .calc-title { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.calc-container .calc-subtitle { font-size: 13px; color: #6b7a90; margin-bottom: 30px; }
.calc-container .input-group { margin-bottom: 24px; }
.calc-container .input-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: #c8d0dc; margin-bottom: 6px; }
.calc-container .input-label span:last-child { font-weight: 400; color: #6b7a90; }
.calc-container .input-field { width: 100%; padding: 14px 16px; background: #0f151f; border: 1px solid #262f3d; border-radius: 14px; color: #f0f2f7; font-size: 18px; font-weight: 500; outline: none; transition: all 0.2s ease; margin-top: 6px; }
.calc-container .input-field:focus { border-color: #4a7cf7; box-shadow: 0 0 0 3px rgba(74, 124, 247, 0.15); background: #131b28; }
.calc-container .range-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: #262f3d; border-radius: 2px; outline: none; margin: 8px 0 4px; }
.calc-container .range-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: #4a7cf7; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 4px rgba(74, 124, 247, 0.15); transition: 0.15s; }
.calc-container .range-slider::-webkit-slider-thumb:hover { transform: scale(1.1); background: #5f8af8; }
.calc-container .range-slider::-moz-range-thumb { width: 18px; height: 18px; background: #4a7cf7; border: none; border-radius: 50%; cursor: pointer; }
.calc-container .results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 30px 0 28px; }
.calc-container .result-card { background: #0f151f; border: 1px solid #1e2836; border-radius: 16px; padding: 18px 16px 16px; text-align: center; }
.calc-container .result-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7a90; margin-bottom: 6px; }
.calc-container .result-card .value { font-size: 22px; font-weight: 600; color: #f0f2f7; }
.calc-container .result-card .value.accent { color: #4a7cf7; }
.calc-container .btn-primary { width: 100%; padding: 16px; background: #4a7cf7; border: none; border-radius: 16px; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s ease, transform 0.1s; }
.calc-container .btn-primary:hover { background: #5f8af8; }
.calc-container .btn-primary:active { transform: scale(0.98); }
.calc-container input[type=number]::-webkit-inner-spin-button,
.calc-container input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.calc-container input[type=number] { -moz-appearance: textfield; }
@media (max-width: 440px) { .calc-container { padding: 28px 18px 32px; margin: 20px 16px; } .calc-container .results-grid { gap: 10px; } .calc-container .result-card .value { font-size: 18px; } }
Кредитный калькулятор
Рассчитайте ежемесячный платёж за 2 секунды
Ежемесячный платёж
33 214 ₽
Общая стоимость кредита
1 195 704 ₽
(function() {
const amountSlider = document.getElementById(‘amountSlider’);
const amountInput = document.getElementById(‘amountInput’);
const amountDisplay = document.getElementById(‘amountDisplay’);
const termSlider = document.getElementById(‘termSlider’);
const termInput = document.getElementById(‘termInput’);
const termDisplay = document.getElementById(‘termDisplay’);
const rateSlider = document.getElementById(‘rateSlider’);
const rateInput = document.getElementById(‘rateInput’);
const rateDisplay = document.getElementById(‘rateDisplay’);
const monthlyPaymentEl = document.getElementById(‘monthlyPayment’);
const totalOverpaymentEl = document.getElementById(‘totalOverpayment’);
const totalCostEl = document.getElementById(‘totalCost’); function calculate() {
const amount = parseFloat(amountInput.value) || 0;
const termMonths = parseFloat(termInput.value) || 1;
const annualRate = parseFloat(rateInput.value) || 0;
const monthlyRate = (annualRate / 100) / 12;
let monthlyPayment = 0;
if (monthlyRate === 0) {
monthlyPayment = amount / termMonths;
} else {
const factor = Math.pow(1 + monthlyRate, termMonths);
monthlyPayment = amount * (monthlyRate * factor) / (factor — 1);
}
const totalPayment = monthlyPayment * termMonths;
const overpayment = totalPayment — amount; monthlyPaymentEl.textContent = Math.round(monthlyPayment).toLocaleString(‘ru-RU’) + ‘ ₽’;
totalOverpaymentEl.textContent = Math.round(overpayment).toLocaleString(‘ru-RU’) + ‘ ₽’;
totalCostEl.textContent = Math.round(totalPayment).toLocaleString(‘ru-RU’) + ‘ ₽’;
} function syncSliderInput(slider, input, display, formatter) {
const update = () => {
const val = slider.value;
input.value = val;
if (display) display.textContent = formatter ? formatter(val) : val;
calculate();
};
slider.addEventListener(‘input’, update);
input.addEventListener(‘input’, function() {
let val = parseFloat(this.value);
if (isNaN(val)) return;
const min = parseFloat(slider.min);
const max = parseFloat(slider.max);
const step = parseFloat(slider.step) || 1;
if (val max) val = max;
val = Math.round(val / step) * step;
slider.value = val;
this.value = val;
if (display) display.textContent = formatter ? formatter(val) : val;
calculate();
});
const initVal = slider.value;
input.value = initVal;
if (display) display.textContent = formatter ? formatter(initVal) : initVal;
} const amountFormatter = (val) => Number(val).toLocaleString(‘ru-RU’) + ‘ ₽’;
const termFormatter = (val) => val + ‘ мес.’;
const rateFormatter = (val) => val + ‘ %’; syncSliderInput(amountSlider, amountInput, amountDisplay, amountFormatter);
syncSliderInput(termSlider, termInput, termDisplay, termFormatter);
syncSliderInput(rateSlider, rateInput, rateDisplay, rateFormatter);
document.getElementById(‘calcBtn’).addEventListener(‘click’, calculate);
calculate();
})();