/* Store sign-in, registration and SMS pages (templates/form-login.php and
 * templates/sms-login.php), and the «شماره موبایل اصلی» card (account.php).
 *
 * Everything is scoped under .dvz-auth (or the card's own classes), so theme
 * updates cannot restyle it and it cannot restyle the theme. Colours follow
 * the theme's --ns-primary when it sets one. */

.dvz-auth {
	--dvz-primary: var(--ns-primary, #3f0261);
	--dvz-accent: #6c00e8;
	--dvz-ink: #2b2233;
	--dvz-muted: #7a7282;
	--dvz-line: #e9e3ef;
	--dvz-field: #f7f5fa;
	--dvz-good: #127a4a;
	--dvz-good-bg: #eaf7f0;
	--dvz-bad: #b3261e;
	--dvz-bad-bg: #fdeeed;
	--dvz-radius: 14px;

	box-sizing: border-box;
	width: 100%;
	max-width: 440px;
	margin: 12px auto 40px;
	color: var(--dvz-ink);
	font-size: 14px;
	line-height: 1.9;
	direction: rtl;
}

.dvz-auth *,
.dvz-auth *::before,
.dvz-auth *::after { box-sizing: border-box; }

.dvz-auth-card {
	position: relative;
	padding: 28px 28px 22px;
	border: 1px solid var(--dvz-line);
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(43, 22, 63, .08);
}

/* The theme puts page content in a white box of its own; around this card
   that is a card in a card, so the box steps back. Matched by structure, not
   theme class names: if a theme update changes it, this simply stops
   matching and the page still looks right. */
:where(article, .entry-content, .page-content):has(> .content > .woocommerce > .dvz-auth),
:where(article, .entry-content, .page-content):has(> .woocommerce > .dvz-auth) {
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

/* A thin accent across the top of the card. */
.dvz-auth-card::before {
	content: "";
	position: absolute;
	inset: 0 22% auto;
	height: 3px;
	border-radius: 0 0 3px 3px;
	background: linear-gradient(90deg, transparent, var(--dvz-accent), transparent);
}

/* ---------------------------------------------------------------- head -- */

.dvz-auth-head { margin: 0 0 20px; text-align: center; }

/* The store's logo (or icon and name), linking home. */
.dvz-auth .dvz-auth-brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 4px 0 18px;
	color: var(--dvz-ink);
	font-size: 1.15rem;
	font-weight: 700;
	text-decoration: none;
	border: 0;
}

.dvz-auth .dvz-auth-logo {
	display: block;
	width: auto !important;
	max-width: 240px;
	height: 64px !important;
	object-fit: contain;
}

.dvz-auth .dvz-auth-icon { width: 40px; height: 40px; border-radius: 12px; }
.dvz-auth-head--brand { margin-bottom: 14px; }
.dvz-auth-head--brand .dvz-auth-brand { margin: 4px 0 0; }
.dvz-auth-head--brand .dvz-auth-logo { height: 54px !important; }


.dvz-auth .dvz-auth-title {
	margin: 0 0 6px;
	padding: 0;
	border: 0;
	color: var(--dvz-ink);
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1.6;
}

.dvz-auth .dvz-auth-title::after,
.dvz-auth .dvz-auth-title::before { display: none; }

.dvz-auth-sub { margin: 0; color: var(--dvz-muted); font-size: .9rem; line-height: 1.9; }

/* ---------------------------------------------------------------- tabs -- */

/* Radios drive the tabs, so they work without JavaScript. Hidden visually,
   not from the keyboard: arrow keys still move between them. */
.dvz-auth-radio {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	opacity: 0;
	pointer-events: none;
}

.dvz-auth-tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	margin: 0 0 22px;
	padding: 4px;
	border-radius: 999px;
	background: var(--dvz-field);
}

.dvz-auth-tab {
	margin: 0 !important;
	padding: 9px 12px;
	border-radius: 999px;
	color: var(--dvz-muted);
	font-weight: 700;
	text-align: center;
	cursor: pointer;
	transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.dvz-auth-tab:hover { color: var(--dvz-ink); }

#dvz-auth-tab-login:checked ~ .dvz-auth-tabs .dvz-auth-tab--login,
#dvz-auth-tab-register:checked ~ .dvz-auth-tabs .dvz-auth-tab--register {
	background: #fff;
	color: var(--dvz-primary);
	box-shadow: 0 2px 10px rgba(43, 22, 63, .1);
}

#dvz-auth-tab-login:focus-visible ~ .dvz-auth-tabs .dvz-auth-tab--login,
#dvz-auth-tab-register:focus-visible ~ .dvz-auth-tabs .dvz-auth-tab--register {
	outline: 2px solid var(--dvz-accent);
	outline-offset: 2px;
}

