/* Print-Only Stylesheet for Knowledge Base Articles */
@media print {
    /* NUCLEAR OPTION: Hide everything at the root level */
    body > *:not(main):not(.print-article-title):not(.print-article-content) {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }

    /* Hide all Flux components except main content */
    flux\\:sidebar,
    [data-flux-sidebar],
    [data-flux-navbar],
    [data-flux-header],
    aside,
    nav,
    header,
    footer,
    /* Hide Livewire elements */
    [wire\\:id],
    [wire\\:snapshot],
    /* Hide everything in body initially */
    body * {
        display: none !important;
    }

    /* Force show ONLY our article elements */
    .print-article-title,
    .print-article-title *,
    .print-article-content,
    .print-article-content * {
        display: block !important;
        visibility: visible !important;
        position: static !important;
    }

    /* Inline elements */
    .print-article-content a,
    .print-article-content span,
    .print-article-content strong,
    .print-article-content em,
    .print-article-content code:not(pre code) {
        display: inline !important;
    }

    .print-article-content li {
        display: list-item !important;
    }

    /* Body and HTML reset */
    html,
    body {
        display: block !important;
        visibility: visible !important;
        font-size: 12pt !important;
        line-height: 1.6 !important;
        color: #000 !important;
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Containers */
    .print-article-title {
        display: block !important;
        width: 100% !important;
        max-width: 18cm !important;
        margin: 1cm auto 0.5cm auto !important;
        padding: 0 !important;
    }

    .print-article-content {
        display: block !important;
        width: 100% !important;
        max-width: 18cm !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    /* Title styling */
    .print-article-title h1,
    .print-article-title h1 * {
        display: block !important;
        font-size: 24pt !important;
        font-weight: bold !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #000 !important;
        line-height: 1.3 !important;
    }

    /* Content headings */
    .print-article-content h2,
    .print-article-content h2 * {
        display: block !important;
        font-size: 18pt !important;
        font-weight: bold !important;
        margin: 0.7cm 0 0.3cm 0 !important;
        color: #000 !important;
        page-break-after: avoid !important;
    }

    .print-article-content h3,
    .print-article-content h3 * {
        display: block !important;
        font-size: 14pt !important;
        font-weight: bold !important;
        margin: 0.5cm 0 0.3cm 0 !important;
        color: #000 !important;
        page-break-after: avoid !important;
    }

    /* Paragraphs */
    .print-article-content p {
        display: block !important;
        margin: 0.3cm 0 !important;
        color: #000 !important;
        orphans: 3 !important;
        widows: 3 !important;
    }

    /* Code blocks */
    .print-article-content pre {
        display: block !important;
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid !important;
        font-size: 10pt !important;
        padding: 0.3cm !important;
        margin: 0.4cm 0 !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }

    .print-article-content code {
        display: inline !important;
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
        padding: 0.1cm 0.2cm !important;
        font-size: 10pt !important;
        color: #000 !important;
    }

    .print-article-content pre code {
        display: block !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    /* Images */
    .print-article-content img {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
        margin: 0.4cm 0 !important;
    }

    /* Links */
    .print-article-content a {
        display: inline !important;
        color: #000 !important;
        text-decoration: underline !important;
    }

    .print-article-content a[href]:after {
        content: " (" attr(href) ")" !important;
        font-size: 9pt !important;
        color: #666 !important;
    }

    /* Lists */
    .print-article-content ul,
    .print-article-content ol {
        display: block !important;
        margin: 0.4cm 0 !important;
        padding-left: 0.8cm !important;
        list-style-position: outside !important;
    }

    .print-article-content li {
        display: list-item !important;
        margin: 0.2cm 0 !important;
    }

    .print-article-content ul {
        list-style-type: disc !important;
    }

    .print-article-content ol {
        list-style-type: decimal !important;
    }

    /* Tables */
    .print-article-content table {
        display: table !important;
        border-collapse: collapse !important;
        width: 100% !important;
        margin: 0.4cm 0 !important;
    }

    .print-article-content thead {
        display: table-header-group !important;
    }

    .print-article-content tbody {
        display: table-row-group !important;
    }

    .print-article-content tr {
        display: table-row !important;
    }

    .print-article-content th,
    .print-article-content td {
        display: table-cell !important;
        border: 1px solid #ddd !important;
        padding: 0.2cm !important;
        text-align: left !important;
    }

    /* Blockquotes */
    .print-article-content blockquote {
        display: block !important;
        margin: 0.4cm 0 !important;
        padding: 0.3cm !important;
        border-left: 3px solid #ddd !important;
        background: #f9f9f9 !important;
    }

    /* Remove decorations */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    /* Page setup */
    @page {
        margin: 1.5cm;
        size: A4;
    }
}
