/*
 * Amiri OTP Auth — focused, RTL authentication surface
 *
 * The component is intentionally scoped to `.amiri-otp` so it can sit inside
 * WooCommerce's account and checkout markup without leaking styles into core
 * forms. The visual language follows the Amiri Gold system: deep navy glass,
 * quiet teal light, and a single confident gold action.
 */

.amiri-otp-wrap {
	--amiri-otp-gold: #e1bf62;
	--amiri-otp-gold-bright: #f3d37a;
	--amiri-otp-canvas: #080b12;
	--amiri-otp-surface: #101722;
	--amiri-otp-surface-raised: #151e2b;
	--amiri-otp-text: #f4f1e9;
	--amiri-otp-muted: #aeb6c3;
	--amiri-otp-subtle: #737e8e;
	--amiri-otp-line: rgba(255, 255, 255, .13);
	--amiri-otp-success: #77d6a0;
	--amiri-otp-danger: #ff9c9c;
	direction: rtl;
	isolation: isolate;
	width: 100%;
	margin: 0 0 1.5rem;
	font-family: Vazirmatn, Tahoma, sans-serif;
	color: var(--amiri-otp-text);
	text-align: right;
	line-height: 1.8;
}

.amiri-otp-wrap,
.amiri-otp-wrap *,
.amiri-otp-wrap *::before,
.amiri-otp-wrap *::after {
	box-sizing: border-box;
}

.amiri-otp {
	position: relative;
	width: min(100%, 640px);
	margin: 0 auto;
	padding: clamp(22px, 4vw, 34px);
	overflow: hidden;
	color: var(--amiri-otp-text);
	background:
		radial-gradient(100% 90% at 100% 0%, rgba(225, 191, 98, .12), transparent 58%),
		radial-gradient(90% 80% at 0% 100%, rgba(40, 122, 125, .09), transparent 62%),
		rgba(16, 23, 34, .84);
	border: 1px solid rgba(255, 255, 255, .14);
	border-top-color: rgba(225, 191, 98, .44);
	border-radius: 26px;
	box-shadow:
		0 28px 72px rgba(0, 0, 0, .32),
		inset 0 1px 0 rgba(255, 255, 255, .08),
		inset 0 -1px 0 rgba(0, 0, 0, .25);
	backdrop-filter: blur(24px) saturate(125%);
	-webkit-backdrop-filter: blur(24px) saturate(125%);
	color-scheme: dark;
}

.amiri-otp::before {
	position: absolute;
	top: 0;
	right: 14%;
	left: 14%;
	height: 1px;
	content: '';
	background: linear-gradient(90deg, transparent, rgba(243, 211, 122, .72), transparent);
	opacity: .72;
	pointer-events: none;
}

.amiri-otp::after {
	position: absolute;
	top: -8rem;
	left: -8rem;
	width: 16rem;
	height: 16rem;
	content: '';
	border: 1px solid rgba(49, 142, 145, .12);
	border-radius: 50%;
	box-shadow: 0 0 0 22px rgba(49, 142, 145, .025), 0 0 0 44px rgba(49, 142, 145, .018);
	pointer-events: none;
}

.amiri-otp__head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 15px;
	min-height: 58px;
	margin-bottom: 28px;
	padding-bottom: 24px;
	border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.amiri-otp__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 52px;
	width: 52px;
	height: 52px;
	color: var(--amiri-otp-gold-bright);
	background: rgba(225, 191, 98, .08);
	border: 1px solid rgba(225, 191, 98, .34);
	border-radius: 16px;
	box-shadow: 0 10px 26px rgba(225, 191, 98, .08), inset 0 1px 0 rgba(255, 255, 255, .09);
}

.amiri-otp__icon svg {
	display: block;
	width: 25px;
	height: 25px;
}

.amiri-otp__head > div {
	min-width: 0;
}

.amiri-otp__head::after {
	position: absolute;
	top: 2px;
	left: 0;
	padding: 4px 9px;
	content: 'امن و سریع';
	color: var(--amiri-otp-gold);
	font-size: 10px;
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: .01em;
	background: rgba(225, 191, 98, .08);
	border: 1px solid rgba(225, 191, 98, .2);
	border-radius: 999px;
}

