/* ReEntry for Gravity Forms — Frontend Styles
 *
 * GF's .gform-theme--framework applies `all: unset; display: revert` to most
 * elements inside forms. We combat this by:
 *   1. Using `all: revert` on our own container elements so browser defaults apply.
 *   2. Using !important on any property GF's reset will strip.
 *   3. Scoping to .reentry-form-wrap where we control the context.
 */

/* ── Hidden bridge fields ───────────────────────────────────────── */
.reentry-hidden-bridge,
li.reentry-hidden-bridge {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* ── Form wrap ──────────────────────────────────────────────────── */
.reentry-form-wrap { max-width: 100%; }
.reentry-return-heading { margin-bottom: 1em; }

/* ── Status messages ─────────────────────────────────────────────── */
.reentry-message {
	all: revert;
	display: block;
	padding: 16px 20px;
	border-radius: 4px;
	margin: 1.5em 0;
	border-left: 4px solid #ccc;
	box-sizing: border-box;
}
.reentry-invalid  { background: #fff8f8 !important; border-color: #dc2626 !important; color: #7f1d1d !important; }
.reentry-expired  { background: #fffbeb !important; border-color: #f59e0b !important; color: #78350f !important; }
.reentry-revoked  { background: #f9fafb !important; border-color: #9ca3af !important; color: #374151 !important; }
.reentry-error    { color: #dc2626 !important; font-weight: 600 !important; }
.reentry-success  { color: #16a34a !important; font-weight: 600 !important; }

/* ── Locked fields top-of-form banner ───────────────────────────── */
.reentry-locked-banner {
	all: revert;
	display: block !important;
	padding: 9px 14px !important;
	margin: 0 0 16px !important;
	background: #f8f8f8 !important;
	border: 1px solid #e0e0e0 !important;
	border-radius: 4px !important;
	font-size: 13px !important;
	color: #555 !important;
	line-height: 1.5 !important;
	box-sizing: border-box !important;
}
.reentry-locked-banner svg {
	display: inline-block !important;
	width: 13px !important;
	height: 13px !important;
	vertical-align: middle !important;
	position: relative !important;
	top: -1px !important;
	opacity: 0.55 !important;
}
.reentry-locked-banner span {
	all: revert;
	display: inline !important;
	font-size: inherit !important;
	color: inherit !important;
	line-height: inherit !important;
}

/* ── Lock icon in field labels ───────────────────────────────────── */
.reentry-label-lock {
	display: inline-flex !important;
	align-items: center !important;
	margin-right: 4px !important;
	opacity: 0.5 !important;
	vertical-align: middle !important;
	position: relative !important;
	top: -1px !important;
}
.reentry-label-lock svg {
	display: block !important;
	width: 12px !important;
	height: 12px !important;
}

/* ── Locked field input ──────────────────────────────────────────── */
.reentry-field-locked {
	display: block !important;
	width: 100% !important;
}

/* Readonly input/textarea showing the stored value */
.reentry-locked-input {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box !important;
	opacity: 0.6 !important;
	background-color: #f6f7f7 !important;
	cursor: not-allowed !important;
	border-color: #ddd !important;
	pointer-events: none !important;
	color: inherit !important;
}
textarea.reentry-locked-input {
	min-height: 80px !important;
	resize: none !important;
}

/* Hide the actual GF input — present for validation only */
.reentry-field-locked > input:not(.reentry-locked-input),
.reentry-field-locked > textarea:not(.reentry-locked-input),
.reentry-field-locked > select {
	display: none !important;
}

/* File upload locked value display */
.reentry-locked-file-value {
	all: revert;
	display: block !important;
	margin: 0 0 4px !important;
	font-size: 0.9em !important;
	color: #555 !important;
}

/* ── Cancel button ───────────────────────────────────────────────── */
/*
 * GF's all:unset strips display, padding, border, color etc. from elements
 * inside the form. We use all:revert first then explicitly set everything.
 */
a.reentry-cancel-link,
.reentry-cancel-link {
	all: revert !important;
	display: inline-block !important;
	vertical-align: middle !important;
	margin-left: 12px !important;
	color: #555 !important;
	font-size: 0.9em !important;
	text-decoration: none !important;
	padding: 6px 14px !important;
	cursor: pointer !important;
	background: transparent !important;
	transition: color 0.15s !important;
	box-sizing: border-box !important;
}
a.reentry-cancel-link:hover,
.reentry-cancel-link:hover {
	color: #fff !important;
	text-decoration: none !important;
}
.reentry-cancel-wrap { display: none; }

/* ── Re-link request form ────────────────────────────────────────── */
.reentry-relink-wrap { margin: 1.5em 0; }
.reentry-relink-card {
	all: revert;
	display: block;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 1.75em 2em;
	max-width: 560px;
	box-sizing: border-box;
}
.reentry-relink-heading { font-size: 1.15em; font-weight: 700; margin: 0 0 .5em; }
.reentry-relink-body { font-size: .95em; color: #4b5563; margin: 0 0 1.25em; line-height: 1.55; }
.reentry-relink-error {
	background: #fef2f2; border: 1px solid #fca5a5; border-radius: 4px;
	color: #dc2626; font-size: .875em; padding: .5em .875em; margin-bottom: 1em;
}
.reentry-relink-form { display: flex; flex-direction: column; gap: .875em; }
.reentry-relink-row { display: flex; align-items: center; gap: .75em; }
.reentry-relink-label {
	font-size: .875em; font-weight: 600; color: #374151;
	white-space: nowrap; flex-shrink: 0; min-width: 100px;
}
.reentry-relink-optional { font-weight: 400; color: #9ca3af; }
.reentry-relink-input {
	all: revert;
	flex: 1; padding: .5em .75em; border: 1px solid #d1d5db; border-radius: 5px;
	font-size: .95em; color: #111827; background: #fff; min-width: 0;
	transition: border-color .15s, box-shadow .15s;
	box-sizing: border-box;
}
.reentry-relink-input:focus {
	outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.reentry-relink-btn {
	all: revert;
	display: inline-block; padding: .55em 1.25em; background: #1e4d8c; color: #fff;
	border: none; border-radius: 5px; font-size: .95em; font-weight: 600;
	cursor: pointer; transition: background .15s; margin-left: 100px;
	box-sizing: border-box;
}
.reentry-relink-btn:hover { background: #163d70; }
.reentry-relink-btn:disabled { opacity: .6; cursor: not-allowed; }

@media (prefers-color-scheme: dark) {
	.reentry-relink-card { background: #1f2937; border-color: #374151; }
	.reentry-relink-heading { color: #f9fafb; }
	.reentry-relink-body { color: #9ca3af; }
	.reentry-relink-label { color: #d1d5db; }
	.reentry-relink-input { background: #111827; border-color: #4b5563; color: #f9fafb; }
}
