/**
 * TotalPoll Paystack Bridge — Frontend purchase UI
 * Mobile-first. Fields reflow; pay button never shares a cramped grid cell.
 */

.tppb-purchase {
	--tppb-fg: #1a1a1a;
	--tppb-muted: #5c5c5c;
	--tppb-border: rgba(26, 26, 26, 0.14);
	--tppb-surface: #f7f5f2;
	--tppb-accent: #0f6b4c;
	--tppb-accent-fg: #ffffff;
	--tppb-danger: #9b1c1c;
	--tppb-info: #1d4e89;
	--tppb-radius: 6px;
	--tppb-font: inherit;
	--tppb-control-h: 2.85rem;

	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 1.25rem 0;
	padding: clamp(1rem, 3vw, 1.5rem);
	color: var(--tppb-fg);
	font-family: var(--tppb-font);
	background:
		radial-gradient(120% 80% at 0% 0%, rgba(15, 107, 76, 0.08), transparent 55%),
		linear-gradient(180deg, #fffefb 0%, var(--tppb-surface) 100%);
	border: 1px solid var(--tppb-border);
	border-radius: calc(var(--tppb-radius) + 2px);
}

.tppb-purchase *,
.tppb-purchase *::before,
.tppb-purchase *::after {
	box-sizing: border-box;
}

.tppb-purchase--notice {
	padding: 1rem 1.15rem;
}

.tppb-purchase__header {
	margin-bottom: 1rem;
}

.tppb-purchase__title {
	margin: 0 0 0.25rem;
	font-size: clamp(1.15rem, 2.5vw, 1.4rem);
	line-height: 1.25;
	font-weight: 700;
	letter-spacing: -0.02em;
	word-wrap: break-word;
}

.tppb-purchase__poll {
	margin: 0 0 0.35rem;
	color: var(--tppb-muted);
	font-size: 0.92rem;
	word-wrap: break-word;
}

.tppb-purchase__price {
	margin: 0;
	font-size: 0.88rem;
	color: var(--tppb-muted);
}

/* —— Form —— */
.tppb-purchase__form {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
	width: 100%;
	min-width: 0;
}

.tppb-purchase__field {
	display: grid;
	gap: 0.4rem;
	min-width: 0;
	width: 100%;
}

.tppb-purchase__label {
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--tppb-muted);
}

.tppb-purchase__choice-row {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	min-width: 0;
}

.tppb-purchase__thumb {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: var(--tppb-radius);
	overflow: hidden;
	border: 1px solid var(--tppb-border);
	background: #fff;
}

.tppb-purchase__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tppb-purchase__select,
.tppb-purchase__input {
	display: block;
	width: 100%;
	min-width: 0;
	min-height: var(--tppb-control-h);
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--tppb-border);
	border-radius: var(--tppb-radius);
	background: #fff;
	color: var(--tppb-fg);
	font: inherit;
	font-size: 16px;
	line-height: 1.3;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tppb-purchase__select {
	flex: 1 1 auto;
	max-width: 100%;
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c5c5c' d='M1.4 0.6L6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.85rem center;
	padding-right: 2.25rem;
}

.tppb-purchase__select:focus,
.tppb-purchase__input:focus,
.tppb-purchase__qty-input:focus {
	outline: none;
	border-color: var(--tppb-accent);
	box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.18);
}

/* —— Quantity —— */
.tppb-purchase__qty {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	gap: 0.5rem;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.tppb-purchase__qty-btn {
	flex: 0 0 var(--tppb-control-h);
	width: var(--tppb-control-h);
	min-width: var(--tppb-control-h);
	height: var(--tppb-control-h);
	margin: 0;
	padding: 0;
	border: 1px solid var(--tppb-border);
	border-radius: var(--tppb-radius);
	background: #fff;
	color: var(--tppb-fg);
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.12s ease;
	-webkit-tap-highlight-color: transparent;
}

.tppb-purchase__qty-btn:hover {
	background: rgba(15, 107, 76, 0.08);
}

.tppb-purchase__qty-btn:active {
	transform: scale(0.96);
}

.tppb-purchase__qty-input {
	flex: 1 1 auto;
	width: auto;
	min-width: 3.5rem;
	max-width: none;
	min-height: var(--tppb-control-h);
	height: var(--tppb-control-h);
	margin: 0;
	padding: 0.5rem 0.4rem;
	border: 1px solid var(--tppb-border);
	border-radius: var(--tppb-radius);
	background: #fff;
	color: var(--tppb-fg);
	font: inherit;
	font-size: 16px;
	line-height: 1.2;
	text-align: center;
	font-variant-numeric: tabular-nums;
	-moz-appearance: textfield;
	appearance: textfield;
}

.tppb-purchase__qty-input::-webkit-outer-spin-button,
.tppb-purchase__qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* —— Actions row: total + pay (always full width of form) —— */
.tppb-purchase__actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.85rem;
	width: 100%;
	min-width: 0;
	grid-column: 1 / -1;
	padding-top: 0.35rem;
	margin-top: 0.15rem;
	border-top: 1px solid var(--tppb-border);
}

