/**
 * Rental Express — всплывающее окно с формой CF7.
 * Стили в духе темы (main-eight, скругления, типографика).
 */

.rental-express-popup-form {
	position: fixed;
	inset: 0;
	z-index: 100000;
	max-width: 100%;
	max-height: 100%;
	margin: auto;
	padding: 0;
	border: none;
	border-radius: 1rem;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	background: transparent;
}

.rental-express-popup-form::backdrop {
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(4px);
}

/* Fallback для старых браузеров без showModal */
.rental-express-popup-form[open]:not(.rental-express-popup-form--open) {
	display: block;
}

.rental-express-popup-form__backdrop {
	display: none;
}

.rental-express-popup-form__inner {
	position: relative;
	background: #fff;
	border-radius: 1rem;
	max-width: 28rem;
	width: 100%;
	margin: 0 auto;
	max-height: calc(100vh - 3rem);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.rental-express-popup-form__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 2.5rem;
	height: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: hsl(var(--main-eight-h), var(--main-eight-s), 96%);
	color: hsl(var(--main-eight-h), var(--main-eight-s), 44%);
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
	z-index: 2;
	font-size: 1.25rem;
}

.rental-express-popup-form__close:hover {
	background: var(--main-eight-600);
	color: #fff;
}

.rental-express-popup-form__title {
	font-size: 1.375rem;
	font-weight: 600;
	color: var(--heading-color, #0f172a);
	margin: 0;
	padding: 1.5rem 3rem 0.5rem 1.5rem;
	line-height: 1.3;
}

.rental-express-popup-form__body {
	padding: 0 1.5rem 1.5rem;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
}

/* Стили полей CF7 внутри попапа */
.rental-express-popup-form__body .wpcf7-form-control-wrap {
	display: block;
	margin-bottom: 1rem;
}

.rental-express-popup-form__body input[type="text"],
.rental-express-popup-form__body input[type="email"],
.rental-express-popup-form__body input[type="tel"],
.rental-express-popup-form__body input[type="url"],
.rental-express-popup-form__body textarea {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid #e2e8f0;
	border-radius: 0.5rem;
	font-size: 1rem;
	transition: border-color 0.2s;
}

.rental-express-popup-form__body input:focus,
.rental-express-popup-form__body textarea:focus {
	outline: none;
	border-color: var(--main-eight-600);
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Поле выбора файла — современная зона с превью и множественным выбором */
.rental-express-popup-form__body .wpcf7-form-control-wrap:has(input[type="file"]) {
	position: relative;
	display: block;
	min-height: 5rem;
	border: 1px dashed #cbd5e1;
	border-radius: 0.5rem;
	background: #f8fafc;
	transition: border-color 0.2s, background 0.2s;
	overflow: hidden;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap:has(input[type="file"]):hover,
.rental-express-popup-form__body .wpcf7-form-control-wrap:has(input[type="file"]).rental-express-dragover {
	border-color: var(--main-eight-600);
	background: #f1f5f9;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap:has(input[type="file"]) input[type="file"] {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	font-size: 0;
	padding: 0;
	margin: 0;
	border: none;
	background: transparent;
	z-index: 1;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap:has(input[type="file"]) input[type="file"]::file-selector-button {
	display: none;
}

/* Зона drag-and-drop и превью (добавляется JS) */
.rental-express-file-zone {
	position: relative;
	z-index: 2;
	min-height: 5rem;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	pointer-events: none;
}
.rental-express-file-zone * {
	pointer-events: auto;
}
.rental-express-file-drop {
	color: #64748b;
	font-size: 0.9375rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	cursor: pointer;
}
.rental-express-file-drop-icon {
	width: 2.5rem;
	height: 2.5rem;
	opacity: 0.8;
}
.rental-express-file-previews {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
	gap: 0.5rem;
	width: 100%;
	margin-top: 0.75rem;
	align-items: start;
}
.rental-express-file-preview {
	position: relative;
	aspect-ratio: 1;
	border-radius: 0.375rem;
	overflow: hidden;
	background: #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: center;
}
.rental-express-file-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.rental-express-file-preview-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0.25rem;
	color: #64748b;
	font-size: 0.625rem;
	word-break: break-all;
	text-align: center;
}
.rental-express-file-preview-name {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0,0,0,0.6);
	color: #fff;
	font-size: 0.625rem;
	padding: 0.2rem 0.25rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.rental-express-file-actions {
	margin-top: 0.5rem;
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	flex-wrap: wrap;
}
.rental-express-file-clear,
.rental-express-file-add {
	font-size: 0.8125rem;
	padding: 0.35rem 0.75rem;
	border-radius: 0.375rem;
	border: none;
	cursor: pointer;
	background: #e2e8f0;
	color: #475569;
	transition: background 0.2s, color 0.2s;
}
.rental-express-file-clear:hover,
.rental-express-file-add:hover {
	background: #cbd5e1;
	color: #0f172a;
}
.rental-express-file-add {
	background: hsl(var(--main-eight-h), var(--main-eight-s), 95%);
	color: var(--main-eight-600);
}
.rental-express-file-add:hover {
	background: hsl(var(--main-eight-h), var(--main-eight-s), 90%);
}
.rental-express-file-zone.has-files .rental-express-file-drop {
	display: none;
}
.rental-express-file-zone:not(.has-files) .rental-express-file-previews,
.rental-express-file-zone:not(.has-files) .rental-express-file-actions {
	display: none;
}

.rental-express-popup-form__body .wpcf7-submit {
	width: 100%;
	padding: 0.875rem 1.5rem;
	background: var(--main-eight-600) !important;
	color: #fff !important;
	border: none;
	border-radius: 50px;
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.1s;
}

.rental-express-popup-form__body .wpcf7-submit:hover {
	opacity: 0.95;
}

.rental-express-popup-form__body .wpcf7-not-valid-tip {
	font-size: 0.8125rem;
	color: #dc2626;
	margin-top: 0.25rem;
}

.rental-express-popup-form__body .wpcf7-response-output {
	margin: 1rem 0 0;
	padding: 0.75rem 1rem;
	border-radius: 0.5rem;
	font-size: 0.875rem;
}

/* Галочка согласия — текст обтекает чекбокс, ссылка в одной строке с предложением */
.rental-express-popup-form__body p:has(.wpcf7-form-control-wrap[data-name="consent"]) {
	margin-bottom: 1rem;
}
.rental-express-popup-form__body p:has(.wpcf7-form-control-wrap[data-name="consent"]) label {
	display: block;
	cursor: pointer;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #475569;
	margin-bottom: 0;
}
.rental-express-popup-form__body p:has(.wpcf7-form-control-wrap[data-name="consent"]) label br {
	display: none;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap[data-name="consent"] {
	float: left;
	margin-right: 0.5rem;
	margin-top: 0.2rem;
}
.rental-express-popup-form__body p:has(.wpcf7-form-control-wrap[data-name="consent"]) label::after {
	content: "";
	display: table;
	clear: both;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap[data-name="consent"] .wpcf7-list-item {
	display: block;
	margin: 0;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap[data-name="consent"] input[type="checkbox"] {
	appearance: none;
	width: 1.25rem;
	height: 1.25rem;
	border: 2px solid #cbd5e1;
	border-radius: 0.25rem;
	background: #fff;
	cursor: pointer;
	margin: 0;
	vertical-align: middle;
	transition: border-color 0.2s, background 0.2s;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap[data-name="consent"] input[type="checkbox"]:checked {
	background: var(--main-eight-600);
	border-color: var(--main-eight-600);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
}
.rental-express-popup-form__body .wpcf7-form-control-wrap[data-name="consent"] input[type="checkbox"]:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}
.rental-express-popup-form__body p:has(.wpcf7-form-control-wrap[data-name="consent"]) a {
	color: var(--main-eight-600);
	text-decoration: underline;
}
.rental-express-popup-form__body p:has(.wpcf7-form-control-wrap[data-name="consent"]) a:hover {
	text-decoration: none;
}

body.rental-express-popup-open {
	overflow: hidden;
}

/* При открытом попапе скрываем кастомный курсор темы — иначе поверх кнопки показывается «запрещено» и клик не доходит */
body.rental-express-popup-open .mouseCursor {
	display: none !important;
}

/* Кнопка «Отправить»: всегда кликабельна и курсор pointer (на случай перекрытия/стилей темы) */
.rental-express-popup-form__body .wpcf7-submit {
	cursor: pointer !important;
	pointer-events: auto !important;
}
.rental-express-popup-form__body .wpcf7-submit:disabled {
	cursor: not-allowed !important;
	opacity: 0.7;
}

@media (max-width: 575.98px) {
	.rental-express-popup-form__inner {
		max-height: calc(100vh - 1rem);
		margin: 0.5rem;
	}
	.rental-express-popup-form__title {
		padding-right: 2.5rem;
		font-size: 1.25rem;
	}
	.rental-express-popup-form__body {
		padding-left: 1rem;
		padding-right: 1rem;
		padding-bottom: 1rem;
	}
}
