/**
 * Overlay Auth — Landing Page Design
 * Academy-style full-screen auth with branding + form split layout.
 * Design: Dark theme (#0a0a0a), gold accent (#c9a96e), Montserrat font.
 *
 * @package Base47_Flow_Pro
 * @since   1.1.0
 */

/* ─── Scroll Lock ─── */
html.b47flow-overlay-active {
	overflow: hidden !important;
	height: 100% !important;
}

html.b47flow-overlay-active body {
	overflow: hidden !important;
	height: 100% !important;
}

/* ─── Root Container ─── */
.b47flow-overlay-auth--landing {
	--oa-bg: #0a0a0a;
	--oa-card-bg: transparent;
	--oa-text: #ffffff;
	--oa-text-muted: #a0a0a0;
	--oa-accent: #c9a96e;
	--oa-accent-hover: #b8944f;
	--oa-input-bg: rgba(255, 255, 255, 0.06);
	--oa-input-border: rgba(255, 255, 255, 0.15);
	--oa-input-focus: rgba(201, 169, 110, 0.4);
	--oa-radius: 6px;
	--oa-font: 'Montserrat', 'Noto Sans Hebrew', -apple-system, sans-serif;

	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	z-index: 2147483647 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	font-family: var(--oa-font);
	color: var(--oa-text);
	background: var(--oa-bg);
	overflow-y: auto;
}

/* ─── Background Layer ─── */
.b47flow-overlay-auth__bg {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100vw;
	height: 100vh;
	z-index: 0;
	overflow: hidden;
}

.b47flow-overlay-auth__bg-video {
	position: absolute;
	top: 50%;
	left: 50%;
	min-width: 100%;
	min-height: 100%;
	width: auto;
	height: auto;
	transform: translate(-50%, -50%);
	object-fit: cover;
}

.b47flow-overlay-auth__bg-image {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	background-size: cover;
	background-position: center;
}

.b47flow-overlay-auth__bg-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	background: rgba(10, 10, 10, 0.75);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

/* ─── Content Split Layout ─── */
.b47flow-overlay-auth__content {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 80px;
	max-width: 1100px;
	width: 90%;
	padding: 60px;
	align-items: center;
	margin: auto;
}

/* ─── Left: Branding ─── */
.b47flow-overlay-auth__branding {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.b47flow-overlay-auth__brand-logo {
	max-width: 180px;
	height: auto;
	margin-bottom: 12px;
}

.b47flow-overlay-auth__title {
	font-size: 2.8rem;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.5px;
	margin: 0;
	color: var(--oa-text);
}

.b47flow-overlay-auth__subtitle {
	font-size: 1.1rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 2px;
	color: var(--oa-accent);
	margin: 0;
}

.b47flow-overlay-auth__desc {
	font-size: 0.95rem;
	line-height: 1.7;
	color: var(--oa-text-muted);
	margin: 8px 0 0;
	max-width: 420px;
}

/* ─── Right: Forms ─── */
.b47flow-overlay-auth__forms {
	max-width: 400px;
	width: 100%;
}

.b47flow-overlay-auth__form-title {
	font-size: 1.4rem;
	font-weight: 700;
	margin: 0 0 20px;
	color: var(--oa-text);
}

/* ─── Panels ─── */
/* Default state (no :target): show register, hide login */
#panel-login {
	display: none;
}

#panel-register {
	display: block;
}

/* CSS-only panel switching via :target (no-JS fallback) */
#panel-login:target {
	display: block !important;
}

#panel-login:target ~ #panel-register,
.b47flow-overlay-auth__forms:has(#panel-login:target) #panel-register {
	display: none !important;
}

#panel-register:target {
	display: block !important;
}

#panel-register:target ~ #panel-login,
.b47flow-overlay-auth__forms:has(#panel-register:target) #panel-login {
	display: none !important;
}

/* Note: When JS is available, the .b47flow-js-active class overrides
   these rules using the --active class for panel switching. */

