body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0; /* Ensure no body margin */
    padding: 0; /* Ensure no body padding */
    background-color: #f0f0f0;
    font-family: sans-serif;
    overflow: hidden; /* Prevent body scrollbars when image is large */
}

.flip-viewer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; /* Use full width */
    /* max-width: 1000px; /* Removed max-width */
    height: 100vh; /* Use full viewport height */
    position: relative;
}

.flip-viewer {
    width: 100%;
    height: calc(100% - 65px); /* Give slightly more height */
    /* border: 1px solid #ccc; */ /* Removed border */
    background-color: #fff;
    overflow: hidden; /* Crucial for containing the image */
    position: relative; /* Needed for absolute positioning of image */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab; /* Indicate draggable */
}

.flip-viewer:active {
    cursor: grabbing;
}

.page {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute; /* For potential transition effects */
    top: 0;
    left: 0;
    opacity: 1;
    transition: opacity 0.5s ease-in-out; /* Simple fade transition */
}

.page img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Scale image while preserving aspect ratio */
    display: block;
    transition: transform 0.2s ease-out; /* Smooth zoom transition */
    transform-origin: center center; /* Zoom from the center */
    /* position: absolute; Removed to allow flex centering */
    /* top: 0; Removed */
    /* left: 0; Removed */
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    gap: 15px; /* Spacing between buttons */
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 0 0 5px 5px;
}

.controls button {
    padding: 8px 15px;
    font-size: 1em;
    cursor: pointer;
    border: 1px solid #aaa;
    background-color: #fff;
    border-radius: 3px;
}

.controls button:hover {
    background-color: #f5f5f5;
}

.controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-indicator {
    padding: 5px 0;
    font-size: 0.9em;
    color: #555;
    text-align: center;
    width: 100%;
}

/* Basic responsiveness */
@media (max-width: 600px) {
    .flip-viewer-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    .flip-viewer {
        height: calc(100% - 70px); /* Adjust for smaller screens */
        border: none;
    }
    .controls {
        padding: 8px 0;
        gap: 10px;
    }
    .controls button {
        padding: 6px 10px;
        font-size: 0.9em;
    }
     .page-indicator {
        padding: 3px 0;
        font-size: 0.8em;
    }
}