/**
 * Loan installment calculator - [icredit_calculator] shortcode.
 */

.icredit-calc {
	--icredit-calc-red: #e11b22;
	--icredit-calc-red-dark: #cb181f;
	--icredit-calc-fill: #a9141a;
	--icredit-calc-text: #25292b;
	--icredit-calc-text-medium: #50585d;
	--icredit-calc-text-light: #6a757c;
	--icredit-calc-track: #f0f1f2;
	--icredit-calc-border: #d1d4d6;
	--icredit-calc-thumb: 34px;

	position: relative;
	box-sizing: border-box;
	width: 100%;
	padding: 30px;
	border: 1px solid #eceded;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 4px 24px rgba(37, 41, 43, 0.06);
	color: var(--icredit-calc-text);
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
}

.icredit-calc *,
.icredit-calc *::before,
.icredit-calc *::after {
	box-sizing: border-box;
}

.icredit-calc__field {
	margin-bottom: 24px;
}

/* Label, help icon and selected value */

.icredit-calc__head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
}

.icredit-calc .icredit-calc__label {
	display: inline-block;
	margin: 0;
	padding: 0;
	color: var(--icredit-calc-text-medium);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.4;
	vertical-align: baseline;
}

.icredit-calc .icredit-calc__help,
.icredit-calc .icredit-calc__help:focus {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #e9eaeb;
	box-shadow: none;
	color: var(--icredit-calc-text-light);
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.icredit-calc .icredit-calc__help:focus-visible,
.icredit-calc .is-tooltip-open .icredit-calc__help {
	background: var(--icredit-calc-red-dark);
	color: #fff;
}

.icredit-calc .icredit-calc__help:focus-visible {
	outline: 2px solid var(--icredit-calc-red-dark);
	outline-offset: 2px;
}

.icredit-calc__tooltip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: -14px;
	z-index: 20;
	width: 310px;
	max-width: calc(100vw - 32px);
	padding: 10px 12px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 6px 24px rgba(37, 41, 43, 0.16);
	color: var(--icredit-calc-text);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.7;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s, visibility 0.2s;
}

.icredit-calc__help:focus-visible + .icredit-calc__tooltip,
.is-tooltip-open .icredit-calc__tooltip {
	opacity: 1;
	visibility: visible;
}

@media (hover: hover) {
	.icredit-calc .icredit-calc__help:hover {
		background: var(--icredit-calc-red-dark);
		box-shadow: none;
		color: #fff;
	}

	.icredit-calc__help:hover + .icredit-calc__tooltip,
	.icredit-calc__tooltip:hover {
		opacity: 1;
		visibility: visible;
	}
}

.icredit-calc__pill {
	display: inline-block;
	flex: 0 0 auto;
	margin-left: auto;
	padding: 7px 12px;
	border-radius: 14px;
	background: var(--icredit-calc-red-dark);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 14px;
	white-space: nowrap;
}

/* Slider */

.icredit-calc__slider {
	position: relative;
	height: var(--icredit-calc-thumb);
}

.icredit-calc__track {
	position: absolute;
	top: 50%;
	right: 0;
	left: 0;
	height: 8px;
	margin-top: -4px;
	border-radius: 4px;
	background: var(--icredit-calc-track);
}

/* Marks and fill are positioned on the center of the thumb, which moves between half a thumb from each end. */
.icredit-calc__tick {
	position: absolute;
	top: 0;
	bottom: 0;
	left: calc(var(--icredit-calc-thumb) / 2 + (100% - var(--icredit-calc-thumb)) * var(--icredit-calc-tick));
	width: 3px;
	margin-left: -1.5px;
	background: var(--icredit-calc-border);
}

.icredit-calc__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: calc(var(--icredit-calc-thumb) / 2 + (100% - var(--icredit-calc-thumb)) * var(--icredit-calc-progress, 0));
	border-radius: 4px;
	background: var(--icredit-calc-fill);
}

.icredit-calc .icredit-calc__slider .icredit-calc__range[type="range"],
.icredit-calc .icredit-calc__slider .icredit-calc__range[type="range"]:focus {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	height: var(--icredit-calc-thumb);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: none;
	background: transparent;
	box-shadow: none;
	cursor: pointer;
}

.icredit-calc__range::-webkit-slider-runnable-track {
	height: var(--icredit-calc-thumb);
	border: 0;
	background: transparent;
}

.icredit-calc__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
	width: var(--icredit-calc-thumb);
	height: var(--icredit-calc-thumb);
	border: 2px solid var(--icredit-calc-red);
	border-radius: 50%;
	background: var(--icredit-calc-text-medium);
	box-shadow: inset 0 0 0 2px #fff;
	transition: box-shadow 0.2s;
}

.icredit-calc__range:focus-visible::-webkit-slider-thumb {
	box-shadow: inset 0 0 0 2px #fff, 0 0 0 4px rgba(225, 27, 34, 0.25);
}

.icredit-calc__range::-moz-range-track {
	height: var(--icredit-calc-thumb);
	border: 0;
	background: transparent;
}

.icredit-calc__range::-moz-range-progress {
	background: transparent;
}

.icredit-calc__range::-moz-range-thumb {
	box-sizing: border-box;
	width: var(--icredit-calc-thumb);
	height: var(--icredit-calc-thumb);
	border: 2px solid var(--icredit-calc-red);
	border-radius: 50%;
	background: var(--icredit-calc-text-medium);
	box-shadow: inset 0 0 0 2px #fff;
	transition: box-shadow 0.2s;
}

.icredit-calc__range:focus-visible::-moz-range-thumb {
	box-shadow: inset 0 0 0 2px #fff, 0 0 0 4px rgba(225, 27, 34, 0.25);
}

.icredit-calc__limits {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 14px;
	color: var(--icredit-calc-text-medium);
	font-size: 14px;
	line-height: 1.6;
}

/* Results */

.icredit-calc__results {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.icredit-calc__result {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 12px;
	border: 1px solid var(--icredit-calc-border);
	border-radius: 8px;
}

.icredit-calc__result-label {
	color: var(--icredit-calc-text-light);
	font-size: 13px;
	line-height: 1.4;
}

.icredit-calc__result-value {
	color: var(--icredit-calc-text);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
}

.icredit-calc__result-value--accent {
	color: var(--icredit-calc-red);
}

.icredit-calc .icredit-calc__note {
	margin: 24px 0 0;
	color: var(--icredit-calc-text-light);
	font-size: 14px;
	line-height: 1.6;
}

@media (max-width: 480px) {
	.icredit-calc {
		padding: 20px 16px;
	}

	.icredit-calc__results {
		gap: 10px;
	}

	.icredit-calc__result {
		padding: 10px;
	}

	.icredit-calc__result-value {
		font-size: 15px;
	}
}
