/* WonderLab Popups - front-end overlay + dialog.
 * Refined, brand-native styling: burgundy accent on warm ivory/white, soft
 * borders, quiet typography. Appearance is driven by inline CSS vars
 * (--wlpop-width / --wlpop-accent / --wlpop-radius / --wlpop-overlay) set
 * per-popup. Body type inherits the storefront font so it blends in. */

.wlpop {
	position: fixed;
	inset: 0;
	z-index: 999999;
	--wlpop-width: 560px;
	--wlpop-radius: 16px;
	--wlpop-accent: #851625;
	--wlpop-overlay: rgba(31, 24, 20, 0.55);
	/* internal palette */
	--wlpop-ink: #2a2521;
	--wlpop-ink-soft: #6b6258;
	--wlpop-muted: #a89f92;
	--wlpop-line: #e7ded1;
	--wlpop-field-bg: #fff;
}
.wlpop[hidden],
.wlpop:not(.is-open) { display: none; }
.wlpop.is-open {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
}

.wlpop-overlay {
	position: absolute;
	inset: 0;
	background: var(--wlpop-overlay);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

.wlpop-dialog {
	position: relative;
	width: var(--wlpop-width);
	max-width: 100%;
	max-height: calc(100vh - 36px);
	overflow: auto;
	background: #fff;
	border-radius: var(--wlpop-radius);
	box-shadow: 0 2px 8px rgba(31, 24, 20, 0.08), 0 30px 70px -20px rgba(31, 24, 20, 0.45);
	padding: 40px 40px 34px;
	box-sizing: border-box;
	/* a hairline of warmth so the white card reads as part of the brand */
	border-top: 3px solid var(--wlpop-accent);
	/* defend against themes that inherit text-align onto our content */
	text-align: left;
}
.wlpop.is-open .wlpop-dialog { animation: wlpopIn 0.28s cubic-bezier(0.16, 0.84, 0.44, 1); }
.wlpop.is-open .wlpop-overlay { animation: wlpopFade 0.28s ease; }
@keyframes wlpopIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes wlpopFade { from { opacity: 0; } to { opacity: 1; } }

/* "Open animation: None" - honour the per-popup setting. */
.wlpop-anim-none.is-open .wlpop-dialog,
.wlpop-anim-none.is-open .wlpop-overlay { animation: none; }

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
	.wlpop.is-open .wlpop-dialog,
	.wlpop.is-open .wlpop-overlay { animation: none; }
}

.wlpop-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	border: 0;
	background: transparent;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	color: var(--wlpop-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, color 0.15s;
}
.wlpop-close:hover, .wlpop-close:focus { background: #f6f1ea; color: var(--wlpop-accent); outline: none; }

.wlpop-heading {
	margin: 0 0 18px;
	font-size: 23px;
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--wlpop-accent);
	font-weight: 700;
}
.wlpop-richtext { font-size: 15px; line-height: 1.65; color: var(--wlpop-ink); }
.wlpop-richtext p { margin: 0 0 12px; }
.wlpop-richtext p:last-child { margin-bottom: 0; }
.wlpop-richtext a { color: var(--wlpop-accent); }