.tppb-purchase__total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	min-width: 0;
	margin: 0;
	padding: 0.25rem 0 0;
	border: 0;
}

.tppb-purchase__total-label {
	font-size: 0.9rem;
	color: var(--tppb-muted);
}

.tppb-purchase__total-value {
	font-size: clamp(1.15rem, 3vw, 1.4rem);
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
	word-break: break-word;
}

/* Reset theme button styles that break layout */
.tppb-purchase .tppb-purchase__submit,
.tppb-purchase .tppb-purchase__again {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	float: none;
	clear: none;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	min-height: 3rem;
	height: auto;
	margin: 0;
	padding: 0.75rem 1.25rem;
	border: 0;
	border-radius: var(--tppb-radius);
	background: var(--tppb-accent) !important;
	background-image: none !important;
	color: var(--tppb-accent-fg) !important;
	font: inherit;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.25;
	letter-spacing: normal;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	white-space: normal;
	cursor: pointer;
	box-shadow: none;
	transition: filter 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}

.tppb-purchase .tppb-purchase__submit:hover,
.tppb-purchase .tppb-purchase__submit:focus,
.tppb-purchase .tppb-purchase__again:hover,
.tppb-purchase .tppb-purchase__again:focus {
	filter: brightness(1.06);
	background: var(--tppb-accent) !important;
	color: var(--tppb-accent-fg) !important;
	text-decoration: none;
}

.tppb-purchase .tppb-purchase__submit:active,
.tppb-purchase .tppb-purchase__again:active {
	transform: translateY(1px);
}

.tppb-purchase .tppb-purchase__submit:disabled {
	opacity: 0.65;
	cursor: wait;
	transform: none;
	filter: none;
}

.tppb-purchase .tppb-purchase__again {
	background: transparent !important;
	color: var(--tppb-accent) !important;
	border: 1px solid rgba(15, 107, 76, 0.35);
}

.tppb-purchase .tppb-purchase__again:hover,
.tppb-purchase .tppb-purchase__again:focus {
	background: rgba(15, 107, 76, 0.06) !important;
	color: var(--tppb-accent) !important;
}

.tppb-purchase__alert {
	margin: 0 0 1rem;
	padding: 0.75rem 0.85rem;
	border-radius: var(--tppb-radius);
	font-size: 0.92rem;
	line-height: 1.4;
	border: 1px solid transparent;
	word-wrap: break-word;
}

.tppb-purchase__alert--error {
	color: var(--tppb-danger);
	background: rgba(155, 28, 28, 0.08);
	border-color: rgba(155, 28, 28, 0.22);
}

.tppb-purchase__alert--info {
	color: var(--tppb-info);
	background: rgba(29, 78, 137, 0.08);
	border-color: rgba(29, 78, 137, 0.2);
}

.tppb-purchase__success {
	text-align: left;
	animation: tppb-fade-in 0.35s ease;
}

.tppb-purchase__success-title {
	margin: 0 0 0.5rem;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--tppb-accent);
}

.tppb-purchase__success-meta {
	margin: 0 0 1.15rem;
	color: var(--tppb-muted);
	font-size: 0.92rem;
	word-wrap: break-word;
}

