/**
 * Book Preview Reader - Popup Styles (RTL)
 *
 * Based on the Odrin theme BookBlock reader.
 * CSS custom property --bpr-accent-color is set dynamically from the widget.
 */

:root {
	--bpr-accent-color: #B80B37;
	--bpr-accent-hover: #9a0930;
}

/* -------------------------------------------------------
   Body lock
------------------------------------------------------- */
body.bpr-disabled {
	overflow: hidden;
	height: 0;
}

/* -------------------------------------------------------
   Book Container (full-screen overlay)
------------------------------------------------------- */
.book-container {
	transition: 0.5s transform, 0.3s left;
	transform: translateX(100%);
	position: fixed;
	top: 0;
	left: 0;
	z-index: 99999;
	background-color: #fff;
	width: 100vw;
	overflow: visible;
	min-height: 100vh;
	direction: rtl;
}

.book-container.showBook {
	transform: translateX(0);
	opacity: 1;
}

/* -------------------------------------------------------
   BookBlock overrides for full-screen use
------------------------------------------------------- */
.bb-bookblock {
	position: relative;
	width: 100vw;
	height: 100vh;
	min-height: 100vh;
	direction: rtl;
}

/* Force RTL on BookBlock internal elements */
.bb-item,
.bb-item .bb-content,
.bb-item .bb-inner {
	direction: rtl;
	text-align: right;
}

.bb-bookblock h1,
.bb-bookblock h2,
.bb-bookblock h3,
.bb-bookblock h4,
.bb-bookblock h5,
.bb-bookblock h6 {
	text-align: center;
}

/* -------------------------------------------------------
   Custom wrapper
------------------------------------------------------- */
.bb-custom-wrapper {
	position: relative;
	width: 100vw;
	height: 100vh;
	height: calc(var(--vh, 1vh) * 100);
}

/* -------------------------------------------------------
   Slide (when TOC is open) - shifts content left in RTL
------------------------------------------------------- */
.book-container.slideRight {
	left: -260px;
}

/* -------------------------------------------------------
   Menu panel (TOC sidebar) - right side in RTL
------------------------------------------------------- */
.menu-panel {
	background: #fafafa;
	width: 260px;
	height: 100%;
	position: absolute;
	z-index: 1000;
	top: 0;
	right: -260px;
	left: auto;
	padding: 50px 20px;
	box-sizing: border-box;
}

.menu-panel h3 {
	font-size: 19px;
	margin-bottom: 10px;
	text-transform: uppercase;
	text-align: center;
	letter-spacing: 1px;
}

/* -------------------------------------------------------
   Menu TOC list
------------------------------------------------------- */
.menu-toc {
	position: relative;
	list-style: none;
	padding: 30px 0;
	height: 90%;
	margin: 0;
	overflow-y: auto;
}

.menu-toc li a {
	transition: 0.3s;
	display: block;
	padding: 10px 20px;
	border-right: 2px solid #B80B37;
	border-left: none;
	text-decoration: none;
	color: #333;
	font-weight: 400;
}

.menu-toc li a:hover {
	border-right-width: 10px;
}

.menu-toc .menu-toc-current a {
	border-right-width: 10px;
	color: #000;
	font-weight: 600;
}

/* -------------------------------------------------------
   Navigation arrows & shared controls
------------------------------------------------------- */
.bb-custom-wrapper nav span,
.menu-button,
.bb-nav-close {
	position: absolute;
	top: 50%;
	right: 7%;
	left: auto;
	color: #B80B37;
	font-size: 77px;
	text-align: center;
	speak: none;
	font-weight: bold;
	cursor: pointer;
	z-index: 1000;
	user-select: none;
	line-height: 1;
}

.bb-custom-wrapper nav span:hover,
.menu-button:hover,
.bb-nav-close:hover {
	color: #9a0930;
}

.bb-custom-wrapper nav span:last-child {
	right: auto;
	left: 7%;
}

