/**
 * Модальные окна «Заказать оценку» и «Обратный звонок» (template-parts/modals.php).
 * z-index выше всех sticky-элементов (баннер cookie 80, панель звонка 90).
 */

.reb-modal {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.reb-modal[hidden] {
	display: none;
}

.reb-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 48, 36, 0.72);
}

.reb-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 440px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 30px 28px 28px;
	background: #fff;
	color: var(--reb-text);
}

.reb-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	font-size: 15px;
	background: transparent;
	border: 0;
	color: var(--reb-text-faint);
	cursor: pointer;
}

.reb-modal__close:hover {
	color: var(--reb-text);
}

.reb-modal__title {
	font-size: 22px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.reb-modal__subtitle {
	margin: 8px 0 18px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--reb-text-muted);
}

/* Форма. */
.reb-modal-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.reb-modal-form__field {
	width: 100%;
	padding: 14px;
	font-size: 14px;
	background: #fff;
	border: 1px solid #CDDCD3;
	border-radius: 0;
}

.reb-modal-form__field::placeholder {
	color: var(--reb-text-faint);
}

.reb-modal-form__field:focus {
	outline: 2px solid var(--reb-accent);
	outline-offset: -1px;
	border-color: var(--reb-accent);
}

.reb-modal-form__field--area {
	min-height: 76px;
	resize: vertical;
}

/* Ошибка валидации: красная рамка + подсказка, кнопка приглушена. */
.reb-modal-form__field--error {
	border-color: #D43030;
}

.reb-modal-form__field--error:focus {
	outline-color: #D43030;
}

.reb-modal-form__error {
	display: none;
	font-size: 12px;
	line-height: 1.4;
	color: #D43030;
}

.reb-modal-form__error--visible {
	display: block;
}

.reb-modal-form__submit {
	width: 100%;
	padding: 16px;
}

.reb-modal-form__submit--disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.reb-modal-form__file {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 700;
	color: var(--reb-accent);
	cursor: pointer;
}

.reb-modal-form__file:hover {
	color: var(--reb-accent-dark);
}

.reb-modal-form__file input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.reb-modal-form__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 11px;
	line-height: 1.45;
	color: var(--reb-text-faint);
	cursor: pointer;
}

.reb-modal-form__consent input {
	flex: 0 0 14px;
	width: 14px;
	height: 14px;
	margin: 1px 0 0;
	accent-color: var(--reb-accent);
}

/* Выбор времени звонка: пилюли-радио. */
.reb-modal-form__times {
	display: flex;
	gap: 8px;
}

.reb-modal-form__time {
	flex: 1;
	cursor: pointer;
}

.reb-modal-form__time input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.reb-modal-form__time span {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 11px 8px;
	font-size: 14px;
	font-weight: 700;
	border: 1px solid #CDDCD3;
	color: var(--reb-text-muted);
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.reb-modal-form__time input:checked + span {
	background: var(--reb-accent);
	border-color: var(--reb-accent);
	color: #fff;
}

/* Состояние успеха. */
.reb-modal__pane--success {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 18px 0 8px;
	text-align: center;
}

.reb-modal__pane--success[hidden] {
	display: none;
}

.reb-modal__check {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 999px;
	background: var(--reb-accent);
	color: #fff;
	font-size: 26px;
	font-weight: 800;
	line-height: 1;
}

.reb-modal__success-btn {
	margin-top: 6px;
}

/* Блокировка прокрутки страницы под модалкой. */
.reb-body--modal-open {
	overflow: hidden;
}

@media (max-width: 480px) {
	.reb-modal {
		padding: 12px;
	}

	.reb-modal__dialog {
		padding: 24px 18px 20px;
	}
}
