/**
 * Road Prize Wheel — frontend styles (mobile-first, RTL).
 */

.rpw-widget {
	--rpw-primary: #e63946;
	--rpw-button: #e63946;
	--rpw-card-bg: #ffffff;
	--rpw-wheel: #1d3557;
	--rpw-bg: #f6f7fb;
	--rpw-text: #1b1b1b;
	--rpw-radius: 16px;
	--rpw-shadow: 0 8px 30px rgba(0, 0, 0, .08);

	box-sizing: border-box;
	position: relative;
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
	padding: 16px;
	overflow-x: hidden;
	background: var(--rpw-bg);
	border-radius: var(--rpw-radius);
	color: var(--rpw-text);
	font-family: inherit;
	line-height: 1.7;
}

.rpw-widget *,
.rpw-widget *::before,
.rpw-widget *::after {
	box-sizing: border-box;
}

.rpw-logo {
	text-align: center;
	margin-bottom: 12px;
}

.rpw-logo img {
	max-height: 64px;
	width: auto;
}

/* Cards */
.rpw-card {
	background: var(--rpw-card-bg);
	border-radius: var(--rpw-radius);
	box-shadow: var(--rpw-shadow);
	padding: 20px 18px;
}

.rpw-title {
	margin: 0 0 16px;
	font-size: 1.25rem;
	font-weight: 700;
	text-align: center;
	color: var(--rpw-text);
}

/* Steps + transitions */
.rpw-step {
	opacity: 1;
	transition: opacity .35s ease, transform .35s ease;
}

.rpw-step[hidden] {
	display: none;
}

.rpw-step.is-leaving {
	opacity: 0;
	transform: translateY(8px);
}

.rpw-step.is-entering {
	opacity: 0;
	transform: translateY(10px);
}

/* Form */
.rpw-field {
	margin-bottom: 14px;
}

.rpw-label {
	display: block;
	margin-bottom: 6px;
	font-size: .9rem;
	font-weight: 600;
}

.rpw-req {
	color: var(--rpw-primary);
	margin-inline-start: 2px;
}

.rpw-input {
	width: 100%;
	padding: 12px 14px;
	font-size: 1rem;
	font-family: inherit;
	color: var(--rpw-text);
	background: #fff;
	border: 1.5px solid #e2e5ee;
	border-radius: 12px;
	outline: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.rpw-input:focus {
	border-color: var(--rpw-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--rpw-primary) 18%, transparent);
}

textarea.rpw-input {
	resize: vertical;
	min-height: 84px;
}

.rpw-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: .92rem;
	cursor: pointer;
}

.rpw-checkbox input {
	width: 18px;
	height: 18px;
	accent-color: var(--rpw-primary);
}

.rpw-field-error {
	display: block;
	margin-top: 5px;
	min-height: 1em;
	font-size: .8rem;
	color: #d62828;
}

.rpw-field.has-error .rpw-input {
	border-color: #d62828;
}

/* Honeypot — visually hidden without causing horizontal overflow on mobile */
.rpw-hp {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Buttons */
.rpw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 14px 18px;
	font-size: 1.05rem;
	font-weight: 700;
	font-family: inherit;
	color: #fff;
	background: var(--rpw-button);
	border: none;
	border-radius: 14px;
	cursor: pointer;
	text-decoration: none;
	transition: transform .12s ease, filter .2s ease, opacity .2s ease;
	-webkit-tap-highlight-color: transparent;
}

.rpw-btn:hover {
	filter: brightness(1.05);
}

.rpw-btn:active {
	transform: scale(.98);
}

.rpw-btn[disabled] {
	opacity: .6;
	cursor: not-allowed;
}

.rpw-btn--spin {
	margin-top: 18px;
	font-size: 1.15rem;
	box-shadow: 0 6px 18px color-mix(in srgb, var(--rpw-button) 40%, transparent);
}

.rpw-btn--ghost {
	background: transparent;
	color: var(--rpw-text);
	border: 1.5px solid #dfe3ee;
	margin-top: 10px;
}

.rpw-btn--download {
	background: var(--rpw-wheel);
	margin-bottom: 4px;
}

/* Spinner */
.rpw-spinner {
	width: 18px;
	height: 18px;
	border: 2.5px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rpw-spin 0.7s linear infinite;
}

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

/* Alerts */
.rpw-alert {
	margin-bottom: 12px;
	padding: 12px 14px;
	border-radius: 12px;
	font-size: .92rem;
	text-align: center;
}

.rpw-alert.is-error {
	background: #fde8e8;
	color: #b02525;
}

.rpw-alert.is-success {
	background: #e6f6ec;
	color: #1b7f43;
}

.rpw-notice {
	padding: 16px;
	text-align: center;
	color: #666;
}

/* Wheel */
.rpw-wheel-wrap {
	position: relative;
	width: 100%;
	max-width: 320px;
	margin: 6px auto 4px;
	aspect-ratio: 1 / 1;
}

.rpw-wheel {
	width: 100%;
	height: 100%;
	display: block;
	filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .12));
}

