/* Sync Bixo Shop Engine — front-end styles */

/* Hide price-bearing third-party payment UI for gated users. The PayPal
   smart buttons and Pay-later messaging render their own markup on the
   product page regardless of is_purchasable and can print installment
   amounts, so for users who cannot see prices we suppress them. Scoped to the
   body.sbse-no-prices class (added only while the price gate is hiding prices)
   so approved users and non-gated stores are unaffected. */
body.sbse-no-prices .ppc-button-wrapper,
body.sbse-no-prices .ppcp-messages,
body.sbse-no-prices [id^="ppc-button-"],
body.sbse-no-prices [data-pp-message],
body.sbse-no-prices .paypal-buttons,
body.sbse-no-prices .wc-ppcp-sdk-v6-messages {
	display: none !important;
}

.sbse-price-login {
	display: inline-block;
	font-weight: 600;
}
.sbse-price-login a {
	text-decoration: underline;
}
.woocommerce ul.products li.product .sbse-price-login {
	margin: 0 0 .5em;
}

/* Native registration form
   Self-contained boxed fields so the form looks consistent even on themes that
   render inputs as a bare underline. Box properties use !important to override
   underline-only theme rules (border:none; border-bottom:...). Scoped entirely
   to .sbse-registration-form so nothing else on the site is affected. */
.sbse-registration-form {
	/* Fill the container so the page/Elementor layout controls the width
	   (set the container width to taste). No fixed cap of our own. */
	max-width: 100%;
	width: 100%;
}
/* "Create Account" button under the login form. Inherits the theme button
   look via .button/.wp-element-button; this class is for scoped overrides. */
.sbse-create-account {
	margin: 14px 0 0;
}
.sbse-create-account-button {
	display: inline-block;
}
.sbse-registration-form .sbse-field {
	margin: 0 0 1rem !important;
}
.sbse-registration-form label {
	display: block;
	font-weight: 600;
	font-size: .95rem;
	margin: 0 0 .4rem;
	line-height: 1.3;
}
.sbse-registration-form input[type="text"],
.sbse-registration-form input[type="email"],
.sbse-registration-form input[type="tel"],
.sbse-registration-form input[type="number"],
.sbse-registration-form select,
.sbse-registration-form textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box !important;
	height: auto !important;
	margin: 0 !important;
	padding: .65rem .8rem !important;
	font-size: 1rem;
	line-height: 1.4;
	color: #1f2937;
	background: #fff !important;
	border: 1px solid #d0d5dd !important;
	border-radius: 8px !important;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .06) !important;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.sbse-registration-form textarea {
	min-height: 104px;
}
.sbse-registration-form input[type="text"]:focus,
.sbse-registration-form input[type="email"]:focus,
.sbse-registration-form input[type="tel"]:focus,
.sbse-registration-form input[type="number"]:focus,
.sbse-registration-form select:focus,
.sbse-registration-form textarea:focus {
	border-color: #2563eb !important;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .18) !important;
	outline: none !important;
}
.sbse-registration-form input::placeholder,
.sbse-registration-form textarea::placeholder {
	color: #9aa3af;
}
.sbse-registration-form .required {
	color: #b32d2e;
}
.sbse-registration-form .sbse-submit {
	margin: 1.25rem 0 0;
}
/* Submit button: it carries the theme/WooCommerce button classes
   (button, wp-element-button) so the theme styles it. This :where() fallback has
   ZERO specificity, so any theme button rule overrides it — it only applies when
   the theme styles buttons not at all. */
:where(.sbse-registration-form .sbse-submit-button) {
	display: inline-block;
	cursor: pointer;
	padding: .7rem 1.4rem;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: #2563eb;
	border: 0;
	border-radius: 8px;
}
.sbse-reg-errors {
	border: 1px solid #b32d2e;
	background: #fdf3f3;
	padding: .75em 1em;
	margin: 0 0 1em;
	border-radius: 3px;
}
.sbse-reg-success {
	border: 1px solid #46b450;
	background: #f3fbf4;
	padding: .75em 1em;
	margin: 0 0 1em;
	border-radius: 3px;
}
.sbse-reg-notice {
	padding: .5em 0;
}

/* Client-side inline validation (sbse-registration.js) */
.sbse-registration-form .sbse-invalid,
.sbse-registration-form input.sbse-invalid,
.sbse-registration-form select.sbse-invalid,
.sbse-registration-form textarea.sbse-invalid {
	border-color: #b32d2e !important;
	box-shadow: 0 0 0 3px rgba(179, 45, 46, .15) !important;
	outline: none !important;
}
.sbse-registration-form .sbse-field-error {
	display: block;
	color: #b32d2e;
	font-size: .9em;
	margin: .25em 0 0;
}

/* -------------------------------------------------------------------------
 * Cache-safe price hydration (price rendering mode = cache_safe).
 * While an approved user's real price is being fetched, the placeholder shows
 * a subtle skeleton shimmer instead of the "log in to view price" prompt, so
 * logged-in users never see the wrong text flash.
 * ---------------------------------------------------------------------- */
