/* =========================================================================
 * Account — layout: page shell, login screen, cards, form fields, quick links
 * =========================================================================
 * Owns: the two-column shell that fills the width with one gutter; the login
 * card and its editorial column; the WooCommerce form controls inside a card;
 * the quick-links row under the login card.
 *
 * Sections 1-4 of the original file.
 *
 * Loaded: account pages only, after account-theme.css
 *
 * Part of the account design system. Split out of a single 2135-line
 * account.css in stage 6 of the architecture work; the rules below are
 * unchanged, in their original order. The order matters: these files are
 * enqueued in sequence (theme -> layout -> dashboard -> address) and the
 * cascade between them is the cascade that used to live inside one file.
 * ========================================================================= */

/* =========================================================================
 * 1. Page shell — fill the width, one gutter, no dead side space
 * ========================================================================= */

.mg-account main.content,
.mg-account main.content.narrow,
.mg-account .content.narrow,
.mg-account main#main.wrap,
.mg-account .wrap.content {
	max-width: none !important;
	width: 100% !important;
	padding-left: var(--mg-acc-gutter) !important;
	padding-right: var(--mg-acc-gutter) !important;
}

/* Height chain: main → article → .entry → .woocommerce → .mg-acc.
 * Every link must be flex, otherwise the stretch stops at the first block
 * ancestor and the page ends in an empty band. */
.mg-account main.content {
	display: flex !important;
	flex-direction: column !important;
	padding-top: 0 !important;
}

.mg-account main.content > article,
.mg-account main.content > article > .entry,
.mg-account main.content > article > .entry > .woocommerce,
.mg-account main.content > article > .entry > .woocommerce > .mg-acc {
	display: flex !important;
	flex-direction: column !important;
	flex: 1 1 auto !important;
	min-height: 0;
}

.mg-account .mg-acc {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: var(--mg-acc-s-8) 0 var(--mg-acc-s-10);
	font-family: var(--mg-acc-font);
	line-height: var(--mg-acc-lh);
	color: var(--mg-acc-ink);
}

/* The theme prints its own page title. Each card carries a heading, so the
 * theme's copy stays in the accessibility tree as the single H1 but is not
 * painted twice. */
.mg-account .page-title {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.mg-account .entry {
	line-height: inherit;
}

/* =========================================================================
 * 2. Login: editorial column + form card
 * ========================================================================= */

.mg-acc__grid {
	display: grid;
	grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
	gap: clamp(24px, 4vw, 64px);
	align-items: center;
	flex: 1 1 auto;
}

/* --- the editorial column (reuses the panel markup) --------------- */
.mg-panel {
	background: none;
	border: 0;
	padding: 0;
	color: var(--mg-acc-ink);
	align-self: center;
}

.mg-panel__eyebrow {
	font-size: var(--mg-acc-fs-eyebrow);
	letter-spacing: var(--mg-acc-ls-eyebrow);
	color: var(--mg-acc-ink-muted);
	margin: 0 0 var(--mg-acc-s-5);
	text-transform: uppercase;
}

.mg-panel__title {
	position: relative;
	isolation: isolate;
	font-family: var(--mg-acc-font-display);
	font-weight: 500;
	font-size: var(--mg-acc-fs-h1);
	line-height: 1.35;
	letter-spacing: -0.01em;
	margin: 0 0 var(--mg-acc-s-4);
	color: var(--mg-acc-ink);
}

/* The gold underline in the mockup, done with a background so it never
 * collides with descenders or with the line box. */
.mg-panel__title em,
.mg-panel__title .mg-mark {
	font-style: normal;
	white-space: nowrap;
	/* A thick, offset underline. Unlike a background gradient or an ::after
	 * box, it is painted by the text engine itself, so it can never sit on
	 * top of the glyphs or clip Persian descenders (ی، ج، ع). */
	text-decoration: underline;
	text-decoration-color: var(--mg-acc-accent);
	text-decoration-thickness: 0.14em;
	text-underline-offset: 0.34em;
	text-decoration-skip-ink: none;
}
.mg-panel__sub {
	font-size: var(--mg-acc-fs-md);
	color: var(--mg-acc-ink-soft);
	max-width: 40ch;
	margin: 0 0 var(--mg-acc-s-7);
}

/* Numbered proof list — thin rules, no boxes. */
.mg-panel__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--mg-acc-line-strong);
	counter-reset: mg-proof;
}

