/**
 * JustOrder Scroll Utils
 * Floating scroll-to-bottom / scroll-to-top button
 */

.jsu-scroll-btn {
	/* Position --- desktop default */
	position: fixed;
	right: 32px;
	bottom: 32px;
	z-index: 9990;

	/* Size */
	width: 56px;
	height: 56px;
	border-radius: 60% !important;

	/* Appearance --- uses brand colours injected from ACF via inline CSS variables, with hard-coded fallbacks */
	background-color: var(--color-accent, #219711) !important;
	color: #ffffff;
	border: var(--color-secondary) !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.08);

	/* Layout */
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;

	/* Interaction */
	-webkit-tap-highlight-color: transparent;
	transition:
		opacity 0.25s ease,
		transform 0.25s ease,
		background-color 0.2s ease,
		box-shadow 0.2s ease;

	/* Hidden by default --- JS toggles visibility */
	opacity: 0;
	transform: translateY(8px) scale(0.95);
	pointer-events: none;
}

.jsu-scroll-btn.jsu-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.jsu-scroll-btn:hover {
	background-color: var(--color-primary, #c41717)!important;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22), 0 3px 6px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px) scale(1);
}

.jsu-scroll-btn:focus-visible {
	outline: 3px solid var(--color-primary, #c41717) !important;
	outline-offset: 3px;
}

.jsu-scroll-btn:active {
	transform: translateY(0) scale(0.96);
}

/* Icon --- flipped via class when direction changes */
.jsu-scroll-btn svg {
	width: 24px;
	height: 24px;
	transition: transform 0.3s ease;
	pointer-events: none;
}

.jsu-scroll-btn.jsu-direction-up svg {
	transform: rotate(180deg);
}

/* Screen-reader only label */
.jsu-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
	.jsu-scroll-btn {
		width: 52px;
		height: 52px;
		right: 24px;
		bottom: 24px;
	}

	.jsu-scroll-btn svg {
		width: 22px;
		height: 22px;
	}
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.jsu-scroll-btn {
		width: 48px;
		height: 48px;
		right: 16px;
		bottom: 20px;
	}

	.jsu-scroll-btn svg {
		width: 20px;
		height: 20px;
	}
}

/* ---------- Respect users who prefer reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.jsu-scroll-btn,
	.jsu-scroll-btn svg {
		transition: opacity 0.15s ease;
	}

	.jsu-scroll-btn:hover {
		transform: none;
	}
}