/**
 * Refine PDF Preview — frontend styles.
 * Brand: Refine maroon #701015 / gold #B8862B / paper #FBF6EC.
 * Only loaded on product pages that actually have a preview PDF.
 */

/* ------------------------------------------------------------------ *
 * Trigger button
 * ------------------------------------------------------------------ */
.rpp-preview-btn {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 14px;
	padding: 11px 22px;
	border: 1.5px solid #701015;
	border-radius: 8px;
	background: linear-gradient(135deg, #701015, #8a1a20);
	color: #fbf6ec;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	box-shadow: 0 2px 10px rgba(112, 16, 21, 0.22);
	-webkit-tap-highlight-color: transparent;
}
.rpp-preview-btn:hover,
.rpp-preview-btn:focus-visible {
	transform: translateY(-1px);
	background: linear-gradient(135deg, #5c0d11, #701015);
	box-shadow: 0 6px 18px rgba(112, 16, 21, 0.32);
	color: #fff;
}
.rpp-preview-btn:focus-visible {
	outline: 2px solid #b8862b;
	outline-offset: 2px;
}
.rpp-preview-btn:active {
	transform: translateY(0);
}
.rpp-btn-icon {
	flex: none;
	color: #e8d9b8;
}

/* ------------------------------------------------------------------ *
 * Modal shell
 * ------------------------------------------------------------------ */
html.rpp-lock,
html.rpp-lock body {
	overflow: hidden !important;
	overscroll-behavior: none;
}

.rpp-modal {
	position: fixed;
	inset: 0;
	z-index: 999999; /* Above Woodmart/Elementor sticky headers. */
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none; /* Never intercept clicks unless open. */
	transition: opacity 0.22s ease;
}
.rpp-modal[hidden] {
	display: none !important; /* Author CSS overrides the UA [hidden] rule — restore it explicitly. */
}
.rpp-modal.rpp-open {
	opacity: 1;
	pointer-events: auto;
}

.rpp-overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 8, 8, 0.82);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	cursor: pointer;
}

.rpp-dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(920px, calc(100vw - 32px));
	height: min(92vh, 1000px);
	background: #efe9dd;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
	transform: translateY(14px) scale(0.985);
	transition: transform 0.22s ease;
}
.rpp-modal.rpp-open .rpp-dialog {
	transform: translateY(0) scale(1);
}

/* ------------------------------------------------------------------ *
 * Header / toolbar
 * ------------------------------------------------------------------ */
.rpp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	background: #701015;
	color: #fbf6ec;
}
.rpp-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: #fbf6ec;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.rpp-tools {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: none;
}
.rpp-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 8px;
	border: none;
	border-radius: 7px;
	background: rgba(255, 255, 255, 0.12);
	color: #fbf6ec;
	font-size: 19px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
	text-decoration: none;
}
.rpp-tool:hover,
.rpp-tool:focus-visible {
	background: rgba(255, 255, 255, 0.24);
	color: #fff;
}
.rpp-tool:focus-visible {
	outline: 2px solid #e8d9b8;
	outline-offset: 1px;
}
.rpp-zoom-level {
	min-width: 44px;
	text-align: center;
	font-size: 12.5px;
	color: #e8d9b8;
	user-select: none;
}
.rpp-close {
	background: rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------------ *
 * Body: spinner, error, pages
 * ------------------------------------------------------------------ */
.rpp-body {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
}
.rpp-pages {
	flex: 1;
	overflow-y: auto;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding: 18px 12px 26px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	outline: none;
	scrollbar-width: thin;
	scrollbar-color: #701015 transparent;
}
.rpp-page {
	flex: none;
	background: #fff;
	box-shadow: 0 3px 16px rgba(36, 21, 17, 0.18);
	border-radius: 3px;
}
.rpp-page canvas {
	display: block;
	height: auto;
	border-radius: 3px;
}

.rpp-spinner {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}
.rpp-spinner[hidden] {
	display: none;
}
.rpp-spinner span {
	width: 44px;
	height: 44px;
	border: 4px solid rgba(112, 16, 21, 0.18);
	border-top-color: #701015;
	border-radius: 50%;
	animation: rpp-spin 0.8s linear infinite;
}
@keyframes rpp-spin {
	to { transform: rotate(360deg); }
}

.rpp-error {
	margin: auto;
	padding: 20px;
	font-size: 15px;
	color: #9b1c1c;
	text-align: center;
}

/* ------------------------------------------------------------------ *
 * Footer / page indicator
 * ------------------------------------------------------------------ */
.rpp-footer {
	padding: 8px 16px;
	background: #241511;
	text-align: center;
}
.rpp-page-indicator {
	font-size: 12.5px;
	letter-spacing: 0.06em;
	color: #e8d9b8;
}

/* ------------------------------------------------------------------ *
 * Print deterrent: blank the preview when printing
 * ------------------------------------------------------------------ */
@media print {
	.rpp-modal { display: none !important; }
}
.rpp-printing .rpp-pages { visibility: hidden; }

/* ------------------------------------------------------------------ *
 * Mobile: full-screen sheet
 * ------------------------------------------------------------------ */
@media (max-width: 767px) {
	.rpp-dialog {
		width: 100vw;
		height: 100dvh; /* Handles mobile browser chrome correctly. */
		border-radius: 0;
	}
	.rpp-title { font-size: 13.5px; max-width: 40vw; }
	.rpp-tool { min-width: 44px; height: 44px; } /* Comfortable touch targets. */
	.rpp-zoom-level { display: none; }
	.rpp-pages { padding: 12px 8px 20px; gap: 12px; }
	.rpp-preview-btn { width: 100%; justify-content: center; padding: 13px 22px; }
}

/* ------------------------------------------------------------------ *
 * Reduced motion
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.rpp-modal,
	.rpp-dialog,
	.rpp-preview-btn {
		transition: none;
	}
	.rpp-spinner span {
		animation-duration: 1.6s;
	}
}