#dvz-auth-tab-login:checked ~ .dvz-auth-panel--register,
#dvz-auth-tab-register:checked ~ .dvz-auth-panel--login { display: none; }

/* --------------------------------------------------------------- steps -- */

.dvz-auth-steps {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin: 0 0 20px !important;
	padding: 0 !important;
	list-style: none !important;
	counter-reset: dvz-step;
}

.dvz-auth-steps li {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 !important;
	color: var(--dvz-muted);
	font-size: .78rem;
	counter-increment: dvz-step;
}

.dvz-auth-steps li::before {
	content: counter(dvz-step, persian);
	display: inline-grid;
	width: 22px;
	height: 22px;
	place-items: center;
	border-radius: 50%;
	background: var(--dvz-field);
	font-size: .72rem;
	font-weight: 700;
}

.dvz-auth-steps li:not(:last-child)::after {
	content: "";
	width: 18px;
	height: 1px;
	margin-inline-start: 2px;
	background: var(--dvz-line);
}

.dvz-auth-steps li.is-current { color: var(--dvz-primary); font-weight: 700; }
.dvz-auth-steps li.is-current::before { background: var(--dvz-primary); color: #fff; }
.dvz-auth-steps li.is-done::before { content: "✓"; background: var(--dvz-good-bg); color: var(--dvz-good); }

/* -------------------------------------------------------------- fields -- */

.dvz-auth form { margin: 0; padding: 0; border: 0; }
.dvz-auth .form-row { margin: 0 0 14px !important; padding: 0 !important; }

.dvz-auth .dvz-auth-label,
.dvz-auth .form-row label {
	display: block;
	margin: 0 0 6px;
	color: var(--dvz-ink);
	font-size: .85rem;
	font-weight: 700;
	line-height: 1.8;
}

.dvz-auth .form-row label .required { color: var(--dvz-bad); text-decoration: none; }

.dvz-auth input.dvz-auth-input {
	display: block;
	width: 100% !important;
	height: 50px !important;
	margin: 0 !important;
	padding: 0 16px !important;
	border: 1.5px solid var(--dvz-line) !important;
	border-radius: var(--dvz-radius) !important;
	background: var(--dvz-field) !important;
	color: var(--dvz-ink) !important;
	box-shadow: none !important;
	font: inherit !important;
	font-size: .95rem !important;
	transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.dvz-auth input.dvz-auth-input::placeholder { color: #b3abbb; opacity: 1; }

.dvz-auth input.dvz-auth-input:focus {
	outline: 0;
	border-color: var(--dvz-accent) !important;
	background: #fff !important;
	box-shadow: 0 0 0 4px rgba(108, 0, 232, .1) !important;
}

/* WooCommerce's own «show password» eye sits inside the field. */
.dvz-auth .password-input { position: relative; display: block; }
.dvz-auth .password-input input.dvz-auth-input { padding-left: 46px !important; }
.dvz-auth .show-password-input {
	position: absolute !important;
	top: 50% !important;
	left: 14px !important;
	right: auto !important;
	transform: translateY(-50%);
	margin: 0 !important;
	padding: 4px !important;
	border: 0 !important;
	background: none !important;
	color: var(--dvz-muted) !important;
	cursor: pointer;
}

/* Inline icons (divanesaz_auth_icon()). */
.dvz-auth .dvz-icon { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; flex: none; }
.dvz-auth-notice .dvz-icon { width: 18px; height: 18px; margin-top: 4px; }

/* WooCommerce's «show password» button, drawn here: an eye, crossed out once
   the password is showing (WooCommerce adds .display-password). */
.dvz-auth .show-password-input {
	width: 34px !important;
	height: 34px !important;
	font-size: 0 !important;
}

.dvz-auth .show-password-input::before,
.dvz-auth .show-password-input::after { content: none !important; }

.dvz-auth .show-password-input::before {
	content: "" !important;
	display: block !important;
	width: 20px !important;
	height: 20px !important;
	margin: auto;
	background: currentColor !important;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dvz-auth .show-password-input.display-password::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
}

.dvz-auth .show-password-input:hover { color: var(--dvz-primary) !important; }

/* The mobile number: an icon, and digits that read left to right. */
.dvz-auth-phone-row { position: relative; }
.dvz-auth-phone-icon {
	position: absolute;
	top: 50%;
	right: 15px;
	display: flex;
	transform: translateY(-50%);
	color: var(--dvz-primary);
	font-size: 20px;
	pointer-events: none;
}

.dvz-auth input.dvz-auth-input--phone {
	padding-right: 44px !important;
	font-size: 1.05rem !important;
	letter-spacing: .06em;
	text-align: left;
}

.dvz-auth input.dvz-auth-input--code {
	height: 58px !important;
	text-align: center;
	font-size: 1.5rem !important;
	font-weight: 700;
	letter-spacing: .55em;
	padding-left: calc(16px + .55em) !important; /* the last digit's spacing, so the row is centred */
}

.dvz-auth input.dvz-auth-input--code::placeholder { letter-spacing: .45em; }

.dvz-inline-error { display: block; width: 100%; margin-top: 6px; color: #b3261e; font-size: .8rem; line-height: 1.8; }
.dvz-inline-error[hidden] { display: none; }

/* ------------------------------------------------------------- buttons -- */

.dvz-auth .dvz-auth-button {
	display: flex;
	width: 100%;
	min-height: 50px;
	margin: 14px 0 0 !important;
	padding: 12px 20px !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 0 !important;
	border-radius: var(--dvz-radius) !important;
	background: linear-gradient(135deg, var(--dvz-accent), var(--dvz-primary)) !important;
	color: #fff !important;
	box-shadow: 0 10px 24px rgba(63, 2, 97, .2) !important;
	font: inherit !important;
	font-size: .98rem !important;
	font-weight: 700 !important;
	line-height: 1.5 !important;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.dvz-auth .dvz-auth-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(63, 2, 97, .26) !important; }
.dvz-auth .dvz-auth-button:focus-visible { outline: 2px solid var(--dvz-accent); outline-offset: 3px; }
.dvz-auth .dvz-auth-button[disabled] { opacity: .6; cursor: default; transform: none; }

/* Password and email come second when a mobile number is on offer. */
.dvz-auth .dvz-auth-button--quiet {
	background: #fff !important;
	color: var(--dvz-primary) !important;
	border: 1.5px solid var(--dvz-primary) !important;
	box-shadow: none !important;
}

.dvz-auth .dvz-auth-button--quiet:hover { background: rgba(63, 2, 97, .05) !important; box-shadow: none !important; }

.dvz-auth .dvz-auth-link {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	border-bottom: 1px dashed currentColor;
	background: none;
	color: var(--dvz-primary);
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.dvz-auth .dvz-auth-link:hover { color: var(--dvz-accent); }
.dvz-auth .dvz-auth-link[disabled] { color: var(--dvz-muted); border-bottom-color: transparent; cursor: default; }

/* --------------------------------------------------------------- bits -- */

.dvz-auth-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin: 2px 0 0;
	font-size: .85rem;
}

.dvz-auth .dvz-auth-check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 10px 0 0;
	color: var(--dvz-ink);
	font-size: .85rem;
	font-weight: 400;
	cursor: pointer;
}

.dvz-auth .dvz-auth-row .dvz-auth-check { margin: 0; }
.dvz-auth .dvz-auth-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--dvz-primary); }

.dvz-auth-note { margin: 10px 0 0; color: var(--dvz-muted); font-size: .8rem; line-height: 1.9; text-align: center; }
.dvz-auth-note--orders { margin: -4px 0 16px; padding: 10px 14px; border-radius: var(--dvz-radius); background: rgba(108, 0, 232, .06); color: var(--dvz-primary); font-weight: 700; }
.dvz-auth-note code { padding: 1px 8px; border-radius: 6px; background: var(--dvz-field); font-weight: 700; letter-spacing: .15em; }

/* «یا با رمز عبور» between the two ways in. */
.dvz-auth-or {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 22px 0 18px;
	color: var(--dvz-muted);
	font-size: .8rem;
}

.dvz-auth-or::before,
.dvz-auth-or::after { content: ""; flex: 1; height: 1px; background: var(--dvz-line); }

.dvz-auth-switch {
	margin: 18px 0 0;
	padding: 14px 0 0;
	border-top: 1px solid var(--dvz-line);
	color: var(--dvz-muted);
	font-size: .88rem;
	text-align: center;
}

.dvz-auth-foot { margin: 16px 0 0; text-align: center; font-size: .85rem; }
.dvz-auth-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--dvz-muted); text-decoration: none; }
.dvz-auth-foot a:hover { color: var(--dvz-primary); }

