/**
 * ROBIN Lead Form — мультишаговая форма.
 * Токены --robin-* берутся из темы (если заданы), иначе используются fallback-значения,
 * поэтому плагин выглядит корректно с любой темой (в т.ч. Kadence).
 * Стиль: минимализм Stripe / Typeform.
 */

.robin-lead {
	--lead-radius: var(--robin-radius, 14px);
	--lead-accent: var(--robin-accent, #2f6bff);
	--lead-accent-2: var(--robin-accent-2, #17d2c2);
	--lead-text: var(--robin-text, #0e1526);
	--lead-muted: var(--robin-muted, #6b7a96);
	--lead-bg-light: var(--robin-bg-light, #f5f7fb);
	background: var(--lead-bg-light);
	padding: 56px 20px;
}

.robin-lead__wrap {
	max-width: 720px;
	margin: 0 auto;
	background: #fff;
	border: 1px solid #e6ebf3;
	border-radius: calc(var(--lead-radius) + 6px);
	box-shadow: 0 24px 60px -30px rgba(11, 18, 32, 0.35);
	padding: 40px;
}

.robin-lead__head { text-align: center; margin-bottom: 28px; }
.robin-lead__title { font-size: clamp(1.4rem, 3.5vw, 2rem); margin: 0 0 8px; }
.robin-lead__subtitle { color: var(--lead-muted); margin: 0; font-size: 0.95rem; }

/* --- Прогресс --- */
.robin-lead__progress {
	height: 6px;
	background: #eef2f9;
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 10px;
}
.robin-lead__progress-bar {
	height: 100%;
	width: 33.33%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--lead-accent), var(--lead-accent-2));
	transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.robin-lead__step-label {
	text-align: right;
	font-size: 0.8rem;
	color: var(--lead-muted);
	margin: 0 0 24px;
	font-variant-numeric: tabular-nums;
}

/* --- Шаги: анимация fade/slide --- */
.robin-lead__step {
	border: 0;
	padding: 0;
	margin: 0;
	display: none;
	opacity: 0;
	transform: translateY(8px);
}
.robin-lead__step.is-active {
	display: block;
	/* Опорное видимое состояние задаём НАПРЯМУЮ, а не через анимацию,
	   иначе при prefers-reduced-motion (анимация off) контент остаётся
	   невидимым (opacity:0). Анимация — только украшение поверх. */
	opacity: 1;
	transform: none;
	animation: robin-fade-in 0.35s ease;
}
.robin-lead__step.is-leaving {
	display: block;
	animation: robin-fade-out 0.2s ease forwards;
}
@keyframes robin-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes robin-fade-out {
	from { opacity: 1; transform: translateY(0); }
	to   { opacity: 0; transform: translateY(-8px); }
}
.robin-lead__legend {
	font-family: var(--robin-font-head, inherit);
	font-weight: 700;
	font-size: 1.15rem;
	margin-bottom: 18px;
	padding: 0;
}

/* --- Карточки выбора (шаг 1 и 2) --- */
.robin-lead__cards { display: grid; gap: 12px; }
.robin-card {
	display: flex;
	flex-direction: column;
	gap: 4px;
	text-align: left;
	padding: 18px 20px;
	border: 1.5px solid #e0e6f0;
	border-radius: var(--lead-radius);
	background: #fff;
	cursor: pointer;
	transition: border-color 0.18s, box-shadow 0.18s, transform 0.08s;
	font-family: inherit;
}
.robin-card:hover { border-color: var(--lead-accent); }
.robin-card:active { transform: scale(0.995); }
.robin-card.is-selected {
	border-color: var(--lead-accent);
	box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.15);
}
.robin-card:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.35);
}
.robin-card__title { font-weight: 600; color: var(--lead-text); }
.robin-card__desc { font-size: 0.85rem; color: var(--lead-muted); }

/* --- Поля ввода (шаг 3) --- */
.robin-lead__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}
.robin-field { display: flex; flex-direction: column; }
.robin-field__label { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.robin-req { color: #e5484d; }
.robin-field__input {
	font: inherit;
	padding: 12px 14px;
	border: 1.5px solid #e0e6f0;
	border-radius: 10px;
	transition: border-color 0.18s, box-shadow 0.18s;
	width: 100%;
}
.robin-field__input:focus {
	outline: none;
	border-color: var(--lead-accent);
	box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.15);
}
.robin-field.is-invalid .robin-field__input { border-color: #e5484d; }
.robin-field__error {
	color: #e5484d;
	font-size: 0.8rem;
	margin-top: 6px;
	min-height: 1em;
}
.robin-field__hint {
	color: #b45309;
	font-size: 0.8rem;
	margin-top: 6px;
}

/* --- Согласие --- */
.robin-consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin-top: 20px;
	font-size: 0.88rem;
	color: var(--lead-text);
	cursor: pointer;
}
.robin-consent input { margin-top: 3px; flex: 0 0 auto; width: 18px; height: 18px; }

/* --- Навигация --- */
.robin-lead__nav {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-top: 28px;
}
.robin-lead__nav [data-next],
.robin-lead__nav [data-submit] { margin-left: auto; }

/* Кнопка (собственная, чтобы не зависеть от темы) */
.robin-lead .robin-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 22px;
	border-radius: var(--lead-radius);
	background: var(--lead-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	border: 0;
	cursor: pointer;
	text-decoration: none;
	transition: opacity 0.15s;
}
.robin-lead .robin-btn:hover { opacity: 0.92; }
.robin-btn--ghost {
	background: transparent;
	color: var(--lead-muted);
	border: 1.5px solid #e0e6f0;
}
.robin-btn--ghost:hover { color: var(--lead-text); }
.robin-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Спиннер на кнопке отправки */
.robin-btn__spinner {
	display: none;
	width: 16px;
	height: 16px;
	margin-left: 8px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: robin-spin 0.7s linear infinite;
}
.robin-btn.is-loading .robin-btn__spinner { display: inline-block; }
.robin-btn.is-loading { pointer-events: none; opacity: 0.85; }
@keyframes robin-spin { to { transform: rotate(360deg); } }

/* --- Ошибка отправки (общий баннер) --- */
.robin-lead__form-error {
	color: #e5484d;
	font-size: 0.88rem;
	margin-top: 14px;
	text-align: center;
	min-height: 1em;
}

/* --- Экран успеха --- */
.robin-lead__success { text-align: center; padding: 32px 12px; animation: robin-fade-in 0.4s ease; }
.robin-lead__success-icon {
	width: 64px; height: 64px;
	margin: 0 auto 16px;
	display: grid; place-items: center;
	border-radius: 50%;
	background: rgba(23, 210, 194, 0.15);
	color: #0aa192;
	font-size: 2rem;
}

/* --- Адаптив --- */
@media (max-width: 560px) {
	.robin-lead__wrap { padding: 24px; }
	.robin-lead__grid { grid-template-columns: 1fr; }
	.robin-lead__step-label { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
	.robin-lead__step,
	.robin-lead__progress-bar,
	.robin-btn__spinner { animation: none !important; transition: none !important; }
}
