/**
 * Styles d'impression unifiés pour tous les documents
 * Style de référence: Bilan et Diagnostic (bleu #1e3a8a)
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    font-size: 11pt;
    line-height: 1.6;
    color: #333;
    background: white;
    padding: 20px;
}

@media print {
    body {
        padding: 0;
    }

    .no-print {
        display: none !important;
    }

    @page {
        margin: 2cm 1.5cm;
    }

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ==================== HEADER ==================== */
.print-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #1e3a8a;
}

/* Header avec logo à gauche, titre au centre */
.print-header.flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.logo, .logo-section img {
    max-height: 100px;
    max-width: 180px;
}

.logo-section {
    flex-shrink: 0;
}

.title-section {
    flex: 1;
    text-align: center;
}

.title-section h1 {
    font-size: 20pt;
    color: #1e3a8a;
    margin-bottom: 5px;
    font-weight: bold;
}

.title-section h2 {
    font-size: 18pt;
    color: #1e3a8a;
    margin-bottom: 5px;
    font-weight: bold;
}

.document-title {
    text-align: center;
    flex-grow: 1;
}

.document-title h1,
.document-title h2 {
    font-size: 18pt;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 5px;
}

.document-title h3 {
    font-size: 14pt;
    color: #555;
    margin: 0;
    font-weight: normal;
}

/* Titre simple centré */
.print-header h1 {
    text-align: center;
    font-size: 18pt;
    color: #1e3a8a;
    margin: 0;
    font-weight: bold;
}

.print-header p {
    text-align: center;
    margin: 10px 0 0 0;
}

/* ==================== INFORMATIONS BÉNÉFICIAIRE ==================== */
.info-beneficiaire,
.info-flex {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    flex-wrap: wrap;
}

.info-item {
    flex: 1;
    min-width: 200px;
}

.info-item strong {
    display: block;
    color: #666;
    font-size: 9pt;
    margin-bottom: 3px;
}

.info-item p {
    margin: 0;
    font-size: 11pt;
    color: #333;
}

.info-section {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

.info-section p {
    margin: 2px 0;
    font-size: 9pt;
    color: #666;
    text-align: left;
}

/* ==================== SECTIONS ==================== */
.section-header,
.section-title,
.question-title {
    background: #1e3a8a;
    color: white;
    padding: 12px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 12pt;
    margin-top: 25px;
    margin-bottom: 15px;
    page-break-after: avoid;
}

.section-title {
    margin-top: 20px;
    margin-bottom: 12px;
    font-size: 11pt;
    padding: 8px 12px;
}

/* Section variants */
.section-title.info {
    background: #28a745;
}

.section-title.warning {
    background: #ffc107;
    color: #333;
}

/* ==================== QUESTIONS & RÉPONSES ==================== */
.question-section {
    margin-top: 30px;
}

.reponse-box {
    border: 2px solid #1e3a8a;
    padding: 20px;
    min-height: 200px;
    background: white;
    border-radius: 5px;
    white-space: pre-line;
    word-wrap: break-word;
}

.empty-reponse {
    color: #999;
    font-style: italic;
}

.sub-section {
    margin: 10px 0;
    padding: 8px;
    background: #f8f9fa;
    border-left: 4px solid #1e3a8a;
}

.commentaires-box {
    border: 2px solid #ffc107;
    padding: 15px;
    background: #fffbf0;
    min-height: 100px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.empty-comment {
    color: #999;
    font-style: italic;
}

/* ==================== TABLES ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    page-break-inside: auto;
}

th, td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    font-size: 10pt;
}

thead,
table th {
    background-color: #e9ecef;
    font-weight: bold;
}

table th {
    text-align: center;
}

tr {
    page-break-inside: avoid;
    page-break-after: auto;
}

.aborde-oui {
    background-color: #d4edda;
}

/* ==================== CHECKBOXES & RADIOS ==================== */
.checkbox {
    text-align: center;
    font-size: 16pt;
}

.checkbox-checked::before {
    content: "✓";
    color: #1e3a8a;
    font-weight: bold;
}

.checkbox-unchecked::before {
    content: "☐";
    color: #6c757d;
}

.checkbox-cell {
    text-align: center;
    width: 8%;
}

.checkbox-print {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #1e3a8a;
    background: white;
    position: relative;
    border-radius: 2px;
}

.checkbox-print.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12pt;
    font-weight: bold;
    color: #1e3a8a;
}

.radio-cell {
    text-align: center;
    width: 12%;
}

.radio-print {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #333;
    border-radius: 50%;
    background: white;
    position: relative;
}

.radio-print.checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #000;
    border-radius: 50%;
}

/* ==================== FOOTER ==================== */
.print-footer {
    margin-top: 40px;
    padding-top: 15px;
    border-top: 2px solid #ddd;
    font-size: 9pt;
    color: #666;
    text-align: center;
}

/* ==================== BOUTONS DE CONTRÔLE ==================== */
.print-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11pt;
    transition: all 0.3s;
    margin: 5px;
}

.btn-primary {
    background: #1e3a8a;
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

/* ==================== SECTIONS GÉNÉRIQUES ==================== */
.section {
    margin-bottom: 30px;
    page-break-inside: avoid;
}

.total {
    background: #f8f9fa;
    padding: 12px 15px;
    border-left: 4px solid #1e3a8a;
    font-weight: bold;
    margin-top: 15px;
    border-radius: 3px;
}

.beneficiaire-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.beneficiaire-info table {
    margin: 0;
}

.beneficiaire-info table td:first-child {
    font-weight: normal;
    color: #666;
    width: 200px;
}

.beneficiaire-info table td {
    border: none;
    padding: 5px 10px;
}

/* ==================== BOUTON D'IMPRESSION SIMPLE ==================== */
.print-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #1e3a8a;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11pt;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}

.print-button:hover {
    background: #1e40af;
}

@media print {
    .print-button {
        display: none !important;
    }
}

/* ==================== UTILITAIRES ==================== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-15 {
    padding: 15px;
}

.border-rounded {
    border-radius: 5px;
}
