/* Inline login modal for the EDD checkout.
   Styling mirrors the active theme's login form (siteorigin-theme:
   .page-login/.so-auth .edd_form rules) so the modal matches the site's
   auth pages: --color-* tokens, 0.75rem radii, accent-blue focus rings, and
   the gradient .edd-submit button. */

/* Inline login trigger embedded in the checkout email-exists notice.
   Rendered as an <a> by checkout.js so it inherits the theme's checkout link
   styling (colour + hover underline) automatically. */
.so-edd-login-trigger {
	cursor: pointer;
}

/* Modal container. Hidden via the [hidden] attribute until opened by JS. */
.so-edd-login-modal {
	align-items: center;
	display: flex;
	inset: 0;
	justify-content: center;
	position: fixed;
	z-index: 100000;
}

.so-edd-login-modal[hidden] {
	display: none;
}

.so-edd-login-modal__overlay {
	background: rgba( 0, 0, 0, 0.6 );
	inset: 0;
	position: absolute;
}

.so-edd-login-modal__dialog {
	background: var( --color-surface, #fdfdfd );
	border-radius: 0.75rem;
	box-shadow: 0 12px 48px rgba( 0, 0, 0, 0.25 );
	box-sizing: border-box;
	color: var( --color-text-secondary, #555 );
	margin: 20px;
	max-height: calc( 100vh - 40px );
	max-width: 460px;
	overflow-y: auto;
	padding: 2.5rem;
	position: relative;
	width: 100%;
}

.so-edd-login-modal__close {
	background: none;
	border: 0;
	color: var( --color-text-muted, #888 );
	cursor: pointer;
	font-size: 1.75rem;
	line-height: 1;
	padding: 0;
	position: absolute;
	right: 1.25rem;
	top: 1.25rem;
	transition: color 0.15s;
}

.so-edd-login-modal__close:hover,
.so-edd-login-modal__close:focus {
	color: var( --color-text-primary, #1a1a2e );
}

/* Title — the clear top of the hierarchy; scoped under the modal id so it wins
   against any page heading rules. */
#so-edd-login-modal .so-edd-login-modal__title {
	color: var( --color-text-primary, #1a1a2e );
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.2;
	margin: 0 0 1.5rem;
	padding-right: 2rem;
}

/* Error region — accent-red left border on a subtle surface. */
.so-edd-login-modal__error {
	background: var( --color-surface-alt, #f6f6f6 );
	border-left: 3px solid var( --color-accent-red, #f84646 );
	border-radius: 0.5rem;
	color: var( --color-text-primary, #1a1a2e );
	margin-bottom: 1.25rem;
	padding: 0.75rem 1rem;
}

.so-edd-login-modal__error[hidden] {
	display: none;
}

.so-edd-login-form p,
.so-edd-login-magic__form p {
	margin: 0 0 1rem;
}

/* Field labels — scoped under the modal id so they win specificity against
   EDD/theme `label` rules and stay clearly below the headings in the hierarchy. */
#so-edd-login-modal .so-edd-login-form label,
#so-edd-login-modal .so-edd-login-magic__form label {
	color: var( --color-text-secondary, #555 );
	display: block;
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0;
	margin-bottom: 0.375rem;
	text-transform: none;
}

/*
 * Scoped under #so-edd-login-modal so these reach specificity (1,2,1) and beat
 * EDD core's `#edd_checkout_form_wrap input[type=text] { padding: 4px 6px }`
 * (1,1,1) — the modal renders inside #edd_checkout_form_wrap, and an id beats
 * any number of classes, so the unscoped (0,2,1) rule lost. Border matches the
 * checkout fields' #e5e7eb. No !important needed.
 */
#so-edd-login-modal .so-edd-login-form input[type="text"],
#so-edd-login-modal .so-edd-login-form input[type="password"],
#so-edd-login-modal .so-edd-login-magic__form input[type="email"] {
	background-color: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 0.75rem;
	box-sizing: border-box;
	color: var( --color-text-primary, #1a1a2e );
	display: block;
	font-size: 0.875rem;
	line-height: 1.5;
	padding: 0.625rem 1rem;
	transition: border-color 0.15s, box-shadow 0.15s;
	width: 100%;
}

#so-edd-login-modal .so-edd-login-form input[type="text"]:focus,
#so-edd-login-modal .so-edd-login-form input[type="password"]:focus,
#so-edd-login-modal .so-edd-login-magic__form input[type="email"]:focus {
	border-color: var( --color-accent-blue, #4ca3ff );
	box-shadow: 0 0 0 3px rgba( 76, 163, 255, 0.15 );
	outline: none;
}

/* Submit buttons — mirror the theme's gradient .edd-submit button. */
.so-edd-login-form__submit,
.so-edd-login-magic__submit {
	align-items: center;
	background: linear-gradient( to bottom, var( --color-accent-blue, #4ca3ff ), var( --color-accent-blue-hover, #3b96f0 ) );
	border: none;
	border-radius: 0.75rem;
	box-shadow: 0 1px 6px rgba( 76, 163, 255, 0.25 );
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	font-size: 0.9375rem;
	font-weight: 600;
	justify-content: center;
	padding: 0.75rem 2rem;
	transition: all 0.15s;
	width: 100%;
}

.so-edd-login-form__submit:hover,
.so-edd-login-form__submit:focus,
.so-edd-login-magic__submit:hover,
.so-edd-login-magic__submit:focus {
	box-shadow: 0 2px 12px rgba( 76, 163, 255, 0.35 );
	transform: translateY( -1px );
}

@media ( prefers-reduced-motion: reduce ) {

	.so-edd-login-form__submit:hover,
	.so-edd-login-form__submit:focus,
	.so-edd-login-magic__submit:hover,
	.so-edd-login-magic__submit:focus {
		transform: none;
	}
}

/* Lost-password link — mirrors the theme's .edd-lost-password a styling. */
.so-edd-login-form__lost-password {
	margin: 0.875rem 0 0;
}

.so-edd-login-form__lost-password a {
	color: var( --color-accent-blue, #4ca3ff );
	font-size: 0.875rem;
	text-decoration: none;
	transition: color 0.15s;
}

.so-edd-login-form__lost-password a:hover,
.so-edd-login-form__lost-password a:focus {
	color: var( --color-accent-blue-hover, #3b96f0 );
	text-decoration: underline;
}

.so-edd-login-magic {
	border-top: 1px solid var( --color-border, #e8e8e8 );
	margin-top: 2rem;
	padding-top: 1.75rem;
}

/* Section subheading — smaller and lighter than the title so it reads as a
   secondary label, not a competing heading. */
#so-edd-login-modal .so-edd-login-magic__heading {
	color: var( --color-text-secondary, #555 );
	font-size: 0.9375rem;
	font-weight: 600;
	margin: 0 0 1rem;
}

/* Info message — accent-blue left border on a subtle surface. */
.so-edd-login-magic__message {
	background: var( --color-surface-alt, #f6f6f6 );
	border-left: 3px solid var( --color-accent-blue, #4ca3ff );
	border-radius: 0.5rem;
	color: var( --color-text-primary, #1a1a2e );
	font-size: 0.8125rem;
	margin-bottom: 1rem;
	padding: 0.75rem 1rem;
}

.so-edd-login-magic__message[hidden] {
	display: none;
}
