@import url('https://cdnjs.cloudflare.com/ajax/libs/primeicons/4.1.0/primeicons.min.css');

/* ✅ print-styles.css — STRUCTURE GÉNÉRALE POUR TOUS LES DOCUMENTS */
@media print {
    /* Reset et base */
    body {
        margin: 0;
        padding: 15px;
        font-family: 'Tahoma', Tahoma, Geneva, Verdana, sans-serif;
        color: #000;
        background: #fff;
        font-size: 15px;
        line-height: 1.3;
        min-width: unset !important;
    }

    /* STRUCTURE GÉNÉRALE DE L'EN-TÊTE POUR TOUS LES DOCUMENTS */
    .flex.justify-content-between.align-items-start {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        margin-bottom: 20px;
        width: 100%;
        gap: 14px;
    }

    /* COLONNE GAUCHE - INFOS SOCIÉTÉ */
    .flex.justify-content-between.align-items-start > div:first-child {
        width: 40% !important;
        padding: 10px !important;
        text-align: left;
    }

    /* COLONNE DROITE - TOUT LE CONTENU DROITE */
    .flex.justify-content-between.align-items-start > div:last-child {
        width: 55% !important;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
    }

    /* TITRE DOCUMENT (Facture, BL, BC, Devis) */
    .font-bold.text-3xl {
        font-size: 20px !important; /* Augmenté de 18px à 22px */
        font-weight: bold !important;
        text-align: center;
        margin: 0 0 10px 0 !important; /* Augmenté de 8px à 10px */
        width: 100%;
    }

    /* RÉFÉRENCE ET DATE - EN HAUT À DROITE */
    .flex.gap-2.flex-column {
        padding: 10px !important;
        text-align: right;
        width: 100%;
        margin: 0 !important;
    }

    .flex.gap-2.flex-column p {
        margin: 3px 0 !important; /* Augmenté de 2px à 3px */
        font-size: 13px !important; /* Augmenté de 11px à 13px */
        font-weight: bold !important;
    }

    /* BLOC CLIENT - EN BAS À DROITE - LARGEUR RÉDUITE */
    .border-1.border-round.p-2 {
        border: 1px solid #000 !important;
        border-radius: 8px !important;
        padding: 8px !important; /* Padding réduit */
        text-align: left; /* Retour à l'alignement gauche */
        margin-top: 0 !important;
        width: 50% !important; /* RÉDUIT de 75% à 50% */
        min-width: 200px; /* Largeur minimale */
        max-width: 300px; /* Largeur maximale */
    }

    .border-1.border-round.p-2 .font-bold {
        font-size: 15px !important;
        margin-bottom: 6px !important;
        text-align: center;
        font-weight: bold !important;
    }

    .border-1.border-round.p-2 p {
        margin: 2px 0 !important;
        font-size: 13px !important;
        line-height: 1.3; /* Ligne plus serrée */
    }

    /* === STYLES COMMUNS DES TABLEAUX === */
    table {
        border: 1px solid #000000;
        border-collapse: collapse;
        width: 100%;
    }

    th, td {
        border-bottom: 0.25px solid #000000;
        background-color: #ffffff;
        padding: 8px; /* Augmenté de 6px à 8px */
        text-align: left;
        font-size: 13px; /* Augmenté de 10px à 12px */
    }

    th {
        border-top: 1px solid #000000;
        background: #e0e0e0 !important;
    }

    /* TABLEAU PRODUITS */
    #listAchatContent {
        margin: 20px 0; /* Augmenté de 15px à 20px */
        width: 100%;
    }

    #listAchatContent table {
        width: 100%;
        border-collapse: collapse;
        border: 1px solid #000;
    }

    #listAchatContent th,
    #listAchatContent td {
        padding: 8px; /* Augmenté de 6px à 8px */
        font-size: 12px; /* Augmenté de 10px à 12px */
        text-align: left;
    }

    /* FOOTER COMMUN */
    .flex.justify-content-between.mt-4 {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-top: 20px; /* Augmenté de 15px à 20px */
        width: 100%;
        gap: 12px; /* Augmenté de 10px à 12px */
    }

    /* Tableau TIM/Taxes (gauche) */
    .flex.flex-column.col-4 {
        width: 45%;
    }

    /* Tableau Totaux (droite) */
    .flex.flex-column.col-7 {
        width: 50%;
    }

    /* Styles des tableaux footer */
    .flex.justify-content-between.mt-4 table {
        width: 100%;
        border-collapse: collapse;
        border: 1px solid #000;
        font-size: 12px; /* Augmenté de 10px à 12px */
    }

    .flex.justify-content-between.mt-4 th,
    .flex.justify-content-between.mt-4 td {
        padding: 6px; /* Augmenté de 4px à 6px */
        text-align: center;
    }

    /* Message en lettres */
    .ml-8.mr-8 {
        margin: 12px 0; /* Augmenté de 8px à 12px */
        padding: 12px; /* Augmenté de 8px à 12px */
        font-size: 13px; /* Augmenté de 11px à 13px */
    }

    .ml-8.mr-8 .text-2xl {
        font-size: 14px; /* Augmenté de 12px à 14px */
        font-weight: bold;
        margin-bottom: 8px; /* Augmenté de 3px à 5px */
    }

    .ml-8.mr-8 .text-xl {
        font-size: 13px; /* Augmenté de 11px à 13px */
        font-style: normal;
    }

    /* Cachet et signature */
    .flex.justify-content-end.mr-8.ml-8.mt-2 {
        text-align: right;
        margin-top: 20px; /* Augmenté de 15px à 20px */
        padding-top: 12px; /* Augmenté de 8px à 12px */
        border-top: 1px dashed #000;
        font-size: 11px;
    }

    /* Cacher éléments inutiles */
    button, [pButton], .p-paginator, .p-multiSelect, .no-print, .p-panel, p-panel {
        display: none !important;
    }

    /* Optimisation impression */
    * {
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        box-sizing: border-box;
    }

    table {
        page-break-inside: avoid;
    }

    /* Masquer les éléments de l'interface */
    .p-flex-wrap, .p-justify-content-end, .p-align-items-center, .p-gap-2 {
        display: none !important;
    }
    /* STYLES POUR LES ICÔNES PRIMEICONS */
    .pi-check-circle,
    .pi-times-circle,
    .pi {
        display: inline-block !important;
        visibility: visible !important;
        font-family: "PrimeIcons", serif !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        font-size: 16px !important;
    }

    /* Section description de l'échange */
    .flex.flex-column.align-items-center.w-full.mt-4.mb-4.p-4.bg-gray-50.rounded {
        background: #f8f9fa !important;
        border: 1px solid #dee2e6 !important;
        margin: 20px 0 !important;
        padding: 15px !important;
    }

    .flex.flex-column.gap-2 {
        width: 100% !important;
    }

    .flex.flex-row.gap-4 {
        display: flex !important;
        justify-content: space-between !important;
        margin-bottom: 8px !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dashed #ccc !important;
    }

    .flex.flex-row.gap-4:last-child {
        border-bottom: none !important;
        margin-bottom: 0 !important;
    }

    /* Section montant */
    .mt-4.flex.flex-column.align-items-center.border-t.pt-4 {
        margin-top: 25px !important;
        padding-top: 20px !important;
        border-top: 2px solid #000 !important;
        text-align: center !important;
    }

    /* Couleurs pour les types d'échange */
    .text-red-600 {
        color: #dc2626 !important;
    }

    .text-green-600 {
        color: #16a34a !important;
    }

    /* Masquer les éléments avec la classe "hide-on-print" uniquement pendant l'impression */
    .hide-on-print {
        display: none !important;
        visibility: hidden !important;
    }
}