/* LANDINGI-805: попап заявки на мобильный тариф (#popup-mobile).
   Макет: Figma BPpJxwCBb5XaJ243JC5mAQ, лист 1420-4421, состояния элементов 1443-3379.
   Базовые .popup / .popup__wrapper / .popup__close — из popup-application.css,
   здесь только переопределения под макет. Desktop-компоновка с 768 px. */

.popup-mobile {
	border: none;
	--pm-text: #282828;
	--pm-muted: #626C77;
	--pm-placeholder: #A0A0A8;
	--pm-border: #DCE0E9;
	--pm-border-hover: #C8CED9;
	--pm-tab-bg: #28303F;
	--pm-bg-soft: #F0F3F5;
	--pm-bg-softer: #F6F8F9;
	--pm-yellow: #FFD93A;
	--pm-yellow-hover: #FFC800;
	--pm-yellow-active: #E6B400;
	--pm-focus: #0077FF;
	--pm-error: #E53935;
}

.popup-mobile .popup__wrapper {
	width: calc(100% - 24px);
	max-width: 336px;
	max-height: calc(100% - 24px);
	overflow-y: auto;
	padding: 20px 12px 24px;
	top: 50%;
	border: none;
	border-radius: 20px;
	box-shadow: 0 16px 48px rgba(40, 48, 63, 0.16);
	gap: 24px;
}

@media screen and (min-width: 768px) {
	.popup-mobile .popup__wrapper {
		width: 532px;
		max-width: 532px;
		padding: 24px 32px 32px;
	}
}

/* Попап фокусируется программно при открытии на мобильном (чтобы Tab не ушёл
   на страницу и не поднялась клавиатура) — рамку от этого не показываем */
.popup-mobile .popup__wrapper:focus {
	outline: none;
}

/* --- Крестик: существующий компонент сайта, только позиция под шапку --- */

