/* Print Stylesheet */

@media print {
    /* Hide UI elements */
    .sidebar,
    .sidebar-toggle,
    .editor-toolbar,
    .editor-header .editor-actions,
    .editor-footer,
    .modal-backdrop,
    .toast-container,
    .context-menu,
    .search-container,
    .sidebar-footer {
        display: none !important;
    }

    /* Reset layout */
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.5;
    }

    .app-container,
    .main-view,
    .content {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .content {
        margin-left: 0 !important;
    }

    .editor-container {
        height: auto !important;
    }

    /* Hide editor, show only preview */
    .EasyMDEContainer .CodeMirror,
    .EasyMDEContainer .editor-toolbar {
        display: none !important;
    }

    .EasyMDEContainer .editor-preview,
    .EasyMDEContainer .editor-preview-side {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: white !important;
        padding: 0 !important;
    }

    /* Note title */
    .note-title {
        font-size: 24pt !important;
        font-weight: bold !important;
        margin-bottom: 1cm !important;
        padding: 0 !important;
        border-bottom: 2pt solid black !important;
    }

    /* Typography for print */
    h1 { font-size: 18pt; margin-top: 0.5cm; }
    h2 { font-size: 14pt; margin-top: 0.4cm; }
    h3 { font-size: 12pt; margin-top: 0.3cm; }

    p, li {
        orphans: 3;
        widows: 3;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        break-after: avoid;
    }

    img, table, pre {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Links - show URLs */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }

    /* Code blocks */
    pre, code {
        background-color: #f5f5f5 !important;
        border: 1px solid #ddd !important;
        font-size: 10pt;
    }

    pre {
        padding: 0.5cm !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }

    /* Tables */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
    }

    th, td {
        border: 1px solid #333 !important;
        padding: 0.25cm 0.5cm !important;
    }

    th {
        background-color: #eee !important;
    }

    /* Blockquotes */
    blockquote {
        border-left: 4pt solid #333 !important;
        margin: 0.5cm 0 !important;
        padding-left: 0.5cm !important;
        font-style: italic;
    }

    /* Page margins */
    @page {
        margin: 2cm;
    }

    @page :first {
        margin-top: 3cm;
    }

    /* Running headers/footers (CSS Paged Media - limited browser support) */
    @page {
        @top-right {
            content: counter(page);
        }
    }
}