/* JS-active overrides — when JS is loaded, it takes full control */
.b47flow-js-active #panel-login {
	display: none !important;
}

.b47flow-js-active #panel-register {
	display: none !important;
}

.b47flow-js-active .b47flow-overlay-auth__panel--active {
	display: block !important;
	animation: b47flow-panel-fade-in 0.25s ease;
}

@keyframes b47flow-panel-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.b47flow-overlay-auth__panel[hidden] {
	display: none;
}

/* ─── Pending Confirmation ─── */
.b47flow-overlay-auth__confirmation {
	text-align: center;
	padding: 24px 16px;
	color: var(--oa-text);
}

.b47flow-overlay-auth__confirmation p {
	font-size: 1rem;
	line-height: 1.5;
	margin: 0;
}

/* ─── Form Fields ─── */
.b47flow-overlay-auth__form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.b47flow-overlay-auth__field label {
	display: block;
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--oa-text-muted);
	margin-bottom: 6px;
}

.b47flow-overlay-auth__field input {
	width: 100%;
	padding: 12px 14px;
	background: var(--oa-input-bg);
	border: 1px solid var(--oa-input-border);
	border-radius: var(--oa-radius);
	color: var(--oa-text);
	font-size: 0.95rem;
	font-family: var(--oa-font);
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
}

.b47flow-overlay-auth__field input:focus {
	outline: none;
	border-color: var(--oa-accent);
	box-shadow: 0 0 0 3px var(--oa-input-focus);
}

.b47flow-overlay-auth__field input::placeholder {
	color: rgba(255, 255, 255, 0.3);
}

/* ─── Field Row (side-by-side fields) ─── */
.b47flow-overlay-auth__field-row {
	display: flex;
	gap: 12px;
}

.b47flow-overlay-auth__field--half {
	flex: 1;
	min-width: 0;
}

@media (max-width: 480px) {
	.b47flow-overlay-auth__field-row {
		flex-direction: column;
		gap: 0;
	}
}

/* ─── Row (remember + forgot) ─── */
.b47flow-overlay-auth__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.85rem;
}

.b47flow-overlay-auth__remember {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--oa-text-muted);
	cursor: pointer;
}

.b47flow-overlay-auth__remember input {
	accent-color: var(--oa-accent);
}

.b47flow-overlay-auth__forgot {
	color: var(--oa-accent);
	text-decoration: none;
	font-size: 0.85rem;
}

.b47flow-overlay-auth__forgot:hover {
	text-decoration: underline;
}

/* ─── Submit Button ─── */
.b47flow-overlay-auth__submit {
	width: 100%;
	padding: 14px;
	background: var(--oa-accent);
	color: #0a0a0a;
	border: none;
	border-radius: var(--oa-radius);
	font-size: 0.95rem;
	font-weight: 700;
	font-family: var(--oa-font);
	letter-spacing: 1px;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s;
	position: relative;
	margin-top: 6px;
}

.b47flow-overlay-auth__submit:hover {
	background: var(--oa-accent-hover);
}

.b47flow-overlay-auth__submit:active {
	transform: scale(0.98);
}

.b47flow-overlay-auth__submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ─── Spinner ─── */
.b47flow-overlay-auth__spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(10, 10, 10, 0.3);
	border-top-color: #0a0a0a;
	border-radius: 50%;
	animation: b47flow-spin 0.6s linear infinite;
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
}

.b47flow-overlay-auth__submit--loading .b47flow-overlay-auth__spinner {
	display: block;
}

.b47flow-overlay-auth__submit--loading .b47flow-overlay-auth__submit-text {
	opacity: 0.6;
}

@keyframes b47flow-spin {
	to { transform: translateY(-50%) rotate(360deg); }
}

/* ─── Divider ─── */
.b47flow-overlay-auth__divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 24px 0;
	color: var(--oa-text-muted);
	font-size: 0.8rem;
}