.amiri-otp__title {
	margin: 0;
	color: var(--amiri-otp-text);
	font-size: clamp(1.03rem, 2vw, 1.25rem);
	font-weight: 750;
	line-height: 1.7;
	letter-spacing: -.015em;
}

.amiri-otp__sub {
	margin: 3px 0 0;
	color: var(--amiri-otp-muted);
	font-size: .79rem;
	line-height: 1.8;
}

.amiri-otp__trust {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 9px;
	margin-top: 24px;
	padding-top: 19px;
	border-top: 1px solid rgba(255, 255, 255, .09);
}

.amiri-otp__trust-item {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-width: 0;
	padding: 9px 7px;
	color: var(--amiri-otp-muted);
	font-size: .68rem;
	line-height: 1.7;
	text-align: center;
	background: rgba(255, 255, 255, .028);
	border: 1px solid rgba(255, 255, 255, .08);
	border-radius: 12px;
}

.amiri-otp__trust-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	color: var(--amiri-otp-gold);
}

.amiri-otp__trust-icon svg {
	display: block;
	width: 16px;
	height: 16px;
}

.amiri-otp__step {
	position: relative;
	animation: amiri-otp-step-in .35s ease both;
}

.amiri-otp__step[hidden] {
	display: none !important;
}

.amiri-otp__label {
	display: block;
	margin: 0 0 9px;
	color: #e8e5de;
	font-size: .82rem;
	font-weight: 650;
	line-height: 1.7;
}

.amiri-otp__label::after {
	margin-inline-start: 4px;
	content: '*';
	color: var(--amiri-otp-gold);
}

.amiri-otp__phone-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: stretch;
	gap: 10px;
}

.amiri-otp__phone-control {
	position: relative;
	display: block;
	min-width: 0;
}

.amiri-otp__prefix {
	position: absolute;
	top: 50%;
	right: 14px;
	z-index: 1;
	color: var(--amiri-otp-gold);
	font-size: .74rem;
	font-weight: 700;
	direction: ltr;
	transform: translateY(-50%);
	pointer-events: none;
}

.amiri-otp__input {
	display: block;
	width: 100%;
	min-height: 54px;
	margin: 0;
	padding: 13px 15px;
	color: var(--amiri-otp-text);
	font-family: inherit;
	font-size: .95rem;
	font-weight: 500;
	line-height: 1.7;
	background: rgba(5, 8, 14, .48);
	border: 1px solid rgba(255, 255, 255, .16);
	border-radius: 14px;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18);
	outline: none;
	transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.amiri-otp__input::placeholder {
	color: #7f8997;
	opacity: 1;
}

.amiri-otp__input:hover {
	border-color: rgba(225, 191, 98, .35);
}

.amiri-otp__input:focus {
	background: rgba(8, 13, 22, .72);
	border-color: rgba(243, 211, 122, .9);
	box-shadow: 0 0 0 4px rgba(225, 191, 98, .13), 0 10px 22px rgba(0, 0, 0, .15);
}

.amiri-otp__input[aria-invalid='true'] {
	border-color: rgba(255, 156, 156, .82);
	box-shadow: 0 0 0 4px rgba(255, 110, 110, .1);
}

.amiri-otp__input--phone {
	direction: ltr;
	text-align: left;
	letter-spacing: .04em;
	/* Keep the typed number clear of the visible +98 prefix. This block is
	 * intentionally after the shared input rule so the padding cannot be
	 * overwritten by the base control styles. */
	padding-right: 58px;
	padding-left: 16px;
}

.amiri-otp__input--code {
	min-height: 66px;
	padding: 10px 18px;
	font-size: 1.55rem;
	font-variant-numeric: tabular-nums;
	letter-spacing: .38em;
	text-align: center;
	direction: ltr;
}

.amiri-otp__input--code::placeholder {
	color: #687383;
	letter-spacing: .35em;
}

.amiri-otp__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 54px;
	margin: 0;
	padding: 12px 21px;
	color: var(--amiri-otp-gold-bright);
	font-family: inherit;
	font-size: .86rem;
	font-weight: 750;
	line-height: 1.7;
	white-space: nowrap;
	background: rgba(225, 191, 98, .08);
	border: 1px solid rgba(225, 191, 98, .5);
	border-radius: 14px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
	cursor: pointer;
	transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease, opacity .2s ease;
}

