/**
 * ROI-калькулятор. Все селекторы заскоуплены под .roi-calc,
 * чтобы общие имена классов не конфликтовали с темой и Tailwind.
 */

.roi-calc {
	/* Акцент оставлен фирменным бордовым сайта (#A30C33) — тот же цвет,
	   что использован по всей теме (кнопки, hover, брендовая лента), а не
	   #9E0B36/#A11135 из референса: так калькулятор не выбивается из общей
	   палитры сайта соседними секциями. */
	--accent-color: #A30C33;
	--accent-hover: #7F0827;
	--card-bg: #F7EAEE;
	--text-primary: #0E1526;
	--text-secondary: #717171;
	--bg-primary: #F6F3F1;
	--bg-secondary: #F6F3F1;
	--border-color: #E6EBF3;
	--white: #ffffff;
	--shadow: 0 10px 40px rgba(11, 18, 32, 0.04);
	--shadow-hover: 0 20px 40px rgba(163, 12, 51, 0.06);
	--green-text: #1B856D;
	--button-active-bg: #FAEAEF;
	--button-border: #E7CDD5;
	--slider-track: #9F9F9F;
	--thumb-color: #A30C33;

	font-family: 'TTInterfaces', Arial, sans-serif;
	background: var(--white);
	color: var(--text-primary);
	line-height: 1.6;
	padding: 40px 20px;
}

.roi-calc *,
.roi-calc *::before,
.roi-calc *::after {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

.roi-calc .container {
	max-width: 1200px;
	margin: 0 auto;
}

/* Header */
.roi-calc .header {
	text-align: center;
	margin-bottom: 28px;
}
.roi-calc .header h1,
.roi-calc .header h2 { /* h2: на главной один h1 — в hero */
	font-size: clamp(1.8rem, 4vw, 2.3rem);
	font-weight: 700;
	color: var(--text-primary);
	line-height: 1.3;
	max-width: 800px;
	margin: 0 auto;
	letter-spacing: -0.01em;
}

/* Calculator Layout */
.roi-calc .calculator-wrapper {
	display: grid;
	grid-template-columns: 1.1fr 0.9fr;
	gap: 0;
	background: var(--white);
	border-radius: 24px;
	overflow: hidden;
	align-items: stretch;
	/* Пунктирная обводка — серая, тонкая, с мелким шагом (тоньше рамка
	   даёт более мелкий пунктир — так браузер масштабирует dash-паттерн
	   от border-width). */
	border: 1px dashed #9CA3AF;
}
@media (max-width: 960px) {
	.roi-calc .calculator-wrapper { grid-template-columns: 1fr; }
}

/* Left Column - Inputs */
.roi-calc .inputs-section {
	padding: 32px;
	background: var(--white);
	display: flex;
	flex-direction: column;
	/* Единственный ребёнок (обёртка title+инпутов) короче правой колонки
	   (там графики/таблица), а justify-content: space-between с одним
	   элементом не даёт эффекта — весь пустой остаток уезжал вниз.
	   center делит его пополам сверху/снизу, внизу остаётся меньше
	   пустого белого поля. */
	justify-content: center;
}
@media (max-width: 600px) {
	.roi-calc .inputs-section { padding: 20px; }
}
/* Сдвигаем заголовок «Входные параметры» чуть выше центра — без ухода к
   flex-start, который снова оставлял слишком много пустого места снизу. */
.roi-calc .inputs-section__body { margin-top: -28px; }
.roi-calc .section-title {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: 30px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--border-color);
}
.roi-calc .input-group { margin-bottom: 22px; }
.roi-calc .input-group:last-of-type { margin-bottom: 0; }
.roi-calc .input-label-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}
.roi-calc .input-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--text-primary);
}
.roi-calc .input-value-display {
	font-size: 0.9rem;
	font-weight: 700;
	color: #000;
	background: #F6F3F1;
	padding: 4px 12px;
	border-radius: 8px;
	border: 1px solid #EFEEED;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}
.roi-calc .info-icon-wrapper {
	position: relative;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.roi-calc .info-icon {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 1.5px solid var(--text-secondary);
	color: var(--text-secondary);
	font-size: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: help;
	background: transparent;
	font-weight: bold;
	transition: all 0.2s ease;
}
.roi-calc .info-icon-wrapper:hover .info-icon {
	border-color: var(--accent-color);
	color: var(--accent-color);
	background: var(--button-active-bg);
}
.roi-calc .tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	background: var(--text-primary);
	color: white;
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 0.8rem;
	font-weight: 400;
	white-space: normal;
	text-align: left;
	line-height: 1.5;
	letter-spacing: 0.03em;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
	margin-bottom: 8px;
	z-index: 100;
	width: 320px;
	max-width: 320px;
	box-shadow: 0 10px 25px rgba(11, 18, 32, 0.15);
}
.roi-calc .tooltip strong {
	font-weight: 700;
	/* TTInterfaces не содержит Bold (максимум — Medium), поэтому для этих
	   меток усиливаем насыщенность искусственно — только внутри тултипа.
	   Дублирующая тень «съедает» межбуквенные просветы при мелком кегле —
	   компенсируем это увеличенным трекингом, иначе текст слипается. */
	text-shadow: 0.03em 0 0 currentColor, -0.03em 0 0 currentColor;
	letter-spacing: 0.09em;
}
.roi-calc .tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--text-primary);
}
.roi-calc .info-icon-wrapper:hover .tooltip { opacity: 1; visibility: visible; }

