/* Login / register / lost-password / reset-password: one shared "auth card"
   language for every logged-out screen on the My Account page. Reuses
   .qg-input (components/account/component.css) for fields and .qg-btn for
   buttons so it stays visually consistent with the logged-in dashboard. */

.qg-auth-shell {
	position: relative;
	display: flex;
	justify-content: center;
	padding: var(--qg-space-7) var(--qg-space-4);
	min-height: 60vh;
	overflow: hidden;
}

/* A quiet echo of the hero's gradient-mesh brand mark — soft, mostly out
   of frame, just enough to make the auth screen feel like part of the same
   brand rather than a bare utility form. */
.qg-auth-shell::before {
	content: '';
	position: absolute;
	top: -20%;
	left: 50%;
	width: min(700px, 140vw);
	height: min(700px, 140vw);
	transform: translateX(-50%);
	background:
		radial-gradient(38% 38% at 30% 30%, rgba(255, 229, 59, 0.16) 0%, transparent 100%),
		radial-gradient(42% 42% at 70% 25%, rgba(255, 122, 26, 0.14) 0%, transparent 100%),
		radial-gradient(40% 40% at 50% 70%, rgba(179, 39, 29, 0.1) 0%, transparent 100%);
	filter: blur(50px);
	pointer-events: none;
}

.qg-auth {
	position: relative;
	width: 100%;
	display: flex;
	justify-content: center;
}

/* Mobile/tablet (default): the frame is a transparent no-op wrapper — the
   card alone is the whole visual unit, exactly as before. */
.qg-auth__frame {
	width: 100%;
	max-width: 440px;
}

.qg-auth__card {
	position: relative;
	width: 100%;
	background: var(--qg-color-surface);
	border: 1px solid var(--qg-color-line);
	border-radius: var(--qg-radius-lg);
	box-shadow: var(--qg-shadow-lg);
	padding: var(--qg-space-6) var(--qg-space-5);
	overflow: hidden;
}

.qg-auth__card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--qg-color-yellow) 0%, var(--qg-color-accent) 100%);
}

/* The decorative brand half of the split-screen — built and always present
   in the markup (shared across login/register, lost-password and
   reset-password), but only switched on at the desktop breakpoint below.
   Kept out of the flow entirely on smaller screens so it never affects
   mobile layout or scroll height. */
.qg-auth__visual {
	display: none;
}

/* Desktop: stop floating a phone-width card in an ocean of empty page.
   The frame becomes the actual visual unit — a wide, tall bordered card
   split into a branded story panel and the form itself — and the inner
   .qg-auth__card sheds its own chrome since the frame now supplies it. */