.mg-panel__list li {
	display: flex;
	align-items: center;
	gap: var(--mg-acc-s-3);
	padding: 14px 2px;
	border-bottom: 1px solid var(--mg-acc-line);
	font-size: var(--mg-acc-fs-md);
	color: var(--mg-acc-ink);
	counter-increment: mg-proof;
}

.mg-panel__list li::before {
	content: "0" counter(mg-proof);
	font-size: var(--mg-acc-fs-xs);
	color: var(--mg-acc-ink-faint);
	letter-spacing: 0.1em;
	min-width: 22px;
	flex: 0 0 auto;
	font-variant-numeric: tabular-nums;
}

/* The tick that PHP prints is redundant next to the number. */
.mg-panel__tick {
	display: none;
}

.mg-panel__foot {
	margin-top: var(--mg-acc-s-6);
	font-size: var(--mg-acc-fs-sm);
	color: var(--mg-acc-ink-muted);
	display: flex;
	align-items: center;
	gap: var(--mg-acc-s-2);
}

.mg-panel__foot svg {
	width: 15px;
	height: 15px;
	opacity: 0.7;
}

/* --- the form card ------------------------------------------------- */
.mg-card {
	border: 1px solid var(--mg-acc-line);
	border-radius: var(--mg-acc-r-sm);
	padding: clamp(22px, 3vw, 40px);
	background: var(--mg-acc-surface);
	box-shadow: var(--mg-acc-shadow-md);
	max-width: 560px;
	width: 100%;
	justify-self: start;
}

.mg-card__eyebrow {
	font-size: var(--mg-acc-fs-eyebrow);
	letter-spacing: 0;
	color: var(--mg-acc-ink-muted);
	margin: 0 0 6px;
	font-weight: 400;
}

.mg-card__title {
	font-family: var(--mg-acc-font-display);
	font-weight: 500;
	font-size: var(--mg-acc-fs-h2);
	line-height: 1.4;
	margin: 0 0 10px;
	color: var(--mg-acc-ink);
}

.mg-card__lead {
	font-size: var(--mg-acc-fs-sm);
	color: var(--mg-acc-ink-muted);
	margin: 0 0 var(--mg-acc-s-6);
}

/* =========================================================================
 * 3. WooCommerce forms inside the card
 * =========================================================================
 * Specificity note, learned the hard way: the theme ships
 *   .woocommerce form .form-row input.input-text   → (0,4,1)
 * which beats .mg-card .woocommerce-Input → (0,2,0). Every field rule below
 * therefore carries at least five class/type selectors, and the :focus rule
 * is repeated explicitly — the theme also sets box-shadow:none on focus,
 * which silently deleted the keyboard focus ring (an accessibility defect,
 * not a matter of taste).
 * ========================================================================= */

