/*
 * Assessment Form front-end styles.
 * Uses logical properties (margin-inline, etc.) so the layout mirrors
 * correctly for RTL languages (e.g. Persian) without a separate stylesheet.
 */

.maf-form {
	display: flex;
	flex-direction: column;
	gap: 24px;
	margin: 0 auto;
}

.maf-card {
	background: #fff;
	border: 1px solid #e2e5e9;
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	padding: 24px;
}

.maf-card__title {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 600;
	color: #1d2327;
	border-inline-start: 4px solid #2271b1;
	padding-inline-start: 12px;
}

.maf-grid {
	display: flex;
	flex-wrap: wrap;
	margin: 0;
	gap: 0;
}

.maf-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 0 0 calc(var(--maf-col, 12) / 12 * 100%);
	max-width: calc(var(--maf-col, 12) / 12 * 100%);
	padding: 0;
	min-width: 0;
	box-sizing: border-box;
}

.maf-field label {
	font-weight: 500;
	font-size: 14px;
	color: #1d2327;
}

.maf-required {
	color: #d63638;
	margin-inline-start: 2px;
}

.maf-field input[type="text"],
.maf-field input[type="email"],
.maf-field input[type="number"],
.maf-field input[type="tel"],
.maf-field select,
.maf-field textarea {
	padding: 10px 12px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	font-size: 14px;
	width: 99%;
	box-sizing: border-box;
	transition: border-color 0.15s ease;
}

.maf-field input:focus,
.maf-field select:focus,
.maf-field textarea:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.maf-field--error input,
.maf-field--error select,
.maf-field--error textarea {
	border-color: #d63638;
}

.maf-field__error {
	color: #d63638;
	font-size: 12px;
	min-height: 14px;
}

.maf-repeater__row {
	border: 1px dashed #c3c4c7;
	border-radius: 8px;
	padding: 44px 16px 16px;
	margin-bottom: 12px;
	position: relative;
}
.maf-repeater__row-actions {
	display: flex;
	gap: 6px;
	position: absolute;
	top: 8px;
	inset-inline-end: 8px;
}

.maf-repeater__remove {
	background: none;
	border: 1px solid #d63638;
	color: #d63638;
	border-radius: 6px;
	width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
}
.maf-repeater__remove svg {
	width: 16px;
	height: 16px;
}
.maf-repeater__toggle {
	background: #ebebeb;
    border: 0;
    color: #6A6A6A;
    border-radius: 6px;
    width: 44px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    border-radius: 16px;
}
.maf-repeater__toggle:hover, .maf-repeater__toggle:focus {
	background: #ebebeb;
	color: #6A6A6A;
}
.maf-repeater__toggle svg {
	width: 20px;
	height: 20px;
	transition: transform .2s ease;
}
.maf-repeater__row.is-collapsed .maf-grid {
	display: none;
}
.maf-repeater__row.is-collapsed .maf-repeater__toggle svg {
	transform: rotate(180deg);
}


.maf-repeater__add {
	background: #f0f6fc;
	border: 1px dashed #2271b1;
	color: #2271b1;
	border-radius: 6px;
	padding: 8px 14px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
}

.maf-submit-row {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-top: 12px;
}

