.book-container {
    width: 100%;
    height: 80vh;
    position: relative;
    perspective: 1500px;
    margin: 2rem auto;
}

.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    opacity: 0;
    transition: opacity 0.3s;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.page.active {
    opacity: 1;
}

.page-content {
    display: flex;
    width: 100%;
    height: 100%;
}

.page-image {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.page-text {
    flex: 1;
    padding: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Atkinson Hyperlegible Next', sans-serif;
    font-size: 24px;
    line-height: 1.6;
    text-align: center;
}

.navigation-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(-50%);
    pointer-events: none; /* Allows clicks to pass through */
}

.nav-button {
    background: var(--accent-color);
    color: rgb(0, 0, 0);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    pointer-events: auto; /* Makes the buttons clickable */
}

.nav-button:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-button i {
    pointer-events: none;
}

.page-indicator {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .page-content {
        flex-direction: column;
        align-items: center; /* Ensure elements are centered */
    }

    .page-image, .page-text {
        flex: none;
        width: 100%;
    }

    .page-image {
        padding: 10px; /* Reduce padding to optimize space */
    }

    .page-image img {
        max-width: 90%; /* Avoid touching screen edges */
        max-height: 70vh; /* Prevent excessive vertical growth */
    }

    .page-text {
        font-family: 'Atkinson Hyperlegible Next', sans-serif;
        font-size: 20px;
        font-weight: 400; /* Ensures correct weight */
        line-height: 1.5; /* Improves readability */
        text-align: center;
        padding: 20px;
    }
}

@media (orientation: landscape) and (max-width: 992px) {
    .page-content {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 20px;
    }

    .page-image {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 10px;
    }

    .page-text {
        flex: 1;
        font-size: 20px;
        text-align: center;
        padding: 30px;
    }

    .text-center h2 {
        text-align: center;
        width: 100%;
    }

    .navigation-controls {
        position: absolute;
        top: 50%;
        left: -60px;  /* Move left button further to the left */
        right: -60px; /* Move right button further to the right */
        display: flex;
        justify-content: space-between;
        align-items: center;
        transform: translateY(-50%);
        width: calc(100% + 120px); /* Expands clickable area */
        pointer-events: none; /* Prevents interference with text */
    }

    .nav-button {
        pointer-events: auto; /* Re-enables button clicks */
        width: 60px; /* Slightly larger buttons for better touch interaction */
        height: 60px;
    }
}