@keyframes tppb-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* —— ≥560px: votes + email side by side; pay stays full width —— */
@media (min-width: 560px) {
	.tppb-purchase__thumb {
		width: 56px;
		height: 56px;
	}

	.tppb-purchase__form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1rem 1.15rem;
	}

	.tppb-purchase__field--choice {
		grid-column: 1 / -1;
	}

	.tppb-purchase__field--qty {
		grid-column: 1;
	}

	.tppb-purchase__field--email {
		grid-column: 2;
	}

	.tppb-purchase__actions {
		grid-column: 1 / -1;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.85rem 1.25rem;
	}

	.tppb-purchase__total {
		flex: 1 1 auto;
		justify-content: flex-start;
		gap: 0.75rem;
		padding: 0;
	}

	.tppb-purchase .tppb-purchase__submit {
		flex: 0 1 auto;
		width: auto;
		min-width: min(100%, 14rem);
		max-width: 100%;
		padding-left: 1.75rem;
		padding-right: 1.75rem;
	}

	.tppb-purchase__qty {
		max-width: 15rem;
	}
}

/* —— ≥900px: three fields on one row; actions still full width —— */
@media (min-width: 900px) {
	.tppb-purchase__form {
		grid-template-columns: minmax(0, 1.5fr) minmax(11rem, 0.9fr) minmax(0, 1.2fr);
		align-items: end;
	}

	.tppb-purchase__field--choice {
		grid-column: 1;
	}

	.tppb-purchase__field--qty {
		grid-column: 2;
	}

	.tppb-purchase__field--email {
		grid-column: 3;
	}

	.tppb-purchase__actions {
		grid-column: 1 / -1;
	}

	.tppb-purchase__qty {
		max-width: none;
		width: 100%;
	}

	.tppb-purchase .tppb-purchase__submit {
		min-width: 16rem;
	}
}

/* —— Narrow phones —— */
@media (max-width: 359px) {
	.tppb-purchase {
		padding: 0.85rem;
		margin: 0.85rem 0;
	}

	.tppb-purchase {
		--tppb-control-h: 2.5rem;
	}

	.tppb-purchase__thumb {
		width: 40px;
		height: 40px;
	}

	.tppb-purchase .tppb-purchase__submit {
		min-height: 2.75rem;
		font-size: 0.95rem;
		padding: 0.65rem 1rem;
	}
}

/* —— Contest listing cards + Vote link to standalone page —— */
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid],
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item],
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item.tppb-voting-card,
div#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid],
div#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] {
	box-sizing: border-box;
	padding: 0.65rem !important;
}

#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid] > .totalpoll-question-choices-item-container,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] > .totalpoll-question-choices-item-container,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item.tppb-voting-card > .totalpoll-question-choices-item-container,
div#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid] > .totalpoll-question-choices-item-container,
div#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] > .totalpoll-question-choices-item-container,
.totalpoll-question-choices-item-container.tppb-voting-card-inner {
	box-sizing: border-box !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: stretch !important;
	gap: 1rem !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	margin: 0 !important;
	padding: 1.25rem !important;
	overflow: hidden !important;
	background: #fffefb !important;
	border: 1px solid rgba(26, 26, 26, 0.12) !important;
	border-radius: 10px !important;
	color: #1a1a1a !important;
}

#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid] .totalpoll-question-choices-item-content-container,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] .totalpoll-question-choices-item-content-container,
#totalpoll.totalpoll-wrapper .tppb-voting-card .totalpoll-question-choices-item-content-container,
.tppb-voting-card-inner .totalpoll-question-choices-item-content-container {
	box-sizing: border-box !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	height: auto !important;
	flex: 0 0 auto !important;
	padding: 0 !important;
	margin: 0 !important;
	overflow: hidden !important;
	border-radius: 8px !important;
}

#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid] .totalpoll-question-choices-item-content img,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] .totalpoll-question-choices-item-content img,
.tppb-voting-card-inner .totalpoll-question-choices-item-content img {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	object-fit: cover !important;
	border-radius: 8px !important;
}

#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid] .totalpoll-question-choices-item-label,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] .totalpoll-question-choices-item-label,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item-results[data-choice-uid] .totalpoll-question-choices-item-label,
#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item-results[data-tppb-choice-item] .totalpoll-question-choices-item-label,
.tppb-voting-card-inner .totalpoll-question-choices-item-label {
	box-sizing: border-box !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	padding: 0.85rem 0.9rem !important;
	border-radius: 8px !important;
	cursor: default !important;
}