.maf-submit-btn {
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 14px 32px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.maf-submit-btn:hover {
	background: #135e96;
}

.maf-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.maf-submit-status.maf-success {
	color: #00a32a;
	font-weight: 600;
}

.maf-submit-status.maf-error {
	color: #d63638;
	font-weight: 600;
}

/* Right-to-left languages (e.g. Persian via WPML) */
html[dir="rtl"] .maf-card__title {
	border-inline-start: none;
	border-inline-end: 4px solid #2271b1;
	padding-inline-start: 0;
	padding-inline-end: 12px;
}

html[dir="rtl"] .maf-form,
html[dir="rtl"] .maf-field input,
html[dir="rtl"] .maf-field select,
html[dir="rtl"] .maf-field textarea {
	font-family: "Vazirmatn", Tahoma, sans-serif;
}

/* ------------------------------------------------------------------ */
/* Builder-driven additions: widths, choices, uploads, content blocks  */
/* ------------------------------------------------------------------ */

.maf-field--w-full  { --maf-field-w: 100%; }
.maf-field--w-half  { --maf-field-w: 50%;  }
.maf-field--w-third { --maf-field-w: 33.3333%; }

/* Responsive fields: when a field has .maf-field--rw, the inline scoped styles
   take priority — no extra global rules needed.  For legacy fields without
   .maf-field--rw, collapse to full-width on small screens. */
@media (max-width: 640px) {
	.maf-grid > .maf-field:not(.maf-field--rw) { width: 100%; }
}

.maf-card__desc {
	margin: 50px 0 30px;
    color: #212121;
    font-size: 20px;
    font-weight: 500;
    font-family: "Poppins" !important;
}

.maf-field__help {
	color: #6b7280;
	font-size: 12px;
}

.maf-html { font-size: 14px; color: #1d2327; }
.maf-html > :first-child { margin-top: 0; }
.maf-html > :last-child { margin-bottom: 0; }

.maf-choices { display: flex; flex-direction: column; gap: 8px; }
.maf-choices--inline { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }
.maf-choice {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 400 !important;
	font-size: 14px;
	cursor: pointer;
}
.maf-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2271b1; }

.maf-field input[type="date"],
.maf-field input[type="url"] {
	padding: 10px 12px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	font-size: 14px;
	width: 99%;
	box-sizing: border-box;
}

/* Upload */
.maf-upload input[type="file"] {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
}
.maf-upload { position: relative; }
.maf-upload__zone {
	border: 2px dashed #c3c4c7;
	border-radius: 8px;
	padding: 20px 16px;
	text-align: center;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	color: #50575e;
	background: #fafbfc;
	transition: all .15s ease;
}
.maf-upload__zone:hover,
.maf-upload__zone:focus-visible,
.maf-upload__zone.is-over {
	border-color: #2271b1;
	background: #f0f6fc;
	outline: none;
}
.maf-upload__icon { font-size: 22px; color: #2271b1; }
.maf-upload__text { font-size: 14px; font-weight: 500; }
.maf-upload__hint { font-size: 12px; color: #8c8f94; }
.maf-upload__list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.maf-upload__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid #e2e5e9;
	border-radius: 6px;
	font-size: 13px;
}
.maf-upload__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Custom width is set via inline --maf-field-w */
.maf-field--w-custom {
	/* --maf-field-w already set inline */
}

@media (max-width: 640px) {
	.maf-grid > .maf-field:not(.maf-field--rw).maf-field--w-custom { width: 100%; }
}

.maf-upload__size { color: #8c8f94; font-size: 12px; }
.maf-upload__remove {
	border: 0;
	background: transparent;
	color: #d63638;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

/* Repeater polish */
.maf-repeater__row { transition: opacity .15s ease, transform .15s ease; }
.maf-repeater__row.is-removing { opacity: 0; transform: scale(.98); }
.maf-repeater__remove:disabled,
.maf-repeater__add:disabled { opacity: .45; cursor: not-allowed; }

.maf-form.is-submitting { opacity: .7; pointer-events: none; }


/* ------------------------------------------------------------------ */

/* Column system */
.maf-col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.maf-col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.maf-col-3 { flex: 0 0 25%; max-width: 25%; }
.maf-col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.maf-col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.maf-col-6 { flex: 0 0 50%; max-width: 50%; }
.maf-col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.maf-col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.maf-col-9 { flex: 0 0 75%; max-width: 75%; }
.maf-col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.maf-col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.maf-col-12 { flex: 0 0 100%; max-width: 100%; }

/* Conditional Fields Logic & Animations                              */
/* ------------------------------------------------------------------ */

[hidden],
.maf-form [hidden],
.maf-field[hidden],
.maf-field--conditional[hidden] {
	display: none !important;
}

.maf-field[data-condition]:not([hidden]),
.maf-field--conditional:not([hidden]) {
	display: flex;
	animation: mafFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mafFadeIn {
	0% {
		opacity: 0;
		transform: translateY(-8px);
	}
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ------------------------------------------------------------------ */
/* Select2 customization — match form field styles                     */
/* ------------------------------------------------------------------ */

.maf-field .select2-container--default .select2-selection--single {
	height: 48px;
    padding: 8px 16px;
    border: 1px solid #D1D1D1 !important;
    border-radius: 12px;
    font-size: 14px;
    transition: border-color 0.15s ease;
    background-color: #fff;
    box-shadow: none;
    display: flex;
    flex-flow: row;
    align-items: center;
    font-family: "Poppins" !important;
}

.maf-field .select2-container--default .select2-selection--single .select2-selection__rendered {
	color: #1d2327;
	line-height: 1.6;
	padding-left: 0;
	padding-right: 20px;
}

[dir="rtl"] .maf-field .select2-container--default .select2-selection--single .select2-selection__rendered {
	padding-right: 0;
	padding-left: 20px;
}

.maf-field .select2-container--default .select2-selection--single .select2-selection__placeholder {
	color: #8c8f94;
}

.maf-field .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 100%;
	right: 8px;
}

[dir="rtl"] .maf-field .select2-container--default .select2-selection--single .select2-selection__arrow {
	right: auto;
	left: 8px;
}

.maf-field .select2-container--default.select2-container--open .select2-selection--single,
.maf-field .select2-container--default.select2-container--focus .select2-selection--single {
	outline: none;
	border-color: #D1D1D1;
}

.maf-field--error .select2-container--default .select2-selection--single {
	border-color: #d63638;
}

/* Dropdown */
.select2-container--default .select2-dropdown {
	border-color: #c3c4c7;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 999999;
    margin-top: -1px;
}

.select2-container--open .select2-dropdown--above {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.select2-container--open .select2-dropdown--below {
	border-top-left-radius: 0 !important;
  	border-top-right-radius: 0 !important;
}

.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
	padding: 8px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 14px;
	outline: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.select2-container--default .select2-results__option {
	padding: 8px 12px;
	font-size: 14px;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
	background-color: #2271b1;
	color: #fff;
}

.select2-container--default .select2-results__option--selected {
	background-color: #f0f6fc;
}

/* Ensure the Select2 container takes full width */
.maf-field .select2-container {
	width: 99% !important;
}

.select2-container:has(.select2-dropdown) {
	margin-top: 0 !important;
	z-index: 9;
}
.admin-bar .select2-container:has(.select2-dropdown) {
  margin-top: 32px !important;
}

.maf-captcha-field {
	max-width: 50%;
}

.iti__country-container input {
  display: none !important;
}

.width-120 label {
	width: 100%;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
	height: 42px;
	padding-left: 0;
}

.maf-form .select2-container--default .select2-selection__arrow {
  display: none !important;
}

.maf-form .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #6C81B3 !important;
  box-shadow: none !important;
}

.maf-form .select2-container--default .select2-selection--single {
  height: 48px !important;
  border: 1px solid #D1D1D1 !important;
  border-radius: 12px !important;
  background-color: #fff !important;
  background-image: url("https://icpimmigration.com/wp-content/uploads/2026/06/arrow-down.svg") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 16px !important;
  outline: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
}

.maf-from .select2-selection__clear, .maf-from .select2-selection__clear:hover {
  color: #c36;
}

.rtl .maf-form .select2-container--default .select2-selection--single {
  background-position: left 16px center !important;
}

.rtl .select2-container--default .select2-selection--single .select2-selection__clear {
	margin-left: 10px;
    margin-right: 0;
}

.iti__selected-country:hover, .iti__selected-country:focus, .iti--allow-dropdown .iti__country-container:not(:has(+ input[disabled])):not(:has(+ input[readonly])) .iti__selected-country-primary:hover {
	background-color: rgba(0, 0, 0, 0.05) !important;
	border-top-left-radius: 12px;
  	border-bottom-left-radius: 12px;
}

@media (max-width: 600px) {
	.admin-bar .select2-container:has(.select2-dropdown) {
		margin-top: 46px !important;
	}
	.width-120 label {
		width: 100%;
	}
}
/* ------------------------------------------------------------------ */
/* Captcha Box & Refresh Button                                       */
/* ------------------------------------------------------------------ */
.maf-captcha-box {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.maf-captcha-img {
	display: block;
	height: 40px;
	width: 100px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #f0f0f0;
	transition: opacity 0.2s ease;
}

.maf-captcha-refresh {
	height: 40px;
	width: 40px;
	padding: 0;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #fff;
	color: #50575e;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
}

.maf-captcha-refresh:hover,
.maf-captcha-refresh:focus {
	border-color: #2271b1;
	color: #2271b1;
	background: #f0f6fc;
	outline: none;
}

.maf-captcha-refresh:disabled {
	opacity: 0.6;
	cursor: wait;
}

.maf-captcha-refresh.is-spinning svg {
	animation: mafCaptchaSpin 0.7s linear infinite;
}

@keyframes mafCaptchaSpin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/* Success Modal Popup                                                */
/* ------------------------------------------------------------------ */
.maf-success-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.maf-success-modal[hidden] {
	display: none !important;
}

.maf-success-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.maf-success-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 24, 39, 0.6);
	backdrop-filter: blur(3px);
}

.maf-success-modal__dialog {
	position: relative;
	z-index: 1;
	background: #ffffff;
	border-radius: 16px;
	max-width: 500px;
	width: 100%;
	padding: 32px 28px 28px;
	box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
	text-align: start;
	transform: translateY(16px) scale(0.97);
	transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.maf-success-modal.is-open .maf-success-modal__dialog {
	transform: translateY(0) scale(1);
}

.maf-success-modal__close {
	position: absolute;
	top: 14px;
	inset-inline-end: 16px;
	background: #f3f4f6;
	border: none;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	font-size: 20px;
	line-height: 1;
	color: #4b5563;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.maf-success-modal__close:hover {
	background: #e5e7eb;
	color: #111827;
}

.maf-success-modal__icon {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: #e6f4ea;
	color: #1e6b34;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}

.maf-success-modal__message {
	font-size: 15px;
	line-height: 1.9;
	color: #1f2937;
	white-space: pre-line;
	margin-bottom: 24px;
}

.maf-success-modal__actions {
	display: flex;
	justify-content: center;
}

.maf-success-modal__btn {
	min-width: 140px;
	padding: 11px 28px;
	font-size: 15px;
}

.maf-tel-input {
	padding-left: 60px !important;
}

.iti__country-list {
	left: 0 !important;
}

.iti__country-list li {
	direction: ltr;
}

.iti__country {
	gap: 5px;
}

.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag {
	border-top-left-radius: 10px;
  	border-bottom-left-radius: 10px;
}

[dir="rtl"] .iti--allow-dropdown .iti__flag-container, [dir="rtl"] .iti--separate-dial-code .iti__flag-container {
	right: auto !important;
  	left: 12px !important;
}