/* Aljobaily book reader (assets/js/book-reader.js) */
.ajr {
	--ajr-bg: #2b2620;
	--ajr-bar: #1f1b17;
	--ajr-side: #faf7f0;
	--ajr-ink: #2a2520;
	--ajr-muted: #7a6f60;
	--ajr-line: #e6dfcf;
	--ajr-accent: #eaae09;
	--ajr-accent-soft: rgba(234, 174, 9, 0.16);
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: var(--ajr-bg);
	color: var(--ajr-ink);
	font-family: inherit;
	line-height: 1.6;
	direction: rtl;
}
html.ajr-open, html.ajr-open body { overflow: hidden; }
.ajr *, .ajr *::before, .ajr *::after { box-sizing: border-box; }
.ajr button { font-family: inherit; }

/* Toolbar */
.ajr-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 56px;
	padding: 0 12px;
	background: var(--ajr-bar);
	color: #f3ece0;
	flex: none;
}
.ajr-title {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ajr-nav, .ajr-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.ajr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font-size: 18px;
	cursor: pointer;
	transition: background .15s;
}
.ajr-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.ajr-btn:focus-visible { outline: 2px solid var(--ajr-accent); outline-offset: 1px; }
.ajr-btn:disabled { opacity: .35; cursor: default; }
.ajr-page-input {
	width: 64px;
	height: 34px;
	margin: 0 4px;
	padding: 0 6px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	text-align: center;
	font-size: 15px;
	-moz-appearance: textfield;
}
.ajr-page-input::-webkit-inner-spin-button, .ajr-page-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ajr-page-total { font-size: 14px; color: #c9bfae; margin-inline-end: 4px; white-space: nowrap; }

/* Body */
.ajr-body { display: flex; flex: 1 1 auto; min-height: 0; position: relative; }
.ajr-side {
	width: 340px;
	flex: none;
	display: flex;
	flex-direction: column;
	background: var(--ajr-side);
	border-inline-end: 1px solid var(--ajr-line);
	transition: margin .25s ease;
	min-height: 0;
}
.ajr.side-collapsed .ajr-side { margin-inline-start: -340px; }
.ajr-stage {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	position: relative;
	padding: 12px;
}
.ajr-status { color: #e9e0cf; font-size: 16px; }
.ajr-book { flex: none; }

/* Search box + tabs */
.ajr-search { display: flex; gap: 6px; padding: 12px 12px 8px; }
.ajr-search input {
	flex: 1;
	min-width: 0;
	height: 40px;
	padding: 0 14px;
	border: 1px solid var(--ajr-line);
	border-radius: 20px;
	background: #fff;
	color: var(--ajr-ink);
	font-size: 15px;
}
.ajr-search input:focus { outline: none; border-color: var(--ajr-accent); box-shadow: 0 0 0 3px var(--ajr-accent-soft); }
.ajr-search .ajr-btn { color: var(--ajr-ink); width: 40px; height: 40px; border-radius: 20px; background: var(--ajr-accent-soft); }
.ajr-search .ajr-btn:hover { background: var(--ajr-accent); }
.ajr-tabs { display: flex; padding: 0 12px; border-bottom: 1px solid var(--ajr-line); }
.ajr-tab {
	flex: 1;
	padding: 10px 0;
	border: 0;
	border-bottom: 3px solid transparent;
	background: none;
	color: var(--ajr-muted);
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}
.ajr-tab.is-active { color: var(--ajr-ink); border-bottom-color: var(--ajr-accent); }
.ajr-pane { flex: 1 1 auto; overflow-y: auto; padding: 8px 6px 24px; min-height: 0; }
.ajr-empty { color: var(--ajr-muted); padding: 16px; text-align: center; }

/* Index tree */
.ajr-toc-list { list-style: none; margin: 0; padding: 0; }
.ajr-toc-list .ajr-toc-list { padding-inline-start: 18px; }
.ajr-toc-row { display: flex; align-items: flex-start; }
.ajr-toc-row.is-leaf { padding-inline-start: 26px; }
.ajr-toc-toggle {
	flex: none;
	width: 26px;
	height: 34px;
	border: 0;
	background: none;
	color: var(--ajr-muted);
	cursor: pointer;
	padding: 0;
}
.ajr-toc-toggle::before { content: "\f104"; font-family: FontAwesome; display: inline-block; transition: transform .15s; }
.ajr-toc-toggle[aria-expanded="true"]::before { transform: rotate(-90deg); }
.ajr-toc-row:has(> .ajr-toc-toggle[aria-expanded="false"]) + .ajr-toc-list { display: none; }
.ajr-toc-link {
	flex: 1;
	display: flex;
	gap: 10px;
	align-items: baseline;
	padding: 6px 8px;
	border-radius: 6px;
	color: var(--ajr-ink);
	text-decoration: none;
	font-size: 14.5px;
}
.ajr-toc-link:hover { background: var(--ajr-accent-soft); color: var(--ajr-ink); }
.ajr-toc-link.is-current { background: var(--ajr-accent-soft); box-shadow: inset -3px 0 0 var(--ajr-accent); font-weight: 700; }
.ajr-toc-link.is-disabled { color: var(--ajr-muted); pointer-events: none; }
.ajr-toc-title { flex: 1; }
.ajr-toc-page { flex: none; color: var(--ajr-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Search results */
.ajr-res-head { padding: 6px 8px 10px; color: var(--ajr-muted); font-size: 14px; }
.ajr-res-list { list-style: none; margin: 0; padding: 0; }
.ajr-res {
	display: block;
	padding: 10px;
	border-radius: 8px;
	color: var(--ajr-ink);
	text-decoration: none;
	border-bottom: 1px solid var(--ajr-line);
}
.ajr-res:hover { background: var(--ajr-accent-soft); color: var(--ajr-ink); }
.ajr-res-page { display: block; font-size: 12.5px; font-weight: 700; color: #a07400; margin-bottom: 2px; }
.ajr-res-snip { display: block; font-size: 14px; line-height: 1.7; }
.ajr-res-snip mark { background: #fde58a; color: inherit; padding: 0 2px; border-radius: 2px; }
.ajr-res-note { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--ajr-muted); }

/* Pages */
.ajr-page { background: #fff; overflow: hidden; direction: ltr; } /* canvas inherits direction; RTL shifts every glyph PDF.js draws */
.ajr-blank { background: #3a3128; }
.ajr-page canvas { display: block; width: 100%; height: 100%; }
.ajr-hl { position: absolute; inset: 0; pointer-events: none; }
.ajr-mark {
	position: absolute;
	background: rgba(255, 210, 40, 0.45);
	border-radius: 2px;
	mix-blend-mode: multiply;
	animation: ajr-pulse 1.4s ease-out 1;
}
@keyframes ajr-pulse {
	0% { box-shadow: 0 0 0 0 rgba(234, 174, 9, .9); }
	100% { box-shadow: 0 0 0 10px rgba(234, 174, 9, 0); }
}
.ajr-num {
	position: absolute;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 11px;
	color: #9a907f;
	pointer-events: none;
}

/* Mobile: sidebar overlays the book */
@media (max-width: 899px) {
	.ajr-side {
		position: absolute;
		inset-block: 0;
		inset-inline-start: 0;
		z-index: 3;
		width: min(340px, 88vw);
		box-shadow: 0 0 30px rgba(0, 0, 0, .35);
	}
	.ajr.side-collapsed .ajr-side { margin-inline-start: calc(-1 * min(340px, 88vw) - 30px); }
	.ajr-title { display: none; }
	.ajr-bar { gap: 4px; padding: 0 6px; justify-content: space-between; }
	.ajr-btn { width: 34px; }
	.ajr-page-input { width: 52px; }
}
@media (max-width: 420px) {
	.ajr-nav .ajr-btn:first-child, .ajr-nav .ajr-btn:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.ajr-side, .ajr-mark { transition: none; animation: none; }
}

/* Audio playlist (jPlayer) leaves an invisible video-play overlay on top of the book button */
.single-book .jp-video-play { display: none !important; }
