body,
html {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #002147;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #eee;
    padding: 10px;
    text-align: center;
    z-index: 1000;
}

#flipbook-container {
    position: absolute;
    top: 60px;
    bottom: 70px;
    left: 0;
    right: 0;
    overflow: auto;
    cursor: grab;
    background: #f5f5f5;
}

#flipbook {
    transform-origin: center center;
    transition: transform 0.2s ease-out;
}

#flipbook-scroll {
    display: flex;
    justify-content: center;
    /* จัดให้อยู่ตรงกลางแนวนอน */
    align-items: center;
    /* จัดให้อยู่ตรงกลางแนวตั้ง (ถ้าขนาดสูงไม่เกิน container) */
    width: fit-content;
    /* ให้ขนาดพอดีกับ Flipbook */
    min-width: 100%;
    /* อย่างน้อยต้องเต็มความกว้างของ container */
    height: 100%;
    padding: 10px;
    background: #f5f5f5;
}

#flipbook .page img {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #FFFFFF;
}

.page-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 999;
    user-select: none;
}

.page-arrow.left {
    left: 10px;
}

.page-arrow.right {
    right: 10px;
}

#page-number {
    width: 50px;
    font-size: 0.9rem;
    padding: 2px 5px;
    text-align: center;
}

@media (max-width: 480px) {
    footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 5px;
        padding: 5px;
    }

    footer .btn {
        padding: 0 5px;
        font-size: 0.85rem;
    }

    footer #page-number {
        width: 40px;
        padding: 0.2rem;
        font-size: 0.8rem;
    }

    footer span#total-pages {
        font-size: 0.85rem;
    }
}