/* -------------------------------------------------------
   TOC toggle button (top-right in RTL)
------------------------------------------------------- */
.menu-button {
	right: 60px;
	left: auto;
	top: 50px;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 2px;
	padding-right: 50px;
	padding-left: 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.menu-button svg {
	transition: 0.18s;
	position: absolute;
	right: 10px;
	left: auto;
	top: 1px;
	z-index: 1;
	color: #B80B37;
}

.menu-button span {
	display: inline-block;
	padding-top: 6px;
}

.menu-button:hover svg,
.menu-button.hovered svg {
	transform: scale(1.2);
	color: #9a0930;
}

/* -------------------------------------------------------
   Close button (top-left in RTL)
------------------------------------------------------- */
.bb-nav-close {
	transition: 0.18s;
	left: 70px;
	right: auto;
	top: 50px;
	font-size: 40px;
	font-weight: 300;
	line-height: 1;
}

.bb-nav-close:hover {
	transform: scale(1.2);
	color: #9a0930;
}

/* -------------------------------------------------------
   Book content area
------------------------------------------------------- */
.book-content {
	position: absolute;
	left: 0;
	width: 100%;
	height: 100vh;
	padding: 100px 22%;
	overflow: hidden;
	-webkit-font-smoothing: subpixel-antialiased;
	box-sizing: border-box;
	direction: rtl;
}

.book-content-inner {
	position: relative;
	height: 100%;
	padding-left: 70px;
	padding-right: 0;
	overflow-y: auto;

	/* Styled scrollbar (CSS-only) */
	scrollbar-width: thin;
	scrollbar-color: #B80B37 transparent;
}

.book-content-inner::-webkit-scrollbar {
	width: 6px;
}

.book-content-inner::-webkit-scrollbar-track {
	background: transparent;
}

.book-content-inner::-webkit-scrollbar-thumb {
	background: #B80B37;
	border-radius: 3px;
}

/* -------------------------------------------------------
   Chapter heading
------------------------------------------------------- */
.chapter-heading {
	margin-bottom: 90px;
}

.book-content h2 {
	font-weight: 700;
	font-size: 3em;
	padding: 0 0 10px;
	color: #333;
	margin: 0 1% 40px;
	text-align: center;
	box-shadow: none;
	text-shadow: none;
}

/* -------------------------------------------------------
   Chapter body text
------------------------------------------------------- */
.book-content p {
	text-align: justify;
	margin-bottom: 20px;
	font-weight: 400;
}

.menu-panel,
.book-content {
	font-size: 22px;
	font-weight: 300;
	line-height: 37px;
}


/* -------------------------------------------------------
   Chapter images
------------------------------------------------------- */
.book-content img {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 20px auto;
}

/* -------------------------------------------------------
   Book shadow effects (spine shadow)
------------------------------------------------------- */
.bb-custom-side {
	position: relative;
	float: right;
	overflow: hidden;
	width: 50%;
	height: 100%;
}

.bb-custom-side::before {
	position: absolute;
	top: 0;
	z-index: 100;
	width: 80px;
	height: 100%;
	box-shadow: inset -30px 0 40px -20px rgba(0, 0, 0, 0.1);
	content: "";
}

.bb-custom-side:first-child::before {
	left: 0;
	box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.05),
	            inset 30px 0 40px -20px rgba(0, 0, 0, 0.15);
}

/* -------------------------------------------------------
   Button base styles
------------------------------------------------------- */
.bpr-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: none;
	cursor: pointer;
	font-family: inherit;
	transition: background-color 0.3s, color 0.3s;
	text-decoration: none;
	line-height: 1.4;
}

.bpr-trigger:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.bpr-trigger .bpr-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: bpr-spin 0.6s linear infinite;
}

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

/* -------------------------------------------------------
   Responsive: <= 1199px (tablets)
------------------------------------------------------- */
@media only screen and (max-width: 1199px) {
	.book-content {
		padding: 100px 14% 80px;
	}

	.menu-button,
	.bb-nav-close {
		top: 40px;
	}

	.menu-button {
		right: 40px;
		left: auto;
		padding-right: 45px;
		padding-left: 0;
	}

	.bb-nav-close {
		left: 40px;
		right: auto;
	}

	.menu-panel {
		padding: 100px 20px 50px;
	}

	.bb-custom-wrapper nav span {
		right: 3%;
		left: auto;
	}

	.bb-custom-wrapper nav span:last-child {
		right: auto;
		left: 3%;
	}
}

/* -------------------------------------------------------
   Responsive: <= 991px (large tablets)
------------------------------------------------------- */
@media only screen and (max-width: 991px) {
	.book-content-inner {
		padding-left: 45px;
		padding-right: 0;
	}

	.chapter-heading {
		margin-bottom: 50px;
	}

	.menu-panel,
	.book-content {
		font-size: 20px;
	}

	.bb-custom-wrapper nav span {
		font-size: 72px;
	}
}

/* -------------------------------------------------------
   Responsive: <= 767px (mobile)
------------------------------------------------------- */
@media only screen and (max-width: 767px) {
	.book-content {
		padding: 60px 30px 50px;
	}

	.menu-button,
	.bb-nav-close {
		top: 20px;
	}

	.menu-button {
		right: 20px;
		left: auto;
		padding-right: 45px;
		padding-left: 0;
	}

	.menu-panel,
	.book-content {
		font-size: 18px;
		line-height: 30px;
	}

	.bb-nav-close {
		left: 20px;
		right: auto;
	}

	.book-content-inner {
		padding-bottom: 70px;
	}

	/* TOC panel as fixed overlay on mobile */
	.menu-panel {
		position: fixed;
		right: -260px;
		left: auto;
		top: 0;
		height: 100%;
		z-index: 100000;
		transition: right 0.3s ease;
	}

	.book-container.slideRight {
		left: 0;
	}

	.book-container.slideRight .menu-panel {
		right: 0;
	}

	/* Move nav arrows to bottom bar on mobile */
	.bb-custom-wrapper nav {
		background-color: #fff;
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		height: 70px;
		z-index: 9999;
	}

	.bb-custom-wrapper nav span {
		top: auto;
		right: 10%;
		left: auto;
		bottom: 20px;
		font-size: 66px;
	}

	.bb-custom-wrapper nav span:last-child {
		right: auto;
		left: 10%;
	}
}

/* -------------------------------------------------------
   Responsive: <= 480px (small mobile)
------------------------------------------------------- */
@media only screen and (max-width: 480px) {
	.book-content {
		padding: 60px 10px 0;
	}

	.book-content-inner {
		padding-left: 30px;
		padding-right: 0;
	}

	.chapter-heading {
		margin-bottom: 30px;
	}

	.menu-panel,
	.book-content {
		font-size: 17px;
		line-height: 28px;
	}

	.bb-custom-wrapper nav span {
		bottom: 30px;
	}

	.menu-panel {
		right: -200px;
		left: auto;
		width: 200px;
		padding: 100px 10px 50px;
	}

	.book-container.slideRight .menu-panel {
		right: 0;
	}
}