.mg-account .mg-card form .form-row input.input-text,
.mg-account .mg-card form .form-row input[type="text"],
.mg-account .mg-card form .form-row input[type="email"],
.mg-account .mg-card form .form-row input[type="password"],
.mg-account .mg-card form .form-row input[type="tel"],
.mg-account .mg-card form .woocommerce-Input {
	height: var(--mg-acc-h-control) !important;
	line-height: var(--mg-acc-h-control) !important;
	padding: 0 16px !important;
	border: 1px solid var(--mg-acc-line-strong) !important;
	border-radius: var(--mg-acc-r-sm) !important;
	background: var(--mg-acc-surface) !important;
	color: var(--mg-acc-ink) !important;
	font-family: inherit !important;
	font-size: var(--mg-acc-fs-md) !important;
	box-shadow: none !important;
	transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.mg-account .mg-card form .form-row input.input-text:hover,
.mg-account .mg-card form .form-row input[type="text"]:hover,
.mg-account .mg-card form .form-row input[type="email"]:hover,
.mg-account .mg-card form .form-row input[type="password"]:hover {
	border-color: var(--mg-acc-line-mid) !important;
}

.mg-account .mg-card form .form-row input.input-text:focus,
.mg-account .mg-card form .form-row input[type="text"]:focus,
.mg-account .mg-card form .form-row input[type="email"]:focus,
.mg-account .mg-card form .form-row input[type="password"]:focus,
.mg-account .mg-card form .form-row input[type="tel"]:focus,
.mg-account .mg-card form .woocommerce-Input:focus {
	border-color: var(--mg-acc-ink) !important;
	box-shadow: 0 0 0 3px var(--mg-acc-ring) !important;
	outline: none !important;
}

/* Password field with its eye toggle. */
.mg-account .mg-card .mg-pw {
	position: relative;
}

.mg-account .mg-card .mg-pw input {
	padding-inline-end: 52px !important;
}

.mg-account .mg-card .mg-pw__btn {
	position: absolute;
	inset-inline-end: 7px;
	bottom: 7px;
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	border: 0;
	background: none;
	color: var(--mg-acc-ink-muted);
	border-radius: var(--mg-acc-r-sm);
	cursor: pointer;
	padding: 0;
}

.mg-account .mg-card .mg-pw__btn:hover {
	color: var(--mg-acc-ink);
	background: var(--mg-acc-surface-sunken);
}

.mg-account .mg-card .mg-pw__btn svg {
	width: 19px;
	height: 19px;
}

/* Labels: readable, not shouty. */
.mg-account .mg-card form .form-row label,
.mg-account .mg-card .woocommerce-form-login__rememberme span {
	font-size: var(--mg-acc-fs-sm);
	color: var(--mg-acc-ink-soft);
	font-weight: 500;
	display: block;
	margin-bottom: var(--mg-acc-s-2);
}

.mg-account .mg-card form .form-row {
	padding: 0;
	margin: 0 0 var(--mg-acc-s-5);
}

/* Kill the theme's nested box around the form — a rounded 5px frame inside a
 * rounded 3px card reads as a rendering mistake. */
.mg-account .mg-card form.woocommerce-form,
.mg-account .mg-card form.login,
.mg-account .mg-card form.register,
.mg-account .mg-card form.woocommerce-form-login,
.mg-account .mg-card form.woocommerce-form-register {
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	background: none !important;
}

/* WooCommerce's own <h2>ورود</h2>. Kept in the DOM for screen readers, not
 * painted — the card already has a visible heading.
 * Scoped with :not() because other cards legitimately carry their own <h2> as a
 * direct child (the password-reset card does), and the original blanket rule
 * hid those too. */
.mg-account .mg-card > h2:not(.mg-card__title),
.mg-account .mg-card .woocommerce > h2:not(.mg-card__title) {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Remember-me + lost password on one line, comfortably spaced. */
.mg-account .mg-card .form-row.mg-row-between,
.mg-account .mg-card .woocommerce-form-login__rememberme {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--mg-acc-s-4);
	flex-wrap: wrap;
	margin: 0 0 var(--mg-acc-s-6);
}

.mg-account .mg-card .woocommerce-form-login__rememberme {
	min-height: 44px;
	font-weight: 400;
	margin-bottom: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: var(--mg-acc-s-2);
	white-space: nowrap;
}

/* The theme makes this label a block; inside a flex row it must not be. */
.mg-account .mg-card .woocommerce-form-login__rememberme label,
.mg-account .mg-card .woocommerce-form-login__rememberme span {
	display: inline !important;
	margin: 0 !important;
	font-weight: 400 !important;
}

.mg-account .mg-card .woocommerce-form-login__rememberme input[type="checkbox"] {
	width: 19px;
	height: 19px;
	accent-color: var(--mg-acc-ink);
	margin-inline-end: var(--mg-acc-s-2);
	vertical-align: -4px;
}

.mg-account .mg-card .lost_password {
	margin: 0;
	font-size: var(--mg-acc-fs-sm);
	text-align: start;
	display: flex;
	justify-content: flex-start;
}

.mg-account .mg-card .lost_password a {
	width: -moz-fit-content;
	width: fit-content;
}

.mg-account .mg-card .lost_password a,
.mg-account .mg-card .mg-link-quiet {
	color: var(--mg-acc-ink-soft);
	text-decoration: underline;
	text-decoration-color: var(--mg-acc-line-strong);
	text-underline-offset: 4px;
	text-decoration-thickness: 1px;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

.mg-account .mg-card .lost_password a:hover,
.mg-account .mg-card .mg-link-quiet:hover {
	color: var(--mg-acc-ink);
	border-color: var(--mg-acc-ink);
}

/* Buttons. */
.mg-account .mg-card button.button,
.mg-account .mg-card .woocommerce-form-login__submit,
.mg-account .mg-card .woocommerce-form-register__submit,
.mg-account .mg-card input.button,
.mg-account .mg-card .mg-btn {
	width: 100%;
	height: var(--mg-acc-h-control);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--mg-acc-ink);
	border-radius: var(--mg-acc-r-sm);
	background: var(--mg-acc-ink);
	color: var(--mg-acc-surface);
	font-family: inherit;
	font-size: var(--mg-acc-fs-md);
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	padding: 0 20px;
	transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.mg-account .mg-card button.button:hover,
.mg-account .mg-card .woocommerce-form-login__submit:hover,
.mg-account .mg-card .woocommerce-form-register__submit:hover,
.mg-account .mg-card input.button:hover,
.mg-account .mg-card .mg-btn:hover {
	background: var(--mg-acc-surface);
	color: var(--mg-acc-ink);
}

.mg-account .mg-card button.button:active,
.mg-account .mg-card .mg-btn:active {
	transform: translateY(1px);
}

.mg-account .mg-card button.button:focus-visible,
.mg-account .mg-card .woocommerce-form-login__submit:focus-visible,
.mg-account .mg-card .mg-btn:focus-visible {
	outline: 2px solid var(--mg-acc-ink);
	outline-offset: 3px;
}

/* Ghost (secondary) button: "ساخت حساب تازه". */
.mg-account .mg-card .mg-btn--ghost {
	background: var(--mg-acc-surface);
	color: var(--mg-acc-ink);
	border-color: var(--mg-acc-line-strong);
	font-weight: 400;
}

.mg-account .mg-card .mg-btn--ghost:hover {
	border-color: var(--mg-acc-ink);
	background: var(--mg-acc-surface-sunken);
}

/* Divider with a word in it. */
.mg-account .mg-card .mg-or {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: var(--mg-acc-s-6) 0 var(--mg-acc-s-5);
	color: var(--mg-acc-ink-faint);
	font-size: var(--mg-acc-fs-sm);
}

.mg-account .mg-card .mg-or::before,
.mg-account .mg-card .mg-or::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--mg-acc-line);
}

