/* 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: 640px;
	--wlpop-radius: 20px;
	--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: flex-start;
	justify-content: center;
	padding: 18px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

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

.wlpop-dialog {
	position: relative;
	/* Responsive: fluid % on smaller screens, capped at a form-friendly max so
	   fields never get awkwardly wide on large monitors. */
	width: min(92vw, var(--wlpop-width));
	max-width: 100%;
	margin: auto;
	background: #fff;
	border-radius: var(--wlpop-radius, 20px);
	box-shadow: 0 6px 18px rgba(31, 24, 20, 0.12), 0 28px 64px -16px rgba(31, 24, 20, 0.42), 0 60px 110px -30px rgba(31, 24, 20, 0.30);
	padding: 44px 46px 40px;
	box-sizing: border-box;
	/* 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: 16px;
	right: 16px;
	width: 38px;
	height: 38px;
	border: 0;
	background: #2f2a26;            /* dark circle + white X, like the original */
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, transform 0.15s;
	z-index: 2;
}
.wlpop-close:hover, .wlpop-close:focus { background: #000; color: #fff; outline: none; transform: scale(1.05); }

.wlpop-heading {
	margin: 0 0 8px;
	font-size: 30px;
	line-height: 1.12;
	letter-spacing: -0.02em;
	color: var(--wlpop-accent);
	font-weight: 700;
}
/* Contact-form intro: required note (italic accent) + description, under the title.
   Tight rhythm so the intro reads as one compact block, clearly above the form. */
.wlpop-form-required-note { margin: 0; font-size: 12.5px; font-style: italic; font-weight: 600; color: var(--wlpop-accent); }
.wlpop-form-desc { margin: 0 0 22px; font-size: 13.5px; line-height: 1.6; font-weight: 500; color: var(--wlpop-ink-soft); }
.wlpop-richtext { font-size: 15px; line-height: 1.65; font-weight: 500; 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; }

/* Image-only announcement = a full-bleed banner: no card chrome, image fills the
   whole popup and dominates the view, like a promotional creative. */
.wlpop-dialog.wlpop-banner {
	width: min(94vw, 760px);
	background: transparent;
	box-shadow: none;
	padding: 0;
	border-radius: 0;
}
.wlpop-banner .wlpop-content { padding: 0; }
.wlpop-banner .wlpop-image {
	margin: 0;
	width: 100%;
	border-radius: var(--wlpop-radius, 20px);
	box-shadow: 0 18px 48px -14px rgba(31, 24, 20, 0.5);
}
/* Close button floats over the image with a readable backdrop. */
.wlpop-banner .wlpop-close {
	top: 12px;
	right: 12px;
	background: rgba(20, 16, 12, 0.55);
}
.wlpop-banner .wlpop-close:hover,
.wlpop-banner .wlpop-close:focus { background: rgba(0, 0, 0, 0.82); }

/* 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: 22px; }
/* Field grid: full-width by default, two half-width fields pair on one row. */
.wlpop-form-fields { display: flex; flex-wrap: wrap; gap: 18px; }
.wlpop-form-fields > .wlpop-field { flex: 1 1 100%; min-width: 0; }
.wlpop-form-fields > .wlpop-field--half { flex: 1 1 calc(50% - 9px); }
@media (max-width: 480px) {
	.wlpop-form-fields > .wlpop-field--half { flex: 1 1 100%; }
}
.wlpop-field { display: flex; flex-direction: column; gap: 8px; }
.wlpop .wlpop-field label {
	font-size: 13px !important;
	font-weight: 600 !important;
	color: var(--wlpop-ink) !important;
	letter-spacing: 0.01em !important;
	line-height: 1.3 !important;
	margin: 0 !important;
}
.wlpop-req { color: var(--wlpop-accent); font-weight: 700; }

/* Fields - scoped + !important so the host theme (Divi/Woo) cannot override
   padding/border/size. This is what keeps the form looking the same on any page. */
.wlpop .wlpop-field input,
.wlpop .wlpop-field select,
.wlpop .wlpop-field textarea {
	width: 100% !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	/* Longhand (not shorthand) so the phone field's LEFT padding can stay
	   non-!important and defer to intl-tel-input's dynamic value (which makes
	   room for the +60 box). Right/top/bottom stay theme-proof. */
	padding-top: 13px !important;
	padding-right: 16px !important;
	padding-bottom: 13px !important;
	min-height: 52px !important;
	border: 1.5px solid var(--wlpop-line) !important;
	border-radius: 12px !important;
	font-family: inherit !important;
	font-size: 15px !important;
	line-height: 1.4 !important;
	color: var(--wlpop-ink) !important;
	/* background-color (not the `background` shorthand) so the select's chevron
	   background-image is never wiped; no `background` in transition so the arrow
	   never slides back in. */
	background-color: #fff !important;
	box-shadow: none !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wlpop .wlpop-field textarea { min-height: 124px !important; resize: vertical; line-height: 1.6 !important; }
.wlpop .wlpop-field input::placeholder,
.wlpop .wlpop-field textarea::placeholder { color: var(--wlpop-muted) !important; opacity: 1; }

/* Left padding: enforced on normal fields (theme-proof), but the phone field
   (data-wlpop-phone) gets a plain, non-!important value so intl-tel-input v25's
   dynamic inline padding-left (original + width of the +60 box) wins and the
   number never overlaps the dial code. */
.wlpop .wlpop-field input:not([data-wlpop-phone]),
.wlpop .wlpop-field select,
.wlpop .wlpop-field textarea { padding-left: 16px !important; }
.wlpop .wlpop-field input[data-wlpop-phone] { padding-left: 16px; }

/* Branded dropdown chevron (native arrows are inconsistent) */
.wlpop .wlpop-field select {
	appearance: none !important; -webkit-appearance: none !important; -moz-appearance: none !important;
	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") !important;
	background-repeat: no-repeat !important;
	background-position: right 16px center !important;
	background-size: 11px !important;
	padding-right: 42px !important;
	cursor: pointer;
}

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

/* Consent / PDPA checkbox - small, quiet, beside the statement */
.wlpop-field-consent { margin-top: 2px; }
.wlpop .wlpop-field-consent .wlpop-consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
}
/* Consent text - scoped + !important on the label AND the text span so the host
   theme (Divi) typography can't override the original quiet style. */
.wlpop .wlpop-field-consent .wlpop-consent,
.wlpop .wlpop-field-consent .wlpop-consent-text {
	font-family: inherit !important;
	font-size: 12px !important;
	font-weight: 400 !important;
	line-height: 1.55 !important;
	color: var(--wlpop-ink-soft) !important;
}
/* Native 16px checkbox - neutralise the field-input base styling so it isn't
   blown up to a full-width box, and keep the original quiet look. */
.wlpop .wlpop-field-consent .wlpop-consent input[type="checkbox"] {
	width: 16px !important;
	height: 16px !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 1px 0 0 !important;
	flex: 0 0 auto !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	box-shadow: none !important;
	appearance: auto !important;
	-webkit-appearance: auto !important;
	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 .wlpop-submit {
	margin-top: 4px !important;
	align-self: flex-end;          /* button sits on the RIGHT */
	background: var(--wlpop-accent) !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 999px !important;
	padding: 15px 44px !important;
	min-width: 150px;
	font-family: inherit !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	letter-spacing: 0.01em !important;
	line-height: 1.2 !important;
	cursor: pointer;
	box-shadow: 0 10px 22px -10px var(--wlpop-accent) !important;
	transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.wlpop .wlpop-submit:hover { filter: brightness(1.05); transform: translateY(-2px); box-shadow: 0 14px 28px -10px var(--wlpop-accent) !important; }
.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 { padding: 6px 0 4px; }

/* Submitted: hide the pre-submit intro so the thank-you reads as its own state. */
.wlpop-content.wlpop-submitted .wlpop-heading,
.wlpop-content.wlpop-submitted .wlpop-form-required-note,
.wlpop-content.wlpop-submitted .wlpop-form-desc { display: none; }

/* Centred thank-you: check badge + heading + message (mirrors the Thank You page). */
.wlpop-done { text-align: center; padding: 14px 4px 10px; }
.wlpop-done-check {
	width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
	background: var(--wlpop-accent); display: flex; align-items: center; justify-content: center;
	box-shadow: 0 14px 28px -12px var(--wlpop-accent);
	animation: wlpopDonePop 0.42s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
.wlpop-done-check svg { width: 38px; height: 38px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wlpop-done-title { margin: 0 0 10px; font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -0.015em; color: var(--wlpop-accent); }
.wlpop-done-msg { margin: 0 auto; max-width: 42ch; font-size: 15px; line-height: 1.6; font-weight: 500; color: var(--wlpop-ink-soft); }
@keyframes wlpopDonePop { from { opacity: 0; transform: scale(0.55); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
	.wlpop-dialog { padding: 32px 22px 26px; }
	.wlpop .wlpop-heading { font-size: 22px; }
	.wlpop .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); }
