/* ── IWF Content Lock — Frontend Styles ─────────────────────────────────── */

/* Hide locked sections by default (manual CSS class approach) */
.iwf-locked-content {
	display: none !important;
}

/* ── Elementor element lock (selected container approach) ─────────────────── */

/* While the form is shown, hide the element's own children */
.iwf-element-locking > *:not(.iwf-element-lock-form) {
	display: none !important;
}

/* The form inserted inside the locked element fills the space */
.iwf-element-lock-form {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 200px;
	box-sizing: border-box;
}

/* ── Form wrapper ─────────────────────────────────────────────────────────── */
.iwf-lock-wrap {
	position: relative;
	width: 100%;
}

.iwf-lock-form-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 48px 40px;
	box-sizing: border-box;
}

/* ── Lock icon ────────────────────────────────────────────────────────────── */
.iwf-lock-icon {
	display: block;
	font-size: 48px;
	width: 48px;
	height: 48px;
	margin-bottom: 20px;
	color: #555;
	line-height: 1;
}

.iwf-lock-icon svg {
	width: 1em;
	height: 1em;
	display: block;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
.iwf-lock-title {
	margin: 0 0 10px;
	font-size: 1.6em;
	font-weight: 700;
	color: #222;
}

.iwf-lock-desc {
	margin: 0 0 24px;
	font-size: 1em;
	color: #555;
	max-width: 420px;
}

/* ── Form row ─────────────────────────────────────────────────────────────── */
.iwf-lock-input-row {
	display: flex;
	gap: 10px;
	width: 100%;
	max-width: 420px;
	flex-wrap: wrap;
}

.iwf-lock-input {
	flex: 1 1 200px;
	padding: 12px 16px;
	font-size: 1em;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	color: #222;
	outline: none;
	transition: border-color 0.2s;
	box-sizing: border-box;
	min-width: 0;
}

.iwf-lock-input:focus {
	border-color: #666;
}

.iwf-lock-btn {
	flex-shrink: 0;
	padding: 12px 24px;
	font-size: 1em;
	font-weight: 600;
	background: #222;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.2s, opacity 0.2s;
	line-height: 1.4;
	box-sizing: border-box;
}

.iwf-lock-btn:hover {
	background: #444;
}

.iwf-lock-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── Error message ────────────────────────────────────────────────────────── */
.iwf-lock-error {
	margin: 12px 0 0;
	font-size: 0.9em;
	color: #e74c3c;
}

/* ── Revealed inline content ──────────────────────────────────────────────── */
.iwf-lock-content {
	width: 100%;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
	.iwf-lock-form-wrap {
		padding: 32px 20px;
	}

	.iwf-lock-input-row {
		flex-direction: column;
	}

	.iwf-lock-input,
	.iwf-lock-btn {
		width: 100%;
	}
}

/* ── Page-level lock overlay ──────────────────────────────────────────────── */

body.iwf-page-locked {
	overflow: hidden !important;
}

.iwf-page-lock-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
}

/* ── Elementor Editor preview mode ───────────────────────────────────────── */
/* body.elementor-editor-active is set by Elementor on the canvas iframe */

/* Give the locked element a positioning context for the overlay */
body.elementor-editor-active .iwf-element-locked {
	position: relative !important;
}

/* Show the real content behind so you can still see/edit it */
body.elementor-editor-active .iwf-element-locking > *:not( .iwf-element-lock-form ) {
	display: block !important;
}

/* Form becomes an absolute overlay with frosted-glass effect */
body.elementor-editor-active .iwf-element-lock-form {
	position: absolute !important;
	inset: 0;
	min-height: 200px;
	z-index: 10;
	background: rgba( 255, 255, 255, 0.88 ) !important;
	backdrop-filter: blur( 3px );
	-webkit-backdrop-filter: blur( 3px );
	pointer-events: none; /* let clicks pass through to Elementor handles */
}

/* Allow the form inputs/button to still receive pointer events */
body.elementor-editor-active .iwf-element-lock-form .iwf-lock-form-wrap {
	pointer-events: auto;
}

/* "Preview" badge in top-right corner */
body.elementor-editor-active .iwf-element-lock-form::before {
	content: "🔒 Lock Preview";
	position: absolute;
	top: 8px;
	right: 8px;
	background: #5e5ce6;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
	padding: 3px 8px;
	border-radius: 4px;
	font-family: -apple-system, BlinkMacSystemFont, sans-serif;
	pointer-events: none;
}

/* ── Server-side page lock screen ─────────────────────────────────────────── */
.iwf-page-lock-screen {
	display: flex;
	justify-content: center;
	padding: 80px 16px 100px;
	min-height: 50vh;
	box-sizing: border-box;
}

.iwf-page-lock-screen .iwf-lock-form-wrap {
	max-width: 560px;
	width: 100%;
}

.iwf-page-lock-screen .iwf-lock-icon,
.iwf-page-lock-screen .iwf-lock-btn {
	color: var(--iwf-lock-accent, #555);
}

.iwf-page-lock-screen .iwf-lock-btn {
	background: var(--iwf-lock-accent, #222);
	color: #fff;
}

.iwf-page-lock-screen .iwf-lock-btn:hover {
	filter: brightness(0.92);
}

.iwf-page-lock-form {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}
