/*
 * V2 account authentication surfaces.
 *
 * This file is loaded by the V7/V2 base template only.  The selectors are
 * intentionally prefixed with v2- so the older shop templates keep their
 * existing login and registration presentation.
 */

:root {
	--v2-auth-paper: #f6f2ed;
	--v2-auth-white: #ffffff;
	--v2-auth-text: #262626;
	--v2-auth-muted: #6f6b67;
	--v2-auth-line: #ded9d3;
	--v2-auth-orange: #ffb36f;
	--v2-auth-orange-dark: #e99a56;
	--v2-auth-soft: #e9edef;
}

/* The modal is mounted at the end of <body> so it is not constrained by a
 * product, checkout, or header stacking context. */
.v2-login-modal {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(36, 37, 37, 0.42);
	z-index: 1200;
}

.v2-login-modal.is-open {
	display: flex;
}

.v2-login-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(480px, 100%);
	max-height: min(760px, calc(100vh - 48px));
	overflow: auto;
	background: var(--v2-auth-paper);
	color: var(--v2-auth-text);
	border: 1px solid rgba(38, 38, 38, 0.08);
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

.v2-login-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ece9e5;
	color: var(--v2-auth-text);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.v2-login-modal__close:hover,
.v2-login-modal__close:focus-visible {
	background: #e2ddd7;
	outline: 2px solid var(--v2-auth-orange);
	outline-offset: 2px;
}

.v2-login-modal__main {
	padding: 38px 34px 28px;
}

.v2-login-modal__title {
	margin: 0 0 28px;
	font-size: 36px;
	font-weight: 700;
	line-height: 1.1;
	text-align: center;
}

.v2-login-modal__form {
	display: grid;
	gap: 14px;
}

.v2-login-modal__field {
	width: 100%;
	height: 46px;
	padding: 0 20px;
	border: 1px solid transparent;
	border-radius: 24px;
	background: var(--v2-auth-white);
	color: var(--v2-auth-text);
	font-size: 16px;
}

.v2-login-modal__field:focus {
	border-color: var(--v2-auth-orange-dark);
	outline: 2px solid rgba(255, 179, 111, 0.28);
	outline-offset: 1px;
}

.v2-login-modal__password-wrap {
	position: relative;
}

.v2-login-modal__password-wrap .v2-login-modal__field {
	padding-right: 58px;
}

.v2-login-modal__password-toggle {
	position: absolute;
	top: 50%;
	right: 16px;
	width: 28px;
	height: 28px;
	padding: 0;
	transform: translateY(-50%);
	border: 0;
	background: transparent;
	color: var(--v2-auth-text);
	cursor: pointer;
	font-size: 17px;
}

.v2-login-modal__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 16px;
}

.v2-login-modal__submit,
.v2-checkout-login__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 8px 24px;
	border: 0;
	border-radius: 12px 17px 13px 16px / 11px 12px 10px 13px;
	background: var(--v2-auth-orange);
	color: var(--v2-auth-text);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 140ms ease, transform 140ms ease;
}

.v2-login-modal__submit:hover,
.v2-login-modal__submit:focus-visible,
.v2-checkout-login__trigger:hover,
.v2-checkout-login__trigger:focus-visible {
	background: #ffab61;
	color: var(--v2-auth-text);
	transform: translateY(-1px);
	outline: 2px solid rgba(233, 154, 86, 0.32);
	outline-offset: 2px;
}

.v2-login-modal__submit:disabled {
	opacity: 0.65;
	cursor: wait;
	transform: none;
}

