body { font-family: 'Vazirmatn', sans-serif; overflow-x: hidden; }

/* چیدمان کانتینر برای دسکتاپ و موبایل */
.viewer-container { display: flex; justify-content: center; flex-wrap: wrap; gap: 2rem; padding: 2rem 0; width: 100%; }
@media (max-width: 1024px) { 
    .viewer-container { flex-direction: column; align-items: center; gap: 0; } 
}

/* ساختار پایه کاغذ A4 */
.a4-page {
    width: 210mm; 
    height: 297mm; 
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    position: relative; 
    padding: 10mm; /* حاشیه تا شروع کادر اصلی */
    flex-shrink: 0; 
    transform-origin: top center; 
    overflow: hidden;
    z-index: 1;
}

/* پترن نقطه‌ای (اعمال شده روی همه صفحات) */
.a4-pattern {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px; opacity: 0.6; z-index: -1;
}
/* کادر مشکی استاندارد برای صفحات داخلی */
.page-border {
    border: 2px solid #000; 
    border-radius: 12px; /* کرو شدن حاشیه */
    overflow: hidden; /* بریدن گوشه‌های هدر برای هماهنگی با کرو */
    height: 100%; 
    display: flex; 
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    position: relative;
    box-sizing: border-box;
}

/* کادر طلایی مخصوص کاور */
.cover-border {
    border: 3px solid #ca8a04; 
    border-radius: 12px; /* کرو شدن حاشیه کاور */
    overflow: hidden;
    height: 100%; 
    padding: 40px; 
    display: flex; 
    flex-direction: column;
    justify-content: space-between; 
    background: rgba(255, 255, 255, 0.95);
    box-sizing: border-box;
}
/* هدر یکپارچه با کادر (بدون فاصله از کناره‌ها) */
.fs-header {
    border-bottom: 2px solid #000; 
    display: flex; 
    flex-direction: column; 
    font-size: 11px; 
    font-weight: bold; 
    text-align: center; 
    color: #000; 
    flex-shrink: 0;
}
.fs-header-row { display: flex; border-bottom: 2px solid #000; }
.fs-header-row:last-child { border-bottom: none; }
.fs-col-right { width: 25%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 5px; }
.fs-col-center { width: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; border-left: 2px solid #000; border-right: 2px solid #000; padding: 5px; }
.fs-col-left { width: 25%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 5px; }

/* محتوای داخل صفحات (با فاصله از کادر) */
.page-content {
    padding: 10mm;
    flex-grow: 1;
}

/* استایل متون */
.prose { color: black !important; text-align: justify; }
.prose h1 { font-size: 1.5rem; font-weight: 900; margin-bottom: 1rem; border-bottom: 2px solid #000; padding-bottom: 0.5rem; color: #0f172a; }
.prose h2 { font-size: 1.25rem; font-weight: 700; margin-top: 1.5rem; margin-bottom: 0.75rem; color: #1e293b; }
.prose p { margin-bottom: 1rem; line-height: 2; font-size: 14px; color: #334155; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 13px; }
.prose table, .prose th, .prose td { border: 1px solid #64748b; }
.prose th, .prose td { padding: 8px; text-align: right; }
.prose th { background-color: #f1f5f9; }

/* فهرست مطالب */
.toc-line { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; font-size: 14px; font-weight: bold; color: #0f172a; }
.toc-line .dots { flex-grow: 1; border-bottom: 1px dotted #000; margin: 0 10px; position: relative; top: -4px; }
.toc-subline { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; padding-right: 15px; font-size: 13px; color: #333; }
.toc-subline .dots { flex-grow: 1; border-bottom: 1px dotted #999; margin: 0 10px; position: relative; top: -4px; }

.hidden-section { display: none !important; }