/* ArXiv.org Scientific Paper Style */

@import url('https://fonts.googleapis.com/css2?family=Latin+Modern+Roman:wght@400;700&family=Computer+Modern+Serif&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Latin Modern Roman', 'Computer Modern Serif', 'Times New Roman', Times, serif;
    font-size: 10pt;
    line-height: 1.6;
    color: #000;
    background-color: #f9f9f9;
    padding: 20px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.paper-container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: #fff;
    padding: 72px 90px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.export-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.export-btn {
    padding: 8px 16px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: 'Latin Modern Roman', 'Computer Modern Serif', serif;
    font-size: 10pt;
    cursor: pointer;
    color: #000;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.export-btn:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.paper {
    text-align: justify;
}

/* Two-column layout for main content */
.paper-content {
    column-count: 2;
    column-gap: 24px;
    column-fill: balance;
    text-align: justify;
    margin: 25px 0;
}

/* Paper Header */
.paper-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #000;
    column-span: all;
}

.paper-title {
    font-size: 16pt;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.3;
    text-align: center;
}

.author-block {
    margin: 15px 0;
    font-size: 10pt;
}

.author {
    font-weight: 700;
    margin-bottom: 5px;
}

.affiliation {
    font-style: italic;
    font-size: 9pt;
    color: #333;
}

.date {
    margin-top: 10px;
    font-size: 10pt;
}

/* Abstract - Full width */
.abstract {
    margin: 25px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-left: 3px solid #000;
    column-span: all;
}

.abstract h2 {
    font-size: 12pt;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.abstract p {
    font-style: italic;
    text-align: justify;
    line-height: 1.7;
}

/* Sections */
.section {
    margin: 20px 0;
    break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    -webkit-column-break-inside: avoid;
}

.section h2 {
    font-size: 12pt;
    font-weight: 700;
    margin: 25px 0 15px 0;
    text-align: left;
    page-break-after: avoid;
    page-break-before: auto;
    column-span: all;
    break-after: avoid;
    break-before: auto;
    display: block;
    -webkit-column-break-after: avoid;
}

.section h3 {
    font-size: 11pt;
    font-weight: 700;
    margin: 18px 0 10px 0;
    text-align: left;
    page-break-after: avoid;
    break-after: avoid;
    display: block;
}

.section p {
    margin: 10px 0;
    text-align: justify;
    text-indent: 0;
    line-height: 1.6;
    orphans: 3;
    widows: 3;
    hyphens: auto;
}

.section ul,
.section ol {
    margin: 12px 0 12px 25px;
    padding-left: 0;
    break-inside: avoid;
}

.section li {
    margin: 8px 0;
    text-align: justify;
    line-height: 1.6;
    break-inside: avoid;
}

.section li::marker {
    font-weight: 700;
}

/* Academic Tables - Span full width across both columns */
.academic-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 9pt;
    page-break-inside: avoid;
    break-inside: avoid;
    column-span: all;
    display: table;
    margin-left: 0;
    margin-right: 0;
    -webkit-column-break-inside: avoid;
    page-break-before: auto;
    page-break-after: auto;
}

.academic-table caption {
    font-weight: 700;
    margin-bottom: 8px;
    text-align: left;
    font-size: 9pt;
    column-span: all;
    page-break-after: avoid;
}

.academic-table thead {
    display: table-header-group;
}

.academic-table tbody {
    display: table-row-group;
}

.academic-table tr {
    page-break-inside: avoid;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.academic-table thead {
    border-top: 2px solid #000;
    border-bottom: 1px solid #000;
}

.academic-table th {
    font-weight: 700;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #000;
    background-color: transparent;
    color: #000;
}

.academic-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #ccc;
    vertical-align: top;
}

.academic-table tbody tr:last-child td {
    border-bottom: 1px solid #000;
}

.academic-table tbody tr:hover {
    background-color: transparent;
}

.findings-table {
    font-size: 9pt;
}

.findings-table td {
    padding: 6px 8px;
}

