/* Variables de couleurs pour les comportements */
:root {
    --my-cvc-bg-color-light: rgb(215, 189, 233);
    --my-cvc-bg-color-dark: rgb(119, 54, 163);
    --my-ecl-bg-color-light: rgb(255, 221, 113);
    --my-ecl-bg-color-dark: rgb(240, 161, 31);
    --my-air-bg-color-light: rgb(180, 199, 231);
    --my-air-bg-color-dark: rgb(47, 85, 151);
    --my-sto-bg-color-light: rgb(246, 199, 121);
    --my-sto-bg-color-dark: rgb(190, 123, 13);
    --my-cta-bg-color-light: rgb(196, 237, 255);
    --my-cta-bg-color-dark: rgb(156, 225, 255);
}

/* Styles du footer sticky (identique aux autres pages) */
html {
    position: relative;
    min-height: 100%;
}

body {
    /* Marge en bas pour la hauteur du footer */
    margin-bottom: 60px;
    /* Padding en haut pour le header fixe */
    padding-top: 60px;
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    /* Définit la hauteur fixe du footer */
    height: 60px;
    line-height: 60px; /* Centre verticalement le texte */
    background-color: #f5f5f5;
}

.footer > .container {
    padding-right: 15px;
    padding-left: 15px;
}

/* Styles de la page d'aide */
main.container-fluid {
    padding-left: 30px;
    padding-right: 30px;
    padding-top: 15px;
}

/* Navigation latérale sticky */
.sidebar-toc {
    position: sticky;
    top: 80px; /* 60px pour le header + 20px d'espacement */
    max-height: calc(100vh - 100px); /* Compte tenu du header */
}

/* Zone de contenu principal */
.main-content {
    max-width: 100%;
    margin-bottom: 60px;
}

/* Titres */
h1 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 3px solid #007bff;
    padding-bottom: 10px;
}

h2 {
    color: #007bff;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

h4 {
    color: #495057;
    margin-top: 25px;
    margin-bottom: 15px;
}

h5 {
    color: #6c757d;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

h6 {
    color: #495057;
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 700;
    font-size: 1.1rem;
    padding-left: 12px;
    border-left: 4px solid #007bff;
    scroll-margin-top: 160px;
}

/* Texte d'introduction */
.lead {
    color: #6c757d;
    margin-bottom: 30px;
}

/* Table des matières */
#table-of-contents,
#table-of-contents-mobile {
    list-style: none;
    padding-left: 0;
}

.toc-item {
    margin-bottom: 4px;
}

.toc-link {
    color: #007bff;
    text-decoration: none;
    padding: 8px 12px;
    display: block;
    border-radius: 4px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    position: relative;
}

.toc-link:hover {
    background-color: #e7f3ff;
    text-decoration: none;
    color: #0056b3;
    border-left-color: #007bff;
    transform: translateX(3px);
}

.toc-link.active {
    background-color: #007bff;
    color: white;
    font-weight: 600;
    border-left-color: #0056b3;
    transform: translateX(3px);
}

/* Icône d'expansion/réduction */
.toc-expand-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.toc-item.expanded > a > .toc-expand-icon,
.toc-subsections li.expanded > a > .toc-expand-icon {
    transform: rotate(90deg);
}

/* Sous-sections */
.toc-subsections {
    list-style: none;
    padding-left: 0;
    margin-left: 20px;
    margin-top: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.toc-item.expanded .toc-subsections {
    max-height: 1500px; /* Augmenté pour inclure les sous-sous-sections */
}

.toc-subsections li {
    margin-bottom: 2px;
}

.toc-sublink {
    font-size: 0.85rem;
    padding: 6px 10px;
    padding-left: 12px;
}

.toc-sublink:hover {
    background-color: #f0f8ff;
}

.toc-sublink.active {
    background-color: #0056b3;
}

/* Sous-sous-sections */
.toc-subsubsections {
    list-style: none;
    padding-left: 0;
    margin-left: 20px;
    margin-top: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.toc-subsections li.expanded .toc-subsubsections {
    max-height: 800px; /* Suffisant pour les sous-sous-sections */
}

.toc-subsubsections li {
    margin-bottom: 2px;
}

.toc-subsublink {
    font-size: 0.8rem;
    padding: 5px 8px;
    padding-left: 10px;
    color: #6c757d;
}

.toc-subsublink:hover {
    background-color: #f8f9fa;
}

.toc-subsublink.active {
    background-color: #6c757d;
}

/* Style de la carte de la barre latérale */
.sidebar-toc .card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    border-radius: 10px;
    overflow: hidden; /* Pour que le header et body respectent le border-radius */
    background-color: white; /* Fond blanc pour éviter le gris */
}

.sidebar-toc .card-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #007bff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-toc .card-body {
    padding: 15px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background-color: white; /* Fond blanc au lieu de transparent */
}

/* Barre de défilement personnalisée pour card-body */
.sidebar-toc .card-body::-webkit-scrollbar {
    width: 6px;
}

.sidebar-toc .card-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 10px 0; /* Arrondi en bas à droite */
}

.sidebar-toc .card-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.sidebar-toc .card-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Sections */
.help-section {
    margin-bottom: 50px;
    scroll-margin-top: 160px;
}

.help-subsection {
    margin-left: 20px;
    scroll-margin-top: 160px;
}

/* Cartes */
.card {
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
    border-radius: 8px;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.card-body {
    padding: 20px;
}

.card-body p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.card-body p:last-child {
    margin-bottom: 0;
}

/* Styles pour les cartes de comportement avec bordures colorées */
#subsection-cvc .card {
    border: 3px solid var(--my-cvc-bg-color-dark);
    border-left: 8px solid var(--my-cvc-bg-color-dark);
}

#subsection-ecl .card {
    border: 3px solid var(--my-ecl-bg-color-dark);
    border-left: 8px solid var(--my-ecl-bg-color-dark);
}

#subsection-air .card {
    border: 3px solid var(--my-air-bg-color-dark);
    border-left: 8px solid var(--my-air-bg-color-dark);
}

#subsection-sto .card {
    border: 3px solid var(--my-sto-bg-color-dark);
    border-left: 8px solid var(--my-sto-bg-color-dark);
}

#subsection-cta .card {
    border: 3px solid var(--my-cta-bg-color-dark);
    border-left: 8px solid var(--my-cta-bg-color-dark);
}

/* Ajustements responsifs */
@media (max-width: 991px) {
    main.container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 768px) {
    .help-subsection {
        margin-left: 0;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-top: 30px;
    }

    h4 {
        font-size: 1.25rem;
    }
}

/* Styles spécifiques au desktop */
@media (min-width: 992px) {
    /* Ajuste le contenu principal pour fonctionner avec la barre latérale fixe */
    .main-content {
        padding-left: 20px;
    }

    /* Transitions plus fluides sur desktop */
    .toc-link {
        transition: all 0.2s ease-in-out;
    }
}

/* Styles d'impression */
@media print {
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }

    #table-of-contents {
        page-break-after: always;
    }

    .help-section {
        page-break-inside: avoid;
    }

    header,
    footer {
        display: none;
    }
}