[data-rpw-wheel-rotor] {
	transform-box: fill-box;
	transform-origin: center;
	transform: rotate(0deg);
}

.rpw-wheel.is-spinning [data-rpw-wheel-rotor] {
	transition: transform 3.8s cubic-bezier(.15, .82, .18, 1);
}

.rpw-seg-text {
	font-size: 15px;
	font-weight: 700;
	fill: #fff;
	font-family: inherit;
}

.rpw-seg-icon {
	font-size: 22px;
}

/* Pointer at the top */
.rpw-pointer {
	position: absolute;
	top: -6px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-inline-start: 14px solid transparent;
	border-inline-end: 14px solid transparent;
	border-top: 24px solid var(--rpw-primary);
	z-index: 3;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
}

/* Prize list */
.rpw-prizes {
	margin-top: 18px;
	display: grid;
	gap: 10px;
}

.rpw-prize-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px;
	background: #fafbff;
	border: 1px solid #eef0f7;
	border-radius: 12px;
}

.rpw-prize-dot {
	flex: 0 0 auto;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	margin-top: 5px;
}

.rpw-prize-icon {
	font-size: 1.25rem;
	line-height: 1.4;
}

.rpw-prize-iconimg {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	object-fit: contain;
	border-radius: 6px;
}

.rpw-prize-body {
	display: flex;
	flex-direction: column;
}

.rpw-prize-title {
	font-size: .95rem;
}

.rpw-prize-desc {
	font-size: .82rem;
	color: #6b7280;
}

/* Modal */
.rpw-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.rpw-modal[hidden] {
	display: none;
}

.rpw-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 20, 40, .55);
	backdrop-filter: blur(2px);
	animation: rpw-fade .25s ease;
}

.rpw-modal__box {
	position: relative;
	width: 100%;
	max-width: 360px;
	background: var(--rpw-card-bg);
	border-radius: 20px;
	padding: 28px 22px 22px;
	text-align: center;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
	animation: rpw-pop .3s cubic-bezier(.2, .8, .2, 1.2);
}

.rpw-modal__confetti {
	font-size: 2.4rem;
	line-height: 1;
	margin-bottom: 8px;
}

.rpw-modal__icon {
	display: block;
	width: 72px;
	height: 72px;
	object-fit: contain;
	margin: 0 auto 10px;
	border-radius: 10px;
}

.rpw-modal__icon[hidden] {
	display: none;
}

.rpw-modal__title {
	margin: 0 0 10px;
	font-size: 1.35rem;
	color: var(--rpw-primary);
}

.rpw-modal__prize {
	margin: 0 0 8px;
	font-size: 1.1rem;
	font-weight: 700;
}

.rpw-modal__message {
	margin: 0 0 18px;
	font-size: .95rem;
	color: #4b5563;
}

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

@keyframes rpw-pop {
	from { opacity: 0; transform: translateY(10px) scale(.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Desktop tuning */
@media (min-width: 600px) {
	.rpw-widget {
		max-width: 520px;
		padding: 24px;
	}
	.rpw-wheel-wrap {
		max-width: 420px;
	}
	.rpw-seg-text { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.rpw-wheel.is-spinning [data-rpw-wheel-rotor] {
		transition: transform 0.6s ease;
	}
	.rpw-step { transition: none; }
}


/* Already-won result screen */
.rpw-result-card {
	text-align: center;
}

.rpw-result-emoji {
	font-size: 2.6rem;
	line-height: 1;
	margin-bottom: 6px;
}

.rpw-result-image {
	display: block;
	width: 84px;
	height: 84px;
	object-fit: contain;
	margin: 0 auto 10px;
	border-radius: 12px;
}

.rpw-result-image[hidden] {
	display: none;
}

.rpw-result-mobile {
	font-size: .95rem;
	color: #4b5563;
	margin: 0 0 12px;
}

.rpw-result-label {
	font-weight: 600;
}

.rpw-result-prizebox {
	background: #fafbff;
	border: 1px solid #eef0f7;
	border-radius: 12px;
	padding: 12px;
	margin-bottom: 12px;
}

.rpw-result-plabel {
	display: block;
	font-size: .8rem;
	color: #6b7280;
	margin-bottom: 4px;
}

.rpw-result-prize {
	font-size: 1.15rem;
	color: var(--rpw-primary);
}

.rpw-result-message {
	font-size: .95rem;
	color: #4b5563;
	margin: 0 0 14px;
}

.rpw-result-next {
	font-size: .9rem;
	background: #eef6ff;
	color: #1d4ed8;
	border-radius: 10px;
	padding: 10px;
	margin-bottom: 10px;
}

.rpw-result-next[hidden] {
	display: none;
}

.rpw-result-conditions {
	white-space: pre-line;
	text-align: start;
	font-size: .9rem;
	background: #fff8e5;
	border: 1px solid #f0e0b0;
	color: #6b5300;
	border-radius: 10px;
	padding: 12px;
}

.rpw-result-conditions[hidden] {
	display: none;
}

.rpw-result-conditions::before {
	content: "شروط استفاده مجدد:";
	display: block;
	font-weight: 700;
	margin-bottom: 6px;
}
