/**
 * Alavi Office Tools — contact form.
 * The form uses the site's own form classes (bj-form, bj-field, bj-label, bj-form-submit,
 * bj-form-ok, bj-form-err), so it looks like the existing form. This file adds only what
 * the new form needs: hidden traps, field marks, the hint and the extra question.
 */

/* Trap fields: out of sight and out of reach, but still in the page for robots. */
.aot-cf .aot-cf__trap {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
}

/* No far-away offset: in right-to-left pages it would make the page scroll sideways. */
.aot-cf .aot-cf__trap--far {
	top: 0 !important;
	inset-inline-start: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/*
 * Light, delicate look (owner's request, 1.1.1). The rules are scoped to form.bj-form.aot-cf so they
 * win over the site's general form rules without !important; colours follow the site palette
 * (gold #cc9952, warm greys).
 */
.aot-cf {
	position: relative;
	--aot-cf-gold: #cc9952;
	--aot-cf-gold-soft: #dcbf94;
	--aot-cf-line: #e8e1d6;
	--aot-cf-label: #a49e95;
	--aot-cf-text: #3a3632;
}

/*
 * Even, compact rhythm (owner's request, 1.2.3). The site's form rule is a flex column with its own
 * 8px gap, which added to the margins below; the gap is cleared so these margins are the only spacing:
 * label → field 5px, field → next label 14px, field → line under it 8px, line → button 14px.
 */
form.bj-form.aot-cf {
	gap: 0;
	row-gap: 0;
}

form.bj-form.aot-cf .aot-cf__field {
	display: block;
	margin: 0 0 14px;
	padding: 0;
}

form.bj-form.aot-cf .bj-label {
	display: block;
	height: auto;
	margin: 0 2px 5px;
	padding: 0;
	font-size: 11.5px;
	font-weight: 500;
	line-height: 1.6;
	color: var(--aot-cf-label);
}

form.bj-form.aot-cf .bj-label b {
	margin-inline-end: 3px;
	font-size: 10px;
	font-weight: 400;
	color: var(--aot-cf-gold);
	vertical-align: 1px;
}

form.bj-form.aot-cf .aot-cf__field input,
form.bj-form.aot-cf .aot-cf__field textarea {
	box-sizing: border-box;
	display: block;
	width: 100%;
	margin: 0;
	border: 1px solid var(--aot-cf-line);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.72);
	box-shadow: none;
	font-family: inherit;
	font-size: 13px;
	font-weight: 400;
	color: var(--aot-cf-text);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

form.bj-form.aot-cf .aot-cf__field input {
	height: 40px;
	padding: 0 14px;
	line-height: 1.6;
}

/* The message box: real line spacing and room around the text. */
form.bj-form.aot-cf .aot-cf__field textarea {
	min-height: 150px;
	height: auto;
	padding: 12px 14px;
	line-height: 2;
	resize: vertical;
}

form.bj-form.aot-cf .aot-cf__field input:hover,
form.bj-form.aot-cf .aot-cf__field textarea:hover {
	border-color: var(--aot-cf-gold-soft);
}

form.bj-form.aot-cf .aot-cf__field input:focus,
form.bj-form.aot-cf .aot-cf__field textarea:focus {
	outline: none;
	border-color: var(--aot-cf-gold);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(204, 153, 82, 0.12);
}

form.bj-form.aot-cf .aot-cf__submit {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid var(--aot-cf-gold-soft);
	border-radius: 10px;
	background: transparent;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 38px;
	color: #b8843f;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

form.bj-form.aot-cf .aot-cf__submit:hover,
form.bj-form.aot-cf .aot-cf__submit:focus-visible {
	border-color: var(--aot-cf-gold);
	background: var(--aot-cf-gold);
	color: #fff;
	outline: none;
}

.aot-cf .aot-cf__hint,
.aot-cf .aot-cf__privacy {
	margin: -6px 2px 14px;
	font-size: 11px;
	line-height: 1.8;
	color: var(--aot-cf-label);
}



/* A field the visitor must fix. */
.aot-cf .aot-cf--bad input,
.aot-cf .aot-cf--bad textarea {
	border-color: #c0392b !important;
	box-shadow: 0 0 0 1px #c0392b33;
}

.aot-cf .aot-cf__hint.aot-cf--bad {
	color: #c0392b;
}

.aot-cf .aot-cf__notice {
	margin-bottom: 14px;
	padding: 10px 14px;
	border-radius: 10px;
	font-size: 12px;
	line-height: 1.8;
}

.aot-cf .aot-cf__notice.bj-form-ok:not([hidden]) {
	background: #edf7ee;
	color: #24683a;
}

.aot-cf .aot-cf__notice.bj-form-err:not([hidden]) {
	background: #fbecea;
	color: #a1301f;
}

/* The extra question (only for suspicious sends). */
.aot-cf .aot-cf__question {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.aot-cf .aot-cf__question[hidden] {
	display: none;
}

.aot-cf .aot-cf__question-text {
	font-size: 12px;
	color: var(--aot-cf-text);
	line-height: 1.8;
}

form.bj-form.aot-cf .aot-cf__question input {
	box-sizing: border-box;
	width: 80px;
	height: 36px;
	padding: 0 8px;
	border: 1px solid var(--aot-cf-line);
	border-radius: 10px;
	background: #fff;
	font-family: inherit;
	font-size: 13px;
	text-align: center;
}

form.bj-form.aot-cf .aot-cf__question input:focus {
	outline: none;
	border-color: var(--aot-cf-gold);
	box-shadow: 0 0 0 3px rgba(204, 153, 82, 0.12);
}

.aot-cf .aot-cf__submit[disabled] {
	opacity: 0.7;
	cursor: progress;
}

/*
 * Success popup (1.2.2, owner's request): centred over the page, closes itself after 4.5s
 * (thin gold bar shows the time), or on its button, Escape, or a tap outside.
 */
.aot-cf-pop {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(38, 34, 29, 0.16);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.aot-cf-pop.is-open {
	opacity: 1;
}

.aot-cf-pop__box {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 340px;
	padding: 30px 26px 26px;
	overflow: hidden;
	border-radius: 18px;
	background: #fffdf9;
	box-shadow: 0 24px 60px -20px rgba(38, 34, 29, 0.35), 0 2px 6px rgba(38, 34, 29, 0.06);
	text-align: center;
	transform: translateY(8px) scale(0.97);
	transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.aot-cf-pop.is-open .aot-cf-pop__box {
	transform: none;
}

/* Gold ring with a check drawn in CSS (no icon font, no image). */
.aot-cf-pop__icon {
	position: relative;
	display: block;
	width: 54px;
	height: 54px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: #f7efe2;
	box-shadow: inset 0 0 0 1px #ecdcc2;
}

.aot-cf-pop__icon::after {
	content: "";
	position: absolute;
	top: 15px;
	left: 21px;
	width: 10px;
	height: 18px;
	border: solid #b8843f;
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
}

.aot-cf-pop__text {
	margin: 0;
	color: #3a3632;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.9;
}

.aot-cf-pop__close {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	width: 30px;
	height: 30px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #a49e95;
	font-family: inherit;
	font-size: 20px;
	line-height: 30px;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.aot-cf-pop__close:hover,
.aot-cf-pop__close:focus-visible {
	background: #f4eee5;
	color: #3a3632;
	outline: none;
}

/* Time left before the popup closes. */
.aot-cf-pop__bar {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 3px;
	background: #cc9952;
	transform-origin: right center;
}

.aot-cf-pop[dir="ltr"] .aot-cf-pop__bar {
	transform-origin: left center;
}

.aot-cf-pop.is-open .aot-cf-pop__bar {
	animation: aot-cf-pop-time 4.5s linear forwards;
}

@keyframes aot-cf-pop-time {
	from {
		transform: scaleX(1);
	}
	to {
		transform: scaleX(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.aot-cf-pop,
	.aot-cf-pop__box {
		transition: none;
	}

	.aot-cf-pop__bar {
		display: none;
	}
}

/*
 * Desktop: inside the site's contact card (.bj-contact-form, borujerdi-kit) the form card is as tall as
 * the column beside it (owner's request, 1.2.4). The row stretches its columns; the message box starts
 * small (96px) and grows to fill the card, so the card no longer makes the row taller.
 * Only where the card holds this form (:has), only from 1025px (Elementor's desktop).
 */
@media (min-width: 1025px) {
	.e-con:has(> .bj-contact-form .aot-cf) {
		align-items: stretch;
	}

	.bj-contact-form:has(.aot-cf) {
		justify-content: flex-start;
	}

	.bj-contact-form .elementor-widget:has(.aot-cf),
	.bj-contact-form .elementor-widget:has(.aot-cf) > .elementor-widget-container,
	.bj-contact-form .elementor-widget-container > div:has(> .aot-cf) {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		width: 100%;
	}

	.bj-contact-form form.bj-form.aot-cf {
		flex: 1 1 auto;
	}

	.bj-contact-form form.bj-form.aot-cf .aot-cf__field[data-field="message"] {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
	}

	.bj-contact-form form.bj-form.aot-cf .aot-cf__field textarea {
		flex: 1 1 0;
		height: 0;
		min-height: 96px;
	}
}
