#bb-bookstack-loading {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 9999;
  background: rgba(255,255,255,0.5);
  text-align: center;
  justify-content: center;
  align-items: center;
  display: flex;
}

.loader {
--background: linear-gradient(135deg, #5e5402, #574e03);
--shadow: rgba(254, 222, 39, 0.28);
--text: #867d6c;
--page: rgba(255, 255, 255, 0.36);
--page-fold: rgba(255, 255, 255, 0.52);
--duration: 3s;
width: 200px;
height: 140px;
position: relative;
}
.loader::before,
.loader::after {
content: '';
position: absolute;
bottom: 8px;
width: 120px;
top: 80%;
box-shadow: 0 16px 12px var(--shadow);
transform: rotate(-6deg);
}
.loader::after {
right: 4px;
transform: rotate(6deg);
}
.loader::before {
left: 4px;
}
.loader > div {
width: 100%;
height: 100%;
border-radius: 13px;
position: relative;
z-index: 1;
perspective: 600px;
box-shadow: 0 4px 6px var(--shadow);
background-image: var(--background);
}
.loader ul {
margin: 0;
padding: 0;
list-style: none;
position: relative;
}
.loader li {
position: absolute;
top: 10px;
left: 10px;
transform-origin: 100% 50%;
color: var(--page);
opacity: 0;
transform: rotateY(180deg);
animation: var(--duration) ease infinite;
}
.loader li:first-child {
transform: rotateY(0deg);
opacity: 1;
}
.loader li:last-child {
opacity: 1;
}
.loader li svg {
width: 90px;
height: 120px;
display: block;
}
.loader span {
display: block;
margin-top: 20px;
text-align: center;
color: var(--text);
position: static;
font-weight:bold;
}
.loader li:nth-child(2) {
color: var(--page-fold);
animation-name: page-2;
}
.loader li:nth-child(3) {
color: var(--page-fold);
animation-name: page-3;
}
.loader li:nth-child(4) {
color: var(--page-fold);
animation-name: page-4;
}
.loader li:nth-child(5) {
color: var(--page-fold);
animation-name: page-5;
}
@keyframes page-2 {
0% {
  transform: rotateY(180deg);
  opacity: 0;
}
0% {
  opacity: 0;
}
20% {
  opacity: 1;
}
35%, 100% {
  opacity: 0;
}
50%, 100% {
  transform: rotateY(0deg);
}
}
@keyframes page-3 {
15% {
  transform: rotateY(180deg);
  opacity: 0;
}
15% {
  opacity: 0;
}
35% {
  opacity: 1;
}
50%, 100% {
  opacity: 0;
  transform: rotateY(0deg);
}
}
@keyframes page-4 {
30% {
  transform: rotateY(180deg);
  opacity: 0;
}
30% {
  opacity: 0;
}
50% {
  opacity: 1;
}
65%, 100% {
  opacity: 0;
  transform: rotateY(0deg);
}
}
@keyframes page-5 {
45% {
  transform: rotateY(180deg);
  opacity: 0;
}
45% {
  opacity: 0;
}
65% {
  opacity: 1;
}
80%, 100% {
  opacity: 0;
  transform: rotateY(0deg);
}
}
.book-loader__text {
  font-size: 1.2em;
  color: #333;
  margin-top: 8px;
  font-family: 'Roboto', Arial, sans-serif;
}
.bb-book {
  width: 120px; height: 80px; position: relative;
}
.bb-book .bb-left-page, .bb-book .bb-right-page, .bb-book .bb-turning-page, .bb-book .bb-backcover, .bb-book .bb-cover {
  position: absolute; top: 0; width: 60px; height: 80px; border-radius: 0 0 18px 18px/0 0 30px 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.bb-book .bb-left-page {
  left: 0; background: #fffbe8; z-index: 2; border: 2px solid #e0c97f; border-right: none;
  box-shadow: -2px 0 8px rgba(0,0,0,0.08);
  transform: rotateY(10deg) skewY(-2deg);
}
.bb-book .bb-right-page {
  left: 60px; background: #fffbe8; z-index: 2; border: 2px solid #e0c97f; border-left: none;
  box-shadow: 2px 0 8px rgba(0,0,0,0.08);
  transform: rotateY(-10deg) skewY(2deg);
}
.bb-book .bb-turning-page {
  left: 60px; background: #fffbe8; z-index: 3; border: 2px solid #e0c97f; border-left: none;
  box-shadow: 2px 0 8px rgba(0,0,0,0.12);
  transform-origin: left center;
  animation: bb-page-turn 0.7s infinite cubic-bezier(.77,0,.18,1);
  opacity: 1;
}
@keyframes bb-page-turn {
  0% { transform: rotateY(0deg) skewY(2deg); opacity: 1; }
  40% { transform: rotateY(-90deg) skewY(2deg); opacity: 0.7; }
  80% { transform: rotateY(-180deg) skewY(2deg); opacity: 0; }
  100% { transform: rotateY(-180deg) skewY(2deg); opacity: 0; }
}
.bb-book .bb-backcover {
  left: 0; background: #c68642; z-index: 1; border: 3px solid #5c3310; width: 120px; height: 80px;
  border-radius: 0 0 18px 18px/0 0 30px 30px;
  opacity: 0.85;
}
.bb-book .bb-cover {
  left: 0; background: #8d5524; z-index: 4; border: 3px solid #5c3310; width: 120px; height: 80px;
  border-radius: 0 0 18px 18px/0 0 30px 30px;
  opacity: 0.15;
}
.bb-book-label {
  position: absolute; bottom: 8px; left: 0; width: 100%; text-align: center; font-size: 0.9em; color: #5c3310; font-family: serif;
}

/* --- Existing Plugin Styles Below --- */

.bb-bookstack-content .align-left {
  text-align: left;
}

.bb-bookstack-content .align-right {
  text-align: right;
}

.bb-bookstack-content .align-center {
  text-align: center;
}

.bb-bookstack-content img.align-left {
  float: left;
  padding-right: 15px;
}

.bb-bookstack-content img.align-right {
  float: right;
  padding-left: 15px;
}

.bb-bookstack-content details {
  border: 1px solid;
  border-color: #ddd;
  margin-bottom: 1em;
  padding: 12px;
  box-sizing: border-box;
  outline-color: var(--color-primary);
  outline-width: 1px;
}

.bb-bookstack-content details > summary {
  margin-top: -12px;
  margin-left: -12px;
  margin-right: -12px;
  margin-bottom: -12px;
  font-weight: bold;
  background-color: #eee;
  padding: 6px 12px;
}

.bb-bookstack-content details > summary::before {
   content: '▸ ';
}

.bb-bookstack-content details > summary + * {
  padding-top: 20px;
}

.bb-bookstack-content .info, .bb-bookstack-content .success, .bb-bookstack-content .warning, .bb-bookstack-content .danger {
  margin: 5px 0 15px 0;
  padding: 0 0 0 14px;
}

.bb-bookstack-content .info {
  border-color: #0288d1;
  background-color: #d3efff;
  color: #01466c;
}

.bb-bookstack-content .success {
  border-color: #0f7d15;
  background-color: #eafdeb;
  color: #063409;
}

.bb-bookstack-content .warning {
  border-color: #cf4d03;
  background-color: #fee3d3;
  color: #6a2802;
}

.bb-bookstack-content .danger {
  border-color: #ab0f0e;
  background-color: #fcdbdb;
  color: #4d0706;
}

.bb-bookstack-content blockquote, .bb-bookstack-content .callout {
  margin: 5px 0 15px 0;
  padding: 0 0 0 14px;
  border-top: 0 none;
  border-left: 4px solid #eee;
}

.bb-bookstack-content ul, .bb-bookstack-content ol {
  display: flow-root;
  padding-left: 20px;
}

.bb-bookstack-content p.bb-min-width {
  min-width: 200px;
  display: flow-root;
}

.bb-bookstack-book .bb-bookstack-book-label, .bb-bookstack-chapter .bb-bookstack-chapter-label {

}

.bb-bookstack-chapter-label {
  display: block;
  font-weight: bold;
  font-size: 16px;
  color: var(--link-color, #223035);
  padding: 10px 0;
  line-height: 1.4;
  text-indent: 0; /* Reset any weird inherited value */
  margin-left: 0;  /* Optional: align exactly with page items */
  text-align: left;
}

.bb-bookstack-chapter .bb-bookstack-page {
/*  margin-left: 20px; */
  font-weight: normal;
}

.bb-bookstack-book .bb-bookstack-chapter {
  font-weight: bold;
}

.bb-bookstack-book .bb-bookstack-chapter, .bb-bookstack-book .bb-bookstack-page {
/*  margin-left: 20px; */
}

.bb-bookstack-book .bb-bookstack-chapter .bb-bookstack-page {
  font-weight: normal;
}

.bb-bookstack-book .bb-bookstack-page {
  font-weight: normal;
}

.bb-bookstack-page.bb-active {
  background-color: #ccc;
}

/* WF Additions */
.bb-bookstack-wrapper {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
  gap: 2rem;
}

.bb-bookstack-sidebar {
  flex: 0 0 auto;
  max-width: 33.333%;
  overflow: visible;
  position: sticky;
  top: 20px;
  align-self: flex-start;
}

.bb-bookstack-main {
  flex: 1 1 auto;
  overflow: visible;
  min-width: 0;
}

.bb-bookstack-wrapper .bb-bookstack-book {
  background-color: #fff;
  padding: 10px;
}

.bb-bookstack-book {
  background-color: #fff;
  border-radius: 4px;
  padding: 24px 30px;
}

.bb-bookstack-book-label {
  display: block;
  color: var(--link-color, #223035);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--e-a-border-color, #e6e8ea);
}

.bb-bookstack-page {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 6px 0;
  position: relative;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: -0.18px;
  font-family: 'DM Sans', sans-serif;
}

.bb-bookstack-page a {
  color: #263037;
  width: 100%;
  text-decoration: none;
  transition: color 0.2s ease;
}

.bb-bookstack-page a:hover {
  color: var(--link-color-hover, #0b3f66);
  text-decoration: underline;
}

.bb-bookstack-page a::after {
  content: "\f054"; /* Font Awesome right-chevron */
  font-family: "Font Awesome 6 Free"; 
  font-size: 12px;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 900;
}

.bb-bookstack-page.bb-active {
  background-color: var(--e-a-bg-hover, #f1f2f3);
  border-left: 3px solid var(--e-a-color-primary-bold, #6b614d);
  padding-left: 12px;
}

.bb-bookstack-page a {
  transition: transform 0.2s ease;
padding-right: .6em;
}
.bb-bookstack-page a:hover {
  transform: translateX(5px);
}
.bb-bookstack-download {
margin-top: 10px;
margin-bottom: 20px;
}

.bb-bookstack-download a {
display: inline-block;
color: #c00;
font-weight: bold;
text-decoration: none;
}

.bb-bookstack-download a:hover {
text-decoration: underline;
}