/* References - Can use two columns or full width */
.references {
    margin: 30px 0;
    padding-top: 20px;
    border-top: 1px solid #000;
    column-span: all;
}

.references h2 {
    font-size: 12pt;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    column-span: all;
}

.references ol {
    margin-left: 0;
    padding-left: 25px;
    column-count: 2;
    column-gap: 20px;
}

.references li {
    margin: 10px 0;
    text-align: left;
    line-height: 1.6;
    break-inside: avoid;
}

/* Footer */
.paper-footer {
    margin-top: 40px;
    padding-top: 15px;
    border-top: 1px solid #ccc;
    text-align: center;
    font-size: 9pt;
    color: #666;
    font-style: italic;
    column-span: all;
}

.paper-footer p {
    margin: 0;
}

/* Print Styles */
@media print {
    body {
        background-color: #fff;
        padding: 0;
    }
    
    .paper-container {
        max-width: 100%;
        padding: 0;
        box-shadow: none;
        margin: 0;
    }
    
    .export-controls {
        display: none;
    }
    
    .paper {
        padding: 0;
    }
    
    .section {
        page-break-inside: avoid;
    }
    
    .academic-table {
        page-break-inside: avoid;
    }
    
    h2, h3 {
        page-break-after: avoid;
    }
}

/* PDF Export Styles - Preserve exact same layout as main document */
body.pdf-exporting .paper-container {
    padding: 72px 90px;
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: none;
}

body.pdf-exporting .paper {
    width: 100%;
    font-size: 10pt;
}

body.pdf-exporting .paper-content {
    column-count: 2;
    column-gap: 24px;
    column-fill: balance;
    text-align: justify;
    margin: 25px 0;
}

body.pdf-exporting .section {
    margin: 20px 0;
    break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
}

body.pdf-exporting .section h2 {
    font-size: 12pt;
    font-weight: 700;
    margin: 25px 0 15px 0;
    text-align: left;
    page-break-after: avoid;
    column-span: all;
    break-after: avoid;
    display: block;
}

body.pdf-exporting .section h3 {
    font-size: 11pt;
    font-weight: 700;
    margin: 18px 0 10px 0;
    text-align: left;
    page-break-after: avoid;
    break-after: avoid;
    display: block;
}

body.pdf-exporting .section p {
    margin: 10px 0;
    text-align: justify;
    text-indent: 0;
    line-height: 1.6;
    orphans: 3;
    widows: 3;
    hyphens: auto;
}

body.pdf-exporting .academic-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 9pt;
    page-break-inside: avoid;
    break-inside: avoid;
    column-span: all;
    display: table;
    margin-left: 0;
    margin-right: 0;
}

body.pdf-exporting .academic-table caption {
    font-weight: 700;
    margin-bottom: 8px;
    text-align: left;
    font-size: 9pt;
    column-span: all;
}

body.pdf-exporting .abstract {
    margin: 25px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-left: 3px solid #000;
    column-span: all;
}

body.pdf-exporting .paper-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #000;
    column-span: all;
}

body.pdf-exporting .paper-title {
    font-size: 16pt;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.3;
    text-align: center;
}

body.pdf-exporting .references {
    margin: 30px 0;
    padding-top: 20px;
    border-top: 1px solid #000;
    column-span: all;
}

body.pdf-exporting .references ol {
    margin-left: 0;
    padding-left: 25px;
    column-count: 2;
    column-gap: 20px;
}

/* Responsive for smaller screens */
@media (max-width: 900px) {
    .paper-container {
        padding: 40px 30px;
        max-width: 100%;
    }
    
    .export-controls {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .paper-content {
        column-count: 1;
    }
}

@media (max-width: 600px) {
    .paper-container {
        padding: 20px 15px;
    }
    
    .paper-title {
        font-size: 14pt;
    }
    
    .paper-content {
        column-count: 1;
    }
    
    .academic-table {
        font-size: 8pt;
    }
    
    .findings-table {
        font-size: 7pt;
    }
    
    .academic-table th,
    .academic-table td {
        padding: 4px 6px;
    }
}
