/* =========================================
   1. GLOBAL STYLES
   ========================================= */
body {
    overflow: hidden;
    background-color: #ffffff;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* =========================================
   2. VIEWPORT & LAYOUT
   ========================================= */
.flipbook-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 50px); /* Subtract footer */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    display: block;
    /* Removed rel-container styling as it's no longer needed for stacking */
}

/* =========================================
   3. FLIPBOOK & PAGES
   ========================================= */
.flipbook {
    transition: margin-left 0.2s ease-in-out;
}

.flipbook .page {
    background-color: white;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Clean grey border to define the page */
    border: 1px solid #dcdcdc; 
    
    /* Optional: A very subtle standard shadow for depth 
       (This moves WITH the page automatically) */
    box-shadow: 0 0 5px rgba(0,0,0,0.1); 
}

/* =========================================
   4. INNER SPINE SHADOW (The "Fold" Gradient)
   ========================================= */
/* We use ::after to overlay a gradient on top of the image */
.flipbook .page::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to pass through */
    z-index: 10;
}

/* Even Pages (Left side): Gradient on the RIGHT edge */
.flipbook .even::after {
    background: linear-gradient(to right, 
        rgba(0, 0, 0, 0) 90%, 
        rgba(0, 0, 0, 0.05) 95%, 
        rgba(0, 0, 0, 0.2) 100%);
}

/* Odd Pages (Right side): Gradient on the LEFT edge */
.flipbook .odd::after {
    background: linear-gradient(to left, 
        rgba(0, 0, 0, 0) 90%, 
        rgba(0, 0, 0, 0.05) 95%, 
        rgba(0, 0, 0, 0.2) 100%);
}

/* No spine shadow on Cover (Page 1) */
.flipbook .page.p1::after {
    background: none;
}

/* =========================================
   5. NAVIGATION ARROWS
   ========================================= */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 2000;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}
.nav-arrow:hover { transform: translateY(-50%) scale(1.1); background-color: rgba(0,0,0,0.9); }
.prev-arrow { left: 20px; }
.next-arrow { right: 20px; }

/* =========================================
   6. FOOTER CONTROLS
   ========================================= */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: #f1f1f1;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 1000;
    border-top: 1px solid #ddd;
}
.control-group { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.footer input { width: 40px; padding: 5px; text-align: center; border: 1px solid #ccc; border-radius: 4px; }
.footer button { background-color: #333; color: white; border: none; padding: 6px 12px; cursor: pointer; border-radius: 4px; }
.footer button:hover { background-color: #555; }

/* =========================================
   7. PRINT
   ========================================= */
.print-container { display: none; }
@media print {
    .footer, .flipbook-viewport, .flipbook, .nav-arrow { display: none !important; }
    body { background-color: white; overflow: visible; }
    .print-container { display: block; width: 100%; }
    .print-container img { width: 100%; height: auto; display: block; page-break-after: always; margin-bottom: 20px; }
}