/* «ارسال به ۰۹۱۲… · ویرایش» above the code box. */
.dvz-auth-chip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 12px;
	margin: 0 0 16px;
	padding: 10px 14px;
	border-radius: var(--dvz-radius);
	background: var(--dvz-field);
	font-size: .88rem;
}

.dvz-auth-chip bdi { font-weight: 700; letter-spacing: .04em; }
.dvz-auth-chip form { display: inline; margin: 0; }
.dvz-auth-chip .dvz-auth-link { font-size: .82rem; }
.dvz-auth-chip--ok { background: var(--dvz-good-bg); color: var(--dvz-good); }
.dvz-auth-chip--ok .dvz-icon { margin-inline-end: 2px; font-size: 1.1em; }
.dvz-auth-chip .dvz-auth-link .dvz-icon { margin-inline-end: 2px; }

.dvz-auth-resend {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin: 16px 0 0 !important;
	color: var(--dvz-muted);
	font-size: .85rem;
}

/* Our own answers. */
.dvz-auth-notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 18px;
	padding: 12px 14px;
	border-radius: var(--dvz-radius);
	font-size: .88rem;
	line-height: 1.9;
}

.dvz-auth-notice--good { background: var(--dvz-good-bg); color: var(--dvz-good); }
.dvz-auth-notice--error { background: var(--dvz-bad-bg); color: var(--dvz-bad); }

