/* ==========================================================================
   EVOC AIR - FEUILLE DE STYLE HAUTE DEFINITION POUR IMPRESSION (@media print)
   ========================================================================== */

#print-container {
    display: none;
}

@media print {
    /* Masquer l'application web générale */
    body * {
        visibility: hidden;
    }

    #print-container, #print-container * {
        visibility: visible;
    }

    #print-container {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #ffffff;
        color: #000000;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    @page {
        margin: 8mm 10mm;
        size: auto;
    }

    /* -------------------------------------------------------------------------
       1. FORMAT STANDARD A4 (FACTURE, BL, PROFORMA, TRANSFERT)
       ------------------------------------------------------------------------- */
    .print-doc-a4 {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 13px;
        color: #1e293b;
        box-sizing: border-box;
        page-break-after: always;
    }

    .doc-header-grid {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: 2.5px solid #0f172a;
        padding-bottom: 16px;
        margin-bottom: 22px;
        width: 100%;
    }

    .company-brand h1 {
        font-size: 24px;
        font-weight: 800;
        color: #0f172a;
        margin-bottom: 4px;
    }

    .company-legal-info {
        font-size: 10px;
        color: #475569;
        line-height: 1.4;
    }

    .doc-badge-title {
        text-align: right;
    }

    .doc-type-title {
        font-size: 20px;
        font-weight: 800;
        text-transform: uppercase;
        color: #0f172a;
    }

    .doc-reference {
        font-size: 13px;
        font-weight: 700;
        color: #4f46e5;
    }

    .doc-date {
        font-size: 11px;
        color: #64748b;
    }

    .parties-grid {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        margin-bottom: 22px;
        width: 100%;
    }

    .party-box {
        flex: 1;
        border: 1.5px solid #cbd5e1;
        border-radius: 8px;
        padding: 14px 18px;
        background: #f8fafc;
    }

    .party-box-title {
        font-size: 11.5px;
        font-weight: 800;
        text-transform: uppercase;
        color: #475569;
        border-bottom: 1.5px solid #e2e8f0;
        padding-bottom: 5px;
        margin-bottom: 8px;
    }

    .doc-table {
        width: 100% !important;
        border-collapse: collapse;
        margin-bottom: 25px;
    }

    .doc-table th {
        background: #f1f5f9;
        border: 1.5px solid #cbd5e1;
        padding: 10px 14px;
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
        text-align: left;
    }

    .doc-table td {
        border: 1px solid #cbd5e1;
        padding: 10px 14px;
        font-size: 13px;
    }

    .doc-totals-box {
        margin-left: auto;
        width: 320px;
        border: 1.5px solid #cbd5e1;
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 30px;
    }

    .doc-total-row {
        display: flex;
        justify-content: space-between;
        padding: 8px 14px;
        font-size: 13px;
        border-bottom: 1px solid #e2e8f0;
    }

    .doc-total-row.grand-total {
        background: #0f172a;
        color: #ffffff;
        font-size: 15px;
        font-weight: 800;
        border-bottom: none;
    }

    .signatures-block {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        margin-top: 35px;
        page-break-inside: avoid;
        width: 100%;
    }

    .signature-box {
        flex: 1;
        height: 105px;
        border: 1.5px dashed #94a3b8;
        border-radius: 8px;
        padding: 10px;
        font-size: 12px;
        font-weight: 700;
        text-align: center;
        color: #475569;
        background: #fafafa;
    }

    /* -------------------------------------------------------------------------
       2. FORMAT TICKET DE CAISSE THERMIQUE (80MM)
       ------------------------------------------------------------------------- */
    .print-ticket-80mm {
        width: 72mm;
        margin: 0 auto;
        padding: 5px;
        font-family: 'Courier New', Courier, monospace;
        font-size: 11px;
        line-height: 1.3;
        page-break-after: always;
    }

    .ticket-header {
        text-align: center;
        margin-bottom: 10px;
        border-bottom: 1px dashed #000;
        padding-bottom: 8px;
    }

    .ticket-title {
        font-size: 15px;
        font-weight: bold;
    }

    .ticket-table {
        width: 100%;
        border-collapse: collapse;
        margin: 8px 0;
    }

    .ticket-table th {
        border-bottom: 1px dashed #000;
        padding: 4px 0;
        font-size: 10px;
        text-align: left;
    }

    .ticket-table td {
        padding: 3px 0;
        font-size: 10.5px;
    }

    .ticket-total {
        border-top: 1px dashed #000;
        border-bottom: 1px dashed #000;
        padding: 6px 0;
        font-size: 13px;
        font-weight: bold;
        display: flex;
        justify-content: space-between;
        margin: 8px 0;
    }

    .ticket-footer {
        text-align: center;
        margin-top: 12px;
        font-size: 10px;
    }

    /* -------------------------------------------------------------------------
       3. FORMAT ETIQUETTES PRODUITS
       ------------------------------------------------------------------------- */
    /* Format 1: Rouleau Thermique Continu (1 étiquette par saut de page ~50x30mm) */
    .print-labels-roll .single-label {
        width: 50mm;
        height: 30mm;
        margin: 0 auto;
        padding: 3mm;
        box-sizing: border-box;
        text-align: center;
        page-break-after: always;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        font-family: 'Segoe UI', Tahoma, sans-serif;
    }

    /* Format 2: Planche A4 Multi-Étiquettes (Grille de 3 x 8 = 24 étiquettes) */
    .print-labels-a4-sheet {
        display: grid;
        grid-template-columns: repeat(3, 63mm);
        grid-auto-rows: 34mm;
        gap: 2mm 3mm;
        width: 195mm;
        margin: 0 auto;
        page-break-after: always;
    }

    .print-labels-a4-sheet .single-label {
        border: 1px solid #cbd5e1;
        border-radius: 4px;
        padding: 2.5mm;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        text-align: center;
        box-sizing: border-box;
        overflow: hidden;
    }

    .lbl-head {
        font-size: 8.5px;
        font-weight: 800;
        text-transform: uppercase;
        color: #334155;
        letter-spacing: 0.5px;
    }

    .lbl-name {
        font-size: 9.5px;
        font-weight: 700;
        color: #0f172a;
        line-height: 1.15;
        height: 22px;
        overflow: hidden;
        margin: 1px 0;
    }

    .lbl-price-cash {
        font-size: 13px;
        font-weight: 900;
        color: #0f172a;
    }

    .lbl-tiers {
        font-size: 8px;
        font-weight: 600;
        color: #334155;
        display: flex;
        justify-content: space-around;
        border-top: 1px dotted #94a3b8;
        padding-top: 2px;
    }

    .lbl-barcode svg {
        height: 24px;
        max-width: 90%;
    }

    /* -------------------------------------------------------------------------
       4. FORMAT CONTRAT DE VENTE PAR FACILITÉ A4 (ARABE RTL & FRANÇAIS LTR)
       ------------------------------------------------------------------------- */
    .print-contract-a4 {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 5mm 8mm !important;
        font-size: 11.5px;
        color: #0f172a;
        box-sizing: border-box;
        page-break-after: auto;
        font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    }

    .contract-document[dir="rtl"] {
        direction: rtl;
        text-align: right;
        font-family: 'Segoe UI', Tahoma, 'Cairo', 'Amiri', Arial, sans-serif;
    }

    .contract-document[dir="ltr"] {
        direction: ltr;
        text-align: left;
    }

    .contract-header {
        text-align: center;
        border-bottom: 2px solid #0f172a;
        padding-bottom: 8px;
        margin-bottom: 12px;
    }

    .contract-title-main {
        font-size: 18px;
        font-weight: 900;
        color: #0f172a;
        letter-spacing: 0.5px;
    }

    .contract-subtitle {
        font-size: 11px;
        color: #475569;
        margin-top: 2px;
        font-weight: 600;
    }

    .contract-ref-box {
        font-size: 11px;
        margin-top: 6px;
        color: #1e293b;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        display: inline-block;
        padding: 3px 14px;
        border-radius: 4px;
    }

    .contract-section-title {
        font-size: 13px;
        font-weight: 800;
        color: #1e293b;
        background: #f1f5f9;
        border-right: 4px solid #4338ca;
        padding: 4px 10px;
        margin: 10px 0 6px 0;
    }
    .contract-document[dir="ltr"] .contract-section-title {
        border-right: none;
        border-left: 4px solid #4338ca;
    }

    .parties-wrapper {
        display: grid;
        grid-template-columns: 1fr 1.3fr;
        gap: 12px;
        margin-bottom: 8px;
    }

    .party-card {
        border: 1px solid #cbd5e1;
        border-radius: 5px;
        padding: 8px 10px;
        background: #ffffff;
        font-size: 11px;
        line-height: 1.5;
    }

    .party-heading {
        font-size: 12px;
        font-weight: 800;
        color: #0f172a;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 3px;
        margin-bottom: 5px;
    }

    .party-row {
        margin-bottom: 3px;
    }

    .highlight-ccp {
        font-weight: 800;
        color: #0f172a;
        background: #fef08a;
        padding: 1px 6px;
        border-radius: 3px;
        border: 1px solid #fde047;
        direction: ltr !important;
        unicode-bidi: isolate !important;
        display: inline-block;
    }

    .contract-money {
        direction: ltr !important;
        unicode-bidi: isolate !important;
        display: inline-block;
        white-space: nowrap;
        font-weight: 800;
    }

    bdi[dir="ltr"] {
        direction: ltr !important;
        unicode-bidi: isolate !important;
        display: inline-block;
    }

    .contract-paragraph {
        font-size: 11px;
        line-height: 1.45;
        margin: 4px 0 6px 0;
        color: #334155;
    }

    .contract-articles-table {
        width: 100%;
        border-collapse: collapse;
        margin: 6px 0;
        font-size: 11px;
    }

    .contract-articles-table th, 
    .contract-articles-table td {
        border: 1px solid #94a3b8;
        padding: 4px 6px;
    }

    .contract-articles-table th {
        background: #e2e8f0;
        color: #0f172a;
        font-weight: 700;
    }

    .financial-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin: 6px 0 8px 0;
    }

    .fin-box {
        border: 1px solid #cbd5e1;
        border-radius: 4px;
        padding: 5px 8px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        background: #f8fafc;
    }

    .fin-box.highlight {
        background: #fef2f2;
        border-color: #fca5a5;
    }

    .fin-box.primary {
        background: #f5f3ff;
        border-color: #ddd6fe;
    }

    .fin-label {
        font-size: 10px;
        color: #475569;
        font-weight: 600;
    }

    .fin-value {
        font-size: 13px;
        font-weight: 800;
        color: #0f172a;
        margin-top: 1px;
    }

    .fin-value.danger {
        color: #b91c1c;
    }

    .fin-value.purple {
        color: #6d28d9;
    }

    .contract-terms-list {
        margin: 4px 0 10px 0;
        padding-right: 18px;
        font-size: 10.5px;
        line-height: 1.45;
        color: #334155;
    }
    .contract-document[dir="ltr"] .contract-terms-list {
        padding-right: 0;
        padding-left: 18px;
    }

    .contract-terms-list li {
        margin-bottom: 4px;
    }

    .signatures-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr 1.2fr;
        gap: 8px;
        margin-top: 10px;
    }

    .sig-card {
        border: 1px solid #0f172a;
        border-radius: 4px;
        padding: 6px 8px;
        height: 85px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        background: #ffffff;
    }

    .sig-card.apc-box {
        border: 1.5px dashed #0284c7;
        background: #f0f9ff;
    }

    .sig-title {
        font-size: 10.5px;
        font-weight: 800;
        color: #0f172a;
        text-align: center;
    }

    .sig-sub {
        font-size: 9px;
        color: #64748b;
        text-align: center;
    }

    .sig-zone {
        flex: 1;
    }

    .contract-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;
        visibility: hidden !important;
        line-height: 0 !important;
        font-size: 0 !important;
        overflow: hidden !important;
    }

    /* -------------------------------------------------------------------------
       7. ÉTIQUETTES DE PRIX PERSONNALISABLES (PLANCHE A4 & THERMIQUE)
       ------------------------------------------------------------------------- */
    .print-labels-a4-sheet {
        width: 210mm !important;
        margin: 0 auto !important;
        padding: 0 !important;
        box-sizing: border-box;
    }

    .print-labels-a4-sheet .labels-a4-sheet {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 auto !important;
        padding: 8mm 10mm !important;
        box-shadow: none !important;
        page-break-after: always !important;
        break-after: page !important;
        box-sizing: border-box !important;
    }

    .print-labels-a4-sheet .tag-hover-actions {
        display: none !important;
    }

    .print-labels-a4-sheet .price-tag-card {
        border-color: #000000 !important;
        box-shadow: none !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        background: #ffffff !important;
    }

    .print-labels-roll {
        width: 50mm !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .print-labels-roll .price-tag-card {
        width: 50mm !important;
        margin: 0 0 4mm 0 !important;
        page-break-after: always !important;
        break-after: page !important;
        border: 1px dashed #64748b !important;
    }
}