.tppb-vote-link-wrap {
	box-sizing: border-box;
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
}

.tppb-vote-link,
#totalpoll .tppb-vote-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	min-height: 2.85rem;
	margin: 0;
	padding: 0.75rem 1.25rem;
	border: 0;
	border-radius: 6px;
	background: #0f6b4c !important;
	background-image: none !important;
	color: #fff !important;
	font: inherit;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.25;
	text-align: center;
	text-decoration: none !important;
	text-transform: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.12s ease;
	-webkit-tap-highlight-color: transparent;
}

.tppb-vote-link:hover,
.tppb-vote-link:focus,
#totalpoll .tppb-vote-link:hover,
#totalpoll .tppb-vote-link:focus {
	filter: brightness(1.06);
	background: #0f6b4c !important;
	color: #fff !important;
	text-decoration: none !important;
}

.tppb-vote-link:active {
	transform: translateY(1px);
}

/* Locked contestant on detail purchase form */
.tppb-purchase__locked-choice {
	flex: 1 1 auto;
	margin: 0;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--tppb-border);
	border-radius: var(--tppb-radius);
	background: rgba(15, 107, 76, 0.06);
	font-weight: 600;
	line-height: 1.35;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.tppb-purchase--locked .tppb-purchase__thumb {
	display: block;
}

.tppb-purchase--locked .tppb-purchase__field--choice {
	grid-column: 1 / -1;
}

/* —— Contestant standalone detail page —— */
.tppb-choice-detail {
	box-sizing: border-box;
	display: grid;
	gap: 1.5rem;
	width: 100%;
	max-width: 42rem;
	margin: 0 auto;
	padding: 0.25rem 0 2rem;
}

.tppb-choice-detail *,
.tppb-choice-detail *::before,
.tppb-choice-detail *::after {
	box-sizing: border-box;
}

.tppb-choice-detail__crumb {
	margin: 0;
}

.tppb-choice-detail__back {
	color: #0f6b4c;
	font-weight: 600;
	text-decoration: none;
}

.tppb-choice-detail__back:hover,
.tppb-choice-detail__back:focus {
	text-decoration: underline;
}

.tppb-choice-detail__card {
	display: grid;
	gap: 1rem;
	padding: clamp(1rem, 3vw, 1.35rem);
	background:
		radial-gradient(120% 80% at 0% 0%, rgba(15, 107, 76, 0.08), transparent 55%),
		linear-gradient(180deg, #fffefb 0%, #f7f5f2 100%);
	border: 1px solid rgba(26, 26, 26, 0.12);
	border-radius: 10px;
}

.tppb-choice-detail__media {
	margin: 0;
	overflow: hidden;
	border-radius: 8px;
}

.tppb-choice-detail__media img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

.tppb-choice-detail__header {
	display: grid;
	gap: 0.35rem;
}

.tppb-choice-detail__title {
	margin: 0;
	font-size: clamp(1.45rem, 4vw, 1.9rem);
	line-height: 1.2;
	letter-spacing: -0.02em;
	font-weight: 700;
}

.tppb-choice-detail__poll {
	margin: 0;
	color: #5c5c5c;
	font-size: 0.95rem;
}

.tppb-choice-detail__votes {
	margin: 0.25rem 0 0;
	font-size: 1rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.tppb-choice-detail__purchase {
	width: 100%;
	min-width: 0;
}

.tppb-choice-detail__purchase .tppb-purchase {
	margin: 0;
}

@media (max-width: 559px) {
	#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid],
	#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item],
	#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item.tppb-voting-card {
		padding: 0.45rem !important;
	}

	#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-choice-uid] > .totalpoll-question-choices-item-container,
	#totalpoll.totalpoll-wrapper .totalpoll-question-choices-item[data-tppb-choice-item] > .totalpoll-question-choices-item-container,
	.totalpoll-question-choices-item-container.tppb-voting-card-inner {
		gap: 0.85rem !important;
		padding: 1rem !important;
	}

	.tppb-vote-link,
	#totalpoll .tppb-vote-link {
		min-height: 2.75rem;
		font-size: 0.98rem;
	}

	.tppb-choice-detail {
		gap: 1.15rem;
		padding-bottom: 1.5rem;
	}
}