/* The privacy sentence WooCommerce adds to registration forms. */
.dvz-auth .woocommerce-privacy-policy-text p { margin: 4px 0 0; color: var(--dvz-muted); font-size: .78rem; line-height: 1.9; }
.dvz-auth .woocommerce-privacy-policy-text a { color: var(--dvz-primary); }

/* WooCommerce's password strength hint under a new password. */
.dvz-auth .woocommerce-password-strength { margin-top: 8px; padding: 6px 10px; border-radius: 10px; font-size: .8rem; text-align: center; }
.dvz-auth .woocommerce-password-hint { display: block; margin-top: 6px; color: var(--dvz-muted); font-size: .76rem; line-height: 1.8; }

/* The honeypot: out of sight without an offset — left:-9999px on an RTL page
   opens a 10,000px scrollable strip that phones can land in. */
.dvz-hp {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

@media (max-width: 480px) {
	.dvz-auth { margin: 0 auto 28px; }
	.dvz-auth-card { padding: 22px 16px 18px; border-radius: 20px; }
	.dvz-auth .dvz-auth-title { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
	.dvz-auth * { transition: none !important; }
}

/* ------------------------------------------------------------------------
 * «ورود با کد پیامکی» under the theme's other sign-in forms (header popup,
 * checkout), and the «شماره موبایل اصلی» card in Account details.
 * --------------------------------------------------------------------- */

.dvz-sms-entry { margin: 12px 0 0; }
.dvz-sms-entry a.btn {
	background: transparent !important;
	border: 1px solid var(--ns-primary, #3f0261) !important;
	color: var(--ns-primary, #3f0261) !important;
	border-radius: 20px;
}
.dvz-sms-entry a.btn:hover { background: var(--ns-primary-alpha-10, rgba(63, 2, 97, .1)) !important; }

.dvz-sms-lead { margin: 0 0 16px; font-size: .92em; line-height: 2; opacity: .8; }
.dvz-main-phone .dvz-sms-notice { margin: 0 0 16px !important; }

.dvz-sms-to {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 12px;
	margin: 0 0 12px;
	font-size: .92em;
}
.dvz-sms-to bdi { font-weight: 700; }
.dvz-sms-to form, .dvz-main-phone .dvz-sms-resend, .dvz-main-phone-actions form { margin: 0; display: inline; }

.dvz-code { text-align: center; letter-spacing: .5em; font-size: 1.3em !important; font-weight: 700; }
.dvz-code::placeholder { letter-spacing: .35em; }

.dvz-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--ns-primary, #3f0261);
	font: inherit;
	font-size: .9em;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.dvz-link[disabled] { opacity: .55; cursor: default; text-decoration: none; }
.dvz-link--muted { color: inherit; opacity: .7; }

.dvz-main-phone .dvz-sms-resend { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 12px; font-size: .9em; opacity: .9; }
.dvz-main-phone .dvz-sms-back { margin: 18px 0 0; text-align: center; font-size: .9em; }
.dvz-main-phone .dvz-sms-local { margin: -4px 0 10px; font-size: .85em; opacity: .7; }

.dvz-main-phone { margin-top: 24px; }
.dvz-main-phone h3 { margin: 0 0 8px; font-size: 1.1em; }
.dvz-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; max-width: 460px; }
.dvz-row .form-control { flex: 1 1 200px; min-width: 0; }
.dvz-main-phone-current { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; max-width: 460px; font-size: 1.05em; }
.dvz-main-phone-actions { display: inline-flex; gap: 14px; }
.dvz-ok { color: #198754; font-size: .85em; margin-inline-start: 6px; }