.mg-account .mg-card .mg-foot-note {
	margin: var(--mg-acc-s-5) 0 0;
	font-size: var(--mg-acc-fs-xs);
	color: var(--mg-acc-ink-muted);
	text-align: center;
	line-height: 1.9;
}

.mg-account .mg-card .mg-foot-note a {
	color: var(--mg-acc-ink-soft);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* =========================================================================
 * 4. Quick links row (below the login card)
 * ========================================================================= */

.mg-acc__links {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--mg-acc-s-3);
	margin-top: var(--mg-acc-s-6);
	flex: 0 0 auto;
}

.mg-acc__link {
	display: flex;
	align-items: center;
	gap: var(--mg-acc-s-3);
	padding: 16px 18px;
	background: var(--mg-acc-surface);
	border: 1px solid var(--mg-acc-line);
	border-radius: var(--mg-acc-r-sm);
	text-decoration: none;
	color: var(--mg-acc-ink);
	transition: border-color 0.16s ease, background 0.16s ease;
	min-width: 0;
}

.mg-acc__link:hover {
	border-color: var(--mg-acc-line-mid);
	background: var(--mg-acc-surface-sunken);
}

.mg-acc__linkIcon {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: var(--mg-acc-r-sm);
	background: var(--mg-acc-surface-sunken);
	color: var(--mg-acc-ink);
}

.mg-acc__linkIcon svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.mg-acc__linkText {
	min-width: 0;
	display: block;
}

.mg-acc__linkText b {
	display: block;
	font-size: var(--mg-acc-fs-base);
	font-weight: 600;
}

.mg-acc__linkText small {
	display: block;
	font-size: var(--mg-acc-fs-xs);
	color: var(--mg-acc-ink-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

