/* Menu latéral pliable — remplace l'ancien bandeau du haut. Voir sidebar.js
   pour le pliage/dépliage (desktop) et le tiroir mobile, tous deux mémorisés
   en localStorage sur le même principe que table_resize.js. */

:root {
    --sidebar-largeur: 250px;
    --sidebar-largeur-reduite: 36px;
}

body {
    background-color: #f3f6f7;
}

.app-shell {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-largeur);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    background-color: var(--althae-fonce);
    color: #dcecf1;
    transition: width 0.2s ease;
    z-index: 1030;
}

.app-sidebar.is-collapsed {
    width: var(--sidebar-largeur-reduite);
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: 64px;
}

.app-sidebar__brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    min-width: 0;
}

.app-sidebar__logo {
    height: 30px;
    flex-shrink: 0;
}

.app-sidebar__brand-text {
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.app-sidebar__toggle {
    background: transparent;
    border: none;
    color: #bfe0e8;
    padding: 0.3rem 0.45rem;
    border-radius: 0.4rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s ease, background-color 0.15s ease;
}

.app-sidebar__toggle:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.app-sidebar.is-collapsed .app-sidebar__toggle i {
    transform: rotate(180deg);
    display: inline-block;
}

.app-sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.85rem 0.6rem;
}

.app-sidebar__section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    padding: 0.9rem 0.75rem 0.3rem;
    white-space: nowrap;
    overflow: hidden;
}

.app-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.2rem;
    border-radius: 0.5rem;
    color: #cfe8ee;
    text-decoration: none;
    font-size: 0.925rem;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar__link i {
    font-size: 1.05rem;
    width: 1.3rem;
    text-align: center;
    flex-shrink: 0;
}

.app-sidebar__link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-sidebar__link.active {
    background-color: var(--althae-turquoise);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(4, 162, 169, 0.35);
}

.app-sidebar__user {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.85rem 1rem;
}

.app-sidebar__user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.4rem;
}

.app-sidebar.is-collapsed .app-sidebar__brand-text,
.app-sidebar.is-collapsed .app-sidebar__label,
.app-sidebar.is-collapsed .app-sidebar__section-label,
.app-sidebar.is-collapsed .app-sidebar__user-name,
.app-sidebar.is-collapsed .app-sidebar__user .badge {
    display: none;
}

.app-sidebar.is-collapsed .app-sidebar__link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.app-sidebar.is-collapsed .app-sidebar__link i {
    width: auto;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
}

.app-mobile-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1040;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    background-color: var(--althae-fonce);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.app-sidebar-backdrop {
    display: none;
}

.app-navbar-guest {
    background-color: var(--althae-fonce);
}

@media (max-width: 991.98px) {
    .app-mobile-toggle {
        display: inline-flex;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: var(--sidebar-largeur);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    /* Le pliage "icônes seules" n'a pas de sens en tiroir mobile plein écran. */
    .app-sidebar.is-collapsed {
        width: var(--sidebar-largeur);
    }
    .app-sidebar.is-collapsed .app-sidebar__brand-text,
    .app-sidebar.is-collapsed .app-sidebar__label,
    .app-sidebar.is-collapsed .app-sidebar__section-label,
    .app-sidebar.is-collapsed .app-sidebar__user-name,
    .app-sidebar.is-collapsed .app-sidebar__user .badge {
        display: initial;
    }
    .app-sidebar.is-collapsed .app-sidebar__link {
        justify-content: flex-start;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .app-sidebar.is-mobile-open {
        transform: translateX(0);
        box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0);
    }

    .app-sidebar-backdrop.is-visible {
        display: block;
        position: fixed;
        inset: 0;
        background-color: rgba(10, 25, 30, 0.45);
        z-index: 1020;
    }

    .app-main {
        padding-top: 3.25rem;
    }
}

@media (min-width: 992px) {
    .app-sidebar-backdrop {
        display: none !important;
    }
}

/* Cartes de section (fiche dossier, et réutilisables ailleurs) : même
   principe de bandeau coloré que .categorie-parametrage (brand.css), pour une
   cohérence visuelle entre la fiche de consultation et le formulaire de
   paramétrage — Identification=bleu, Fiscal=orange, Affectation=violet,
   Mission/déontologie=vert, Facturation=cyan, Autres=gris. */
.carte-section {
    background-color: #fff;
    border: 1px solid rgba(10, 60, 76, 0.08);
    border-left-width: 5px;
    border-radius: 0.6rem;
    box-shadow: 0 1px 3px rgba(10, 60, 76, 0.06);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.carte-section__titre {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 1.1rem;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.carte-section__titre i {
    margin-right: 0.5rem;
}

.carte-section__corps {
    padding: 0 1.1rem 0.9rem;
}

.carte-section__corps > .table {
    margin-bottom: 0.5rem;
}

.carte-section--identification { border-left-color: #0d6efd; }
.carte-section--identification .carte-section__titre { background-color: #eaf2ff; color: #0a3577; }
.carte-section--fiscal { border-left-color: #fd7e14; }
.carte-section--fiscal .carte-section__titre { background-color: #fff2e6; color: #7a3b00; }
.carte-section--affectation { border-left-color: #6f42c1; }
.carte-section--affectation .carte-section__titre { background-color: #f1ecfa; color: #3d2170; }
.carte-section--mission { border-left-color: #198754; }
.carte-section--mission .carte-section__titre { background-color: #e6f4ec; color: #0a3622; }
.carte-section--facturation { border-left-color: #0dcaf0; }
.carte-section--facturation .carte-section__titre { background-color: #e7f9fc; color: #055160; }
.carte-section--autres { border-left-color: #6c757d; }
.carte-section--autres .carte-section__titre { background-color: #eef0f1; color: #41464b; }

.fiche-entete {
    background: linear-gradient(120deg, var(--althae-fonce), var(--althae-bleu));
    color: #fff;
    border-radius: 0.6rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.fiche-entete h1 {
    margin: 0;
    color: #fff;
}

.fiche-entete .btn-outline-primary {
    --bs-btn-color: #fff;
    --bs-btn-border-color: #fff;
    --bs-btn-hover-bg: #fff;
    --bs-btn-hover-color: var(--althae-fonce);
}
