/* ========================================= */
/* --- EPUB BROWSER READER STYLES --- */
/* ========================================= */

/* The Orange Trigger Button */
.read-browser-btn {
    background-color: #ff8c00; /* Deep, retro orange */
    color: #111;
    border: 2px solid #ff8c00;
    cursor: pointer;
    margin-top: 10px;
}

.read-browser-btn:hover {
    background-color: transparent;
    color: #ff8c00;
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.6);
}

/* The Magic Backdrop (Matches Nav Overlay) */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(17, 17, 17, 0.88);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* THE SHIELD BREAKER: Lets clicks pass through to the site */
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.reader-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Restores clickability to the modal when it's open */
}

/* The Paper Book Container */
.reader-container {
    background-color: #f4f0e6; /* Realistic warm cream paper */
    width: 95vw;
    max-width: 900px;
    height: 85vh;
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.8);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Close Button */
.close-reader-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: #444; /* Dark ink */
    font-size: 2rem;
    cursor: pointer;
    z-index: 100;
    transition: color 0.3s ease, transform 0.3s ease;
}

.close-reader-btn:hover {
    color: #dc143c; /* Ruby red on hover to indicate close */
    transform: scale(1.1);
}

/* The Loading Screen */
.reader-loader {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #f4f0e6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    padding: 20px;
    transition: opacity 0.5s ease;
}

.reader-loader p {
    color: #2b2b2b;
    margin-bottom: 20px;
}

/* The CSS Progress Bar */
.progress-bar-container {
    width: 80%;
    max-width: 400px;
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #ff8c00; /* Matches the trigger button */
    animation: loadBook 2s infinite ease-in-out;
}

@keyframes loadBook {
    0% { width: 0%; transform: translateX(-100%); }
    50% { width: 50%; transform: translateX(50%); }
    100% { width: 100%; transform: translateX(200%); }
}

/* The ePub Canvas */
.epub-viewer {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    padding: 40px 10px 10px 10px; /* Space for the close button */
    overflow: hidden; /* ePub.js handles the internal pagination */
}

/* Pagination Controls */
.reader-controls {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px 20px 20px;
    background-color: #f4f0e6;
    border-top: 1px dashed rgba(0,0,0,0.1);
}

.reader-controls .nav-arrow {
    color: #2b2b2b;
    background: transparent;
    border: 1px solid #2b2b2b;
    border-radius: 3px;
    padding: 5px 20px;
    font-size: 1.5rem;
}

.reader-controls .nav-arrow:hover {
    background-color: #2b2b2b;
    color: #f4f0e6;
    text-shadow: none;
}