/* Moduplay Auth — Login/Register Styles */

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

/* Logout button styled to match an inline link (used in admin bar). */
.moduplay-logout-link {
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
	cursor: pointer;
	font: inherit;
	text-decoration: underline;
}

/* Flash error notice rendered after a failed Auth0 redirect. */
.moduplay-auth-error-notice {
	margin: 1rem auto;
	max-width: 60rem;
	padding: 0.75rem 1rem;
	background: #fdecea;
	border: 1px solid #f5c2c0;
	border-radius: 4px;
	color: #611a15;
}
.moduplay-auth-error-notice code {
	font-size: 0.85em;
	background: rgba(0, 0, 0, 0.05);
	padding: 0.1em 0.3em;
	border-radius: 3px;
}

/* Screen-reader only */
.sr-only {
	position: absolute;
	width: 0.0625rem;
	height: 0.0625rem;
	padding: 0;
	margin: -0.0625rem;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Container */
.moduplay-auth {
	max-width: 30rem;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Logo */
.moduplay-auth__logo {
	margin-bottom: 1rem;
	text-align: center;
}

.moduplay-auth__logo a {
	display: inline-block;
}

.moduplay-auth__logo img {
	max-width: 12.5rem;
	height: auto;
}

/* Headings */
.moduplay-auth__heading {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--moduplay-auth-secondary, #1A1A1A);
	margin: 0 0 .5rem;
	line-height: 1.3;
}

.moduplay-auth__subheading {
	font-size: 0.875rem;
	color: #6b7280;
	margin: 0 0 1rem;
	line-height: 1.5;
}

/* Terms */
.moduplay-auth__terms {
	font-size: 0.75rem;
	color: #6b7280;
	line-height: 1.5;
	margin-top: 0.75rem;
	text-align: center;
}

.moduplay-auth__terms a {
	color: var(--moduplay-auth-primary, #E30613);
	text-decoration: none;
}

.moduplay-auth__terms a:hover {
	text-decoration: underline;
}

/* Messages */
.moduplay-auth__messages {
	padding: 0.75rem 1rem;
	border-radius: 0.25rem;
	margin-bottom: 0.75rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.moduplay-auth__messages--error {
	background: #f8d7da;
	color: #842029;
}

.moduplay-auth__messages--success {
	background: #d1e7dd;
	color: #0f5132;
}

.moduplay-auth__messages--info {
	background: #cff4fc;
	color: #055160;
}

/* Tabs */
.moduplay-auth__tabs {
	display: flex;
	border-bottom: 0.125rem solid #e5e7eb;
	margin-bottom: 1.5rem;
}

.moduplay-auth__tab {
	flex: 1;
	padding: 0.625rem 1rem;
	border: none;
	background: none;
	font-size: 0.9375rem;
	font-weight: 600;
	color: #6b7280;
	cursor: pointer;
	border-bottom: 0.125rem solid transparent;
	margin-bottom: -0.125rem;
	transition: color 0.2s, border-color 0.2s;
}

.moduplay-auth__tab:hover {
	color: var(--moduplay-auth-secondary, #1A1A1A);
}

.moduplay-auth__tab:focus-visible {
	outline: 0.125rem solid var(--moduplay-auth-primary, #E30613);
	outline-offset: -0.125rem;
	border-radius: 0.125rem;
}

.moduplay-auth__tab--active {
	color: var(--moduplay-auth-primary, #E30613);
	border-bottom-color: var(--moduplay-auth-primary, #E30613);
}

/* Form */
.moduplay-auth__form {
	position: relative;
}

.moduplay-auth__field {
	position: relative;
	margin-bottom: 0.5rem;
}

/* Floating label */
.moduplay-auth__label {
	position: absolute;
	top: 50%;
	left: 0.75rem;
	transform: translateY(-50%);
	font-size: 0.875rem;
	color: #6b7280;
	pointer-events: none;
	transform-origin: left top;
	transition: transform 0.2s ease, font-size 0.2s ease, color 0.2s ease, top 0.2s ease;
	background: #fff;
	padding: 0 0.25rem;
	line-height: 1;
	z-index: 1;
}

/* Float the label when input is focused OR has a value */
.moduplay-auth__field:focus-within .moduplay-auth__label,
.moduplay-auth__input:not(:placeholder-shown) ~ .moduplay-auth__label {
	top: 0;
	transform: translateY(-50%);
	font-size: 0.75rem;
	color: var(--moduplay-auth-primary, #E30613);
}

/* When not focused but filled, use neutral colour */
.moduplay-auth__field:not(:focus-within) .moduplay-auth__input:not(:placeholder-shown) ~ .moduplay-auth__label {
	color: #374151;
}

.moduplay-auth__input {
	width: 100%;
	padding: 0.75rem;
	border: 0.0625rem solid #d1d5db;
	border-radius: 0.375rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #111827;
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
}

/* Hide the placeholder text (the space keeps :placeholder-shown working) */
.moduplay-auth__input::placeholder {
	color: transparent;
}

.moduplay-auth__input:focus {
	outline: none;
	border-color: var(--moduplay-auth-primary, #E30613);
	box-shadow: 0 0 0 0.1875rem rgba(227, 6, 19, 0.1);
}

.moduplay-auth__input--error {
	border-color: #dc2626;
}

.moduplay-auth__input--error:focus {
	box-shadow: 0 0 0 0.1875rem rgba(220, 38, 38, 0.1);
}

.moduplay-auth__error {
	display: none;
	font-size: .875rem;
	color: #dc2626;

	&:not(:empty) {
		margin-top: 0.25rem;
		margin-bottom: .5rem;
		display: block;
	}
}

/* Inline notice (e.g. Turnstile disabled in non-production environments) */
.moduplay-auth__field--turnstile-disabled .moduplay-auth__notice {
	margin: 0;
	padding: 0.625rem 0.875rem;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: #92400e;
	background: #fffbeb;
	border: 1px solid #fcd34d;
	border-radius: 6px;
}

/* Hint text */
.moduplay-auth__hint {
	text-align: center;
	font-size: 0.8125rem;
	color: #6b7280;
	margin-top: 0.75rem;
	line-height: 1.5;
}

/* Button */
.moduplay-auth__button {
	width: 100%;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	min-height: 3rem;
	padding: .625rem 1.25rem;
	border: .0625rem solid transparent;
	border-radius: .1875rem;
	font-size: 1rem;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	color: var(--moduplay-auth-button-text, #fff);
	background: var(--moduplay-auth-button-bg, var(--moduplay-auth-primary, #E30613));
	cursor: pointer;
	transition: all .2s;
}

.moduplay-auth__button:hover {
	opacity: 0.9;
}

.moduplay-auth__button:active {
	transform: scale(0.98);
}

.moduplay-auth__button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.moduplay-auth__button:focus-visible {
	outline: 0.125rem solid var(--moduplay-auth-primary, #E30613);
	outline-offset: 0.125rem;
}

/* Spinner */
.moduplay-auth__spinner {
	width: 1.125rem;
	height: 1.125rem;
	border: 0.125rem solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: moduplay-auth-spin 0.6s linear infinite;
}

@keyframes moduplay-auth-spin {
	to { transform: rotate(360deg); }
}

/*
 * Spinner inside a theme button (tier-upgrade / request-access submit, etc.).
 * These buttons use the theme's `.btn` class rather than `.moduplay-auth__button`,
 * so centre the spinner and colour it with `currentColor` so it stays visible on
 * any button background (the default white spinner above suits the dark auth modal
 * buttons only).
 */
.btn .moduplay-auth__spinner {
	display: inline-block;
	vertical-align: middle;
	border-color: currentColor transparent transparent transparent;
}

.btn:has(> .moduplay-auth__spinner) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

/*
 * Tier-upgrade submit: while loading the label stays put and the spinner sits
 * beside it. Disabling the button blocks hover/click; the styles below make
 * that state read as intentional rather than a greyed-out failure.
 */
#moduplay-tier-upgrade-submit.is-loading {
	cursor: default;
	opacity: 1;
	pointer-events: none;
}

/* Code input */
.moduplay-auth__code-fieldset {
	border: none;
	padding: 0;
	margin: 0;
}

.moduplay-auth__code-inputs {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	margin: 1.5rem 0;
	align-items: center;
}

.moduplay-auth__code-digit {
	width: 3rem;
	height: 3.5rem;
	text-align: center;
	font-size: 1.5rem;
	font-weight: 700;
	border: 0.125rem solid #d1d5db;
	border-radius: 0.5rem;
	background: #fff;
	color: #111827;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.moduplay-auth__code-digit:focus {
	outline: none;
	border-color: var(--moduplay-auth-primary, #E30613);
	box-shadow: 0 0 0 0.1875rem rgba(227, 6, 19, 0.1);
}

.moduplay-auth__code-separator {
	font-size: 1.5rem;
	color: #9ca3af;
	font-weight: 300;
	user-select: none;
}

.moduplay-auth__verify-text {
	text-align: center;
	font-size: 0.875rem;
	color: #4b5563;
	margin-bottom: 0.5rem;
}

/* Actions row (resend + back) */
.moduplay-auth__actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 1rem;
}

/* Links */
.moduplay-auth__link {
	background: none;
	border: none;
	color: var(--moduplay-auth-primary, #E30613);
	cursor: pointer;
	font-size: 0.875rem;
	text-decoration: none;
	padding: 0;
}

.moduplay-auth__link:hover {
	text-decoration: underline;
}

.moduplay-auth__link:focus-visible {
	outline: 0.125rem solid var(--moduplay-auth-primary, #E30613);
	outline-offset: 0.125rem;
	border-radius: 0.125rem;
}

.moduplay-auth__link:disabled {
	color: #9ca3af;
	cursor: default;
	text-decoration: none;
}

.moduplay-auth__link--loading::before {
	content: '';
	display: inline-block;
	width: 0.875rem;
	height: 0.875rem;
	margin-right: 0.375rem;
	border: 0.125rem solid #9ca3af;
	border-top-color: var(--moduplay-auth-primary, #E30613);
	border-radius: 50%;
	animation: moduplay-auth-spin 0.6s linear infinite;
	vertical-align: middle;
}

/* Inline link inside messages */
.moduplay-auth__inline-link {
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	font: inherit;
	padding: 0;
	text-decoration: underline;
}

.moduplay-auth__inline-link:hover {
	opacity: 0.8;
}

/* Checkbox field */
.moduplay-auth__field--checkbox {
	margin: 1rem 0;
}

.moduplay-auth__checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	font-size: 0.875rem;
	color: var(--moduplay-auth-secondary, #1A1A1A);
	cursor: pointer;
	line-height: 1.4;
}

.moduplay-auth__checkbox {
	width: 1.125rem;
	height: 1.125rem;
	margin-top: 0.0625rem;
	flex-shrink: 0;
	accent-color: var(--moduplay-auth-primary, #E30613);
	cursor: pointer;
}

/* Pricing disclosure agreement body (admin-managed WYSIWYG content) */
.moduplay-pricing-disclosure__content {
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--moduplay-auth-secondary, #1A1A1A);
	max-height: 40vh;
	overflow-y: auto;
	margin-bottom: 1rem;
}

.moduplay-pricing-disclosure__content > *:first-child {
	margin-top: 0;
}

.moduplay-pricing-disclosure__content > *:last-child {
	margin-bottom: 0;
}

/* Pricing disclosure checkbox */
.moduplay-pricing-disclosure__checkbox {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	font-size: 0.875rem;
	color: var(--moduplay-auth-secondary, #1A1A1A);
	cursor: pointer;
	line-height: 1.4;
	margin-bottom: 1rem;
}

.moduplay-pricing-disclosure__checkbox input[type="checkbox"] {
	width: 1.125rem;
	height: 1.125rem;
	margin-top: 0.0625rem;
	flex-shrink: 0;
	accent-color: var(--moduplay-auth-primary, #E30613);
	cursor: pointer;
}

/* Pending message */
.moduplay-auth__pending-message {
	text-align: center;
	padding: 1.5rem 0;
}

.moduplay-auth__icon-success {
	color: #16a34a;
	margin-bottom: 1rem;
}

.moduplay-auth__pending-message h3 {
	font-size: 1.25rem;
	margin: 0 0 0.5rem;
	color: var(--moduplay-auth-secondary, #1A1A1A);
}

.moduplay-auth__pending-message p {
	color: #4b5563;
	font-size: 0.875rem;
	line-height: 1.6;
}

/* SSO divider */
.moduplay-auth__divider {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin: 1.25rem 0;
	color: #9ca3af;
	font-size: 0.8125rem;
}

.moduplay-auth__divider::before,
.moduplay-auth__divider::after {
	content: '';
	flex: 1;
	height: 0.0625rem;
	background: #e5e7eb;
}

/* SSO button variant */
.moduplay-auth__button--sso {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 3rem;
	padding: .625rem 1.25rem;
	border: .0625rem solid #d1d5db;
	border-radius: .1875rem;
	background: #fff;
	color: var(--moduplay-auth-secondary, #1A1A1A);
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.moduplay-auth__button--sso:hover {
	background: #f9fafb;
	border-color: #9ca3af;
	color: var(--moduplay-auth-secondary, #1A1A1A);
	text-decoration: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.moduplay-auth__spinner,
	.moduplay-auth__link--loading::before {
		animation-duration: 1.5s;
	}
	.moduplay-auth__button,
	.moduplay-auth__input,
	.moduplay-auth__tab,
	.moduplay-auth__code-digit,
	.moduplay-auth__label {
		transition: none;
	}
}

/* ==========================================================================
   Account Profile Details
   ========================================================================== */

.moduplay-profile__details {
	margin: 0 0 1.5rem;
	padding: 0;
	display: grid;
	grid-template-columns: 8rem 1fr;
	gap: 0;
	border: 1px solid #e5e7eb;
	border-radius: 0.5rem;
	overflow: hidden;
	background: #fff;
}

.moduplay-profile__details dt,
.moduplay-profile__details dd {
	margin: 0;
	padding: 0.75rem 1rem;
	font-size: 0.875rem;
	line-height: 1.5;
	border-bottom: 1px solid #e5e7eb;
}

.moduplay-profile__details dt {
	font-weight: 600;
	color: #374151;
	background: #f9fafb;
}

.moduplay-profile__details dd {
	color: #1f2937;
}

/* Remove border from last row */
.moduplay-profile__details dt:nth-last-of-type(1),
.moduplay-profile__details dd:last-of-type {
	border-bottom: none;
}

@media (max-width: 30rem) {
	.moduplay-profile__details {
		grid-template-columns: 1fr;
	}

	.moduplay-profile__details dt {
		padding-bottom: 0.25rem;
		border-bottom: none;
	}

	.moduplay-profile__details dd {
		padding-top: 0;
	}
}

/* ==========================================================================
   Login Page — Dedicated Template Layout
   ========================================================================== */

body.moduplay-auth-page {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	background: #fff;
	color: #1a1a1a;
	min-height: 100vh;
}

/* Two-column wrapper */
.moduplay-auth-page__wrapper {
	display: flex;
	min-height: 100vh;
}

/* Left: Form column */
.moduplay-auth-page__form-col {
	width: 50%;
	display: flex;
	flex-direction: column;
	position: relative;
}

.moduplay-auth-page__main {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem 3rem;
}

.moduplay-auth-page__form-inner {
	width: 100%;
	max-width: 27.5rem;
}

/* Right: Image column — fixed so it stays put when left side scrolls */
.moduplay-auth-page__image-col {
	width: 50%;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-color: var(--moduplay-auth-primary, #E30613);
}

/* Gradient overlay on image */
.moduplay-auth-page__image-col::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 40%);
	pointer-events: none;
}

/* Caption overlay */
.moduplay-auth-page__image-caption {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 2rem 2.5rem;
	color: #fff;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.4;
	z-index: 1;
}

/* Footer — mirror __main's centering so children align with __form-inner */
.moduplay-auth-page__footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 1rem 3rem;
	font-size: 0.8125rem;
	line-height: 1.6;
	text-align: center;
}

.moduplay-auth-page__footer > * {
	width: 100%;
	max-width: 45rem;
}

.moduplay-auth-page__brands {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem 1rem;
}

.moduplay-auth-page__brand-link {
	display: block;
	line-height: 0;
}

.moduplay-auth-page__brand-logo {
	height: 2rem;
	width: auto;
	display: block;
	transition: opacity 0.2s;
}

.moduplay-auth-page__brand-link:hover .moduplay-auth-page__brand-logo {
	opacity: 0.7;
}

.moduplay-auth-page__copyright {
	color: #9ca3af;
	font-size: 0.6875rem;
	margin-bottom: 0;
	margin-top: .75rem;
}

.moduplay-auth-page__copyright a {
	color: #9ca3af;
	text-decoration: none;
	margin-left: 0.5rem;
}

.moduplay-auth-page__copyright a:hover {
	color: var(--moduplay-auth-primary, #E30613);
	text-decoration: underline;
}

/* Skip link */
.skip-link {
	position: absolute;
	left: -624.9375rem;
	top: auto;
	width: 0.0625rem;
	height: 0.0625rem;
	overflow: hidden;
	z-index: 100;
}

.skip-link:focus {
	left: 1.25rem;
	top: 1.25rem;
	width: auto;
	height: auto;
	padding: 0.5rem 1rem;
	background: var(--moduplay-auth-primary);
	color: #fff;
	border-radius: 0.25rem;
	font-size: 0.875rem;
	text-decoration: none;
}

/* Tablet and below: hide image panel */
@media (max-width: 48rem) {
	.moduplay-auth-page__image-col {
		display: none;
	}
	.moduplay-auth-page__form-col {
		width: 100%;
	}
	.moduplay-auth-page__main {
		padding: 2rem 1.5rem;
	}
	.moduplay-auth-page__footer {
		padding: 1.5rem;
	}
}

/* Mobile: tighten padding */
@media (max-width: 30rem) {
	.moduplay-auth-page__main {
		padding: 1.5rem 1.25rem;
	}
	.moduplay-auth-page__footer {
		padding: 1.25rem;
	}
}

/* ==========================================================================
   Login/Register Modal
   ========================================================================== */

.moduplay-auth-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	/* Centering is done via margin: auto on the container, not align-items:
	   center — flex centering clips the top edge off-screen (unscrollably)
	   when the modal is taller than the viewport. */
	padding: 2rem 1rem;
	overflow-y: auto;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.moduplay-auth-modal--active {
	opacity: 1;
	visibility: visible;
}

/* Hide logo inside modal */
.moduplay-auth-modal .moduplay-auth__logo {
	display: none;
}

.moduplay-auth-modal__overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.moduplay-auth-modal__container {
	position: relative;
	margin: auto;
	width: 100%;
	max-width: 32rem;
	background: #fff;
	border-radius: 0.5rem;
	padding: 2rem;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	z-index: 1;
	overflow: hidden;
	transform: translateY(1rem) scale(0.97);
	transition: transform 0.3s ease;
}

.moduplay-auth-modal--active .moduplay-auth-modal__container {
	transform: translateY(0) scale(1);
}

.moduplay-auth-modal__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	background: none;
	border: none;
	font-size: 1.5rem;
	line-height: 1;
	color: #6b7280;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	z-index: 1;
}

.moduplay-auth-modal__close:hover,
.moduplay-auth-modal__close:focus {
	color: #111827;
}

.moduplay-auth-modal__close:focus-visible {
	outline: 0.125rem solid var(--moduplay-auth-primary, #E30613);
	outline-offset: 0.125rem;
	border-radius: 0.125rem;
}

body.moduplay-auth-modal-open {
	overflow: hidden;
}

/* Modal mobile adjustments */
@media (max-width: 30rem) {
	.moduplay-auth-modal {
		padding: 1rem 0.75rem;
	}
	.moduplay-auth-modal__container {
		padding: 1.5rem 1.25rem;
		border-radius: 0.375rem;
	}
}

/* ==========================================================================
   Early-click Loading Overlay
   Shown when user clicks My Account before the footer JS has loaded.
   ========================================================================== */

#moduplay-auth-loading {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

#moduplay-auth-loading.moduplay-auth-loading--visible {
	opacity: 1;
}

.moduplay-auth-loading__spinner {
	width: 2.5rem;
	height: 2.5rem;
	border: 0.1875rem solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: moduplay-auth-spin 0.6s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
	.moduplay-auth-loading__spinner {
		animation-duration: 1.5s;
	}
}
