/* Smart Coupon Popup — front-end styles (compact centered card, RTL). */

.scp-root[hidden],
.scp-msg[hidden] {
	display: none !important;
}

.scp-root {
	--scp-radius: 22px;
	--scp-text: #1d2433;
	--scp-muted: #5b6475;
	--scp-surface: #ffffff;
	--scp-border: #e6e8ee;
	--scp-error: #b42318;
	--scp-success: #067647;
	/* Soft tints of the configured colors (plain fallbacks for browsers without color-mix). */
	--scp-tint: #f4f6fa;
	--scp-tint-strong: #e9edf5;
	--scp-tint: color-mix(in srgb, var(--scp-primary) 9%, #fff);
	--scp-tint-strong: color-mix(in srgb, var(--scp-primary) 16%, #fff);
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 24px 16px;
	font-family: inherit;
	direction: rtl;
}

html.scp-open {
	overflow: hidden;
}

.scp-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.scp-dialog {
	position: relative;
	width: 100%;
	max-width: 360px;
	max-height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	box-sizing: border-box;
	background: var(--scp-surface);
	color: var(--scp-text);
	border-radius: var(--scp-radius);
	box-shadow: 0 18px 50px rgba(15, 23, 42, 0.25), 0 2px 8px rgba(15, 23, 42, 0.08);
	text-align: center;
	line-height: 1.7;
}

.scp-dialog:focus {
	outline: none;
}

.scp-close {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--scp-surface);
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
	color: var(--scp-text);
	font-size: 22px;
	line-height: 32px;
	cursor: pointer;
}

.scp-close:hover,
.scp-close:focus-visible {
	background: var(--scp-tint);
}

/* Gift header */

.scp-hero {
	position: relative;
	padding: 18px 16px 6px;
	background: linear-gradient(180deg, var(--scp-tint-strong), var(--scp-tint));
	overflow: hidden;
}

.scp-hero::after {
	content: "";
	position: absolute;
	right: -12%;
	bottom: -22px;
	left: -12%;
	height: 40px;
	border-radius: 50%;
	background: var(--scp-surface);
}

.scp-gift {
	position: relative;
	z-index: 1;
	display: block;
	width: 104px;
	height: auto;
	margin: 0 auto;
}

.scp-gift .g-box { fill: var(--scp-primary); opacity: 0.85; }
.scp-gift .g-lid { fill: var(--scp-primary); }
.scp-gift .g-shade { fill: #000; opacity: 0.12; }
.scp-gift .g-ribbon,
.scp-gift .g-bow { fill: var(--scp-secondary); }
.scp-gift .g-knot { fill: var(--scp-secondary); stroke: var(--scp-surface); stroke-width: 1.5; }
.scp-gift .g-spark { fill: var(--scp-primary); }
.scp-gift .g-spark--alt { fill: var(--scp-secondary); opacity: 0.7; }

/* Body */

.scp-body {
	position: relative;
	padding: 6px 20px 20px;
}

.scp-title {
	margin: 0 0 6px;
	padding: 0;
	font-size: 1.2rem;
	font-weight: 800;
	line-height: 1.6;
	color: var(--scp-secondary);
	text-wrap: balance;
}

.scp-text {
	margin: 0 0 14px;
	font-size: 0.92rem;
	color: var(--scp-muted);
	white-space: pre-line;
}

.scp-text--small {
	margin: 0 0 10px;
	font-size: 0.82rem;
}

.scp-center {
	text-align: center;
}

.scp-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: right;
}

.scp-label {
	font-size: 0.88rem;
	font-weight: 600;
}

/* Two classes so generic theme rules such as input[type="tel"] do not override the field. */
.scp-root .scp-input {
	width: 100%;
	box-sizing: border-box;
	min-height: 48px;
	margin: 0;
	padding: 8px 14px;
	border: 1px solid var(--scp-border);
	border-radius: 12px;
	background: #fafbfc;
	color: var(--scp-text);
	font: inherit;
	font-size: 1rem;
}

.scp-root .scp-input:focus {
	outline: none;
	border-color: var(--scp-primary);
	background: #fff;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--scp-primary) 18%, transparent);
}

.scp-phone-row {
	display: flex;
	gap: 8px;
	direction: ltr;
}

.scp-phone-icon {
	display: flex;
	flex: 0 0 48px;
	align-items: center;
	justify-content: center;
	height: 48px;
	box-sizing: border-box;
	border: 1px solid var(--scp-border);
	border-radius: 12px;
	background: var(--scp-tint);
	color: var(--scp-secondary);
}

/* The number reads left to right as one sequence even when the theme makes inputs RTL. */
.scp-root .scp-phone-row .scp-input,
.scp-root .scp-phone-row .scp-input::placeholder {
	direction: ltr !important;
	text-align: left !important;
	unicode-bidi: isolate;
	letter-spacing: 0.06em;
	word-spacing: normal;
}

.scp-icon {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex: none;
}

/* OTP boxes: one transparent input over the drawn cells */

.scp-otp {
	position: relative;
	display: flex;
	justify-content: center;
	gap: 8px;
}

.scp-otp__cell {
	display: flex;
	flex: 1 1 0;
	align-items: center;
	justify-content: center;
	max-width: 46px;
	height: 50px;
	box-sizing: border-box;
	border: 1px solid var(--scp-border);
	border-radius: 12px;
	background: #fafbfc;
	color: var(--scp-text);
	font-size: 1.25rem;
	font-weight: 700;
}

.scp-otp__cell.is-filled {
	background: #fff;
	border-color: var(--scp-tint-strong);
}

.scp-otp__cell.is-active {
	border-color: var(--scp-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--scp-primary) 18%, transparent);
}