.sbse-price--defer {
	display: inline-block;
}
.sbse-price--loading:not(.sbse-price--revealed) {
	position: relative;
	display: inline-block;
	min-width: 5em;
	min-height: 1em;
	border-radius: 4px;
	overflow: hidden;
	color: transparent !important;
	vertical-align: middle;
}
.sbse-price--loading:not(.sbse-price--revealed) > * {
	visibility: hidden;
}
.sbse-price--loading:not(.sbse-price--revealed)::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient( 90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.12) 37%, rgba(0,0,0,.06) 63% );
	background-size: 400% 100%;
	animation: sbse-price-shimmer 1.2s ease-in-out infinite;
}
@keyframes sbse-price-shimmer {
	0%   { background-position: 100% 0; }
	100% { background-position: 0 0; }
}
@media ( prefers-reduced-motion: reduce ) {
	.sbse-price--loading:not(.sbse-price--revealed)::after { animation: none; }
}

/* -------------------------------------------------------------------------
 * No-FOUC skeleton (cache-safe mode). A logged-in visitor is flagged in <head>
 * (html.sbse-auth, set from the client-hint cookie before first paint), so the
 * price placeholder shows a neutral skeleton from the very first paint instead
 * of the "log in to view price" text — no wrong-text flash on a cached page.
 * The real price is injected by the hydration script, which then adds
 * .sbse-price--revealed to fade it in. Guests (no sbse-auth) keep the login
 * prompt and make no request.
 * ---------------------------------------------------------------------- */
html.sbse-auth .sbse-price--defer:not(.sbse-price--revealed) {
	position: relative;
	display: inline-block;
	min-width: 5em;
	min-height: 1em;
	border-radius: 4px;
	overflow: hidden;
	vertical-align: middle;
	color: transparent !important;
}
html.sbse-auth .sbse-price--defer:not(.sbse-price--revealed) > * {
	visibility: hidden;
}
html.sbse-auth .sbse-price--defer:not(.sbse-price--revealed)::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient( 90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.12) 37%, rgba(0,0,0,.06) 63% );
	background-size: 400% 100%;
	animation: sbse-price-shimmer 1.2s ease-in-out infinite;
}
html.sbse-auth .sbse-price--defer.sbse-price--revealed {
	animation: sbse-price-reveal .25s ease-out;
}
@keyframes sbse-price-reveal {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@media ( prefers-reduced-motion: reduce ) {
	html.sbse-auth .sbse-price--defer:not(.sbse-price--revealed)::after { animation: none; }
	html.sbse-auth .sbse-price--defer.sbse-price--revealed { animation: none; }
}

/* Price could not be loaded (network error / timeout, or the hydration script
 * never ran): show a neutral marker, never the "log in to view price" text,
 * which would be wrong for a logged-in shopper. */
.sbse-price--defer.sbse-price--unavailable > * { display: none !important; }
.sbse-price--defer.sbse-price--unavailable::before { content: "\2014"; opacity: .55; }

/* -------------------------------------------------------------------------
 * Price Rules — message + button shown in place of a hidden price.
 * The button carries .button/.wp-element-button so it inherits the theme's
 * button styling; only spacing is set here.
 * ---------------------------------------------------------------------- */
.sbse-price-rule {
	display: inline-block;
}
.sbse-price-rule__msg {
	font-weight: 600;
}
.sbse-price-rule__btn {
	display: inline-block;
	margin: .35em 0 0 .5em;
}

/* -------------------------------------------------------------------------
 * Promotion merchandising — cart nudge / earned strips + product badge.
 * Neutral, restrained styling that reads well on most themes; colours use
 * CSS variables so a theme (or a snippet) can recolour without editing the
 * plugin. Earned = green; nudge/badge = a soft accent.
 * ---------------------------------------------------------------------- */
/* Cart strip container: hydrated client-side; stays invisible when empty so a
   bare wrapper never adds spacing (e.g. a cached page before hydration). */
.sbse-promo-cart:empty {
	display: none;
}
.sbse-promo-strip {
	--sbse-accent: #6b3f86;
	--sbse-accent-soft: #f3edf7;
	--sbse-accent-line: #e4d7ee;
	display: block;
	margin: 0 0 14px;
	padding: 11px 14px;
	border-radius: 10px;
	font-size: .95em;
	font-weight: 600;
	line-height: 1.4;
	background: var(--sbse-accent-soft);
	border: 1px solid var(--sbse-accent-line);
	color: var(--sbse-accent);
}
.sbse-promo-strip--earned {
	--sbse-accent: #1a8f5a;
	--sbse-accent-soft: #e9f7f0;
	--sbse-accent-line: #bfe6d1;
}
.sbse-promo-strip--product {
	margin-top: 12px;
}

/* Product-page badge — "pill" sits in the normal flow (safe on any theme). */
.sbse-promo-badge {
	--sbse-accent: #6b3f86;
	--sbse-accent-soft: #f3edf7;
	--sbse-accent-line: #e4d7ee;
}
.sbse-promo-badge--pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 10px 0;
	padding: 7px 13px;
	border-radius: 999px;
	font-size: .9em;
	font-weight: 700;
	background: var(--sbse-accent-soft);
	border: 1px solid var(--sbse-accent-line);
	color: var(--sbse-accent);
}
.sbse-promo-badge--pill::before {
	content: "\1F381"; /* 🎁 */
	font-size: 1.05em;
}
/* "ribbon" floats over the gallery — opt-in, theme-test per site. */
.sbse-promo-badge--ribbon {
	position: absolute;
	top: 10px;
	left: 0;
	z-index: 5;
	padding: 6px 12px;
	font-size: .8em;
	font-weight: 800;
	letter-spacing: .3px;
	color: #fff;
	background: var(--sbse-accent);
	border-radius: 0 4px 4px 0;
	box-shadow: 0 3px 8px rgba(0, 0, 0, .2);
}
