/* ====================== */
/* PRINT / EXPORT PDF     */
/* ====================== */

/* 
   When the print dialog opens, we only want to show the dynamically 
   created .print-area or the #cvPreview content.
   Logic: export.js creates a cloned .print-area appended to body.
*/

@media print {

    /* Hide EVERYTHING by default */
    body>* {
        display: none !important;
    }

    /* Except the print container */
    body>.print-area {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 210mm !important;
        /* A4 width */
        height: 297mm !important;
        /* A4 height */
        max-width: 210mm !important;
        max-height: 297mm !important;
        z-index: 9999 !important;
        margin: 0 !important;
        padding: 0 !important;

        /* CRITICAL: Reset any mobile transforms/scales */
        transform: none !important;
        scale: 1 !important;
        overflow: visible !important;
    }

    /* Force A4 page size */
    @page {
        size: A4 portrait;
        margin: 0;
    }

    /* Ensure content fits A4 exactly */
    .print-area>* {
        max-width: 210mm !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;

        /* Reset mobile transforms */
        transform: none !important;
        scale: 1 !important;
    }

    /* Print exact colors (no grayscale conversion) */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Reset viewport units to absolute */
    html,
    body {
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* Ensure no responsive scaling interferes */
    #cvPreview,
    .resume-preview,
    [class*="template-"] {
        transform: none !important;
        scale: 1 !important;
        width: 210mm !important;
        max-width: 210mm !important;
    }
}