body { background-color: #e5e7eb; font-family: sans-serif; margin: 0; padding: 0; }
.no-print { display: block; }

/* KONTROL PANEL */
#ui-panel { 
    display: flex; gap: 15px; padding: 20px; background: white; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 100;
}
.control-box { flex: 1; border-right: 1px solid #ccc; padding-right: 15px; }
.control-box:last-child { border-right: none; }
h3 { margin-top: 0; font-size: 14px; color: #374151; }
label { display: block; font-size: 12px; margin-bottom: 8px; }
input[type="file"] { font-size: 12px; }
button { padding: 10px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; width: 100%; margin-bottom: 5px; }
.btn-action { background: #4f46e5; color: white; }
.btn-generate { background: #16a34a; color: white; height: 100%; font-size: 16px; }

/* KANVAS EDITOR (Dibuat mirip ukuran B5 di layar) */
#editor-container { 
    max-width: 176mm; /* Lebar fisik B5 */
    margin: 30px auto; background: white; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
}
.ql-editor { 
    min-height: 250mm; padding: 25mm 20mm; /* Simulasi margin B5 */
    font-family: 'Georgia', serif; font-size: 11pt; line-height: 1.5; text-align: justify;
}

/* DESAIN VISUAL "PAGE BREAK" DI DALAM EDITOR */
.ql-editor hr {
    border: 0; border-top: 2px dashed #ef4444; margin: 20px 0; 
    position: relative; overflow: visible;
}
.ql-editor hr::after {
    content: "✂️ --- HALAMAN BARU --- ✂️";
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    background: white; padding: 0 10px; color: #ef4444; font-size: 10px; font-family: sans-serif;
}

/* TOMBOL PREVIEW */
#preview-controls { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; gap: 15px; }
.btn-print { background: #16a34a; color: white; width: auto;}
.btn-back { background: #dc2626; color: white; width: auto;}

/* =======================================
   ATURAN CETAK (PAGED.JS)
   ======================================= */
@media print {
    .no-print, #ui-panel, #preview-controls, .ql-toolbar { display: none !important; }
    @page { margin: 0 !important; size: 176mm 250mm; } 
    body { background-color: white; }
    
    /* Ubah <hr> menjadi pemutus halaman asli */
    hr { break-before: page; visibility: hidden; margin: 0; padding: 0; height: 0; }
}

@page {
    size: 176mm 250mm; 
    margin-top: 20mm; margin-bottom: 25mm; 
    margin-inside: 25mm; margin-outside: 15mm;
    @bottom-center { content: counter(page); font-family: 'Georgia', serif; font-size: 10pt; }
}
@page cover-page { margin: 0; @bottom-center { content: none; } }
.cover-image-container { page: cover-page; width: 100vw; height: 100vh; break-after: page; }
.cover-image-container img { width: 100%; height: 100%; object-fit: cover; }
.book-body { font-family: 'Georgia', serif; font-size: 11pt; line-height: 1.45; text-align: justify; }
.book-body p { margin-bottom: 10px; }
