/* =========================================================
   FULLSCREEN PDF VIEWER (DARK MODE & RESPONSIVE)
   ========================================================= */

.pdf-viewer-container {
    position: fixed !important;
    top: 0 !important; 
    left: 0 !important;
    width: 100vw !important; 
    height: 100vh !important;
    background-color: rgba(15, 23, 42, 0.95) !important; /* Latar gelap semi-transparan */
    z-index: 999999 !important; /* Tingkatkan z-index */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Tengah vertikal */
    align-items: center; /* Tengah horizontal */
    backdrop-filter: blur(15px);
}

/* Area Kanvas PDF (Supaya tidak melewati layar) */
.pdf-canvas-wrapper {
    width: 100%;
    height: 85vh; /* Sisakan ruang 15% untuk toolbar */
    overflow-y: auto; /* Bisa scroll jika panjang */
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Nempel ke atas wrapper */
    padding-top: 20px;
    padding-bottom: 80px; /* Ruang untuk toolbar bawah */
}

#pdfCanvas {
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border-radius: 4px;
    max-width: 95%; /* Jangan lewati lebar layar */
    /* Tinggi Canvas dikontrol dinamis oleh JS */
}

/* ==========================================
   TOOLBAR MELAYANG (FLOATING CONTROLS)
   ========================================== */
.toolbar-floating {
    position: absolute;
    bottom: 25px; /* Jarak dari bawah layar */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    z-index: 1000000 !important;
    width: max-content;
    max-width: 90vw;
}

.toolbar-left, .toolbar-center, .toolbar-right { display: flex; align-items: center; }

#pdf-title-display {
    color: white; font-weight: 600; font-size: 0.95rem;
    max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 15px; border-right: 1px solid rgba(255,255,255,0.2);
}

.page-info {
    color: white; font-weight: 600; font-size: 1rem;
    margin: 0 15px; min-width: 50px; text-align: center;
}

.btn-nav {
    background: transparent; border: none; color: white;
    cursor: pointer; padding: 8px; border-radius: 50%;
    transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.btn-nav:hover { background: rgba(255,255,255,0.1); transform: scale(1.1); }
.btn-nav:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.btn-download {
    margin-left: 15px; padding-left: 15px;
    border-left: 1px solid rgba(255,255,255,0.2); border-radius: 0;
    color: var(--accent) !important;
}
.btn-download:hover { color: white !important; background: transparent; }

/* ==========================================
   TOMBOL TUTUP MELAYANG (KANAN ATAS)
   ========================================== */
.btn-close-floating {
    position: absolute;
    top: 25px; right: 30px;
    background: rgba(15, 23, 42, 0.8); color: white;
    border: 1px solid rgba(255,255,255,0.3); padding: 8px 16px;
    border-radius: 30px; z-index: 1000000 !important;
    cursor: pointer; font-weight: 600; font-size: 0.95rem;
    backdrop-filter: blur(5px); transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.btn-close-floating:hover { background: #ef4444; border-color: #ef4444; transform: translateY(-2px); }

/* ==========================================
   LOADING SPINNER
   ========================================== */
.pdf-loader {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: white; z-index: 1000000;
}
.pdf-spinner {
    width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent); border-radius: 50%;
    animation: pdfSpin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite; margin-bottom: 15px;
}
@keyframes pdfSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Sembunyikan judul dokumen di HP agar toolbar tidak kepanjangan */
@media (max-width: 768px) {
    #pdf-title-display { display: none; }
    .btn-download { border-left: none; margin-left: 0; padding-left: 0; }
    .btn-close-floating { top: 15px; right: 15px; padding: 6px 12px; font-size: 0.85rem; }
    .toolbar-floating { bottom: 15px; padding: 8px 16px; }
}