.popup-mobile .popup__close {
	top: 20px;
	right: 12px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.popup-mobile .popup__close img {
	width: 14px;
	height: 14px;
}

@media screen and (min-width: 768px) {
	.popup-mobile .popup__close {
		top: 24px;
		right: 32px;
	}
}

/* --- Шапка: название, цена, старая цена, «с N месяца» --- */

.popup-mobile__header {
	display: flex;
	flex-direction: column;
	gap: 4px;
	/* место под крестик 32px + отступ 16 — название переносится, не наезжая */
	padding-right: 48px;
}

.popup-mobile .popup__title {
	margin: 0;
	font-size: 20px;
	line-height: 24px;
	font-weight: 500;
	text-align: left;
	color: var(--pm-text);
	word-break: break-word;
}

.popup-mobile__price-row {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.popup-mobile__price {
	font-size: 20px;
	line-height: 24px;
	font-weight: 700;
	color: var(--pm-text);
}

.popup-mobile__old-price {
	font-size: 16px;
	line-height: 22px;
	font-weight: 300;
	color: var(--pm-muted);
	text-decoration: line-through;
}

.popup-mobile__price-after {
	font-size: 14px;
	line-height: 18px;
	font-weight: 300;
	color: var(--pm-muted);
}

@media screen and (min-width: 768px) {
	.popup-mobile .popup__title,
	.popup-mobile__price {
		font-size: 24px;
		line-height: 28px;
	}
}

/* --- Тело: CF7-форма + согласие --- */

.popup-mobile__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.popup-mobile .wpcf7 form p {
	margin: 0;
}

.popup-mobile .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
}

.popup-mobile__form {
	display: flex;
	flex-direction: column;
}

/* CF7 (wpautop) оборачивает текст лейбла в <p>, а style.css `* { color }`
   перебивает наследование — цвет задаём и на потомков */
.popup-mobile__label,
.popup-mobile__label * {
	font-size: 14px;
	line-height: 18px;
	font-weight: 300;
	color: var(--pm-muted);
}

.popup-mobile__label {
	margin-bottom: 8px;
}

/* --- Табы «новая сим-карта» / «перенести номер» (CF7 radio) --- */

.popup-mobile .wpcf7-radio.popup-mobile__radio {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-bottom: 20px;
}

/* CF7 без use_label_element рендерит input + span без <label>; с опцией —
   оборачивает в <label>. Кликабельный контейнер — .wpcf7-list-item в обоих случаях
   (клик по нему переключает радио в JS), стили состояний тоже на нём. */
.popup-mobile .popup-mobile__radio .wpcf7-list-item {
	margin: 0;
	display: block;
	position: relative;
	cursor: pointer;
}

.popup-mobile .popup-mobile__radio label {
	display: block;
	cursor: pointer;
}

.popup-mobile .popup-mobile__radio input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.popup-mobile .popup-mobile__radio .wpcf7-list-item-label {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 12px;
	border-radius: 12px;
	border: 1px solid var(--pm-border);
	background: #fff;
	font-size: 14px;
	line-height: 18px;
	font-weight: 300;
	color: var(--pm-text);
	white-space: nowrap;
	transition: background-color .15s, border-color .15s, color .15s;
}

@media screen and (min-width: 768px) {
	.popup-mobile .popup-mobile__radio .wpcf7-list-item-label {
		font-size: 16px;
		line-height: 22px;
	}
}

/* Запас по ширине — на 320 px тексты ложатся впритык; при переполнении уменьшаем кегль */
@media screen and (max-width: 340px) {
	.popup-mobile .popup-mobile__radio .wpcf7-list-item-label {
		font-size: 13px;
	}
}

.popup-mobile .popup-mobile__radio .wpcf7-list-item:hover .wpcf7-list-item-label {
	background: var(--pm-bg-softer);
	border-color: var(--pm-border-hover);
}

.popup-mobile .popup-mobile__radio .wpcf7-list-item:active .wpcf7-list-item-label {
	background: var(--pm-bg-soft);
}

.popup-mobile .popup-mobile__radio input:checked + .wpcf7-list-item-label {
	background: var(--pm-tab-bg);
	border-color: var(--pm-tab-bg);
	color: #fff;
}

.popup-mobile .popup-mobile__radio .wpcf7-list-item:hover input:checked + .wpcf7-list-item-label {
	background: #222731;
	border-color: #222731;
}

.popup-mobile .popup-mobile__radio .wpcf7-list-item:active input:checked + .wpcf7-list-item-label {
	background: #191C22;
	border-color: #191C22;
}

.popup-mobile .popup-mobile__radio input:focus-visible + .wpcf7-list-item-label {
	outline: 2px solid var(--pm-text);
	outline-offset: 2px;
}

/* --- Поля --- */

.popup-mobile .input-wrapper {
	position: relative;
	margin-bottom: 12px;
}

.popup-mobile .t-input {
	display: block;
	width: 100%;
	height: 52px;
	padding: 0 16px;
	border: 1px solid var(--pm-border);
	border-radius: 12px;
	background: #fff;
	/* block.css задаёт .t-input / .t-submit шрифт OfficinaSerif (Tilda) — в попапе Beeline Sans */
	font-family: 'Beeline Sans', sans-serif;
	font-size: 16px;
	line-height: 22px;
	font-weight: 300;
	color: var(--pm-text);
	outline: none;
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
	-webkit-appearance: none;
	appearance: none;
}

.popup-mobile .t-input::placeholder {
	color: var(--pm-placeholder);
	opacity: 1;
}

.popup-mobile .t-input:hover {
	border-color: var(--pm-border-hover);
}

/* 1.5px обводка — через box-shadow поверх 1px border, чтобы поле не «дёргалось» */
.popup-mobile .t-input:focus {
	border-color: var(--pm-focus);
	box-shadow: 0 0 0 0.5px var(--pm-focus);
}

/* Ошибка приоритетнее фокуса: красная обводка остаётся, синяя не показывается */
.popup-mobile .input-wrapper.is-error .t-input,
.popup-mobile .input-wrapper.is-error .t-input:focus,
.popup-mobile .input-wrapper.is-error .t-input:hover {
	border-color: var(--pm-error);
	box-shadow: 0 0 0 0.5px var(--pm-error);
}

.popup-mobile__field-error {
	display: none;
	margin-top: 4px;
	font-size: 12px;
	line-height: 16px;
	font-weight: 300;
	color: var(--pm-error);
}

.popup-mobile .input-wrapper.is-error .popup-mobile__field-error {
	display: block;
}

/* Свои подсказки CF7 и стандартный вывод ответа — не показываем */
.popup-mobile .wpcf7-not-valid-tip,
.popup-mobile .wpcf7-response-output {
	display: none !important;
}

/* --- Блок «Не удалось отправить заявку» --- */

.popup-mobile__send-error {
	display: none;
	position: relative;
	padding: 12px 12px 12px 40px;
	/* поле → блок 12, блок → кнопка 4 + 12 = 16 */
	margin: 0 0 4px;
	border-radius: 12px;
	background: rgba(229, 57, 53, 0.08);
}

.popup-mobile__send-error.is-visible {
	display: block;
}

.popup-mobile__send-error::before {
	content: "!";
	position: absolute;
	left: 12px;
	top: 12px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--pm-error);
	color: #fff;
	font-size: 13px;
	line-height: 20px;
	font-weight: 700;
	text-align: center;
}

.popup-mobile__send-error p {
	margin: 0;
}

.popup-mobile__send-error br {
	display: none;
}

.popup-mobile__send-error b {
	display: block;
	font-size: 14px;
	line-height: 18px;
	font-weight: 500;
	color: var(--pm-error);
}

