* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* NOTE:
   Kalau body ini mengganggu layout global (navbar dll),
   bisa dipindah ke kelas khusus, misal .flipbook-body */
body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    /* background: linear-gradient(135deg, #667eea 0%, #352f89 100%); */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    width: 100%;
    padding: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Tambahan: wrapper agar rapi di tengah dan tidak terlalu lebar */
.book-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 80px auto;
}

/* Container buku utama */
.book-container {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
    margin: 40px auto 20px auto; /* Tambahkan jarak bawah agar tombol tidak menutupi */
    display: none;
    perspective: 2000px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

#book {
    width: 100%;
    height: 100%;
    position: relative;
}

#book .page {
    background-color: white;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

#book .page canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 5px;
}

#book .hard {
    background: #fff !important;
    color: #333;
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 0 5px #666;
}

#book .odd {
    background: -webkit-gradient(
        linear,
        0% 100%,
        100% 0%,
        from(#fff),
        to(#fafafa)
    );
    border-radius: 10px 0 0 10px;
}

#book .even {
    background: -webkit-gradient(
        linear,
        100% 100%,
        0% 0%,
        from(#fff),
        to(#fafafa)
    );
    border-radius: 0 10px 10px 0;
}

/* === Kontrol Navigasi Buku === */
.controls {
    /* HAPUS posisi fixed */
    /* position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%); */

    position: relative;
    margin: 20px auto 40px auto;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 12px 25px;
    border-radius: 50px;
    display: none; /* ini tetap, nanti di JS di-set ke flex */
    z-index: 200;
}

.control-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

#prevBtn svg {
    margin-right: 8px;
}

#nextBtn svg {
    margin-left: 8px;
}

.control-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    background: #4b4ca2;
    transform: translateY(-2px);
}

.control-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.page-info {
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: #333;
    font-weight: 600;
}

/* === Loading State === */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 30px 50px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* === Turn.js Custom Style === */
#book .page-wrapper {
    perspective: 2000px;
}

#book .page {
    transform-style: preserve-3d;
}

#book .page .page-content {
    padding: 20px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========  RESPONSIVE  ========= */

/* Tablet kecil & landscape HP besar */
@media (max-width: 992px) {
    .header h1 {
        font-size: 2.1rem;
    }

    .book-container {
        width: 95vw;
        height: 70vh;
    }

    .controls {
        bottom: 15px;
        padding: 10px 18px;
        gap: 14px;
    }

    .control-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* HP / tablet kecil */
@media (max-width: 768px) {

    .controls {
        bottom: 12px;
        padding: 10px 16px;
        gap: 14px;
        max-width: 90vw;
        border-radius: 30px;
    }

    .page-info {
        order: -1;
        width: 100%;
        justify-content: center;
        margin-bottom: 6px;
        font-size: 0.9rem;
    }

    .control-btn {
        flex: unset;              /* ❗ hentikan tombol melebar 45% */
        width: auto;              /* ❗ ukuran sesuai konten */
        min-width: 110px;         /* biar rapi */
        padding: 8px 14px;        /* ❗ lebih kecil */
        font-size: 0.85rem;
        border-radius: 20px;
        text-align: center;
    }
}

/* HP kecil */
@media (max-width: 576px) {
    .control-btn {
        min-width: 95px;
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .controls {
        padding: 8px 12px;
        gap: 10px;
    }

    .page-info {
        font-size: 0.85rem;
    }
}