@media (min-width: 900px) {
	.qg-auth-shell {
		align-items: center;
		padding-top: var(--qg-space-8);
		padding-bottom: var(--qg-space-8);
	}

	.qg-auth__frame {
		position: relative;
		display: grid;
		grid-template-columns: 1fr 1.05fr;
		align-items: stretch;
		width: 100%;
		max-width: 960px;
		min-height: 620px;
		background: var(--qg-color-surface);
		border: 1px solid var(--qg-color-line);
		border-radius: var(--qg-radius-lg);
		box-shadow: var(--qg-shadow-lg);
		overflow: hidden;
	}

	.qg-auth__frame::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 3px;
		background: linear-gradient(90deg, var(--qg-color-yellow) 0%, var(--qg-color-accent) 100%);
		z-index: 1;
	}

	.qg-auth__visual {
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		padding: var(--qg-space-6) var(--qg-space-6) var(--qg-space-5);
		background: var(--qg-gradient-warm);
		color: #fff8ee;
		overflow: hidden;
	}

	.qg-auth__visual::after {
		content: '';
		position: absolute;
		inset: 0;
		background:
			radial-gradient(60% 50% at 85% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 100%),
			radial-gradient(55% 45% at 10% 100%, rgba(22, 19, 15, 0.18) 0%, transparent 100%);
		pointer-events: none;
	}

	.qg-auth__visual-mark {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		font-family: var(--qg-font-heading);
		font-size: 1.4rem;
		font-weight: 600;
		color: var(--qg-color-accent-dark);
		background: var(--qg-color-surface);
		border-radius: 999px;
	}

	.qg-auth__visual-title {
		position: relative;
		margin: var(--qg-space-6) 0 var(--qg-space-3);
		font-family: var(--qg-font-heading);
		font-weight: 500;
		font-size: clamp(1.7rem, 2.4vw, 2.3rem);
		line-height: 1.2;
	}

	.qg-auth__visual-text {
		position: relative;
		margin: 0;
		max-width: 34ch;
		font-size: 0.98rem;
		line-height: 1.65;
		color: rgba(255, 248, 238, 0.9);
	}

	.qg-auth__visual-stats {
		position: relative;
		display: flex;
		gap: var(--qg-space-5);
		margin: var(--qg-space-6) 0 0;
		padding: var(--qg-space-4) 0 0;
		list-style: none;
		border-top: 1px solid rgba(255, 248, 238, 0.28);
	}

	.qg-auth__visual-stats li {
		display: flex;
		flex-direction: column;
		gap: 0.15rem;
	}

	.qg-auth__visual-stats strong {
		font-family: var(--qg-font-heading);
		font-size: 1.15rem;
		font-weight: 600;
	}

	.qg-auth__visual-stats span {
		font-size: 0.76rem;
		text-transform: uppercase;
		letter-spacing: var(--qg-tracking-label);
		color: rgba(255, 248, 238, 0.75);
	}

	.qg-auth__card {
		display: flex;
		flex-direction: column;
		justify-content: center;
		width: 100%;
		max-width: none;
		background: none;
		border: none;
		box-shadow: none;
		border-radius: 0;
		padding: var(--qg-space-6) var(--qg-space-7);
	}

	.qg-auth__card::before {
		display: none;
	}

	/* Single-panel screens (lost/reset password) have no tabs, so let the
	   form breathe with a touch more vertical room instead of floating in
	   the middle of the tall frame with nothing else around it. */
	.qg-auth__card--single {
		max-width: 480px;
		margin: 0 auto;
	}
}

/* Tab switch — pure CSS, driven by two hidden radios so it works with no JS. */

.qg-auth__radio {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.qg-auth__switch {
	position: relative;
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 0.25rem;
	padding: 0.25rem;
	margin-bottom: var(--qg-space-5);
	background: var(--qg-color-paper);
	border-radius: 999px;
}

/* Only two tabs (registration disabled): Sign In / Phone. */
.qg-auth__switch--pair {
	grid-template-columns: 1fr 1fr;
}

.qg-auth__switch-btn {
	position: relative;
	z-index: 1;
	display: block;
	text-align: center;
	white-space: nowrap;
	padding: 0.6rem 0.5rem;
	border-radius: 999px;
	font-family: var(--qg-font-body);
	font-weight: 600;
	font-size: 0.82rem;
	color: var(--qg-color-ink-soft);
	cursor: pointer;
	transition: color 0.25s var(--qg-ease);
}

#qg-auth-tab-login:checked ~ .qg-auth__switch label[for='qg-auth-tab-login'],
#qg-auth-tab-register:checked ~ .qg-auth__switch label[for='qg-auth-tab-register'],
#qg-auth-tab-phone:checked ~ .qg-auth__switch label[for='qg-auth-tab-phone'] {
	color: var(--qg-color-surface);
}

.qg-auth__switch::after {
	content: '';
	position: absolute;
	top: 0.25rem;
	bottom: 0.25rem;
	left: 0.25rem;
	width: calc(33.333% - 0.25rem);
	background: var(--qg-color-ink);
	border-radius: 999px;
	transition: transform 0.3s var(--qg-ease);
}

.qg-auth__switch--pair::after {
	width: calc(50% - 0.25rem);
}