.popup-mobile__send-error span {
	display: block;
	font-size: 14px;
	line-height: 18px;
	font-weight: 300;
	color: var(--pm-error);
}

/* --- Кнопка «Отправить заявку» --- */

.popup-mobile__submit {
	position: relative;
	/* 12 (margin поля) + 12 = 24 «форма → действия» */
	margin-top: 12px;
}

.popup-mobile .t-submit.mobile-submit {
	display: block;
	width: 100%;
	height: 56px;
	padding: 0 24px;
	border: none;
	border-radius: 12px;
	background: var(--pm-yellow);
	font-family: 'Beeline Sans', sans-serif;
	font-size: 16px;
	line-height: 20px;
	font-weight: 500;
	color: var(--pm-text);
	cursor: pointer;
	transition: background-color .15s;
	-webkit-appearance: none;
	appearance: none;
}

.popup-mobile .t-submit.mobile-submit:hover {
	background: var(--pm-yellow-hover);
}

.popup-mobile .t-submit.mobile-submit:active {
	background: var(--pm-yellow-active);
}

.popup-mobile .t-submit.mobile-submit:focus-visible {
	outline: 2px solid var(--pm-text);
	outline-offset: 2px;
}

/* Загрузка: спиннер CF7 внутри кнопки слева от текста.
   Класс is-sending — свой (JS), а не CF7-шный submitting: CF7 снимает submitting
   раньше времени, когда change-валидация поля совпадает с сабмитом. */
.popup-mobile .wpcf7-spinner {
	display: none;
	position: absolute;
	top: 18px;
	left: calc(50% - 96px);
	width: 20px;
	height: 20px;
	margin: 0;
	padding: 0;
	background: none;
	border: 2px solid rgba(40, 40, 40, 0.25);
	border-top-color: var(--pm-text);
	border-radius: 50%;
	animation: popup-mobile-spin .8s linear infinite;
	opacity: 1;
	visibility: visible;
	pointer-events: none;
}

.popup-mobile .wpcf7-spinner::before {
	display: none;
}

/* !important — в style.css темы спиннер CF7 скрыт глобально с !important */
.popup-mobile form.is-sending .wpcf7-spinner {
	display: block !important;
}

.popup-mobile form.is-sending .t-submit.mobile-submit {
	padding-left: 52px;
	pointer-events: none;
}

.popup-mobile form.is-sending .t-input,
.popup-mobile form.is-sending .t-input:focus {
	background: var(--pm-bg-softer);
	color: var(--pm-muted);
	border-color: var(--pm-border);
	box-shadow: none;
	pointer-events: none;
}

.popup-mobile form.is-sending .popup-mobile__radio {
	opacity: .5;
	pointer-events: none;
}

@keyframes popup-mobile-spin {
	to { transform: rotate(360deg); }
}

/* --- Согласие --- */

.popup-mobile .agreement,
.popup-mobile .agreement * {
	margin: 0;
	font-size: 12px;
	line-height: 16px;
	font-weight: 300;
	color: var(--pm-muted);
}

.popup-mobile .agreement a {
	color: var(--pm-text);
	text-decoration: underline;
}

/* --- Успех --- */

.popup-mobile__success {
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	/* шапка в этом состоянии пустая, но крестик остаётся — оставляем ему строку */
	padding-top: 32px;
}

.popup-mobile.is-success .popup-mobile__success {
	display: flex;
}

.popup-mobile.is-success .popup-mobile__header,
.popup-mobile.is-success .popup-mobile__body {
	display: none;
}

.popup-mobile__success-img {
	width: 100px;
	height: 100px;
	object-fit: contain;
}

.popup-mobile__success-title {
	font-size: 20px;
	line-height: 24px;
	font-weight: 500;
	color: var(--pm-text);
	text-align: center;
}

@media screen and (min-width: 768px) {
	.popup-mobile__success-title {
		font-size: 24px;
		line-height: 28px;
	}
}

.popup-mobile__success-text,
.popup-mobile__success-text * {
	font-size: 16px;
	line-height: 22px;
	font-weight: 300;
	color: var(--pm-muted);
	text-align: center;
}

.popup-mobile__success-text {
	margin-top: -12px;
}

.popup-mobile__ok {
	display: block;
	width: 100%;
	height: 56px;
	margin-top: 4px;
	padding: 0 24px;
	border: none;
	border-radius: 12px;
	background: var(--pm-yellow);
	font-size: 16px;
	line-height: 20px;
	font-weight: 500;
	color: var(--pm-text);
	cursor: pointer;
	transition: background-color .15s;
}

.popup-mobile__ok:hover {
	background: var(--pm-yellow-hover);
}

.popup-mobile__ok:active {
	background: var(--pm-yellow-active);
}

.popup-mobile__ok:focus-visible {
	outline: 2px solid var(--pm-text);
	outline-offset: 2px;
}
