body {
    display: flex;
    flex-direction: column;
}

/* Base de la Sidebar */
.sidebar {
    background-color: #FFFFFF;
    z-index: 1000;
}

/* On n'active la transition de largeur QUE si on n'est pas en train de redimensionner */
body:not(.resize-animation-stopper) .sidebar {
    transition: width 0.3s ease;
}

body:not(.resize-animation-stopper) .main-content {
    transition: margin-left 0.3s ease;
}

.sidebar .btn-sidebar {
    color: #222222;
    text-decoration: none;
}

.sidebar .btn-sidebar:hover {
    color: #AA0000;
    text-decoration: none;
}

/* =========================================================
   1. GRAND ÉCRAN (>= 768px)
   ========================================================= */
@media (min-width: 768px) {
    body {
        flex-direction: row;
    }

    .sidebar {
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        overflow-y: auto;
        width: 300px;
        max-width: 300px;
    }

    .sidebar.collapsed {
        width: 65px;
        overflow: hidden;
    }

    .sidebar.collapsed .nav-link-hidden {
        display: none;
    }

    .sidebar-logo-link {
        pointer-events: none;
        cursor: default;
    }

    /* Décalage du contenu principal */
    .main-content {
        margin-left: 305px;
        flex-grow: 1;
    }

    .sidebar.collapsed ~ .main-content {
        margin-left: 70px;
    }
}

/* =========================================================
   2. PETIT ÉCRAN (< 768px) - Changé à 767.98px
   ========================================================= */
@media (max-width: 767.98px) {
    .blockquote h1 {
        font-size: 1.25rem !important;
        line-height: 1.3;
    }

    .blockquote-footer h2 {
        font-size: 0.9rem !important;
        line-height: 1.3;
        margin-bottom: 0 !important;
    }

    /* Ajustement des espacements du bloc pour gagner en compacticité */
    figure {
        margin-bottom: 1rem !important;
    }

    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        position: relative !important;
    }

    /* Bouton en haut à droite */
    #toggleSidebar {
        position: absolute;
        top: 10px;
        right: 15px;
        z-index: 1001;
        margin-bottom: 0 !important;
    }

    /* Logo */
    .sidebar img {
        max-height: 38px;
        width: auto;
        margin-bottom: 0 !important;
        padding-right: 50px;
        display: block;
    }

    /* Menu déroulant - ÉTAT DÉPLIÉ */
    .sidebar ul.nav-link {
        width: 100%;
        margin-top: 10px;
        margin-bottom: 0;
        padding-top: 15px !important;
        padding-bottom: 0 !important;
        border-top: 1px solid #eee;
        max-height: none !important;
        overflow: visible !important;
        transform-origin: top;
        transform: scaleY(1);
        opacity: 1;

        transition: transform 0.3s ease,
                    max-height 0.3s ease,
                    opacity 0.25s ease,
                    padding 0.3s ease,
                    margin 0.3s ease,
                    border-color 0.3s ease;
    }

    /* Menu déroulant - ÉTAT FERMÉ (COLLAPSED) */
    .sidebar.collapsed ul.nav-link {
        transform: scaleY(0);
        max-height: 0 !important;
        opacity: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        border-top-color: transparent !important;
        pointer-events: none;
        overflow: hidden !important;
    }

    /* Éléments internes */
    .sidebar hr {
        width: 100%;
        margin: 10px 0;
    }

    .sidebar.collapsed hr {
        display: none !important;
    }

    .main-content,
    .sidebar.collapsed ~ .main-content {
        position: relative !important;
        margin-left: 0 !important;
        width: 100% !important;
        clear: both;
    }
}