/* Section styling */
.flipbook-wrapper {
    text-align: center;
    padding: 4rem 2rem;
    background: #f5f5f5; /* soft background */
    min-height: 650px;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: none;        /* DISABLE ALL TOUCH INTERACTIONS */
    -ms-touch-action: none;
}

.flipbook-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: #1b1b1b;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Container */
.book-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    perspective: 1500px;
    position: relative; /* for absolute buttons */
}

/* Buttons */
.book-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 60px;
    height: 60px;
}

.book-btn img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

/* Rotate left button image */
.prev-btn img {
    transform: rotate(180deg);
}

/* Hide disabled button */
.book-btn:disabled {
    opacity: 0;
    cursor: default;
}

/* Flipbook */
#flipbook {
    width: 900px;
    height: 600px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25); /* outer shadow for book */
    border-radius: 15px;
    background: #fff;
    overflow: hidden;
}

/* Pages */
#flipbook .page {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 12px; /* subtle rounded corners for paper */
    box-shadow:
        0 8px 25px rgba(0,0,0,0.15), /* subtle shadow for depth */
        inset 0 0 15px rgba(0,0,0,0.05); /* inner shadow for page texture */
    background: #fff;
    border: 1px solid #ddd;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* Page edge shading */
#flipbook .page::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.1), transparent);
    border-radius: 10px;
    pointer-events: none;
    z-index: 5;
}

#flipbook .page::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to left, rgba(0,0,0,0.1), transparent);
    border-radius: 10px;
    pointer-events: none;
    z-index: 5;
}

/* Images inside pages */
#flipbook .page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Binding between pages */
#flipbook .page:not(:first-child):not(:last-child)::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 16px;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        #ccc,
        #ccc 2px,
        #eee 2px,
        #eee 6px
    );
    border-radius: 8px;
    z-index: 2;
}

/* Book center shadow for realism */
#flipbook::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 6px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.25), rgba(0,0,0,0), rgba(0,0,0,0.25));
    transform: translateX(-50%);
    z-index: 3;
}

/* Optional slight page curl on flip */
#flipbook .page.turned {
    transform: rotateY(0.5deg);
    box-shadow: 5px 0 20px rgba(0,0,0,0.15);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    #flipbook {
        width: 80%;
        height: auto;
    }
}

@media (max-width: 768px) {
    .flipbook-wrapper {
        padding: 2rem 1rem;
        min-height: 400px;
    }

    .flipbook-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .book-container {
        flex-direction: column;
        gap: 15px;
    }

    #flipbook {
        width: 100%;
        height: auto;
    }

    .book-btn {
        width: 70px;
        height: 70px;
    }

    /* Position arrows at the bottom in mobile */
    .prev-btn, .next-btn {
        position: absolute;
        bottom: -80px;
    }

    .prev-btn {
        left: 25%;
    }

    .next-btn {
        right: 25%;
    }

    .book-btn img {
        width: 30px;
        height: 30px;
        margin-bottom: 20px;
    }

    #flipbook {
        box-shadow: none !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    #flipbook .page {
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    /* Remove left + right page shading */
    #flipbook .page::after {
        display: none !important;
    }

    /* Remove middle binding shadow */
    #flipbook::before {
        display: none !important;
    }
}
