/* Book Container */
.book-wrapper {
    background: #f5f5f5;
    padding: 40px 20px;
    min-height: 100vh;
}

.book {
    max-width: 210mm;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.book.theme-classic {
    font-family: "Georgia", "Times New Roman", serif;
}

.book.theme-executive {
    font-family: "Segoe UI", "Arial", sans-serif;
}

.book.theme-vibrant {
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.book.theme-minimal {
    font-family: "Helvetica Neue", Arial, sans-serif;
}

.book.theme-oceanic,
.book.theme-forest,
.book.theme-sunrise,
.book.theme-slate {
    font-family: "Segoe UI", "Arial", sans-serif;
}

/* Page Styling - A4 Size */
.book-page {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    padding: 20mm;
    padding-bottom: 30mm;
    margin: 0 auto 40px;
    background: white;
    position: relative;
    page-break-after: always;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #ddd;
}

.book-page::before {
    content: "";
    position: absolute;
    inset: 10mm;
    border: 1.5px solid rgba(15, 23, 42, 0.16);
    pointer-events: none;
    z-index: 0;
}

.book-page.border-classic::before {
    inset: 10mm;
    border: 1.5px solid rgba(15, 23, 42, 0.16);
}

.book-page::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-image: url('../images/jj.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.book-page > * {
    position: relative;
    z-index: 1;
}

.book-page:last-child {
    page-break-after: avoid;
    margin-bottom: 0;
}

/* Page Content */
.page-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

.page-number {
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

.section-title {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.page-body {
    flex: 1;
    padding: 20px 0;
    padding-bottom: 40px;
    overflow-x: auto;
}

.page-footer {
    display: flex;
    justify-content: center;
    padding-top: 5px;
    padding-bottom: 15px;
    margin-top: 10px;
}

.footer-text {
    font-size: 12px;
    color: #999;
}

.book-page.footer-classic .page-footer {
    border-top: 0;
}

.book-page.footer-line .page-footer {
    border-top: 1.5px solid #334155;
    margin-top: 6px;
}

.book-page.footer-boxed .footer-text {
    background: rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(71, 85, 105, 0.35);
    border-radius: 999px;
    padding: 4px 12px;
}

.book-page.footer-minimal .page-footer {
    padding-top: 2px;
    margin-top: 6px;
}

.book-page.footer-minimal .footer-text {
    color: #6b7280;
    letter-spacing: 0.02em;
}

.book-page.footer-minimal::after {
    height: 6px;
    background-image: none;
    background: #d1d5db;
}

.book-page.footer-accent .page-footer {
    padding-top: 8px;
}

.book-page.footer-accent .footer-text {
    color: #0f766e;
    font-weight: 600;
}

.book-page.footer-accent::after {
    height: 10px;
    background-image: none;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
}

.book-page.footer-wave::after {
    height: 18px;
    background-image: none;
    background: linear-gradient(100deg, #38bdf8, #0ea5e9, #0369a1);
}

/* Cover Page */
.cover-page {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cover-page .page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.cover-image {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    margin-bottom: 40px;
}

.report-title {
    font-size: 72px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.report-subtitle {
    font-size: 32px;
    color: #666;
    margin-bottom: 30px;
}

.report-description {
    font-size: 18px;
    color: #999;
    max-width: 80%;
}

/* Section Divider */
.section-divider {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-divider .page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.section-divider .page-heading {
    font-size: 48px;
    text-align: center;
    color: #333;
}

/* Content Styling */
.page-heading {
    font-size: 36px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.3;
}

.page-subheading {
    font-size: 24px;
    color: #666;
    margin-bottom: 20px;
    font-weight: normal;
}

.theme-executive .page-header {
    border-bottom-color: #0f172a;
}

.theme-executive .report-title,
.theme-executive .page-heading {
    color: #0f172a;
    letter-spacing: 0.02em;
}

.theme-executive .page-number,
.theme-executive .section-title {
    color: #1e293b;
}

.book-page.border-executive::before {
    inset: 8mm;
    border: 2px solid #1e293b;
    box-shadow: inset 0 0 0 5px #e2e8f0;
}

.theme-vibrant .book-page {
    border-color: #f59e0b;
}

.theme-vibrant .page-header {
    border-bottom-color: #ea580c;
}

.theme-vibrant .report-title,
.theme-vibrant .page-heading {
    color: #b45309;
}

.theme-vibrant .report-subtitle,
.theme-vibrant .page-subheading {
    color: #c2410c;
}

.theme-vibrant .section-divider {
    background: linear-gradient(160deg, #fff7ed, #ffedd5);
}

.book-page.border-vibrant::before {
    inset: 8mm;
    border: 3px solid transparent;
    border-image: linear-gradient(135deg, #f97316, #f59e0b, #f43f5e) 1;
}

.theme-minimal .book-page::after {
    background-image: none;
    background: #e5e7eb;
    height: 8px;
}

.theme-minimal .page-header {
    border-bottom: 1px solid #6b7280;
}

.theme-minimal .report-title,
.theme-minimal .page-heading {
    color: #111827;
}

.theme-minimal .report-subtitle,
.theme-minimal .page-subheading,
.theme-minimal .section-title,
.theme-minimal .page-number {
    color: #4b5563;
}

.book-page.border-minimal::before {
    inset: 12mm;
    border: 1px solid #9ca3af;
}

.theme-oceanic {
    background: linear-gradient(180deg, #f0f9ff, #e0f2fe);
}

.theme-oceanic .page-header {
    border-bottom-color: #0369a1;
}

.theme-oceanic .report-title,
.theme-oceanic .page-heading {
    color: #0c4a6e;
}

.theme-oceanic .report-subtitle,
.theme-oceanic .page-subheading,
.theme-oceanic .section-title,
.theme-oceanic .page-number {
    color: #075985;
}

.book-page.border-oceanic::before {
    inset: 8mm;
    border: 2px solid #0ea5e9;
    box-shadow: inset 0 0 0 4px rgba(186, 230, 253, 0.8);
}

.theme-forest {
    background: linear-gradient(180deg, #f0fdf4, #dcfce7);
}

.theme-forest .page-header {
    border-bottom-color: #15803d;
}

.theme-forest .report-title,
.theme-forest .page-heading {
    color: #14532d;
}

.theme-forest .report-subtitle,
.theme-forest .page-subheading,
.theme-forest .section-title,
.theme-forest .page-number {
    color: #166534;
}

.book-page.border-forest::before {
    inset: 8mm;
    border: 2px solid #15803d;
    box-shadow: inset 0 0 0 4px rgba(187, 247, 208, 0.7);
}

.theme-sunrise {
    background: linear-gradient(180deg, #fff7ed, #fef3c7);
}

.theme-sunrise .page-header {
    border-bottom-color: #ea580c;
}

.theme-sunrise .report-title,
.theme-sunrise .page-heading {
    color: #9a3412;
}

.theme-sunrise .report-subtitle,
.theme-sunrise .page-subheading,
.theme-sunrise .section-title,
.theme-sunrise .page-number {
    color: #b45309;
}

.book-page.border-sunrise::before {
    inset: 8mm;
    border: 2px solid #f97316;
    box-shadow: inset 0 0 0 4px rgba(254, 215, 170, 0.75);
}

.theme-slate {
    background: linear-gradient(180deg, #f8fafc, #e2e8f0);
}

.theme-slate .page-header {
    border-bottom-color: #334155;
}

.theme-slate .report-title,
.theme-slate .page-heading {
    color: #1e293b;
}

.theme-slate .report-subtitle,
.theme-slate .page-subheading,
.theme-slate .section-title,
.theme-slate .page-number {
    color: #475569;
}

.book-page.border-slate::before {
    inset: 8mm;
    border: 2px solid #475569;
    box-shadow: inset 0 0 0 4px rgba(226, 232, 240, 0.85);
}

.page-text {
    font-size: 16px;
    line-height: 1.8;
    color: #444;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.page-text p {
    margin-bottom: 1.5em;
    text-align: justify;
}

.page-text h1, .page-text h2, .page-text h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

/* All images in page content */
.page-body img,
.page-text img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 10px 0 !important;
}

/* Images */
.page-image {
    margin: 30px 0;
}

.page-image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.page-image.image-top {
    margin-top: 0;
}

.page-image.image-bottom {
    margin-bottom: 0;
}

.page-image.image-left {
    float: left;
    margin-right: 30px;
    margin-bottom: 20px;
    max-width: 50%;
}

.page-image.image-right {
    float: right;
    margin-left: 30px;
    margin-bottom: 20px;
    max-width: 50%;
}

.page-image figcaption {
    text-align: center;
    font-size: 8px !important;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

.book-page .page-image .image-caption,
.book-page .page-text figcaption {
    font-size: 8px !important;
    line-height: 1.3;
}

.caption-thumbnail {
    max-width: 30% !important;
    height: auto;
    display: block;
    margin: 10px auto 0;
}

/* Table Styles */
.page-text table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    table-layout: fixed;
}

.page-text table td,
.page-text table th {
    padding: 12px 15px;
    border: 1px solid #ddd;
    vertical-align: top;
    width: 50%;
    word-wrap: break-word;
}

.page-text table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.page-text table img,
.page-text table td img,
.page-text table th img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain;
}

/* Ensure table cells have equal width */
.page-text table tr td:first-child,
.page-text table tr td:last-child {
    width: 50%;
}

/* Print Styles */
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    
    body {
        background: white;
    }
    
    .no-print {
        display: none !important;
    }
    
    .book-wrapper {
        padding: 0;
        background: white;
    }
    
    .book {
        box-shadow: none;
    }
    
    .book-page {
        width: 210mm;
        min-height: 297mm;
        padding: 20mm;
        margin: 0;
        box-shadow: none;
        page-break-after: always;
        page-break-inside: avoid;
    }
    
    .book-page:last-child {
        page-break-after: avoid;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .book-page {
        width: 100%;
        min-height: auto;
        padding: 20px;
    }
    
    .report-title {
        font-size: 48px;
    }
    
    .report-subtitle {
        font-size: 24px;
    }
    
    .page-heading {
        font-size: 28px;
    }
    
    .page-subheading {
        font-size: 20px;
    }
    
    .page-image.image-left,
    .page-image.image-right {
        float: none;
        max-width: 100%;
        margin: 20px 0;
    }
}
