/* Print-Optimized CSS for BeautifyMD */

@media print {
    /* Page setup */
    @page {
        size: A4;
        margin: 2.5cm;
        
        @top-right {
            content: counter(page);
            font-size: 10pt;
            color: #666;
        }
        
        @bottom-center {
            content: "BeautifyMD";
            font-size: 9pt;
            color: #999;
        }
    }
    
    /* Remove screen-only elements */
    .navbar,
    .footer,
    .document-actions,
    .document-header .btn,
    .source-view,
    .ads-container,
    .header-content,
    button,
    .btn,
    .toc-link,
    .headerlink,
    a.headerlink,
    a.toc-link {
        display: none !important;
    }
    
    /* Reset body for print */
    body {
        margin: 0;
        padding: 0;
        background: white;
        color: black;
        font-size: 11pt;
        line-height: 1.6;
    }
    
    /* Container adjustments */
    .container,
    .document-viewer,
    .document-content {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    /* Typography adjustments */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
        margin-top: 1.5em;
        color: black !important;
    }
    
    h1 {
        font-size: 24pt;
        margin-top: 0;
        padding-bottom: 0.5em;
        border-bottom: 2pt solid #000;
    }
    
    h2 {
        font-size: 18pt;
        margin-top: 2em;
    }
    
    h3 {
        font-size: 14pt;
    }
    
    p {
        orphans: 3;
        widows: 3;
        text-align: justify;
        margin-bottom: 1em;
    }
    
    /* Links */
    a {
        color: black !important;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    
    a[href^="#"]:after {
        content: "";
    }
    
    /* Lists */
    ul, ol {
        page-break-inside: avoid;
        margin: 1em 0;
        padding-left: 2em;
    }
    
    li {
        line-height: 1.5;
        margin-bottom: 0.5em;
    }
    
    /* Code blocks */
    pre, code {
        font-family: 'Courier New', Courier, monospace;
        font-size: 10pt;
        background: #f5f5f5 !important;
        border: 1pt solid #ddd;
        page-break-inside: avoid;
    }
    
    pre {
        padding: 1em;
        margin: 1em 0;
        overflow-x: visible;
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    
    code {
        padding: 0.2em 0.4em;
    }
    
    /* Tables */
    table {
        page-break-inside: avoid;
        width: 100%;
        border-collapse: collapse;
        margin: 1em 0;
    }
    
    th, td {
        border: 1pt solid #ddd;
        padding: 0.5em;
        text-align: left;
    }
    
    th {
        background: #f5f5f5 !important;
        font-weight: bold;
    }
    
    /* Images and figures */
    img {
        max-width: 100%;
        height: auto;
        page-break-inside: avoid;
        page-break-before: auto;
        page-break-after: auto;
    }
    
    figure {
        page-break-inside: avoid;
        margin: 1em 0;
        text-align: center;
    }
    
    figcaption {
        font-size: 0.9em;
        color: #666;
        margin-top: 0.5em;
    }
    
    /* Blockquotes */
    blockquote {
        page-break-inside: avoid;
        border-left: 3pt solid #ccc;
        padding-left: 1em;
        margin: 1em 0;
        font-style: italic;
        color: #555;
    }
    
    /* Mermaid diagrams */
    .mermaid {
        page-break-inside: avoid;
        text-align: center;
        margin: 1em 0;
        background: white !important;
        border: 1pt solid #ddd;
        padding: 1em;
    }
    
    .mermaid svg {
        max-width: 100%;
        height: auto;
    }
    
    /* Document metadata */
    .document-meta {
        display: none;
    }
    
    /* Page breaks */
    .page-break {
        page-break-after: always;
    }
    
    .no-break {
        page-break-inside: avoid;
    }
    
    /* Style-specific adjustments */
    .formal-style {
        font-family: 'Times New Roman', Times, serif;
    }
    
    .gartner-style h1,
    .gartner-style h2 {
        color: #0066cc !important;
    }
    
    .mckinsey-style h1,
    .mckinsey-style h2 {
        color: #003A70 !important;
    }
    
    .executive-style {
        font-family: 'Arial', sans-serif;
    }
    
    .study-style .note,
    .study-style .definition,
    .study-style .example {
        border: 1pt solid #ddd;
        padding: 0.5em;
        margin: 1em 0;
        page-break-inside: avoid;
    }
    
    /* Ensure content fills the page */
    .document-container {
        min-height: 100vh;
    }
    
    /* Remove shadows and backgrounds */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Force black text for better readability */
    body,
    h1, h2, h3, h4, h5, h6,
    p, li, td, th {
        color: black !important;
    }
}