/* Loyalty Signup modal - matches reference mock (dark green / cream) */

.hifi-loyalty {
	position: fixed;
	inset: 0;
	z-index: 999998;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
}

.hifi-loyalty[hidden] {
	display: none;
}

.hifi-loyalty__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.hifi-loyalty__dialog {
	position: relative;
	width: min(420px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);            /* legacy fallback */
	max-height: calc(100dvh - 32px);           /* avoids iOS Safari URL-bar clip */
	overflow-y: auto;
	background: var(--hifi-loyalty-bg, #29352F);
	color: var(--hifi-loyalty-fg, #F8F7F2);
	border-radius: 12px;
	padding: 32px 28px 24px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
	box-sizing: border-box;
	animation: hifi-loyalty-pop 240ms ease-out;
}

.hifi-loyalty__overlay {
	animation: hifi-loyalty-fade 200ms ease-out;
}

@keyframes hifi-loyalty-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes hifi-loyalty-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.hifi-loyalty__dialog,
	.hifi-loyalty__overlay {
		animation: none;
	}
}

/* "You can't dismiss this way" feedback - quick horizontal shake when the
   user clicks the overlay or hits Escape. JS toggles .is-shaking. */
@keyframes hifi-loyalty-shake {
	0%, 100% { transform: translateX(0); }
	15%      { transform: translateX(-8px); }
	30%      { transform: translateX(7px); }
	45%      { transform: translateX(-5px); }
	60%      { transform: translateX(4px); }
	75%      { transform: translateX(-2px); }
}
.hifi-loyalty__dialog.is-shaking {
	animation: hifi-loyalty-shake 380ms ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
	.hifi-loyalty__dialog.is-shaking {
		animation: none;
	}
}

/* Scoped under `.hifi-loyalty` (specificity 0,2,0) so Elementor Hello Kit's
   generic `.elementor-kit-N h2` / `.elementor-kit-N button` rules (0,1,1)
   don't win the cascade - without this, the host theme's h2 color can match
   our dialog background and render the heading as invisible text-shadow. */
.hifi-loyalty .hifi-loyalty__close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: transparent;
	border: 0;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	opacity: 0.8;
	transition: opacity 150ms ease, transform 150ms ease;
}
.hifi-loyalty .hifi-loyalty__close:hover {
	opacity: 1;
	transform: scale(1.1);
}