/*
 * The real input (keyboard, SMS autofill, paste) covers the boxes but is not drawn. Themes often
 * style every input[type="text"] (position, size, background, opacity), which pulled it out of
 * the overlay as a second white field; these rules keep it in place against such styles.
 */
.scp-root .scp-otp .scp-otp__input {
	position: absolute !important;
	inset: 0 !important;
	z-index: 1;
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	color: transparent !important;
	-webkit-text-fill-color: transparent !important;
	caret-color: transparent !important;
	font-size: 16px !important; /* avoids iOS zoom */
	opacity: 0.01 !important;
	transform: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	cursor: text;
}

.scp-root .scp-otp .scp-otp__input:-webkit-autofill {
	-webkit-box-shadow: 0 0 0 60px transparent inset !important;
	transition: background-color 9999s ease 0s;
}

/* Buttons */

.scp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 50px;
	margin: 4px 0 0;
	padding: 10px 16px;
	box-sizing: border-box;
	border: 0;
	border-radius: 14px;
	background: var(--scp-primary);
	background: linear-gradient(180deg, color-mix(in srgb, var(--scp-primary) 88%, #fff), var(--scp-primary));
	box-shadow: 0 8px 18px color-mix(in srgb, var(--scp-primary) 28%, transparent);
	color: var(--scp-on-primary, #fff);
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.1s ease;
}

.scp-btn:hover {
	filter: brightness(0.95);
	color: var(--scp-on-primary, #fff);
}

.scp-btn:active {
	transform: translateY(1px);
}

.scp-btn .scp-icon--chevron {
	width: 18px;
	height: 18px;
}

.scp-btn:focus-visible,
.scp-link:focus-visible,
.scp-code__copy:focus-visible,
.scp-close:focus-visible,
.scp-bar__copy:focus-visible {
	outline: 3px solid var(--scp-secondary);
	outline-offset: 2px;
}

.scp-btn[disabled] {
	opacity: 0.65;
	cursor: wait;
}

.scp-btn--ghost {
	background: transparent;
	box-shadow: none;
	color: var(--scp-secondary);
	border: 1px solid var(--scp-border);
}

.scp-btn--ghost:hover {
	color: var(--scp-secondary);
	background: var(--scp-tint);
}

.scp-links {
	display: flex;
	justify-content: space-between;
	gap: 8px;
}

.scp-link {
	margin: 0;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--scp-secondary);
	text-decoration: underline;
	font: inherit;
	font-size: 0.82rem;
	cursor: pointer;
}

.scp-link[disabled] {
	color: var(--scp-muted);
	text-decoration: none;
	cursor: default;
}

.scp-msg {
	padding: 8px 12px;
	border-radius: 10px;
	font-size: 0.86rem;
	background: #f6f8fb;
	text-align: right;
}

.scp-msg--error {
	color: var(--scp-error);
	background: #fef3f2;
}

.scp-msg--success {
	margin: 0 0 10px;
	color: var(--scp-success);
	background: #ecfdf3;
}

.scp-spinner {
	width: 32px;
	height: 32px;
	margin: 12px auto 8px;
	border: 3px solid var(--scp-tint-strong);
	border-top-color: var(--scp-primary);
	border-radius: 50%;
	animation: scp-spin 0.8s linear infinite;
}

@keyframes scp-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.scp-spinner {
		animation-duration: 2s;
	}
}

/* Coupon result */

.scp-code {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 56px;
	margin: 6px 0 10px;
	padding: 8px 48px;
	box-sizing: border-box;
	border: 1.5px dashed color-mix(in srgb, var(--scp-primary) 55%, #fff);
	border-radius: 14px;
	background: var(--scp-tint);
	direction: ltr;
}

.scp-code code {
	padding: 0;
	background: none;
	color: var(--scp-secondary);
	font-family: inherit;
	font-size: 1.35rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	word-break: break-all;
}

.scp-code__copy {
	position: absolute;
	top: 50%;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: -18px 0 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--scp-primary);
	cursor: pointer;
}

.scp-code__copy:hover {
	background: var(--scp-tint-strong);
}

.scp-code__status {
	position: absolute;
	left: 12px;
	font-size: 0.75rem;
	color: var(--scp-success);
	direction: rtl;
}

.scp-card {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 10px;
	padding: 10px 14px;
	border-radius: 14px;
	background: var(--scp-tint);
	text-align: right;
}

.scp-card__icon {
	display: flex;
	flex: 0 0 38px;
	align-items: center;
	justify-content: center;
	height: 38px;
	border-radius: 50%;
	background: var(--scp-surface);
	color: var(--scp-primary);
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.scp-card__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	font-size: 0.82rem;
	color: var(--scp-muted);
}

.scp-card__text strong {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--scp-text);
}

