/**
 * Clean Digital Book Flipbook & 3D Page Transitions
 * Muslim Pandai - Wpmedia Child Theme
 */

/* Sembunyikan total di mode Desktop */
@media (min-width: 769px) {
    #mp-clean-book-section,
    .mp-reading-progress,
    .mp-book-edge-tab,
    .mp-next-article-book-card {
        display: none !important;
    }
}

/* Khusus Smartphone (Layar <= 768px) */
@media (max-width: 768px) {
    /* 1. Header Bersih Berisi Logo di Bagian Atas */
    #topnavwrap,
    .gmr-topnavwrap {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 52px !important;
        background: #ffffff !important;
        border-bottom: 1px solid #f1f5f9 !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
        z-index: 1000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 16px !important;
    }

    #masthead {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .site-branding,
    .gmr-logo {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    .custom-logo {
        max-height: 38px !important;
        width: auto !important;
        object-fit: contain !important;
    }

    /* Sembunyikan menu burger, search, tanggal, footer Contact Info, dan daftar artikel biasa di HP */
    .gmr-navright,
    .gmr-top-date,
    #gmr-responsive-menu,
    #main-nav,
    .gmr-topnotification,
    footer#colophon,
    .site-footer,
    #footer-sidebar,
    .widget-footer,
    body.home #content,
    body.blog #content,
    body.archive #content,
    body.category #content,
    body.tag #content,
    body.archive .page-header,
    body.category .page-header,
    body.tag .page-header,
    body.home #secondary,
    body.blog #secondary,
    body.archive #secondary,
    body.category #secondary,
    body.tag #secondary {
        display: none !important;
    }

    /* 2. Full Screen Murni Buku Digital (Dimulai Tepat di Bawah Logo Header) */
    .mp-clean-book-section {
        position: fixed !important;
        top: 52px !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: calc(100dvh - 52px) !important;
        height: calc(100vh - 52px) !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 100 !important;
        background: #fdfbf7 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* 3D Stage / Panggung Buku */
    .mp-book-stage {
        position: relative;
        width: 100%;
        height: 100%;
        perspective: 1400px;
        -webkit-perspective: 1400px;
        border-radius: 0;
        background: #fdfbf7;
        overflow: hidden;
    }

    /* Efek Lipatan Punggung Buku di Kiri */
    .mp-book-spine-shadow {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 22px;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0.04) 40%, transparent 100%);
        z-index: 20;
        pointer-events: none;
    }

    .mp-book-pages-wrapper {
        position: relative;
        width: 100%;
        height: 100%;
        transform-style: preserve-3d;
        -webkit-transform-style: preserve-3d;
    }

    /* Lembaran Halaman Buku Tunggal */
    .mp-book-page {
        position: absolute;
        inset: 0;
        background: #ffffff;
        background: linear-gradient(135deg, #ffffff 0%, #faf8f5 100%);
        box-shadow: inset 18px 0 24px -8px rgba(0, 0, 0, 0.08);
        transform-origin: left center;
        -webkit-transform-origin: left center;
        transform-style: preserve-3d;
        -webkit-transform-style: preserve-3d;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease, box-shadow 0.5s ease;
        display: flex;
        flex-direction: column;
        user-select: none;
        -webkit-user-select: none;
    }

    /* Status Posisi Halaman 3D */
    .mp-book-page.is-active {
        transform: rotateY(0deg) translateZ(0);
        opacity: 1;
        z-index: 10;
        pointer-events: auto;
    }

    .mp-book-page.is-next {
        transform: rotateY(0deg) translateZ(-15px);
        opacity: 0;
        z-index: 5;
        pointer-events: none;
    }

    .mp-book-page.is-prev {
        transform: rotateY(-110deg) translateZ(-30px);
        opacity: 0;
        z-index: 1;
        pointer-events: none;
    }

    /* Animasi Lembaran Balik ke Kiri (Maju Halaman) */
    .mp-book-page.flipping-next {
        animation: mpFlipTurnNext 0.55s cubic-bezier(0.25, 1, 0.35, 1) forwards;
        z-index: 15;
    }

    @keyframes mpFlipTurnNext {
        0% {
            transform: rotateY(0deg) scale(1);
            box-shadow: inset 18px 0 24px -8px rgba(0, 0, 0, 0.08);
        }
        40% {
            box-shadow: -15px 0 30px rgba(0, 0, 0, 0.22);
        }
        100% {
            transform: rotateY(-105deg) scale(0.96);
            opacity: 0;
            box-shadow: -20px 0 40px rgba(0, 0, 0, 0.3);
        }
    }

    /* Animasi Lembaran Balik ke Kanan (Mundur Halaman) */
    .mp-book-page.flipping-prev {
        animation: mpFlipTurnPrev 0.55s cubic-bezier(0.25, 1, 0.35, 1) forwards;
        z-index: 15;
    }

    @keyframes mpFlipTurnPrev {
        0% {
            transform: rotateY(-105deg) scale(0.96);
            opacity: 0;
            box-shadow: -20px 0 40px rgba(0, 0, 0, 0.3);
        }
        60% {
            opacity: 1;
            box-shadow: -15px 0 30px rgba(0, 0, 0, 0.2);
        }
        100% {
            transform: rotateY(0deg) scale(1);
            opacity: 1;
            box-shadow: inset 18px 0 24px -8px rgba(0, 0, 0, 0.08);
        }
    }

    /* Permukaan Kertas Buku Layar Penuh */
    .mp-book-sheet-surface {
        padding: 16px 20px calc(80px + env(safe-area-inset-bottom, 16px)) 24px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
    }

    /* Header Lembar Sederhana */
    .mp-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 8px;
        font-size: 11px;
        color: #94a3b8;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
    }

    .mp-sheet-chapter {
        color: #0829e0;
        font-weight: 700;
    }

    /* Isi Buku: Scroll Kebawah Mulus TANPA Navigator Scrollbar di Kanan */
    .mp-sheet-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        padding: 16px 0 14px 0;
        scrollbar-width: none !important; /* Firefox: Hilangkan scrollbar */
        -ms-overflow-style: none !important; /* IE / Edge: Hilangkan scrollbar */
    }

    /* Hilangkan scrollbar untuk Chrome, Safari, dan WebKit */
    .mp-sheet-body::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .mp-sheet-title {
        margin: 0 0 14px 0;
        font-size: 21px;
        font-weight: 700;
        line-height: 1.35;
        color: #0f172a;
    }

    .mp-sheet-title a {
        color: #0f172a;
        text-decoration: none;
    }

    .mp-sheet-divider {
        width: 38px;
        height: 3px;
        background: #0829e0;
        border-radius: 2px;
        margin-bottom: 16px;
    }

    /* Tipografi Teks Buku Flipbook (Sangat Nyaman Dibaca & Tidak Menjenuhkan) */
    .mp-sheet-text {
        font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 15.5px !important;
        line-height: 1.95 !important; /* Jarak antar baris lega & proporsional agar mata tidak lelah */
        color: #2d3748 !important;
        text-align: justify;
        letter-spacing: 0.15px;
    }

    .mp-sheet-text p {
        margin: 0 0 18px 0 !important;
    }

    /* Ornamen Kaligrafi Basmalah Pembuka (Unwan / Surah Header Style) */
    .mp-mushaf-bismillah {
        margin: 20px 0 22px 0 !important;
        text-align: center !important;
        direction: rtl !important;
    }

    .mp-bismillah-frame {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 12px 24px 10px 24px !important;
        background: #fffdfa !important;
        border: 1px solid rgba(212, 175, 55, 0.4) !important;
        border-radius: 14px !important;
        box-shadow: 0 3px 12px rgba(212, 175, 55, 0.08), inset 0 0 0 2px #faf5e8 !important;
    }

    .mp-bismillah-symbol {
        font-family: 'Amiri Quran', 'Amiri', serif !important;
        font-size: 32px !important;
        line-height: 1.2 !important;
        color: #b48322 !important;
        display: block !important;
        margin-bottom: 2px !important;
    }

    .mp-bismillah-text {
        font-family: 'Amiri Quran', 'Amiri', serif !important;
        font-size: 21px !important;
        font-weight: 700 !important;
        line-height: 1.8 !important;
        color: #000159 !important;
        display: block !important;
        letter-spacing: 0.3px !important;
    }

    /* Bingkai Mushaf Al-Qur'an & Sabda Hadits (Authentic Islamic Mushaf Frame) */
    .mp-quran-card {
        margin: 22px 0 24px 0 !important;
        padding: 16px 18px 14px 18px !important;
        background: #fdfbf7 !important;
        border: 1.5px solid #d4af37 !important;
        border-radius: 14px !important;
        text-align: center !important;
        direction: rtl !important;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04), inset 0 0 0 3px #f7f3e8, inset 0 0 0 4.5px rgba(212, 175, 55, 0.35) !important;
        position: relative !important;
    }

    .mp-quran-header {
        display: flex !important;
        justify-content: center !important;
        margin-bottom: 12px !important;
    }

    .mp-quran-badge {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        background: linear-gradient(135deg, #0829e0 0%, #000159 100%) !important;
        color: #ffffff !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        letter-spacing: 0.6px !important;
        text-transform: uppercase !important;
        padding: 4px 14px !important;
        border-radius: 20px !important;
        box-shadow: 0 2px 8px rgba(8, 41, 224, 0.25) !important;
        direction: ltr !important;
    }

    .mp-badge-icon {
        font-size: 13px !important;
    }

    .mp-quran-verse {
        padding: 4px 0 8px 0 !important;
    }

    .mp-quran-text {
        font-family: 'Amiri Quran', 'Amiri', 'Noto Naskh Arabic', serif !important;
        font-size: 25px !important;
        font-weight: 700 !important; /* Huruf Arab Tebal / Bold tegas */
        line-height: 2.5 !important; /* Jarak baris sangat lega agar harakat Al-Qur'an sempurna */
        color: #0f172a !important;
        display: block !important;
        text-align: center !important;
        letter-spacing: 0.4px !important;
        word-spacing: 2px !important;
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
    }

    .mp-quran-footer-ornament {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-top: 8px !important;
    }

    .mp-quran-ornament-mark {
        color: #d4af37 !important;
        font-size: 16px !important;
        line-height: 1 !important;
        opacity: 0.8 !important;
    }

    /* Kartu Terjemahan Bahasa Indonesia yang Berpasangan */
    .mp-artinya-card {
        margin: 14px 0 24px 0 !important;
        padding: 14px 18px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-left: 4px solid #0829e0 !important;
        border-radius: 0 12px 12px 0 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02) !important;
    }

    .mp-artinya-header {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin-bottom: 6px !important;
    }

    .mp-artinya-icon {
        font-size: 13px !important;
    }

    .mp-artinya-label {
        color: #0829e0 !important;
        font-weight: 700 !important;
        font-size: 12px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    .mp-artinya-body {
        font-size: 15.5px !important;
        line-height: 1.88 !important;
        color: #334155 !important;
        font-style: italic !important;
    }

    /* Frasa Arab Singkat di Tengah Kalimat (Inline) */
    .mp-arabic-inline {
        font-family: 'Amiri', 'Noto Naskh Arabic', serif !important;
        font-size: 1.15em !important;
        font-weight: 700 !important;
        color: #0829e0 !important;
        direction: rtl !important;
        display: inline-block !important;
        margin: 0 2px !important;
    }

    .mp-sheet-text blockquote {
        margin: 16px 0 !important;
        padding: 12px 18px !important;
        background: #f8fafc !important;
        border-left: 3px solid #0829e0 !important;
        font-style: italic !important;
        color: #1e293b !important;
        border-radius: 0 10px 10px 0 !important;
        line-height: 1.88 !important;
    }

    /* Footer Lembar */
    .mp-sheet-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid #f1f5f9;
        padding-top: 10px;
        flex-shrink: 0;
    }

    .mp-sheet-author {
        font-size: 12px;
        color: #64748b;
        font-weight: 500;
    }

    /* Posisi Widget WhatsApp Resmi Agar Tidak Tabrakan */
    #OFdJERzWqS,
    .uCPhfCrRpe {
        bottom: 74px !important;
        z-index: 99998 !important;
    }

    /* Tombol Panah Navigasi Halus di Sisi Buku */
    .mp-book-turn-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
        border: 1px solid #e2e8f0;
        color: #0829e0;
        font-size: 24px;
        font-weight: 700;
        cursor: pointer;
        z-index: 25;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        outline: none;
    }

    .mp-turn-prev {
        left: 8px;
    }

    .mp-turn-next {
        right: 8px;
    }

    .mp-book-turn-arrow:active {
        background: #0829e0;
        color: #ffffff;
    }

    /* 3. Navigasi Lembar Buku pada Single Post */
    .mp-reading-progress {
        position: fixed;
        top: 0;
        left: 0;
        width: 0%;
        height: 3px;
        background: linear-gradient(90deg, #0829e0, #1e0afc);
        z-index: 999999;
    }

    .mp-book-edge-tab {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 54px;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        border: 1px solid #e2e8f0;
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #0829e0;
        font-size: 24px;
        font-weight: 700;
        line-height: 1;
    }

    .mp-edge-prev {
        left: 0;
        border-radius: 0 12px 12px 0;
    }

    .mp-edge-next {
        right: 0;
        border-radius: 12px 0 0 12px;
    }

    .mp-next-article-book-card {
        margin: 24px 12px 40px 12px;
        padding: 20px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-left: 4px solid #0829e0;
        border-radius: 14px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    }

    .mp-next-card-subtitle {
        font-size: 11px;
        font-weight: 700;
        color: #0829e0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: block;
        margin-bottom: 6px;
    }

    .mp-next-card-title {
        margin: 0 0 14px 0;
        font-size: 16px;
        font-weight: 700;
        color: #0f172a;
        line-height: 1.4;
    }

    .mp-next-card-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #0829e0;
        color: #ffffff;
        padding: 8px 18px;
        border-radius: 20px;
        font-size: 12.5px;
        font-weight: 600;
        text-decoration: none;
    }

    .mp-next-swipe-hint {
        margin: 8px 0 0 0;
        font-size: 11px;
        color: #64748b;
        font-style: italic;
    }
}