.v2-login-modal__text-link,
.v2-login-modal__register-link {
	color: var(--v2-auth-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.v2-login-modal__text-link {
	font-size: 14px;
}

.v2-login-modal__message {
	min-height: 20px;
	margin: 2px 0 0;
	color: #a23b2e;
	font-size: 14px;
	line-height: 1.4;
}

.v2-login-modal__benefits {
	padding: 28px 34px 30px;
	background: var(--v2-auth-soft);
}

.v2-login-modal__benefits h3 {
	margin: 0 0 18px;
	font-size: 22px;
	line-height: 1.25;
}

.v2-login-modal__benefits ul {
	display: grid;
	gap: 10px;
	margin: 0 0 18px;
	padding: 0;
	list-style: none;
}

.v2-login-modal__benefits li {
	display: grid;
	grid-template-columns: 30px 1fr;
	align-items: start;
	gap: 10px;
	font-size: 15px;
	line-height: 1.35;
}

.v2-login-modal__benefits li::before {
	content: "✓";
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #9bc4e5;
	color: #fff;
	font-size: 17px;
	font-weight: 700;
}

/* Checkout keeps its server-side login branch as a safety net, but the V2
 * presentation is a single clear launch action that opens the same modal. */
.v2-checkout-login {
	max-width: 520px;
	margin: 0 auto 28px;
	padding: 34px;
	background: var(--v2-auth-soft);
	border-radius: 10px;
	text-align: center;
}

.v2-checkout-login h2 {
	margin: 0 0 10px;
	font-size: 24px;
}

.v2-checkout-login p {
	margin: 0 0 20px;
	color: var(--v2-auth-muted);
}

.v2-checkout-login__fallback {
	display: inline-block;
	margin-left: 16px;
	color: var(--v2-auth-text);
	font-size: 14px;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* The registration route reuses the existing field names and validation but
 * presents the inputs as two-column groups inside a centered customer panel. */
.v2-registration-page {
	min-height: 60vh;
	padding: 18px 16px 64px;
	background: var(--v2-auth-paper);
}

.v2-registration-intro {
	max-width: 920px;
	margin: 0 auto 24px;
	text-align: center;
}

.v2-registration-intro h1 {
	margin: 0 0 12px;
	font-size: clamp(32px, 4vw, 48px);
	line-height: 1.08;
}

.v2-registration-intro h4 {
	max-width: 760px;
	margin: 0 auto;
	color: var(--v2-auth-muted);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
}

.v2-registration-form-column {
	float: none !important;
	width: min(920px, 100%) !important;
	margin: 0 auto;
	padding: 0 !important;
}

.v2-registration-form-shell {
	padding: 0 !important;
	background: transparent !important;
}

.v2-registration-form-body {
	float: none !important;
	margin: 0 !important;
	padding: 32px 34px 38px;
	background: var(--v2-auth-soft);
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(38, 38, 38, 0.06);
}

.v2-registration-form-body > strong,
.v2-registration-section-title {
	display: block;
	margin: 26px 0 12px;
	padding-top: 20px;
	border-top: 1px solid rgba(38, 38, 38, 0.12);
	font-size: 18px;
	line-height: 1.2;
}

.v2-registration-form-body > strong:first-of-type,
.v2-registration-section-title:first-of-type {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.v2-registration-form .row {
	display: flex;
	flex-wrap: wrap;
	margin: 0 -8px;
}

.v2-registration-form .row > [class*="col-"] {
	position: relative;
	float: none;
	min-height: 0;
	margin-bottom: 16px;
	padding: 0 8px;
}

.v2-registration-form .login-field {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: 58px;
	margin: 0;
	padding: 23px 16px 8px;
	border: 1px solid transparent;
	border-radius: 14px;
	background: var(--v2-auth-white);
	color: var(--v2-auth-text);
	font-size: 16px;
}

.v2-registration-form .login-field:focus {
	border-color: var(--v2-auth-orange-dark);
	outline: 2px solid rgba(255, 179, 111, 0.28);
	outline-offset: 1px;
}

.v2-registration-form .textfield-title {
	position: absolute;
	top: 7px;
	left: 24px;
	margin: 0;
	padding: 0;
	color: var(--v2-auth-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

.v2-registration-consent {
	display: grid;
	gap: 12px;
	margin-top: 16px;
	color: var(--v2-auth-muted);
	font-size: 14px;
	line-height: 1.45;
}

.v2-registration-consent label {
	display: grid;
	grid-template-columns: 20px 1fr;
	align-items: start;
	gap: 8px;
}

.v2-registration-consent input {
	width: 16px;
	height: 16px;
	margin: 2px 0 0;
	accent-color: var(--v2-auth-orange-dark);
}

.v2-registration-submit {
	margin-top: 24px;
}

.v2-registration-submit .btn {
	min-height: 44px;
	padding: 10px 24px;
	border: 0;
	border-radius: 12px 17px 13px 16px / 11px 12px 10px 13px;
	background: var(--v2-auth-orange);
	color: var(--v2-auth-text);
	font-weight: 600;
}

.v2-registration-submit .btn:hover,
.v2-registration-submit .btn:focus-visible {
	background: #ffab61;
	color: var(--v2-auth-text);
}

/* Registration opens from both account entry points in a dedicated dialog.
 * The server-rendered registration fragment remains the source of truth for
 * fields and validation; these rules only remove page-level chrome and make
 * the existing form comfortable to complete in a modal-sized scroll area. */
.v2-auth-register-modal {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 18px;
	background: rgba(36, 37, 37, 0.42);
	z-index: 1210;
}

.v2-auth-register-modal.is-open {
	display: flex;
}

.v2-auth-register-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(900px, 100%);
	max-height: min(920px, calc(100vh - 36px));
	overflow: hidden;
	background: var(--v2-auth-paper);
	color: var(--v2-auth-text);
	border: 1px solid rgba(38, 38, 38, 0.08);
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

.v2-auth-register-modal__title {
	flex: 0 0 auto;
	margin: 0;
	padding: 30px 68px 20px 32px;
	font-size: 30px;
	line-height: 1.15;
}

.v2-auth-register-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ece9e5;
	color: var(--v2-auth-text);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.v2-auth-register-modal__close:hover,
.v2-auth-register-modal__close:focus-visible {
	background: #e2ddd7;
	outline: 2px solid var(--v2-auth-orange);
	outline-offset: 2px;
}

.v2-auth-register-modal__body {
	min-height: 0;
	overflow: auto;
	border-top: 1px solid rgba(38, 38, 38, 0.08);
}

.v2-auth-register-modal__loading,
.v2-auth-register-modal__error {
	padding: 32px;
	color: var(--v2-auth-muted);
	font-size: 16px;
	line-height: 1.5;
}

.v2-auth-register-modal__error {
	color: #a23b2e;
}

.v2-auth-register-modal .v2-registration-page {
	min-height: 0;
	padding: 24px 30px 32px;
	background: var(--v2-auth-paper);
}

.v2-auth-register-modal .v2-registration-intro {
	display: none;
}

.v2-auth-register-modal .v2-registration-form-column {
	width: 100% !important;
}

.v2-auth-register-modal .v2-registration-form-body {
	padding: 0;
	background: transparent;
	box-shadow: none;
}

/* Keep the complete company registration group in the modal. These fields
 * already belong to the checkout contract, so hiding them here would create
 * different account data depending on where registration began. */
.v2-auth-register-modal .v2-registration-row--organizationnumber,
.v2-auth-register-modal .v2-registration-row--company,
.v2-auth-register-modal .v2-registration-row--school {
	display: flex;
}

.v2-auth-register-modal .v2-registration-submit .btn {
	cursor: pointer;
}

.v2-auth-register-modal .v2-registration-submit .btn.is-loading {
	opacity: 0.65;
	cursor: wait;
}

@media (max-width: 640px) {
	.v2-login-modal {
		align-items: flex-start;
		padding: 12px;
	}

	.v2-login-modal__dialog {
		max-height: calc(100vh - 24px);
	}

	.v2-login-modal__main,
	.v2-login-modal__benefits {
		padding-right: 22px;
		padding-left: 22px;
	}

	.v2-login-modal__title {
		font-size: 30px;
	}

	.v2-auth-register-modal {
		align-items: flex-start;
		padding: 12px;
	}

	.v2-auth-register-modal__dialog {
		max-height: calc(100vh - 24px);
	}

	.v2-auth-register-modal__title {
		padding: 24px 58px 18px 22px;
		font-size: 26px;
	}

	.v2-auth-register-modal .v2-registration-page {
		padding: 20px 12px 28px;
	}

	.v2-login-modal__actions {
		align-items: stretch;
		flex-direction: column;
	}

	.v2-login-modal__submit {
		width: 100%;
	}

	.v2-registration-page {
		padding-right: 10px;
		padding-left: 10px;
	}

	.v2-registration-form-body {
		padding: 24px 16px 28px;
	}

	.v2-registration-form .row > [class*="col-"] {
		width: 100%;
	}

	.v2-checkout-login {
		padding: 26px 20px;
	}

	.v2-checkout-login__fallback {
		display: block;
		margin: 16px 0 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.v2-login-modal__submit,
	.v2-checkout-login__trigger {
		transition: none;
	}
}
