/* Réinitialisation des marges et suppression des éléments non essentiels */
@media print {
    body * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Masquer les éléments non nécessaires à l'impression */
    header, footer, nav, .sidebar, .widget, .comments, .related-posts, .share-buttons, .ads, iframe, .search-form, .menu, .social-icons {
        display: none !important;
    }

    /* Optimiser la mise en page pour l'impression */
    .site-content, .entry-content, .post-content, article {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
        background: white !important;
        color: black !important;
        font-size: 12pt !important;
        line-height: 1.5 !important;
    }

    /* Gestion des images */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    /* Éviter les sauts de page inutiles */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    p, ul, ol, blockquote {
        orphans: 3;
        widows: 3;
        page-break-inside: avoid;
    }

    /* Liens : afficher les URLs après le texte */
    a[href]:after {
        content: " (" attr(href) ") ";
        font-size: 0.8em;
        color: #999;
    }

    /* Tableaux : éviter les sauts de page */
    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    /* Polices et lisibilité */
    body {
        font-family: Arial, sans-serif !important;
        font-size: 12pt !important;
        line-height: 1.5 !important;
    }

    /* Titres */
    h1 {
        font-size: 18pt !important;
        margin-bottom: 0.5em !important;
    }

    h2 {
        font-size: 16pt !important;
        margin-bottom: 0.4em !important;
    }

    h3 {
        font-size: 14pt !important;
        margin-bottom: 0.3em !important;
    }

    /* Pied de page personnalisé pour l'impression */
    @page {
        margin: 1cm;
    }

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

    @page :left {
        @bottom-left {
            content: "© " attr(data-site-name);
            font-size: 8pt;
        }
    }

    @page :right {
        @bottom-right {
            content: counter(page);
            font-size: 8pt;
        }
    }
}