/* =====================================================
   Bulletin scolaire — Nukunu Mofiala
   Design inspiré du modèle Word
   ===================================================== */

.bulletin-page {
    background: #dfe3e8;
    min-height: 100vh;
    padding: 24px;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #000;
}

.bulletin-page.print-mode {
    background: #fff;
    padding: 0;
}

/* Toolbar (non imprimé) */
.bulletin-toolbar {
    max-width: 900px;
    margin: 0 auto 20px;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

/* Conteneur principal du bulletin */
.bulletin-wrapper {
    max-width: 900px;
    margin: 0 auto 30px;
    background: #fff;
    padding: 24px 28px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    position: relative;
    overflow: hidden;
}

.bulletin-wrapper::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%) rotate(-15deg) scale(0.6);
    width: 100%;
    height: 100%;
    background-image: var(--watermark);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

/* ── En-tête ── */
.entete {
    text-align: center;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.entete-logo {
    margin-bottom: 6px;
}

.school-logo {
    max-height: 60px;
    max-width: 120px;
    display: inline-block;
}

.entete .etab {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
}

.entete .adresse {
    font-size: 10px;
    margin-top: 2px;
    color: #000;
}

.titre-bulletin {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    margin: 10px 0;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-top: 2px solid #1a1a1a;
    border-bottom: 2px solid #1a1a1a;
    padding: 4px 0;
    position: relative;
    z-index: 1;
}

/* ── Infos élève ── */
table.infos {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

table.infos td {
    border: 1px solid #1a1a1a;
    padding: 4px 6px;
}

table.infos td:first-child {
    width: 45%;
}

/* ── Tableau des notes ── */
table.grades {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

table.grades th,
table.grades td {
    border: 1px solid #1a1a1a;
    padding: 3px 4px;
    text-align: center;
    vertical-align: middle;
}

table.grades th {
    background: #eef1f5;
    font-weight: 700;
}

table.grades td.matiere {
    text-align: left;
    font-style: italic;
}

table.grades td.low {
    color: #000;
    font-weight: 700;
}

tr.sous-total td {
    background: #f3f3f3;
    font-weight: 700;
}

tr.sous-total-final td {
    background: #eef1f5;
    font-weight: 700;
    border-top: 2px solid #1a1a1a;
}

/* ── Observations ── */
.obs-line {
    font-size: 11px;
    margin: 6px 0;
    position: relative;
    z-index: 1;
}

/* ── Tableau résumé ── */
table.resume {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin: 8px 0;
    position: relative;
    z-index: 1;
}

table.resume th,
table.resume td {
    border: 1px solid #1a1a1a;
    padding: 4px 6px;
    text-align: center;
}

table.resume th {
    background: #eef1f5;
}

/* ── Signatures ── */
table.signatures {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 14px;
    position: relative;
    z-index: 1;
}

table.signatures td {
    border: 1px solid #1a1a1a;
    padding: 12px 8px 8px;
    width: 50%;
    vertical-align: top;
    text-align: center;
}

.bulletin-footer-text {
    font-size: 10px;
    color: #000;
    text-align: center;
    border-top: 1px dashed #aaa;
    padding-top: 6px;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

/* ── Grille de la liste des élèves (bulletin.php) ── */
.students-bulletin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
    gap: .75rem;
    padding-top: .5rem;
}

.bulletin-student-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    transition: box-shadow .2s;
}

.bulletin-student-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }

.bulletin-student-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: white;
    font-weight: 700;
    font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.bulletin-student-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: .85rem;
}

.bulletin-student-info strong { color: #000; }
.bulletin-student-info span   { color: #000; font-size: .75rem; }

.bulletin-student-actions {
    display: flex;
    gap: .3rem;
}

/* ── Impression / PDF ── */
@media print {
    .no-print, .bulletin-toolbar, .sidebar, .topbar, .main-content > *:not(.bulletin-wrapper) {
        display: none !important;
    }
    .bulletin-page {
        background: white;
        padding: 0;
    }
    .bulletin-wrapper {
        border: none;
        max-width: 100%;
        padding: .5cm .8cm;
        margin: 0;
        box-shadow: none;
    }
    body { margin: 0; }
    @page { size: A4 portrait; margin: .8cm; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
    table.grades { font-size: 9pt; }
    table.grades th, table.grades td { padding: 2px 4px; }
    table.infos { font-size: 10pt; }
    table.resume { font-size: 10pt; }
    .entete .etab { font-size: 14pt; }
    .school-logo { max-height: 50pt; max-width: 100pt; }
    .titre-bulletin { font-size: 12pt; padding: 4px 0; margin: 10px 0; }
    table.signatures { font-size: 10pt; margin-top: 14px; }
    table.signatures td { padding: 12px 8px 8px; }
    .obs-line { font-size: 10pt; margin: 6px 0; }
}
@media print and (orientation: landscape) {
    @page { size: A4 landscape; margin: .8cm; }
}