/* Tab order is Phone, Sign In, Create Account (phone-first — see
   form-login.php) — the slide indicator's translateX steps match that
   order, one column-width per step, regardless of whether the 2-tab
   --pair (no registration) or full 3-tab switch is showing, since Phone
   is always index 0 and Sign In always index 1 either way. */
#qg-auth-tab-login:checked ~ .qg-auth__switch::after {
	transform: translateX(100%);
}

#qg-auth-tab-register:checked ~ .qg-auth__switch::after {
	transform: translateX(200%);
}

.qg-auth__panel {
	display: none;
}

#qg-auth-tab-login:checked ~ .qg-auth__panel--login,
#qg-auth-tab-register:checked ~ .qg-auth__panel--register,
#qg-auth-tab-phone:checked ~ .qg-auth__panel--phone,
.qg-auth__card--single .qg-auth__panel {
	display: block;
	animation: qg-auth-fade 0.35s var(--qg-ease);
}

@keyframes qg-auth-fade {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.qg-auth__title {
	font-family: var(--qg-font-heading);
	font-size: clamp(1.4rem, 5.5vw, 1.8rem);
	font-weight: 500;
	margin: 0 0 0.35rem;
	color: var(--qg-color-ink);
	text-align: center;
}

.qg-auth__subtitle {
	margin: 0 0 var(--qg-space-5);
	color: var(--qg-color-ink-soft);
	font-size: 0.9rem;
	text-align: center;
	line-height: 1.6;
}

.qg-auth__form {
	display: flex;
	flex-direction: column;
	gap: var(--qg-space-3);
}

.qg-auth__field {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.qg-auth__field label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--qg-color-ink);
}

.qg-auth__hint {
	margin: 0;
	font-size: 0.82rem;
	color: var(--qg-color-muted);
	line-height: 1.6;
}

/* Password show/hide is WooCommerce's own built-in behavior — it auto-wraps
   every .woocommerce-Input[type="password"] in a .password-input span and
   appends a .show-password-input button with its own icon (see
   assets/js/frontend/woocommerce.js + the matching rules in
   woocommerce-layout.css). No custom markup/JS for it; just make sure our
   .qg-input still reads full-width inside that wrapper. */

.qg-auth__field--password .password-input {
	width: 100%;
}

.qg-auth__field--password .qg-input {
	width: 100%;
}

/* Password strength meter (register / reset password) is also WooCommerce's
   own wc-password-strength-meter script, auto-enqueued on exactly these
   forms (class-wc-frontend-scripts.php) — this only restyles its real
   .woocommerce-password-strength output to match the card. */

.qg-auth__field--password .woocommerce-password-strength {
	display: block;
	margin-top: 0.5rem;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 600;
	text-align: center;
	background: var(--qg-color-paper);
	color: var(--qg-color-muted);
}

.qg-auth__field--password .woocommerce-password-strength.short,
.qg-auth__field--password .woocommerce-password-strength.bad {
	background: #fdeaea;
	color: var(--qg-color-danger);
}

.qg-auth__field--password .woocommerce-password-strength.good {
	background: #fff6da;
	color: #8a6d00;
}

.qg-auth__field--password .woocommerce-password-strength.strong {
	background: #e6f3ec;
	color: var(--qg-color-success);
}

.qg-auth__field--password .woocommerce-password-hint {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.76rem;
	color: var(--qg-color-muted);
	line-height: 1.5;
}

/* Social login (Google, via the Nextend Social Login plugin) — real OAuth,
   injected through the same woocommerce_login_form/woocommerce_register_form
   hooks WooCommerce always fires here. Only the surrounding spacing/divider
   and the button's box shape are themed; the plugin's own Google-brand
   button (logo, colors) is left exactly as Google's guidelines require. */

.qg-auth__form .nsl-container {
	position: relative;
	margin: 0.35rem 0 0.15rem;
	padding-top: var(--qg-space-4);
}