/* Announcement image + CTA button (content-type popups) */
.wlpop-image {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 0 18px;
	border-radius: calc(var(--wlpop-radius) * 0.55);
}
/* Sample image placeholder (live preview only, before an image is chosen) */
.wlpop-image-sample {
	aspect-ratio: 2 / 1;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	background: repeating-linear-gradient(45deg, #f6f1ea, #f6f1ea 12px, #ece4d8 12px, #ece4d8 24px);
	color: #a89f92;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
}
.wlpop-sample-text { color: var(--wlpop-muted); }
.wlpop-cta-row { display: flex; margin-top: 22px; }
.wlpop-cta-left   { justify-content: flex-start; }
.wlpop-cta-center { justify-content: center; }
.wlpop-cta-right  { justify-content: flex-end; }
.wlpop-cta {
	display: inline-block;
	background: var(--wlpop-accent);
	color: #fff;
	text-decoration: none;
	border-radius: 999px;
	padding: 13px 32px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	box-shadow: 0 6px 16px -8px var(--wlpop-accent);
	transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.wlpop-cta:hover, .wlpop-cta:focus { filter: brightness(1.06); transform: translateY(-1px); color: #fff; }

/* Honeypot - off-screen, never shown */
.wlpop-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px; height: 1px; overflow: hidden;
}

/* Form */
.wlpop-form { display: flex; flex-direction: column; gap: 16px; }
.wlpop-field { display: flex; flex-direction: column; gap: 6px; }
.wlpop-field label {
	font-size: 13px;
	font-weight: 600;
	color: var(--wlpop-ink);
	letter-spacing: 0.01em;
}
.wlpop-req { color: var(--wlpop-accent); }

.wlpop-field input,
.wlpop-field select,
.wlpop-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 16px;
	border: 1.5px solid var(--wlpop-line);
	border-radius: 11px;
	font: inherit;
	font-size: 15px;
	color: var(--wlpop-ink);
	background: var(--wlpop-field-bg);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.wlpop-field input::placeholder,
.wlpop-field textarea::placeholder { color: var(--wlpop-muted); }
.wlpop-field textarea { resize: vertical; min-height: 104px; line-height: 1.55; }

/* Branded dropdown chevron (native arrows are inconsistent) */
.wlpop-field select {
	appearance: none; -webkit-appearance: none; -moz-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath fill='%238a8278' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	background-size: 11px;
	padding-right: 40px;
	cursor: pointer;
}

.wlpop-field input:focus,
.wlpop-field select:focus,
.wlpop-field textarea:focus {
	outline: none;
	border-color: var(--wlpop-accent);
	box-shadow: 0 0 0 3px rgba(133, 22, 37, 0.12);
	background: #fff;
}
.wlpop-field.has-error input,
.wlpop-field.has-error select,
.wlpop-field.has-error textarea { border-color: #c0392b; }
.wlpop-field.has-error input:focus,
.wlpop-field.has-error select:focus,
.wlpop-field.has-error textarea:focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12); }

/* Consent / PDPA checkbox - small, quiet, beside the statement */
.wlpop-field-consent { margin-top: 2px; }
.wlpop-field-consent .wlpop-consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.55;
	color: var(--wlpop-ink-soft);
}
.wlpop-field-consent .wlpop-consent input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 1px 0 0;
	flex-shrink: 0;
	accent-color: var(--wlpop-accent);
	cursor: pointer;
}
.wlpop-field-consent.has-error .wlpop-consent-text { color: #c0392b; }
.wlpop-field-consent.has-error .wlpop-consent input[type="checkbox"] { outline: 2px solid #c0392b; outline-offset: 2px; }

/* International phone input */
.wlpop-field .iti { width: 100%; display: block; }
.wlpop-field .iti__selected-country { border-radius: 11px 0 0 11px; }
.wlpop-field-error { font-size: 12px; color: #c0392b; min-height: 0; }
.wlpop-field.has-error .wlpop-field-error { min-height: 16px; margin-top: -1px; }

.wlpop-submit {
	margin-top: 6px;
	align-self: flex-start;        /* button sits on the LEFT */
	background: var(--wlpop-accent);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 13px 36px;
	min-width: 150px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 16px -8px var(--wlpop-accent);
	transition: transform 0.15s ease, filter 0.15s ease;
}
.wlpop-submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.wlpop-submit[disabled] { opacity: 0.6; cursor: default; transform: none; }
.wlpop-submit:focus-visible,
.wlpop-cta:focus-visible {
	outline: 2px solid var(--wlpop-accent);
	outline-offset: 3px;
}

.wlpop-form-status { font-size: 13px; line-height: 1.5; color: var(--wlpop-ink-soft); }
.wlpop-form-status.is-error { color: #c0392b; }
.wlpop-form.is-done .wlpop-field,
.wlpop-form.is-done .wlpop-submit { display: none; }
.wlpop-form.is-done .wlpop-form-status {
	color: #1e7a3a;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	padding: 22px 4px;
}

@media (max-width: 600px) {
	.wlpop-dialog { padding: 32px 22px 26px; border-radius: 14px; }
	.wlpop-heading { font-size: 20px; }
	.wlpop-submit { align-self: stretch; text-align: center; }
}

/* Embedded form ([wlpop_form]) + shortcode trigger button ([wonderlab_popup]) */
.wlpop-embed { max-width: 560px; }
.wlpop-embed-heading { margin: 0 0 18px; font-size: 21px; font-weight: 700; color: var(--wlpop-accent, #851625); }
.wlpop-trigger-btn {
	display: inline-block;
	background: #851625;
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 12px 28px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 16px -8px #851625;
	transition: transform 0.15s ease, filter 0.15s ease;
}
.wlpop-trigger-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