.b47flow-overlay-auth__divider::before,
.b47flow-overlay-auth__divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: rgba(255, 255, 255, 0.12);
}

/* ─── Switch (Already have account / Don't have account) ─── */
.b47flow-overlay-auth__switch {
	text-align: center;
	font-size: 0.85rem;
	color: var(--oa-text-muted);
	margin: 0 0 10px;
}

.b47flow-overlay-auth__switch-btn {
	display: block;
	width: 100%;
	padding: 16px 24px;
	background: transparent;
	color: var(--oa-text);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: var(--oa-radius);
	font-size: 1rem;
	font-weight: 700;
	font-family: var(--oa-font);
	letter-spacing: 1.5px;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
	min-height: 52px;
	line-height: 1.4;
}

.b47flow-overlay-auth__switch-btn:hover {
	border-color: var(--oa-accent);
	background: rgba(201, 169, 110, 0.08);
}

/* ─── Privacy ─── */
.b47flow-overlay-auth__privacy {
	font-size: 0.78rem;
	color: var(--oa-text-muted);
	line-height: 1.5;
	margin: 4px 0 0;
}

.b47flow-overlay-auth__privacy a {
	color: var(--oa-accent);
	text-decoration: none;
}

.b47flow-overlay-auth__privacy a:hover {
	text-decoration: underline;
}

/* ─── Alert ─── */
.b47flow-overlay-auth__alert {
	display: none;
	padding: 10px 14px;
	border-radius: var(--oa-radius);
	font-size: 0.85rem;
	margin-bottom: 8px;
}

.b47flow-overlay-auth__alert--error {
	display: block;
	background: rgba(220, 53, 69, 0.15);
	border: 1px solid rgba(220, 53, 69, 0.3);
	color: #ff6b7a;
}

.b47flow-overlay-auth__alert--success {
	display: block;
	background: rgba(40, 167, 69, 0.15);
	border: 1px solid rgba(40, 167, 69, 0.3);
	color: #5cdb7a;
}

/* ─── Custom Fields ─── */
.b47flow-overlay-auth__custom-fields {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.b47flow-overlay-auth__custom-fields input,
.b47flow-overlay-auth__custom-fields select,
.b47flow-overlay-auth__custom-fields textarea {
	width: 100%;
	padding: 12px 14px;
	background: var(--oa-input-bg);
	border: 1px solid var(--oa-input-border);
	border-radius: var(--oa-radius);
	color: var(--oa-text);
	font-size: 0.95rem;
	font-family: var(--oa-font);
	box-sizing: border-box;
}

/* ─── Dismiss Animation ─── */
.b47flow-overlay-auth--dismissing {
	animation: b47flow-fadeout 0.4s ease forwards;
}

@keyframes b47flow-fadeout {
	to {
		opacity: 0;
		transform: scale(1.02);
	}
}

/* ─── Responsive: Tablet ─── */
@media (max-width: 900px) {
	.b47flow-overlay-auth__content {
		grid-template-columns: 1fr;
		gap: 40px;
		padding: 40px 30px;
		max-height: 100vh;
		overflow-y: auto;
	}

	.b47flow-overlay-auth__branding {
		text-align: center;
		align-items: center;
	}

	.b47flow-overlay-auth__desc {
		max-width: 100%;
	}

	.b47flow-overlay-auth__forms {
		max-width: 100%;
	}

	.b47flow-overlay-auth__title {
		font-size: 2rem;
	}
}

/* ─── Responsive: Mobile ─── */
@media (max-width: 480px) {
	.b47flow-overlay-auth__content {
		padding: 24px 16px;
		gap: 24px;
	}

	.b47flow-overlay-auth__title {
		font-size: 1.6rem;
	}

	.b47flow-overlay-auth__subtitle {
		font-size: 0.9rem;
	}

	.b47flow-overlay-auth__desc {
		font-size: 0.85rem;
	}
}