.hifi-loyalty .hifi-loyalty__heading {
	margin: 0 0 8px;
	font-size: 28px;
	line-height: 1.15;
	font-weight: 700;
	text-align: center;
	/* Force inherit so admin/theme h2 colors can't override the dialog's fg. */
	color: inherit;
	text-transform: none;
	letter-spacing: normal;
	font-family: inherit;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.hifi-loyalty .hifi-loyalty__subheading {
	margin: 0 0 20px;
	font-size: 15px;
	text-align: center;
	opacity: 0.9;
	color: inherit;
	text-transform: none;
	letter-spacing: normal;
}

.hifi-loyalty__form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.hifi-loyalty .hifi-loyalty__field {
	display: block;
	position: relative;
	width: 100%;
}

/* Theme labels in Elementor Hello normalize to inline/inline-block with a
   shrink-to-content width, which collapses our width:100% inputs to the
   browser default (~200px). Force labels inside our fields to block so the
   input fills the field div edge-to-edge. */
.hifi-loyalty .hifi-loyalty__field > label {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
}

/* Red asterisk marker for required fields. aria-hidden because the
   <input required aria-required="true"> is the source of truth for
   assistive tech - the star is purely visual. */
.hifi-loyalty .hifi-loyalty__field.is-required::after {
	content: "*";
	position: absolute;
	top: 10px;
	right: 14px;
	color: #e5484d;
	font-weight: 700;
	font-size: 16px;
	line-height: 1;
	pointer-events: none;
}
/* Select has a dropdown arrow hugging the right edge - push the star left
   so it doesn't overlap the chevron. */
.hifi-loyalty .hifi-loyalty__field.is-required:has(select)::after {
	right: 38px;
}
/* Inline red star for the consent line (absolute positioning won't work
   well inside a flex-wrapped label). */
.hifi-loyalty .hifi-loyalty__required-star {
	color: #e5484d;
	font-weight: 700;
}

.hifi-loyalty .hifi-loyalty__field select,
.hifi-loyalty .hifi-loyalty__field input[type="text"],
.hifi-loyalty .hifi-loyalty__field input[type="tel"] {
	width: 100%;
	box-sizing: border-box;
	background: transparent;
	color: inherit;
	border: 1px solid rgba(248, 247, 242, 0.35);
	border-radius: 6px;
	padding: 12px 14px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	appearance: none;
	-webkit-appearance: none;
	max-width: 100%;
	min-height: 0;
	transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.hifi-loyalty .hifi-loyalty__field select {
	/* Closed dropdown: cream bg + dark-green text (like a pill/button).
	   Options when opened flip to dark-green bg + cream text. */
	background-color: var(--hifi-loyalty-fg, #F8F7F2);
	color: var(--hifi-loyalty-bg, #29352F);
	border-color: var(--hifi-loyalty-fg, #F8F7F2);
	background-image:
		linear-gradient(45deg, transparent 50%, currentColor 50%),
		linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position:
		calc(100% - 18px) 50%,
		calc(100% - 13px) 50%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 36px;
	cursor: pointer;
}
/* Style each option - Firefox/Chrome respect this; Safari uses native styling. */
.hifi-loyalty .hifi-loyalty__field select option {
	background-color: var(--hifi-loyalty-fg, #F8F7F2);
	color: var(--hifi-loyalty-bg, #29352F);
}

.hifi-loyalty .hifi-loyalty__field input[type="text"]:hover,
.hifi-loyalty .hifi-loyalty__field input[type="tel"]:hover {
	border-color: rgba(248, 247, 242, 0.6);
	background-color: rgba(248, 247, 242, 0.04);
}
.hifi-loyalty .hifi-loyalty__field select:hover {
	border-color: var(--hifi-loyalty-fg, #F8F7F2);
	filter: brightness(0.97);
}

.hifi-loyalty .hifi-loyalty__field input::placeholder {
	color: inherit;
	opacity: 0.75;
}

/* Focus: soft outer ring via box-shadow rather than the default outline so
   it looks intentional rather than like a browser fallback. */
.hifi-loyalty .hifi-loyalty__field select:focus-visible,
.hifi-loyalty .hifi-loyalty__field input:focus-visible {
	outline: none;
	border-color: var(--hifi-loyalty-accent, #F8F7F2);
	box-shadow: 0 0 0 3px rgba(248, 247, 242, 0.25);
}

.hifi-loyalty .hifi-loyalty__consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	width: 100%;
	font-size: 12px;
	line-height: 1.4;
	padding: 4px 0 8px;
	margin: 0;
	cursor: pointer;
}
.hifi-loyalty .hifi-loyalty__consent input[type="checkbox"] {
	margin: 2px 0 0 0;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	/* Separate setting so the checkbox fill can differ from the submit/accent color. */
	accent-color: var(--hifi-loyalty-checkbox, var(--hifi-loyalty-accent, #F8F7F2));
	cursor: pointer;
}
.hifi-loyalty .hifi-loyalty__consent input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--hifi-loyalty-checkbox, var(--hifi-loyalty-accent, #F8F7F2));
	outline-offset: 2px;
	border-radius: 3px;
}

.hifi-loyalty .hifi-loyalty__field-error {
	font-size: 12px;
	color: #ffb4b4;
	margin-top: 4px;
	min-height: 0;
}
.hifi-loyalty .hifi-loyalty__field-error:empty {
	display: none;
}
.hifi-loyalty .hifi-loyalty__field input[aria-invalid="true"],
.hifi-loyalty .hifi-loyalty__field select[aria-invalid="true"] {
	border-color: #ffb4b4 !important;
}

.hifi-loyalty .hifi-loyalty__message {
	min-height: 1.2em;
	font-size: 13px;
	text-align: center;
}
.hifi-loyalty__message.is-error { color: #ffb4b4; }
.hifi-loyalty__message.is-success { opacity: 0.9; }

.hifi-loyalty .hifi-loyalty__submit {
	background: var(--hifi-loyalty-accent, #F8F7F2);
	color: var(--hifi-loyalty-bg, #29352F);
	border: 0;
	border-radius: 6px;
	padding: 14px;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
	transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}
.hifi-loyalty .hifi-loyalty__submit:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}
.hifi-loyalty .hifi-loyalty__submit:active:not(:disabled) {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.hifi-loyalty .hifi-loyalty__submit:disabled { opacity: 0.6; cursor: default; }

.hifi-loyalty .hifi-loyalty__dismiss {
	background: transparent;
	color: inherit;
	border: 0;
	padding: 10px;
	font-size: 14px;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
	opacity: 0.85;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 3px;
	transition: opacity 150ms ease, text-decoration-color 150ms ease;
}
.hifi-loyalty .hifi-loyalty__dismiss:hover {
	opacity: 1;
	text-decoration-color: currentColor;
}

/* ------------------------------------------------------------------
   Sticky bottom-center invitation pill - the new entry point.
   Click body → opens popup. Click × → 30-day dismiss cookie.
   Brand colors come from the same CSS vars the popup uses.
   ------------------------------------------------------------------ */
.hifi-loyalty-pill {
	position: fixed;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 999997;
	display: inline-flex;
	align-items: stretch;
	background: var(--hifi-loyalty-bg, #29352F);
	color: var(--hifi-loyalty-fg, #F8F7F2);
	border-radius: 999px;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	font-family: inherit;
	font-size: 14px;
	line-height: 1;
	max-width: calc(100vw - 24px);
	animation: hifi-loyalty-pill-in 280ms ease-out;
}
.hifi-loyalty-pill[hidden] { display: none; }

/* Also scoped to out-specificity theme `button` rules - without this,
   Elementor's `.elementor-kit-N button` paints the pill buttons over with
   its global button background color. */
.hifi-loyalty-pill .hifi-loyalty-pill__open,
.hifi-loyalty-pill .hifi-loyalty-pill__close {
	background: transparent;
	color: inherit;
	border: 0;
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
	border-radius: 0;
	cursor: pointer;
}

.hifi-loyalty-pill .hifi-loyalty-pill__open {
	padding: 12px 18px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	letter-spacing: 0.01em;
	transition: background-color 150ms ease;
}
.hifi-loyalty-pill .hifi-loyalty-pill__open:hover {
	background: rgba(255, 255, 255, 0.08);
}
.hifi-loyalty-pill .hifi-loyalty-pill__open:focus-visible {
	outline: 2px solid var(--hifi-loyalty-accent, #F8F7F2);
	outline-offset: -3px;
}

.hifi-loyalty-pill .hifi-loyalty-pill__close {
	padding: 0 14px 0 6px;
	font-size: 18px;
	opacity: 0.7;
	border-left: 1px solid rgba(255, 255, 255, 0.15);
	transition: opacity 150ms ease, background-color 150ms ease;
}
.hifi-loyalty-pill .hifi-loyalty-pill__close:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.08);
}
.hifi-loyalty-pill .hifi-loyalty-pill__close:focus-visible {
	outline: 2px solid var(--hifi-loyalty-accent, #F8F7F2);
	outline-offset: -3px;
}

@keyframes hifi-loyalty-pill-in {
	from { opacity: 0; transform: translate(-50%, 12px); }
	to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
	.hifi-loyalty-pill { animation: none; }
}

/* Inline admin preview variant - same look, no fixed positioning. */
.hifi-loyalty-pill.is-preview {
	position: relative !important;
	bottom: auto !important;
	left: auto !important;
	transform: none !important;
	z-index: auto !important;
	margin: 0 0 16px;
	animation: none !important;
	pointer-events: none;
}

/* Honeypot - off-screen, never visible to real users. */
.hifi-loyalty__hp {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Inline admin preview - same look, but contained instead of fullscreen.
   !important on layout props so a stale cached copy of this file can't
   accidentally let the fullscreen modal styling bleed into the admin page. */
.hifi-loyalty.is-preview {
	position: relative !important;
	inset: auto !important;
	display: block !important;
	width: 100% !important;
	max-width: 460px;
	height: auto !important;
	margin: 0 0 24px;
	z-index: auto !important;
	pointer-events: none;
}
.hifi-loyalty.is-preview .hifi-loyalty__overlay { display: none !important; }
.hifi-loyalty.is-preview .hifi-loyalty__dialog {
	position: relative !important;
	max-height: none !important;
	animation: none !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.hifi-loyalty.is-preview .hifi-loyalty__close { display: none !important; }

@media (max-width: 480px) {
	.hifi-loyalty__dialog { padding: 24px 20px; }
	.hifi-loyalty__heading { font-size: 22px; }
}