/* CSS d'impression A4 propre - WTMF-Conseil - Version corrigée */
@media print {
    /* Configuration de base A4 */
    @page {
        size: A4;
        margin: 1.5cm 1cm 1.5cm 1cm;
        orphans: 2;
        widows: 2;
    }
    
    /* Reset complet */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        box-sizing: border-box !important;
    }
    
    /* Body et HTML */
    html {
        width: 100% !important;
        height: auto !important;
    }
    
    body {
        font-family: "Arial", sans-serif !important;
        font-size: 10pt !important;
        line-height: 1.4 !important;
        color: #000 !important;
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        overflow: visible !important;
    }
    
    /* Masquer éléments non imprimables */
    .no-print,
    header.no-print,
    nav,
    button,
    .hover\:bg-blue-600,
    .hover\:bg-gray-500,
    .hover\:bg-purple-600,
    .hover\:bg-orange-500 {
        display: none !important;
    }
    
    /* Container principal */
    .max-w-4xl {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
    
    /* SAUTS DE PAGE - GESTION PROPRE */
    .page-break {
        page-break-before: always !important;
        break-before: page !important;
        display: block !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        clear: both !important;
    }
    
    /* Sections principales */
    section {
        display: block !important;
        width: 100% !important;
        margin-bottom: 20pt !important;
        padding: 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: visible !important;
        position: relative !important;
    }
    
    /* Sections longues autorisées à être coupées */
    section.allow-break {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }
    
    /* TITRES - Tailles et espacements corrects */
    h1, .text-3xl {
        font-size: 18pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 16pt 0 12pt 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        line-height: 1.2 !important;
    }
    
    h2, .text-2xl {
        font-size: 16pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 14pt 0 10pt 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        line-height: 1.2 !important;
    }
    
    h3, .text-xl {
        font-size: 14pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 12pt 0 8pt 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        line-height: 1.2 !important;
    }
    
    h4, .text-lg {
        font-size: 12pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 10pt 0 6pt 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        line-height: 1.2 !important;
    }
    
    h5, h6 {
        font-size: 11pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 8pt 0 4pt 0 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
        line-height: 1.2 !important;
    }
    
    /* PARAGRAPHES */
    p {
        margin: 0 0 8pt 0 !important;
        line-height: 1.4 !important;
        text-align: left !important;
        orphans: 2 !important;
        widows: 2 !important;
    }
    
    /* LISTES */
    ul, ol {
        margin: 8pt 0 12pt 0 !important;
        padding-left: 20pt !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    ul.allow-break, ol.allow-break {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }
    
    li {
        margin-bottom: 4pt !important;
        line-height: 1.4 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* CONTENEURS COLORÉS */
    .bg-purple-50,
    .bg-blue-50,
    .bg-green-50,
    .bg-orange-50,
    .bg-red-50,
    .bg-yellow-50,
    .bg-gray-50 {
        background-color: #f8f9fa !important;
        border: 1pt solid #dee2e6 !important;
        padding: 8pt !important;
        margin: 8pt 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    .bg-gradient-to-r {
        background: #f0f0f0 !important;
        border: 2pt solid #666 !important;
        color: #000 !important;
        padding: 8pt !important;
        margin: 8pt 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* BORDURES */
    .border-l-4 {
        border-left: 3pt solid #000 !important;
        padding-left: 10pt !important;
    }
    
    .border-purple-600 { border-color: #7c3aed !important; }
    .border-blue-600 { border-color: #2563eb !important; }
    .border-green-600 { border-color: #16a34a !important; }
    
    /* COULEURS DE TEXTE */
    .text-purple-800,
    .text-purple-700,
    .text-blue-800,
    .text-blue-700,
    .text-green-800,
    .text-green-700,
    .text-gray-800,
    .text-gray-700 {
        color: #000 !important;
        font-weight: bold !important;
    }
    
    /* ICÔNES SIMPLIFIÉES */
    .fas::before,
    i.fas::before {
        content: "■ " !important;
        font-family: "Arial", sans-serif !important;
        font-weight: normal !important;
    }
    
    /* ESPACEMENTS TAILWIND */
    .mb-8 { margin-bottom: 16pt !important; }
    .mb-6 { margin-bottom: 12pt !important; }
    .mb-4 { margin-bottom: 8pt !important; }
    .mb-2 { margin-bottom: 4pt !important; }
    .mb-3 { margin-bottom: 6pt !important; }
    
    .mt-6 { margin-top: 12pt !important; }
    .mt-4 { margin-top: 8pt !important; }
    .mt-2 { margin-top: 4pt !important; }
    
    .p-6 { padding: 12pt !important; }
    .p-4 { padding: 8pt !important; }
    .p-3 { padding: 6pt !important; }
    .p-2 { padding: 4pt !important; }
    
    .pl-4 { padding-left: 8pt !important; }
    .pb-6 { padding-bottom: 12pt !important; }
    
    /* GRILLES - Conversion en blocs simples */
    .grid {
        display: block !important;
        width: 100% !important;
    }
    
    .grid > div {
        display: block !important;
        width: 100% !important;
        margin-bottom: 8pt !important;
    }
    
    /* Pour les grilles 2 colonnes, essayer de préserver la mise en page */
    .md\:grid-cols-2 > div:nth-child(odd) {
        width: 48% !important;
        display: inline-block !important;
        vertical-align: top !important;
        margin-right: 4% !important;
    }
    
    .md\:grid-cols-2 > div:nth-child(even) {
        width: 48% !important;
        display: inline-block !important;
        vertical-align: top !important;
    }
    
    /* FLEXBOX - Conversion en blocs */
    .flex {
        display: block !important;
    }
    
    .flex.items-center {
        display: block !important;
    }
    
    .flex.items-start {
        display: block !important;
    }
    
    /* ÉLÉMENTS SPÉCIALISÉS */
    .space-y-2 > * { margin-bottom: 4pt !important; }
    .space-y-1 > * { margin-bottom: 2pt !important; }
    
    /* TABLEAUX */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 8pt 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    th, td {
        border: 1pt solid #000 !important;
        padding: 4pt 6pt !important;
        text-align: left !important;
        vertical-align: top !important;
        font-size: 9pt !important;
    }
    
    /* LIENS */
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    /* ÉLÉMENTS FLOTTANTS ET POSITIONNÉS */
    .fixed, .absolute, .relative {
        position: static !important;
    }
    
    /* SUPPRESSION DES EFFETS VISUELS */
    .shadow-lg, .shadow, .shadow-sm {
        box-shadow: none !important;
    }
    
    .rounded-lg, .rounded, .rounded-full {
        border-radius: 0 !important;
    }
    
    /* CORRECTIONS SPÉCIFIQUES POUR ÉVITER LA SUPERPOSITION */
    .w-8.h-8 {
        width: 20pt !important;
        height: 20pt !important;
        line-height: 20pt !important;
        display: inline-block !important;
        text-align: center !important;
        background: #000 !important;
        color: white !important;
        margin-right: 8pt !important;
        vertical-align: top !important;
    }
    
    .ml-11 {
        margin-left: 28pt !important;
    }
    
    /* CORRECTIONS POUR ÉVITER LE CHEVAUCHEMENT */
    * {
        position: static !important;
        float: none !important;
        transform: none !important;
        z-index: auto !important;
    }
    
    /* ESPACEMENT VERTICAL FORCÉ */
    div, section, article {
        clear: both !important;
    }
    
    /* FOOTER */
    footer {
        margin-top: 20pt !important;
        padding-top: 10pt !important;
        border-top: 1pt solid #000 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}