/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Drop zone active state */
#drop-zone.dragover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

/* Preview container styles */
#preview-container .notebook-cell {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

#preview-container .cell-markdown {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.6;
}

#preview-container .cell-markdown h1 { font-size: 1.5em; font-weight: 700; margin: 8px 0; }
#preview-container .cell-markdown h2 { font-size: 1.3em; font-weight: 600; margin: 8px 0; }
#preview-container .cell-markdown h3 { font-size: 1.1em; font-weight: 600; margin: 8px 0; }
#preview-container .cell-markdown p { margin: 4px 0; }
#preview-container .cell-markdown ul,
#preview-container .cell-markdown ol { padding-left: 20px; margin: 4px 0; }

#preview-container .cell-code {
    padding: 0;
    border-bottom: 1px solid #e5e7eb;
}

#preview-container .cell-code pre {
    margin: 0;
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
}

#preview-container .cell-code pre code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

#preview-container .cell-output {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    line-height: 1.5;
}

#preview-container .cell-output pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

#preview-container .cell-output img {
    max-width: 100%;
    height: auto;
}

/* Template: Clean White */
.template-clean .notebook-cell,
.template-clean .cell-code,
.template-clean .cell-markdown {
    background: white;
}

.template-clean .cell-code pre {
    background: #f8f9fa;
    border-radius: 4px;
}

.template-clean .cell-output {
    background: #fafafa;
}

/* Template: Academic Blue */
.template-academic .notebook-cell,
.template-academic .cell-code,
.template-academic .cell-markdown {
    background: white;
}

.template-academic .cell-code pre {
    background: #f0f4ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0;
}

.template-academic .cell-markdown h1,
.template-academic .cell-markdown h2 {
    color: #1e40af;
    border-bottom: 2px solid #dbeafe;
    padding-bottom: 4px;
}

/* Template: Dark */
.template-dark .notebook-cell,
.template-dark .cell-code,
.template-dark .cell-markdown {
    background: #1e1e1e;
    color: #d4d4d4;
    border-bottom-color: #333;
}

.template-dark .cell-markdown h1,
.template-dark .cell-markdown h2,
.template-dark .cell-markdown h3 {
    color: #e0e0e0;
}

.template-dark .cell-output {
    background: #2d2d2d;
    color: #d4d4d4;
    border-bottom-color: #333;
}

.template-dark .cell-output pre {
    color: #d4d4d4;
}

/* PDF render styles */
.pdf-container {
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: #1a1a1a;
}

.pdf-container .notebook-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.pdf-container .cell-markdown {
    margin: 16px 0;
    line-height: 1.7;
}

.pdf-container .cell-code {
    margin: 12px 0;
    page-break-inside: avoid;
}

.pdf-container .cell-code pre {
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    overflow-x: hidden;
}

.pdf-container .cell-output {
    margin: 8px 0 16px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    page-break-inside: avoid;
}

.pdf-container .cell-output img {
    max-width: 100%;
}

/* Print styles — hide UI chrome, show only preview content */
@media print {
    /* Hide navigation, header, footer, and all UI chrome */
    nav,
    header,
    footer,
    .no-print,
    .print-hide {
        display: none !important;
    }

    /* Hide the hero section */
    section:first-of-type {
        display: none !important;
    }

    /* Hide "How it Works" and "Why" sections */
    section:nth-of-type(3),
    section:nth-of-type(4) {
        display: none !important;
    }

    /* Hide all upload / progress / error UI */
    #drop-zone,
    #file-info,
    #options-section,
    #convert-btn,
    #upload-section,
    #progress-section,
    #error-section {
        display: none !important;
    }

    /* Show result section */
    #result-section {
        display: block !important;
    }

    /* Hide the green success bar and "convert another" button inside result */
    #download-btn,
    #convert-another-btn {
        display: none !important;
    }

    /* Hide result-section's top bar (green success header) and bottom actions */
    #result-section > div:first-child,
    #result-section > div:last-child {
        display: none !important;
    }

    /* Reset the preview container to full page */
    #preview-container {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Show only content cells at full width */
    #preview-container .notebook-cell {
        page-break-inside: avoid;
    }

    /* A4 page setup */
    @page {
        size: A4;
        margin: 15mm;
    }

    body {
        background: white !important;
    }
}

/* Loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