.qg-auth__form .nsl-container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: var(--qg-color-line);
}

.qg-auth__form .nsl-container::after {
	content: 'or';
	position: absolute;
	top: 0;
	left: 50%;
	transform: translate(-50%, -50%);
	padding: 0 0.75rem;
	background: var(--qg-color-surface);
	font-family: var(--qg-font-body);
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--qg-color-muted);
}

.qg-auth__form .nsl-container-buttons {
	width: 100%;
}

.qg-auth__form .nsl-container-buttons > * {
	width: 100%;
}

.qg-auth__form a[data-plugin='nsl'] {
	display: block;
	width: 100%;
}

.qg-auth__form .nsl-button {
	width: 100% !important;
	height: 50px !important;
	border-radius: var(--qg-radius) !important;
	border: 1px solid var(--qg-color-line) !important;
	transition: border-color 0.2s var(--qg-ease), box-shadow 0.2s var(--qg-ease);
}

.qg-auth__form a[data-plugin='nsl']:hover .nsl-button {
	border-color: var(--qg-color-ink-soft) !important;
	box-shadow: var(--qg-shadow-sm);
}

.qg-auth__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
	font-size: 0.85rem;
}

.qg-auth__checkbox {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--qg-color-ink-soft);
	cursor: pointer;
}

.qg-auth__checkbox input {
	accent-color: var(--qg-color-ink);
	width: 16px;
	height: 16px;
}

.qg-auth__link {
	color: var(--qg-color-ink-soft);
	text-decoration: none;
	font-weight: 500;
}

.qg-auth__link:hover {
	color: var(--qg-color-accent-dark);
	text-decoration: underline;
}

.qg-auth__submit {
	width: 100%;
	justify-content: center;
	margin-top: 0.25rem;
	padding: 0.9rem 1.5rem;
}

.qg-auth__switch-hint {
	margin: var(--qg-space-4) 0 0;
	text-align: center;
	font-size: 0.85rem;
	color: var(--qg-color-ink-soft);
}

.qg-auth__switch-hint label {
	color: var(--qg-color-accent-dark);
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.qg-auth__switch-hint a {
	color: inherit;
}

/* Phone sign-in tab — two steps (enter number / enter code) shown one at a
   time by phone-auth.js toggling the [hidden] attribute; everything else
   (field/label/button look) is inherited from the shared .qg-auth__field,
   .qg-input and .qg-btn rules above so this tab matches the email tabs. */

.qg-phone-auth__step {
	display: flex;
	flex-direction: column;
	gap: var(--qg-space-3);
}

.qg-phone-auth__step[hidden] {
	display: none;
}

.qg-phone-auth__sent-to {
	margin: -0.25rem 0 0;
	font-size: 0.85rem;
	color: var(--qg-color-ink-soft);
}

.qg-phone-auth__code-input {
	letter-spacing: 0.4em;
	font-weight: 600;
	text-align: center;
}

.qg-phone-auth__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.qg-phone-auth__link-btn {
	background: none;
	border: none;
	padding: 0;
	font-family: var(--qg-font-body);
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--qg-color-ink-soft);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.qg-phone-auth__link-btn:hover {
	color: var(--qg-color-accent-dark);
}

.qg-phone-auth__link-btn:disabled {
	color: var(--qg-color-muted);
	cursor: default;
	text-decoration: none;
}

.qg-phone-auth__message {
	margin: 0;
	min-height: 1.2em;
	font-size: 0.85rem;
	color: var(--qg-color-ink-soft);
}

.qg-phone-auth__message--error {
	color: var(--qg-color-danger);
}

@media (max-width: 480px) {
	.qg-auth__card {
		padding: var(--qg-space-5) var(--qg-space-4);
	}

	.qg-auth__switch-btn {
		padding: 0.6rem 0.3rem;
		font-size: 0.78rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qg-auth__panel,
	.qg-auth__switch-btn,
	.qg-auth__switch::after {
		animation: none;
		transition: none;
	}
}
