/*
 * EDARA Mission 11 — Couche d'impression commune
 * ------------------------------------------------
 * Cette feuille centralise les règles A4, les styles de documents autonomes
 * et les garde-fous d'impression communs aux modules EDARA.
 */

.edara-print-document,
body.edara-responsive-ready {
    --edara-print-page-bg: #f4f1eb;
    --edara-print-sheet-bg: #ffffff;
    --edara-print-text: var(--edara-text, #232323);
    --edara-print-muted: var(--edara-muted, #667085);
    --edara-print-border: var(--edara-border, #eadfca);
    --edara-print-gold: var(--edara-gold, #c9972e);
}

.edara-print-document {
    margin: 0;
    padding: 24px;
    background: var(--edara-print-page-bg);
    color: var(--edara-print-text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.edara-print-wrapper {
    width: min(100%, 980px);
    margin: 0 auto;
}

.edara-print-sheet {
    background: var(--edara-print-sheet-bg);
    border: 1px solid var(--edara-print-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .12);
}

.edara-print-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 30px;
    color: #ffffff;
    background: linear-gradient(135deg, #050505 0%, #171717 58%, #2a2a2a 100%);
    border-bottom: 4px solid var(--edara-print-gold);
}

.edara-print-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.edara-print-brand img {
    display: block;
    width: 116px;
    height: auto;
    border-radius: 10px;
}

.edara-print-title h1,
.edara-print-title p {
    margin: 0;
}

.edara-print-title h1 {
    color: #ffffff;
    font-size: 28px;
    line-height: 1.15;
}

.edara-print-title p {
    margin-top: 6px;
    color: rgba(255, 255, 255, .76);
    font-size: 14px;
}

.edara-print-ref {
    min-width: 220px;
    padding: 14px 16px;
    border: 1px solid rgba(201, 151, 46, .35);
    border-radius: 16px;
    background: rgba(255, 255, 255, .06);
    text-align: right;
}

.edara-print-ref small,
.edara-print-label {
    display: block;
    margin-bottom: 5px;
    color: var(--edara-print-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.edara-print-ref small {
    color: rgba(255, 255, 255, .62);
}

.edara-print-ref strong {
    display: block;
    color: #ffffff;
    font-size: 16px;
}

.edara-print-ref span {
    display: block;
    margin-top: 5px;
    color: rgba(255, 255, 255, .70);
    font-size: 12px;
}

.edara-print-body {
    padding: 30px;
}

.edara-print-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.edara-print-summary-card {
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--edara-print-border);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

.edara-print-summary-card strong,
.edara-print-summary-card span {
    display: block;
    word-break: break-word;
}

.edara-print-summary-card strong {
    color: #111111;
    font-size: 15px;
}

.edara-print-summary-card span {
    color: #4f4b43;
    font-size: 13px;
}

.edara-print-table-card {
    border: 1px solid var(--edara-print-border);
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
}

.edara-print-table-card .edara-table-responsive,
.edara-print-table-card .edara-livre-compte-table-wrap {
    overflow: visible;
}

.edara-print-table-card h3 {
    margin: 0;
    padding: 16px 18px;
    border-bottom: 1px solid var(--edara-print-border);
    background: #fffaf0;
    color: #111111;
    font-size: 16px;
}

.edara-print-table-card table,
.edara-print-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.edara-print-table-card thead th,
.edara-print-table thead th {
    padding: 13px 15px;
    background: #151516;
    color: #ffffff;
    font-size: 12px;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
}

.edara-print-table-card tbody td,
.edara-print-table tbody td {
    padding: 13px 15px;
    border-bottom: 1px solid #f1eadb;
    color: #242424;
    font-size: 13px;
    vertical-align: top;
}

.edara-print-table-card tbody tr:last-child td,
.edara-print-table tbody tr:last-child td {
    border-bottom: 0;
}

.edara-print-note {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px dashed #dcc898;
    border-radius: 16px;
    background: #faf8f2;
    color: #5f5b51;
    font-size: 12px;
}

.edara-print-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--edara-print-border);
    color: var(--edara-print-muted);
    font-size: 12px;
}

.edara-print-signature {
    color: #111111;
    font-weight: 800;
    text-align: right;
}

.edara-print-actions,
.button-print,
.print {
    margin-top: 22px;
    text-align: center;
}

.edara-print-actions button,
.button-print button,
.print button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 22px;
    border: 1px solid var(--edara-print-gold);
    border-radius: 999px;
    background: #111111;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .20);
}

.edara-print-actions button:hover,
.button-print button:hover,
.print button:hover {
    background: var(--edara-gold-gradient, linear-gradient(135deg, #7a5612, #d4af37, #fff0b8, #c9972e));
    color: #111111;
}

.edara-print-document .edara-money-positive,
.edara-print-document .edara-money-negative,
.edara-print-document .edara-money-neutral,
.edara-print-table-card .edara-money-positive,
.edara-print-table-card .edara-money-negative,
.edara-print-table-card .edara-money-neutral {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.edara-print-document .edara-money-positive,
.edara-print-table-card .edara-money-positive {
    color: var(--edara-success, #107c41);
    background: var(--edara-success-soft, #dcfce7);
    border: 1px solid var(--edara-success-border, #bbf7d0);
}

.edara-print-document .edara-money-negative,
.edara-print-table-card .edara-money-negative {
    color: var(--edara-danger, #b32d2e);
    background: var(--edara-danger-soft, #fee2e2);
    border: 1px solid var(--edara-danger-border, #fecaca);
}

.edara-print-document .edara-money-neutral,
.edara-print-table-card .edara-money-neutral {
    color: #475467;
    background: var(--edara-neutral-soft, #f8fafc);
    border: 1px solid var(--edara-neutral-border, #d8dde5);
}

@media (max-width: 760px) {
    .edara-print-document {
        padding: 12px;
    }

    .edara-print-hero,
    .edara-print-brand,
    .edara-print-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .edara-print-hero,
    .edara-print-body {
        padding: 20px;
    }

    .edara-print-ref,
    .edara-print-signature {
        width: 100%;
        min-width: 0;
        text-align: left;
    }

    .edara-print-summary {
        grid-template-columns: 1fr;
    }
}

@page {
    size: A4 portrait;
    margin: 8mm;
}

@media print {
    html,
    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    body.edara-print-document {
        width: 210mm;
        min-height: 297mm;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    .edara-print-wrapper {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }

    .edara-print-sheet {
        border: 1px solid #e7dcc4 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .edara-print-hero {
        padding: 14px 18px !important;
        gap: 12px !important;
        border-bottom-width: 3px !important;
    }

    .edara-print-brand img {
        width: 76px !important;
    }

    .edara-print-title h1 {
        font-size: 20px !important;
    }

    .edara-print-title p,
    .edara-print-ref span {
        font-size: 10px !important;
    }

    .edara-print-ref {
        min-width: 160px !important;
        padding: 8px 10px !important;
        border-radius: 10px !important;
    }

    .edara-print-ref small,
    .edara-print-label {
        font-size: 8.5px !important;
        margin-bottom: 2px !important;
    }

    .edara-print-ref strong {
        font-size: 12px !important;
    }

    .edara-print-body {
        padding: 14px 18px !important;
    }

    .edara-print-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }

    .edara-print-summary-card {
        padding: 8px 10px !important;
        border-radius: 10px !important;
    }

    .edara-print-summary-card strong,
    .edara-print-summary-card span,
    .edara-print-table-card tbody td,
    .edara-print-table tbody td {
        font-size: 9.5px !important;
        line-height: 1.28 !important;
    }

    .edara-print-table-card {
        border-radius: 10px !important;
    }

    .edara-print-table-card h3 {
        padding: 9px 11px !important;
        font-size: 11px !important;
    }

    .edara-print-table-card thead th,
    .edara-print-table thead th {
        padding: 7px 9px !important;
        font-size: 8.5px !important;
    }

    .edara-print-table-card tbody td,
    .edara-print-table tbody td {
        padding: 7px 9px !important;
    }

    .edara-print-note {
        padding: 8px 10px !important;
        border-radius: 10px !important;
        font-size: 9px !important;
        margin-top: 10px !important;
    }

    .edara-print-footer {
        margin-top: 10px !important;
        padding-top: 9px !important;
        font-size: 9px !important;
    }

    .edara-print-actions,
    .button-print,
    .print,
    .edara-admin-nav,
    .edara-subtabs-card,
    .edara-filters,
    .edara-sorties-filters,
    .edara-sorties-add-form,
    .edara-sorties-actions,
    .edara-responsive-debug {
        display: none !important;
    }

    .edara-generated-mobile-cards {
        display: none !important;
    }

    table.edara-responsive-table,
    table.edara-card-table-ready {
        display: table !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    table.edara-responsive-table thead,
    table.edara-card-table-ready thead { display: table-header-group !important; }
    table.edara-responsive-table tbody,
    table.edara-card-table-ready tbody { display: table-row-group !important; }
    table.edara-responsive-table tr,
    table.edara-card-table-ready tr { display: table-row !important; }
    table.edara-responsive-table th,
    table.edara-card-table-ready th,
    table.edara-responsive-table td,
    table.edara-card-table-ready td { display: table-cell !important; }

    .edara-card,
    .edara-print-summary-card,
    .edara-print-table-card,
    .edara-section,
    .edara-alert {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
