@charset "UTF-8";
/* Thème commun de BagdiaScolaire+ : fond, en-tête, tableaux et affichage téléphone */
:root {
    --bleu: #0b5ed7;
    --bleu-fonce: #0a3d91;
    --bleu-nuit: #12305f;
    --orange: #ff9933;
    --texte: #1f2a3c;
    --ligne: #dbe3ee;
    --vert: #1a8754;
    --rouge: #c8373f;
}

html { background: #eef3f9; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--texte);
    background: transparent !important;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #eef3f9 url("../images/fond.jpg") center / cover no-repeat;
}
img { max-width: 100%; }
a { color: var(--bleu); }

/* --- En-tête --- */
header { font-family: inherit; }
.header-container {
    background: linear-gradient(135deg, var(--bleu-fonce), var(--bleu));
    padding: 14px 18px;
    color: #fff;
    box-shadow: 0 3px 12px rgba(10, 40, 90, .25);
}
.brand-section { display: flex; justify-content: center; align-items: center; gap: 14px; }
.brand-section img { height: 56px; width: auto; }
.brand-section h2 { margin: 0; font-size: 1.45rem; color: #fff; border: 0; padding: 0; }
.user-bar { text-align: center; margin-top: 8px; font-size: .95rem; }
.btn-logout, .btn-logout:visited { margin-left: 10px; color: #fff; text-decoration: underline; font-weight: 600; }

.menu-toggle {
    display: none;
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font: 600 1rem inherit;
    font-family: inherit;
    cursor: pointer;
}
nav.main-nav { margin-top: 12px; background: rgba(4, 30, 80, .45); border-radius: 8px; }
.nav-menu { list-style: none; padding: 0; margin: 0; display: flex; justify-content: center; flex-wrap: wrap; }
.nav-item { position: relative; }
.nav-link, .nav-link:visited {
    display: block;
    padding: 12px 18px;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 8px;
    transition: background .2s;
}
.nav-link:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.arrow { margin-left: 5px; font-size: .75rem; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 24px rgba(10, 30, 70, .25);
    z-index: 1000;
}
.dropdown-menu li a { display: block; padding: 10px 16px; color: #24324a; font-weight: 600; font-size: .92rem; text-decoration: none; }
.dropdown-menu li a:hover { background: #eef4ff; color: var(--bleu); }
.nav-item:hover .dropdown-menu, .nav-item.ouvert .dropdown-menu { display: block; }
.btn-licence {
    background: var(--orange);
    color: #1f1a10;
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
}

/* --- Contenu --- */
.page { max-width: 1400px; margin: 0 auto; padding: 22px 18px 36px; box-sizing: border-box; }
.page h2 { color: var(--bleu-nuit); }

/* Tableaux des pages sans Bootstrap */
.table-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.page table:not(.table), .container table {
    background: #fff;
    border-collapse: collapse;
    box-shadow: 0 3px 12px rgba(20, 40, 80, .08);
}
.page table:not(.table) th { background: var(--bleu-nuit); color: #fff; }
.page table:not(.table) tbody tr:hover { background: #f3f7fd; }

/* --- Bilan mensuel --- */
.bilan { max-width: 1180px; margin: 0 auto; }
.bilan-titre { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.bilan-titre h2 { margin: 0; }
.mois-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(20, 40, 80, .1);
}
.mois-nav form { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; margin: 0; }
.mois-nav label { font-weight: 600; }
.mois-nav select { flex: 1; min-height: 44px; padding: 8px 10px; font-size: 1rem; border: 1px solid #b9c6d8; border-radius: 8px; background: #fff; }
.mois-fleche {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--bleu);
    color: #fff !important;
    font-size: 1.6rem;
    line-height: 1;
    text-decoration: none;
}
.mois-fleche.inactive { background: #d6dde8; color: #fff; }
.btn-imprimer { min-height: 44px; padding: 0 14px; border: 1px solid #b9c6d8 !important; border-radius: 8px; background: #fff !important; color: var(--texte) !important; cursor: pointer; font-weight: 600; }
.mois-titre { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 18px 0 12px; font-size: 1.35rem; color: var(--bleu-nuit); }
.etiquette { display: none; }
.etiquette-ouvert { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #e0f3e9; color: #116a40; font-size: .8rem; font-weight: 700; }
.bilan-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 14px; }
.bilan-carte { padding: 16px 18px; background: #fff; border-radius: 12px; border-top: 5px solid var(--bleu); box-shadow: 0 3px 12px rgba(20, 40, 80, .1); }
.bilan-carte span { display: block; color: #55627a; font-size: .9rem; font-weight: 600; }
.bilan-carte strong { display: block; margin-top: 6px; font-size: 1.4rem; overflow-wrap: anywhere; }
.carte-report { border-top-color: #7a8aa3; }
.carte-entree { border-top-color: var(--vert); }
.carte-sortie { border-top-color: var(--rouge); }
.carte-solde { border-top-color: var(--bleu); background: #eef4ff; }
.bilan-mouvements { margin-top: 16px; }
.bloc { min-width: 0; margin-top: 16px; padding: 16px; background: #fff; border-radius: 12px; box-shadow: 0 3px 12px rgba(20, 40, 80, .1); }
.bilan-mouvements .bloc { margin-top: 0; }
.bloc h3 { margin: 0 0 12px; font-size: 1.05rem; color: var(--bleu-nuit); }
.bloc table { width: 100%; font-size: .92rem; box-shadow: none !important; }
.bloc th, .bloc td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--ligne); }
.bloc .montant { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bloc .vide { padding: 18px; text-align: center; color: #66738a; }
.ligne-active { background: #eef4ff; font-weight: 600; }
.bilan-graphique { max-width: 520px; margin-left: auto; margin-right: auto; }
.alerte { margin: 12px 0; padding: 12px 14px; border-radius: 8px; font-weight: 600; }
.alerte-danger { background: #fde8e8; color: #8f1d24; }
.alerte-attention { background: #fff4d6; color: #70510a; }

/* --- Téléphone et petite tablette --- */
@media (max-width: 768px) {
    .header-container { padding: 12px; }
    .brand-section img { height: 44px; }
    .brand-section h2 { font-size: 1.1rem; }
    #entete { height: auto !important; }
    .menu-toggle { display: block; }
    nav.main-nav { display: none; }
    nav.main-nav.ouvert { display: block; }
    .nav-menu { display: block; }
    .nav-link { white-space: normal; }
    .dropdown-menu { position: static; min-width: 0; border-radius: 6px; margin: 0 8px 8px; box-shadow: none; }
    .nav-item:hover .dropdown-menu { display: none; }
    .nav-item.ouvert .dropdown-menu { display: block; }
    .dropdown-menu li a { padding: 12px 14px; }

    .page { padding: 14px 12px 30px; }
    .page h2 { font-size: 1.3rem; }
    .marquee-style { font-size: 18px !important; }

    /* Les largeurs fixes écrites dans les pages s'adaptent à l'écran */
    .page [style*="width"], .page form, .page div { max-width: 100% !important; }
    .page div[style*="width"], .page form[style*="width"] { width: auto !important; }
    .page [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .page [style*="display: flex"], .page [style*="display:flex"] { flex-wrap: wrap !important; }
    .container, .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }
    .financial-summary, .info-card { flex-direction: column; gap: 10px; }
    body > .container { margin: 0 auto; }

    /* Champs faciles à toucher (16px évite le zoom automatique sur iPhone) */
    .page input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=file]),
    .page select, .page textarea, .search-box input[type=text] {
        width: 100%;
        min-height: 44px;
        margin: 0 0 8px;
        font-size: 16px;
        box-sizing: border-box;
    }
    .page button, .page input[type=submit], .page input[type=button], .btn-search { min-height: 44px; }

    /* Tableaux présentés en fiches */
    table.en-fiches, table.en-fiches tbody, table.en-fiches tr, table.en-fiches td { display: block; width: 100%; box-sizing: border-box; }
    table.en-fiches { background: transparent !important; box-shadow: none !important; }
    table.en-fiches thead { display: none; }
    table.en-fiches tr.ligne-titres { display: none; }
    table.en-fiches tr {
        margin-bottom: 10px;
        padding: 6px 10px;
        background: #fff;
        border: 1px solid var(--ligne);
        border-radius: 10px;
    }
    table.en-fiches td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid #edf1f6 !important;
        text-align: right !important;
        flex-wrap: wrap;
        white-space: normal !important;
        overflow-wrap: break-word;
    }
    table.en-fiches td a, table.en-fiches td button { white-space: nowrap; }
    table.en-fiches td:last-child { border-bottom: 0 !important; }
    table.en-fiches td::before { content: attr(data-label); flex: 0 0 42%; color: #55627a; font-weight: 600; font-size: .85rem; text-align: left; }
    table.en-fiches td:not([data-label])::before, table.en-fiches td[data-label=""]::before { content: none; }
    table.en-fiches td[colspan] { justify-content: center; text-align: center !important; }

    .bilan-cartes { grid-template-columns: 1fr 1fr; gap: 10px; }
    .bilan-carte { padding: 12px; }
    .bilan-carte strong { font-size: 1.05rem; }
    .bilan-mouvements { grid-template-columns: 1fr; }
    .bloc { padding: 12px; }
    .btn-imprimer { width: 100%; }
    .mois-nav form { order: -1; flex-basis: 100%; }
    .mois-nav .mois-fleche { flex: 1; }
}

@media (max-width: 380px) {
    .bilan-cartes { grid-template-columns: 1fr; }
}

/* --- Impression --- */
@media print {
    body::before, header, .no-print { display: none !important; }
    html { background: #fff; }
    .page { max-width: none; padding: 0; }
    .bloc, .bilan-carte { box-shadow: none; border: 1px solid #ccc; }
    .table-defile { overflow: visible; }
    /* Sur papier : seulement les données, pas les filtres ni les boutons */
    .page form:not(:has(table)), .page button, .page input[type=submit], .page input[type=button],
    .btn-action, .btn-edit, .btn-delete, .btn-print, .filter-box, .search-box, marquee { display: none !important; }
    .page table { width: 100% !important; box-shadow: none !important; font-size: 11pt; }
    .page table:not(.table) th { background: #e8edf5 !important; color: #000 !important; }
    .page tr { break-inside: avoid; }
    .page .btn { display: none !important; }
    .bilan-cartes { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .bilan-carte strong { font-size: 1.05rem; }
    .bilan-mouvements { display: block; }
    .bilan-mouvements .bloc { margin-top: 12px; }
}