.scp-timer {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: 6px;
	/* Numbers read left to right (minutes : seconds) inside the RTL dialog. */
	direction: ltr;
	margin-top: 2px;
	color: var(--scp-secondary);
	font-variant-numeric: tabular-nums;
}

.scp-timer__unit {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 40px;
}

.scp-timer__unit b {
	font-size: 1.6rem;
	font-weight: 800;
	line-height: 1.2;
}

.scp-timer__unit small {
	direction: rtl;
	font-size: 0.72rem;
	color: var(--scp-muted);
}

.scp-timer__sep {
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.3;
}

.scp-timer__expired {
	font-size: 0.9rem;
	color: var(--scp-error);
}

@media (max-width: 340px) {
	.scp-root {
		padding: 16px 10px;
	}

	.scp-body {
		padding: 4px 14px 16px;
	}

	.scp-gift {
		width: 84px;
	}

	.scp-otp {
		gap: 5px;
	}
}

@media (max-height: 560px) {
	.scp-hero {
		padding-top: 10px;
	}

	.scp-gift {
		width: 72px;
	}
}

/* Countdown under the title, from the first appearance of the popup */

.scp-deadline {
	margin: -4px 0 10px;
	color: var(--scp-muted);
	font-size: 0.85rem;
}

.scp-deadline__time {
	color: var(--scp-secondary);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	unicode-bidi: isolate;
}

.scp-deadline.is-expired {
	color: var(--scp-error);
	font-weight: 600;
}

/* Coupon bar: two short centered rows (code and copy; time left) */

.scp-bar {
	position: relative;
	z-index: 99998;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 5px 12px;
	background: var(--scp-secondary);
	color: var(--scp-on-secondary, #fff);
	font-family: inherit;
	font-size: 0.85rem;
	line-height: 1.5;
	text-align: center;
}

.scp-bar .scp-bar__row {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	max-width: 100%;
	white-space: nowrap;
}

.scp-bar .scp-bar__row--time {
	gap: 4px;
	font-size: 0.8rem;
	opacity: 0.95;
}

.scp-bar code {
	margin: 0;
	padding: 0 8px;
	border: 0;
	border-radius: 6px;
	background: rgba(127, 127, 127, 0.22);
	color: inherit;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: 0.05em;
}

.scp-bar .scp-bar__time {
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	unicode-bidi: isolate;
}

/* Two classes so a theme's generic button styles do not enlarge the bar. */
.scp-bar .scp-bar__copy {
	width: auto;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 1px 10px;
	border: 1px solid currentColor;
	border-radius: 6px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-size: 0.78rem;
	line-height: 1.6;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

.scp-bar .scp-bar__copy:hover {
	background: rgba(127, 127, 127, 0.2);
	color: inherit;
}

/* Signed in but not eligible for a new coupon yet: one friendly line, closes by itself. */
.scp-root .scp-restricted {
	margin: 8px 0 4px;
	text-align: center;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.9;
	color: var(--scp-text);
}