.amiri-otp__btn:hover:not(:disabled) {
	background: rgba(225, 191, 98, .15);
	border-color: rgba(243, 211, 122, .82);
	box-shadow: 0 10px 24px rgba(225, 191, 98, .1), inset 0 1px 0 rgba(255, 255, 255, .1);
	transform: translateY(-1px);
}

.amiri-otp__btn:active:not(:disabled) {
	transform: translateY(0);
}

.amiri-otp__btn:disabled {
	opacity: .5;
	cursor: wait;
}

.amiri-otp__btn[aria-busy='true'] {
	position: relative;
	color: transparent;
	cursor: wait;
}

.amiri-otp__btn[aria-busy='true']::before {
	position: absolute;
	width: 17px;
	height: 17px;
	content: '';
	border: 2px solid var(--amiri-otp-gold-bright);
	border-top-color: transparent;
	border-radius: 50%;
	animation: amiri-otp-spin .75s linear infinite;
}

.amiri-otp__btn--send {
	min-width: 132px;
}

.amiri-otp__btn--verify {
	display: flex;
	width: 100%;
	margin-top: 14px;
	color: #17140d;
	background: var(--amiri-otp-gold);
	border-color: var(--amiri-otp-gold);
	box-shadow: 0 12px 28px rgba(225, 191, 98, .19), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.amiri-otp__btn--verify:hover:not(:disabled) {
	color: #17140d;
	background: var(--amiri-otp-gold-bright);
	border-color: var(--amiri-otp-gold-bright);
	box-shadow: 0 15px 32px rgba(225, 191, 98, .27), inset 0 1px 0 rgba(255, 255, 255, .34);
}

.amiri-otp__btn--resend {
	display: flex;
	width: 100%;
	min-height: 42px;
	margin-top: 8px;
	padding: 8px 12px;
	color: var(--amiri-otp-muted);
	font-size: .76rem;
	font-weight: 600;
	background: transparent;
	border-color: transparent;
	box-shadow: none;
}

.amiri-otp__btn--resend:hover:not(:disabled) {
	color: var(--amiri-otp-gold-bright);
	background: rgba(225, 191, 98, .05);
	border-color: rgba(225, 191, 98, .18);
	box-shadow: none;
}

.amiri-otp__code-head {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	min-height: 30px;
	margin: -4px 0 15px;
}

.amiri-otp__back {
	justify-self: start;
	min-height: 36px;
	padding: 6px 0;
	color: var(--amiri-otp-muted);
	font-family: inherit;
	font-size: .75rem;
	font-weight: 600;
	line-height: 1.7;
	background: transparent;
	border: 0;
	cursor: pointer;
	transition: color .2s ease;
}

.amiri-otp__back:hover {
	color: var(--amiri-otp-gold-bright);
}

.amiri-otp__destination {
	justify-self: center;
	min-width: 0;
	margin: 0;
	color: var(--amiri-otp-subtle);
	font-size: .72rem;
	line-height: 1.7;
	text-align: center;
}

.amiri-otp__timer {
	justify-self: end;
	min-width: 78px;
	color: var(--amiri-otp-gold);
	font-size: .72rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.7;
	text-align: left;
}

.amiri-otp__msg {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	min-height: 0;
	margin: 13px 0 0;
	padding: 0;
	color: var(--amiri-otp-muted);
	font-size: .76rem;
	line-height: 1.9;
}

.amiri-otp__msg:empty {
	display: none;
}

.amiri-otp__msg:not(:empty) {
	padding: 10px 12px;
	border: 1px solid var(--amiri-otp-line);
	border-radius: 11px;
	background: rgba(255, 255, 255, .025);
}

.amiri-otp__msg:not(:empty)::before {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	margin-top: 2px;
	content: '';
	color: var(--amiri-otp-muted);
	font-family: Georgia, serif;
	font-size: 12px;
	font-weight: 700;
	border: 1px solid currentColor;
	border-radius: 50%;
}

.amiri-otp__msg.is-ok {
	color: var(--amiri-otp-success);
	background: rgba(57, 164, 111, .08);
	border-color: rgba(119, 214, 160, .24);
}

.amiri-otp__msg.is-ok::before {
	width: 9px;
	height: 15px;
	margin: 0 5px 0 4px;
	border-width: 0 2px 2px 0;
	border-style: solid;
	border-color: currentColor;
	border-radius: 0;
	transform: rotate(45deg) translate(-1px, -1px);
}

.amiri-otp__msg.is-err {
	color: var(--amiri-otp-danger);
	background: rgba(239, 87, 87, .08);
	border-color: rgba(255, 156, 156, .24);
}

.amiri-otp__msg.is-err::before {
	content: '!';
	font-family: inherit;
}

.amiri-otp__hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.amiri-otp a:focus-visible,
.amiri-otp button:focus-visible,
.amiri-otp input:focus-visible {
	outline: 2px solid var(--amiri-otp-gold-bright);
	outline-offset: 3px;
}

/* Checkout auth card already supplies the outer composition; this card is its
 * focused authentication panel and should use the available column width. */
.amiri-otp-wrap--account .amiri-otp {
	width: 100%;
	max-width: none;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	backdrop-filter: none;
}

.amiri-otp-wrap--account .amiri-otp::before,
.amiri-otp-wrap--account .amiri-otp::after,
.amiri-otp-wrap--account .amiri-otp__head,
.amiri-otp-wrap--account .amiri-otp__trust {
	display: none;
}

.amiri-checkout-auth .amiri-otp,
.amiri-otp-wrap--checkout .amiri-otp {
	width: 100%;
	max-width: none;
	margin: 0;
	background:
		radial-gradient(100% 90% at 100% 0%, rgba(225, 191, 98, .1), transparent 58%),
		radial-gradient(90% 80% at 0% 100%, rgba(40, 122, 125, .08), transparent 62%),
		rgba(16, 23, 34, .72);
}

.amiri-checkout-auth .amiri-otp__trust-item,
.amiri-otp-wrap--checkout .amiri-otp__trust-item {
	background: rgba(5, 8, 14, .2);
}

.amiri-checkout-auth__icon svg {
	display: block;
	width: 23px;
	height: 23px;
}

.amiri-checkout-auth__steps > li > span svg {
	display: block;
	width: 15px;
	height: 15px;
}

@keyframes amiri-otp-step-in {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes amiri-otp-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
	.amiri-otp {
		padding: 24px 18px;
		border-radius: 21px;
	}

	.amiri-otp__head {
		gap: 12px;
		margin-bottom: 23px;
		padding-bottom: 19px;
	}

	.amiri-otp__icon {
		flex-basis: 46px;
		width: 46px;
		height: 46px;
		border-radius: 14px;
	}

	.amiri-otp__icon svg {
		width: 22px;
		height: 22px;
	}

	.amiri-otp__head::after {
		display: none;
	}

	.amiri-otp__phone-row {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.amiri-otp__btn--send {
		width: 100%;
	}

	.amiri-otp__trust {
		gap: 6px;
	}

	.amiri-otp__trust-item {
		align-items: flex-start;
		flex-direction: column;
		gap: 3px;
		padding: 8px 5px;
		font-size: .63rem;
	}

	.amiri-otp__trust-icon {
		margin: 0 auto;
	}
}

@media (max-width: 390px) {
	.amiri-otp {
		padding: 21px 15px;
	}

	.amiri-otp__title {
		font-size: 1rem;
	}

	.amiri-otp__sub {
		font-size: .73rem;
	}

	.amiri-otp__code-head {
		grid-template-columns: auto minmax(0, 1fr);
		gap: 4px;
	}

	.amiri-otp__timer {
		grid-column: 1 / -1;
		grid-row: 2;
		justify-self: start;
		min-height: 19px;
		text-align: right;
	}

	.amiri-otp__destination {
		justify-self: end;
		font-size: .68rem;
	}

	.amiri-otp__input--code {
		font-size: 1.35rem;
		letter-spacing: .28em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.amiri-otp *,
	.amiri-otp *::before,
	.amiri-otp *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
