html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
    font-family: "Segoe UI", Roboto, sans-serif;
    background-color: rgba(128, 128, 128, 0.05) !important;
    color: #1f2937;
    display: flex;
    justify-content: center;
}


/* Flipbook covers full viewport */
#flipbook {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width:1304px;
    height: 100%;
    transition: transform 0.2s ease;
    transform-origin: center center;
    display: flex;
    justify-content: center;
}

.container {
    height: 100%; 
    width: 100%;
}

.container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;

    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Edge, Opera and Firefox */
}

.scale-up img{
    transform: scale(1.11)
}

.container img:not([src]), .container img[src=""] {
    display: none !important;
}

.page {
    background-color: white;
    overflow: hidden;
}

.image-wrapper {
  width: 100%;
  height: 100%;
}

/* Loader (spinner) */
.image-wrapper::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid #ccc;
  border-top-color: gray;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  /* object-fit: contain; */
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}


/* When loaded: fade in image + hide loader */
.image-wrapper.loaded::before {
  display: none;
}
.image-wrapper.loaded img {
  opacity: 1;
}

/* .container img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
} */

/* Pagination */
.pagination-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1111;
    /* background-color: rgba(255, 255, 255, 0.95); */
    backdrop-filter: blur(0px);
    border-top: 1px solid #e5e7eb;
}

.pagination-desktop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.pagination-btn,
.pagination-arrow {
    padding: 4px 14px;
    background-color: #ffffff;
    color: gray;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.pagination-btn:hover,
.pagination-arrow:hover {
    background-color: #f1f5f9;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.pagination-info p {
    color: gray;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-select {
    padding: 6px 12px;
    font-size: 14px;
    color: gray;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    appearance: none;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.pagination-select:focus {
    border-color: gray;
    outline: none;
}

.font-medium {
    font-weight: 500;
}

/* Hidden utility */
.hidden {
    display: none;
}

#topSection {
    position: fixed;
    z-index: 1111;
    width: 100%;
    /* background-color: white; */
}
#progressLabel{
    padding: 0px 10px;
}

#readerApp {
    display: none;
    height: 28px;
    background-color: white;
    /* display: flex; */
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

#controlsSection {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: gray;
    background:white
}

#togglePlay {
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

#startBtn {
    cursor: pointer;
    padding: 6px 10px;
    font-size: 14px;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: gray;
    text-decoration: none;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Bookmark button in top-right */
#bookmark {
    position: absolute;
    top: 50%;
    color: #80808057;
    height: 25px;
    width: 25px;
    cursor: pointer;
}

.page.odd #bookmark {
    rotate: 90deg;
    right: -5
}

.page.even #bookmark {
    rotate: 270deg;
    left: -5
}

#bookmark svg:hover {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

#bookmarkBtn {
    cursor: pointer;
}

#bookmarkBtn:hover {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

#libraryPage {
    cursor: pointer;
    padding: 6px 10px;
    font-size: 14px;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: gray;
    text-decoration: none;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#libraryPage:hover {
    background-color: #f1f5f9;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Hover zone on left edge */
.hover-zone {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 20px;
    z-index: 1002;
    cursor: pointer;
}

/* Sidebar styling */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px;
    background-color: white;
    padding: 1rem;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
    z-index: 11111;
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
}

/* TOC inside sidebar */
.toc-wrapper {
    margin-top: 1rem;
}

.toc-title {
    font-size: 18px;
    font-weight: 600;
    /* color: gray; */
    margin-bottom: 1rem;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 0.5rem;
}

.toc-list {
    font-size: 14px;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 80vh;
    overflow-y: auto;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.toc-item:hover {
    background-color: #f9fafb;
}

.toc-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.toc-item .detail {
    flex: 1;
}

.toc-item span {
    font-weight: 500;
    color: gray;
    text-align: left;
}

.toc-item svg {
    width: 20px;
    height: 20px;
    fill: gray;
    flex-shrink: 0;
}

/* Overlay for sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1111;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}



/* Message block */
.lock-message {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Typography */
.lock-message h3 {
    font-weight: 700;
    color: gray;
}

.lock-message p {
    font-weight: 700;
    padding: 0 1rem;
    color: gray;
}

