/* Rapports A4 (contrôle, convoi) — suit le thème clair / sombre */

.rapport-logo-irs {
    height: 56px;
    width: auto;
}

.rapport-modal-a4 {
    width: 210mm;
    max-width: 95vw;
    margin: 1rem auto;
}

.rapport-modal-a4 .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.rapport-modal-a4 .rapport-body {
    flex: 1;
    min-height: 0;
    max-height: 90vh;
    background: transparent !important;
}

.rapport-a4 {
    width: 100%;
    padding: 15mm;
    box-sizing: border-box;
    border-radius: 4px;
}

.rapport-doc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.rapport-doc-logo .rapport-logo-irs {
    height: auto;
    max-height: 100px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    display: block;
}

.rapport-doc-org {
    font-size: 0.9rem;
    white-space: pre-line;
    line-height: 1.4;
}

.rapport-doc-hr {
    border: none;
    margin: 0.75rem 0;
    opacity: 1;
}

.rapport-doc-title {
    margin: 0.5rem 0 0;
}

.rapport-a4 .badge {
    border: none;
}

/* —— Thème clair : document blanc —— */
html[data-theme="light"] .rapport-a4 {
    background: #ffffff !important;
    color: #212529 !important;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .rapport-doc-org {
    color: #495057 !important;
}

html[data-theme="light"] .rapport-doc-hr {
    border-top: 1px solid #333 !important;
}

html[data-theme="light"] .rapport-doc-title,
html[data-theme="light"] .rapport-a4 .rapport-meta,
html[data-theme="light"] .rapport-a4 .rapport-content,
html[data-theme="light"] .rapport-a4 p,
html[data-theme="light"] .rapport-a4 td,
html[data-theme="light"] .rapport-a4 th,
html[data-theme="light"] .rapport-a4 strong,
html[data-theme="light"] .rapport-a4 .fw-bold,
html[data-theme="light"] .rapport-a4 .table {
    color: #212529 !important;
}

html[data-theme="light"] .rapport-a4 .text-muted {
    color: #6c757d !important;
}

/* —— Thème sombre : document sombre —— */
html[data-theme="dark"] .rapport-a4 {
    background: var(--irs-bg-card, #1E293B) !important;
    color: var(--irs-text, #F1F5F9) !important;
    border: 1px solid var(--irs-border, #475569);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .rapport-doc-org {
    color: var(--irs-text-muted, #94A3B8) !important;
}

html[data-theme="dark"] .rapport-doc-hr {
    border-top: 1px solid var(--irs-border-strong, #64748B) !important;
}

html[data-theme="dark"] .rapport-doc-title,
html[data-theme="dark"] .rapport-a4 .rapport-meta,
html[data-theme="dark"] .rapport-a4 .rapport-content,
html[data-theme="dark"] .rapport-a4 p,
html[data-theme="dark"] .rapport-a4 td,
html[data-theme="dark"] .rapport-a4 th,
html[data-theme="dark"] .rapport-a4 strong,
html[data-theme="dark"] .rapport-a4 .fw-bold,
html[data-theme="dark"] .rapport-a4 .table {
    color: var(--irs-text, #F1F5F9) !important;
}

html[data-theme="dark"] .rapport-a4 .text-muted {
    color: var(--irs-text-muted, #94A3B8) !important;
}

@media print {
    body * {
        visibility: hidden;
    }
    .modal.show .modal-dialog.rapport-modal-a4,
    .modal.show .modal-dialog .modal-content,
    .modal.show .modal-dialog .modal-content * {
        visibility: visible;
    }
    .modal.show .modal-dialog.rapport-modal-a4 {
        max-width: none;
        margin: 0;
    }
    .modal.show .modal-dialog .modal-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm;
        max-height: none;
        background: transparent !important;
    }
    .modal.show .rapport-a4 {
        width: 210mm;
        padding: 15mm;
        box-sizing: border-box;
        box-shadow: none;
    }
    html[data-theme="light"] .modal.show .rapport-a4 {
        background: #fff !important;
        color: #212529 !important;
        border: none;
    }
    html[data-theme="dark"] .modal.show .rapport-a4 {
        background: #1E293B !important;
        color: #F1F5F9 !important;
        border: none;
    }
}
