/**
 * Print utilities for CryptPeer guides and commercial presentation
 * Include this file on pages that offer "Print / Download as PDF"
 * Usage: Add class "print-utils" to body, and a button with class "guide-print-btn"
 * Compatible: guides/*.html, future presentation commerciale
 */

/* Print button - screen only */
.guide-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #00c2a8;
    background: rgba(0, 194, 168, 0.1);
    border: 1px solid rgba(0, 194, 168, 0.3);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.guide-print-btn:hover {
    background: #00c2a8;
    color: #fff;
    border-color: #00c2a8;
}
.guide-print-btn i {
    font-size: 0.9rem;
}

/* Align print button with header elements */
.guide-page-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ========== PRINT STYLES — A4 calibration ========== */
@media print {
    /* A4 page setup */
    @page {
        size: A4;
        margin: 15mm;
    }

    /* Hide navigation, header, sidebars, buttons */
    .main-header,
    .guide-nav,
    .guide-nav-mobile,
    .guides-sidebar,
    .guides-sidebar-toggle,
    .guides-back-to-top,
    .guide-back-to-top,
    .guide-lang-switch,
    .guide-print-btn,
    .guide-header-back {
        display: none !important;
    }

    /* Full width content — A4 compatible */
    html, body {
        background: #fff !important;
        font-size: 10pt;
        line-height: 1.4;
        color: #000;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
    }
    .guide-content-area,
    .guides-content {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }
    .guide-main {
        padding-left: 0 !important;
        max-width: none !important;
    }
    .guides-wrapper {
        display: block !important;
    }

    /* Content width — fit A4 with margins */
    .guide-content-area,
    .guides-content,
    .guide-main {
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Header - compact for print */
    .guide-page-header {
        margin-top: 0 !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        border-bottom: 1px solid #999 !important;
        background: #fff !important;
    }
    .guides-hero {
        box-shadow: none !important;
        border: 1px solid #999 !important;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    .guides-hero h1 { font-size: 1.2rem !important; }
    .guides-hero .subtitle { font-size: 0.9rem !important; }

    /* Typography — readable on A4 */
    h1 { font-size: 1.3rem !important; page-break-after: avoid; }
    h2 { font-size: 1.1rem !important; page-break-after: avoid; }
    h3 { font-size: 1rem !important; page-break-after: avoid; }
    p { orphans: 3; widows: 3; }

    /* Links — keep readable */
    a[href] {
        color: #000 !important;
        text-decoration: underline;
    }
    a[href]::after { content: none; }

    /* Images - avoid breaking, fit width */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }
    figure {
        page-break-inside: avoid;
        margin: 0.75rem 0 !important;
    }

    /* Sections - avoid awkward breaks */
    .guide-section {
        page-break-inside: avoid;
    }
    .guide-card,
    .guides-cta-card {
        page-break-inside: avoid;
    }
    .guide-section,
    .guides-intro,
    .guide-encadre {
        page-break-inside: avoid;
    }

    /* Tables */
    table { page-break-inside: avoid; }

    /* Footer - minimal */
    .main-footer .footer-container {
        border-top: 1px solid #999;
        padding-top: 0.75rem;
    }

    /* Remove shadows, transitions, backgrounds for print */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    .guide-encadre,
    .guide-encadre-savoir,
    .guide-encadre-attention {
        border: 1px solid #999 !important;
        background: #f9f9f9 !important;
    }

    /* Template / presentation commerciale — header simplifié */
    .guide-header {
        background: #fff !important;
        color: #000 !important;
        border-bottom: 1px solid #999 !important;
        padding: 1rem !important;
    }
}
