/* ============================================================
   ORIASUP — application (espaces admin, parent, enseignant)
   ============================================================ */

body.app { background: var(--o-fond); font-size: .95rem; }
.app-cadre { display: flex; min-height: 100vh; }

/* --- Barre latérale --- */
.app-lateral {
    --bs-offcanvas-width: 272px;
    --bs-offcanvas-bg: var(--o-encre);
    background: var(--o-encre);
    color: #C8D6E8;
    width: 264px;
    flex-shrink: 0;
    display: flex; flex-direction: column;
}
/* Bootstrap rend .offcanvas-lg transparent sur grand écran : on garde le bleu */
.app-lateral.offcanvas-lg { background-color: var(--o-encre) !important; }
@media (min-width: 992px) {
    .app-lateral { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.app-marque { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.app-marque a { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: #fff; }
.app-marque img { height: 40px; width: auto; }
.app-marque strong { display: block; font-size: 1.15rem; letter-spacing: .03em; line-height: 1.1; }
.app-marque small { display: block; font-size: .78rem; color: #9FB4D0; font-weight: 400; }

.app-menu { padding: .75rem 0 1rem; flex: 1; }
.app-menu ul { list-style: none; margin: 0; padding: 0; }
.app-menu-section { font-size: .78rem; color: #8099BB; margin: 1.1rem 1.5rem .35rem; font-weight: 500; }
.app-menu a {
    position: relative;
    display: flex; align-items: center; gap: .8rem;
    padding: .55rem 1.5rem; color: #D5E0EE; text-decoration: none; font-size: .92rem;
}
.app-menu a i { width: 18px; text-align: center; color: #8FAACD; font-size: .95rem; }
.app-menu a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
/* Élément actif : la marge rouge du cahier */
.app-menu a.actif { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 500; }
.app-menu a.actif::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--o-marge); }
.app-menu a.actif i { color: #fff; }
.app-menu .pastille { margin-left: auto; background: var(--o-marge); color: #fff; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; }
.app-lateral-pied { border-top: 1px solid rgba(255, 255, 255, .1); padding: .75rem 0; }
.app-lateral-pied a { display: flex; gap: .8rem; align-items: center; padding: .5rem 1.5rem; color: #AFC1D9; text-decoration: none; font-size: .88rem; }
.app-lateral-pied a i { width: 18px; text-align: center; }
.app-lateral-pied a:hover { color: #fff; }

/* --- Zone principale --- */
.app-principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-haut {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: .75rem;
    background: #fff; border-bottom: 1px solid var(--o-trait);
    padding: .6rem 1.75rem; min-height: 64px;
}
.app-haut-titre { margin: 0; font-weight: 600; color: var(--o-encre); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-burger { color: var(--o-encre); font-size: 1.2rem; padding: .25rem .5rem; }
.app-profil { display: flex; align-items: center; gap: .6rem; color: var(--o-graphite); font-weight: 500; border: 0; }
.app-profil .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--o-encre-3); color: var(--o-encre); display: grid; place-items: center; font-weight: 700; }
.app-contenu { padding: 1.75rem; flex: 1; max-width: 1400px; width: 100%; }
.app-pied { padding: 1rem 1.75rem 1.5rem; color: var(--o-ardoise); font-size: .82rem; }
@media (max-width: 575.98px) {
    .app-contenu { padding: 1rem; }
    .app-haut { padding: .5rem 1rem; }
}

/* --- En-tête de page (pages existantes : .page-header / .page-title) --- */
.page-header { margin-bottom: 1.5rem; }
.page-header .page-title, h1.page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .3rem; }
.page-header p { color: var(--o-ardoise); margin-bottom: 0; }
.app-contenu > h1, .app-contenu > h2, .app-contenu > .d-flex > h1, .app-contenu > .d-flex > h2 { font-size: 1.6rem; font-weight: 700; }

/* --- Cartes --- */
.app .card { border: 1px solid var(--o-trait); border-radius: .75rem; box-shadow: none; margin-bottom: 1.5rem; }
.app .card-header { background: #fff; border-bottom: 1px solid var(--o-trait); padding: .9rem 1.25rem; border-radius: .75rem .75rem 0 0 !important; }
.app .card-header h4, .app .card-header h5, .app .card-header .card-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--o-encre); }
.app .card-header i { color: var(--o-stylo); margin-right: .35rem; }
.app .card-body { padding: 1.25rem; }
.app .card-footer { background: #fff; border-top: 1px solid var(--o-trait); }
.card-round { border-radius: .75rem; }

/* Cartes de statistiques (tableaux de bord) */
.card-stats .card-body { padding: 1.1rem 1.25rem; }
.card-stats .row { flex-wrap: nowrap; }
.card-stats .col-5 { flex: 0 0 auto; width: auto; }
.card-stats .col-7 { flex: 1 1 auto; width: auto; }
.card-stats .icon-big { width: 48px; height: 48px; border-radius: .6rem; background: var(--o-encre-3); display: grid; place-items: center; font-size: 1.25rem; }
.card-stats .icon-big i { color: var(--o-encre) !important; }
.card-stats .numbers .card-category { color: var(--o-ardoise); font-size: .85rem; margin: 0 0 .15rem; }
.card-stats .numbers .card-title { font-size: 1.6rem; font-weight: 700; margin: 0; color: var(--o-encre); }

/* --- Tableaux --- */
.app .table { --bs-table-bg: transparent; margin-bottom: 0; }
.app .table > :not(caption) > * > * { padding: .7rem .9rem; border-bottom-color: var(--o-trait); vertical-align: middle; }
.app .table thead th, .thead-light th, .thead-dark th {
    background: #F7F9FC; color: var(--o-ardoise); font-weight: 500; font-size: .82rem;
    border-bottom: 1px solid var(--o-trait); white-space: nowrap;
}
.app .table-hover > tbody > tr:hover > * { background: #F7F9FD; }

/* --- Formulaires --- */
.form-group { margin-bottom: 1rem; }
.form-row { display: flex; flex-wrap: wrap; margin-right: -.5rem; margin-left: -.5rem; }
.form-row > [class*="col"] { padding-right: .5rem; padding-left: .5rem; }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.form-inline .form-group { margin-bottom: 0; }
.app label, .app .form-label { font-weight: 500; color: var(--o-graphite); font-size: .9rem; margin-bottom: .35rem; }
.app .form-control, .app .form-select { border-color: #D3DBE8; border-radius: .5rem; }
.app select.form-control { appearance: auto; }
.btn-block { display: block; width: 100%; }
.custom-control { display: flex; align-items: center; gap: .5rem; }
.custom-control-input { width: 1rem; height: 1rem; }
.custom-control-label { margin: 0; }

/* --- Pastilles d'état (classes Bootstrap 4 : badge-success…) --- */
.badge { font-weight: 500; padding: .38em .65em; border-radius: .4rem; }
.badge-primary { background: var(--o-encre); color: #fff; }
.badge-secondary { background: #E6EAF0; color: #3E4A5E; }
.badge-success { background: #DDF3E8; color: #0F6B47; }
.badge-danger { background: #FBE3E1; color: #A92E27; }
.badge-warning { background: #FDF0D5; color: #8A5A10; }
.badge-info { background: #DDEBFB; color: #1A4E99; }
.badge-light { background: #F1F4F8; color: #3E4A5E; }
.badge-dark { background: var(--o-graphite); color: #fff; }

/* --- Utilitaires Bootstrap 4 encore utilisés --- */
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.float-right { float: right !important; }
.font-weight-bold { font-weight: 700 !important; }
.mr-1 { margin-right: .25rem !important; } .mr-2 { margin-right: .5rem !important; } .mr-3 { margin-right: 1rem !important; }
.ml-1 { margin-left: .25rem !important; } .ml-2 { margin-left: .5rem !important; } .ml-3 { margin-left: 1rem !important; } .ml-auto { margin-left: auto !important; }
.pl-0 { padding-left: 0 !important; } .pr-0 { padding-right: 0 !important; }
.close { background: none; border: 0; font-size: 1.5rem; line-height: 1; opacity: .6; }
.close:hover { opacity: 1; }

/* --- Divers --- */
.app .alert { border-radius: .6rem; border: 0; }
.app .alert-success { background: #DDF3E8; color: #0F5E3F; }
.app .alert-danger { background: #FBE3E1; color: #8E2721; }
.app .alert-warning { background: #FDF0D5; color: #74490B; }
.app .alert-info { background: #E3EEFB; color: #173F7A; }
.app .list-group-item { border-color: var(--o-trait); }
.app .modal-content { border: 0; border-radius: .9rem; }
.app .modal-header { border-bottom-color: var(--o-trait); }
.app .modal-footer { border-top-color: var(--o-trait); }
.app .modal-title { color: var(--o-encre); font-weight: 600; font-size: 1.1rem; }
.app .nav-tabs .nav-link.active { color: var(--o-encre); font-weight: 600; }
.app .dropdown-menu { border-color: var(--o-trait); border-radius: .6rem; box-shadow: 0 12px 28px -12px rgba(2, 49, 91, .25); }
.app .leaflet-container { border-radius: .6rem; }

/* ============================================================
   Pages d'authentification (connexion, inscription, installation)
   ============================================================ */
body.auth { background: var(--o-fond); min-height: 100vh; }
.auth-cadre { display: grid; min-height: 100vh; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-cadre { grid-template-columns: minmax(380px, 44%) 1fr; } }
.auth-panneau {
    background: var(--o-encre); color: #C9D7EA;
    padding: 3rem; display: none; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
@media (min-width: 992px) { .auth-panneau { display: flex; } }
/* Lignes Seyès en filigrane + marge rouge */
.auth-panneau::before {
    content: ""; position: absolute; inset: 0;
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, .07) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, .03) 1px, transparent 1px);
    background-size: 100% 32px, 100% 8px;
}
.auth-panneau::after { content: ""; position: absolute; top: 0; bottom: 0; left: 64px; width: 2px; background: var(--o-marge); opacity: .7; }
.auth-panneau > * { position: relative; z-index: 1; padding-left: 40px; }
.auth-panneau img { height: 96px; width: auto; }
.auth-panneau h2 { color: #fff; font-size: 2rem; font-weight: 700; line-height: 1.15; max-width: 16ch; margin: 2rem 0 1rem; }
.auth-panneau p { max-width: 40ch; }
.auth-panneau ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-panneau li { padding: .45rem 0; display: flex; gap: .75rem; }
.auth-panneau li i { color: #8FB1E6; margin-top: .3rem; }
.auth-panneau .auth-pied { font-size: .85rem; color: #93A9C7; }
.auth-zone { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-boite { width: 100%; max-width: 440px; }
.auth-boite.large { max-width: 640px; }
.auth-logo-mobile { display: block; height: 64px; width: auto; margin: 0 auto 1.5rem; }
@media (min-width: 992px) { .auth-logo-mobile { display: none; } }
.auth-boite h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .4rem; }
.auth-boite .sous-titre { color: var(--o-ardoise); margin-bottom: 1.75rem; }
.auth-boite .form-control { padding: .7rem .9rem; border-color: #D3DBE8; }
.auth-boite .form-label { font-weight: 500; }
.auth-boite .btn-primary { padding: .75rem; font-size: 1rem; }
.auth-liens { margin-top: 1.5rem; font-size: .92rem; color: var(--o-ardoise); }
.auth-aide { margin-top: 1.25rem; padding: .9rem 1rem; background: #fff; border: 1px solid var(--o-trait); border-radius: .6rem; font-size: .88rem; color: var(--o-ardoise); }
.choix-compte { display: grid; gap: 1rem; }
.choix-compte a { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem; background: #fff; border: 1px solid var(--o-trait); border-radius: .75rem; text-decoration: none; color: var(--o-graphite); }
.choix-compte a:hover { border-color: var(--o-stylo); }
.choix-compte i { width: 44px; height: 44px; border-radius: 50%; background: var(--o-encre-3); color: var(--o-encre); display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.choix-compte strong { display: block; color: var(--o-encre); font-size: 1.05rem; margin-bottom: .2rem; }
.choix-compte span { color: var(--o-ardoise); font-size: .92rem; }

/* Le bleu du menu continue jusqu'en bas des pages longues */
@media (min-width: 992px) {
    .app-cadre { background: linear-gradient(to right, var(--o-encre) 264px, transparent 264px); }
}
.app .card-header .btn { white-space: nowrap; }
@media (max-width: 575.98px) {
    .app .card-header { flex-wrap: wrap; gap: .5rem; }
    .app .table > :not(caption) > * > * { padding: .55rem .6rem; }
}
.app .table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: #FAFBFD; }
.app .table td .btn-sm { white-space: nowrap; margin: .1rem 0; }
.app .table td form.d-inline + form.d-inline, .app .table td .btn + form.d-inline { margin-left: .25rem; }