.roi-calc .slider-container {
	display: flex;
	align-items: center;
	gap: 0;
	position: relative;
	padding: 7px 0;
}
.roi-calc .slider {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 3px;
	background: linear-gradient(to right, var(--accent-color) 0%, var(--accent-color) var(--progress, 50%), #EDEBE9 var(--progress, 50%), #EDEBE9 100%);
	border-radius: 3px;
	outline: none;
	margin: 0;
	cursor: pointer;
}
.roi-calc .slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 12px;
	height: 12px;
	background: var(--thumb-color);
	border-radius: 50%;
	cursor: pointer;
	transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.roi-calc .slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.roi-calc .slider::-moz-range-thumb {
	width: 12px;
	height: 12px;
	background: var(--thumb-color);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: transform 0.15s ease;
}
.roi-calc .slider::-moz-range-thumb:hover { transform: scale(1.15); }

/* Шкала под слайдером: 4 точки-деления + подписи значений (референс) —
   чисто декоративные, к состоянию слайдера не привязаны. */
.roi-calc .slider-ticks {
	display: flex;
	justify-content: space-between;
	margin-top: 6px;
}
.roi-calc .slider-tick {
	position: relative;
	font-size: 0.72rem;
	font-weight: 500;
	color: var(--text-secondary);
}
.roi-calc .slider-tick::before {
	content: '';
	position: absolute;
	top: -14px;
	left: 50%;
	transform: translateX(-50%);
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: #EDEBE9; /* цвет серой части дорожки слайдера */
}
.roi-calc .slider-tick:first-child { text-align: left; }
.roi-calc .slider-tick:first-child::before { left: 0; transform: none; }
.roi-calc .slider-tick:last-child { text-align: right; }
.roi-calc .slider-tick:last-child::before { left: auto; right: 0; transform: none; }

/* Табы-переключатели: сегмент-контрол на светло-серой «дорожке», активный
   сегмент — белая табличка с мягкой тенью (референс — переключатель
   интервалов 15m/30m/45m/1h). Строка «название контрола — табы» — в одну
   линию, табы прижаты к правому краю (см. .input-group--inline). */
.roi-calc .input-group--inline {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
}
.roi-calc .input-group--inline .input-label { flex-shrink: 0; }
.roi-calc .button-group {
	display: flex;
	gap: 2px;
	background: #EDEBE9;
	border-radius: 10px;
	padding: 3px;
	width: 100%;
}
.roi-calc .input-label + .button-group { margin-top: 10px; }
.roi-calc .input-group--inline .input-label + .button-group {
	margin-top: 0;
	width: auto;
}
.roi-calc .toggle-btn {
	position: relative;
	padding: 6px 16px;
	border: none;
	border-radius: 7px;
	background: transparent;
	font-size: 0.88rem;
	font-weight: 500;
	color: var(--text-secondary);
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
	text-align: center;
}
.roi-calc .toggle-btn:hover { color: var(--text-primary); }
.roi-calc .toggle-btn.active {
	background: var(--white);
	color: var(--text-primary);
	font-weight: 600;
	box-shadow: 0 1px 3px rgba(11, 18, 32, 0.12), 0 1px 2px rgba(11, 18, 32, 0.06);
}

/* Right Column - Results */
.roi-calc .results-section {
	padding: 32px;
	background: var(--bg-secondary);
	display: flex;
	flex-direction: column;
	border-left: 1px solid var(--border-color);
}
@media (max-width: 960px) {
	.roi-calc .results-section { border-left: none; border-top: 1px solid var(--border-color); }
}
@media (max-width: 600px) {
	.roi-calc .results-section { padding: 20px; }
}

.roi-calc .npv-display {
	margin-bottom: 18px;
	padding: 18px 24px;
}
.roi-calc .npv-label {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--text-secondary);
	letter-spacing: 0.05em;
	margin-bottom: 8px;
	padding-bottom: 0;
	border-bottom: none;
}
.roi-calc .npv-value-container { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.roi-calc .npv-value {
	font-size: clamp(2.4rem, 7vw, 3.5rem);
	font-weight: 700;
	line-height: 1;
	color: var(--text-primary);
	letter-spacing: -0.02em;
	white-space: nowrap;
}
.roi-calc .npv-currency { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 600; color: var(--text-primary); white-space: nowrap; }

.roi-calc .metrics-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-bottom: 18px;
}
@media (max-width: 500px) {
	.roi-calc .metrics-grid { grid-template-columns: 1fr; }
}
.roi-calc .metric-card {
	background: #F6F3F1;
	padding: 15px 14px;
	border-radius: 16px;
	text-align: center;
}
.roi-calc .metric-label { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.3; }
.roi-calc .metric-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }

.roi-calc .table-container { flex: 1; overflow: auto; }
.roi-calc .table-title { font-size: 1rem; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.roi-calc .dynamics-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 15px; }
.roi-calc .dynamics-table th {
	background: transparent;
	padding: 8px 10px;
	text-align: left;
	font-weight: 700;
	color: var(--text-secondary);
	font-size: 0.78rem;
	letter-spacing: 0.04em;
	border-bottom: 1px solid var(--border-color);
}
.roi-calc .dynamics-table td {
	padding: 10px 10px;
	border: none;
	color: var(--text-primary);
	background: var(--white);
	transition: background 0.2s ease;
	white-space: nowrap; /* не переносим "млн ₽" на новую строку */
}
/* На узких экранах даём таблице горизонтальную прокрутку вместо переноса */
.roi-calc .table-container { -webkit-overflow-scrolling: touch; }
.roi-calc .dynamics-table tr td:first-child {
	border-top-left-radius: 10px;
	border-bottom-left-radius: 10px;
	font-weight: 700;
	padding-left: 14px;
}
.roi-calc .dynamics-table tr td:last-child {
	border-top-right-radius: 10px;
	border-bottom-right-radius: 10px;
	padding-right: 14px;
}
.roi-calc .dynamics-table tbody tr {
	box-shadow: 0 2px 4px rgba(11, 18, 32, 0.01);
	transition: transform 0.2s ease;
}
.roi-calc .dynamics-table tbody tr:hover td { background: #E8F6EC; } /* светло-зелёный ховер */
.roi-calc .dynamics-table tbody tr:hover { transform: translateY(-1px); }
.roi-calc .dynamics-table .positive { color: var(--green-text); font-weight: 600; }

/* Contact Form */
.roi-calc .contact-section {
	margin-top: 20px;
	padding: 24px 32px;
	background: var(--white);
	border-radius: 24px;
}
@media (max-width: 600px) {
	.roi-calc .contact-section { padding: 20px; }
}
.roi-calc .contact-form {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 12px;
	max-width: 650px;
	margin: 0 auto;
}
@media (max-width: 600px) {
	.roi-calc .contact-form { flex-direction: column; }
}
.roi-calc .email-input {
	flex: 1;
	width: 100%;
	padding: 10px 18px;
	border: 1.5px solid var(--border-color);
	border-radius: 24px;
	font-size: 0.85rem;
	font-family: inherit;
	background: var(--bg-secondary);
	transition: all 0.25s ease;
}
.roi-calc .email-input:focus {
	outline: none;
	border-color: var(--accent-color);
	background: var(--white);
	box-shadow: 0 0 0 4px rgba(163, 12, 51, 0.1);
}
.roi-calc .email-input::placeholder { color: var(--text-secondary); }
.roi-calc .submit-btn {
	flex-shrink: 0;
	width: auto;
	padding: 11px 24px;
	background-color: var(--accent-color);
	/* фирменный градиент слева направо: #C72329 (1/3) -> #A30C33 */
	background-image: linear-gradient(90deg, #C72329 0%, #A30C33 33%, #A30C33 100%);
	background-repeat: no-repeat;
	background-position: left center;
	background-size: 0% 100%;
	color: white;
	border: none;
	border-radius: 24px;
	font-size: 0.85rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(163, 12, 51, 0.2);
	transition: background-size 0.35s ease, box-shadow 0.25s ease, transform 0.15s ease;
}
@media (max-width: 600px) {
	.roi-calc .submit-btn { width: 100%; }
}
.roi-calc .submit-btn:hover {
	background-size: 100% 100%;
	box-shadow: 0 6px 20px rgba(163, 12, 51, 0.35);
	transform: translateY(-1px);
}
.roi-calc .submit-btn:active { transform: translateY(0); }
.roi-calc .submit-btn.success { background-image: none; background-color: #2d7d32; box-shadow: 0 4px 15px rgba(45, 125, 50, 0.2); }
.roi-calc .submit-btn:disabled { cursor: not-allowed; opacity: 0.9; }

/* Animations */
@keyframes roiFadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}
.roi-calc .metric-card,
.roi-calc .npv-display,
.roi-calc .dynamics-table tr {
	animation: roiFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.roi-calc .value-change { animation: roiPulse 0.3s ease; }
@keyframes roiPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.03); }
	100% { transform: scale(1); }
}
