/*
 * VARIABLES ET PALETTE DE COULEURS
 * Définit les palettes de couleurs pour les thèmes clair et sombre.
 */
:root {
    /* Palette pour le mode clair (par défaut) */
    --background-light: #f8f9fa;
    --background-panel: #ffffff;
    --text-primary: #3a5796;
    --text-secondary: #4a6baf;
    --border-color: #dee2e6;
    --accent-color: #20c997;
    --accent-hover: #17a2b8;
    --footer-bg: #212529;
    --footer-text: #f8f9fa;
}

html[data-theme='dark'] {
    /* Palette pour le mode sombre */
    --background-light: #1e1e1e;
    --background-panel: #2d2d2d;
    --text-primary: #e6e6e6;
    --text-secondary: #fdfdfd;
    --border-color: #444444;
    --accent-color: #20c997;
    --accent-hover: #17a2b8;
    --footer-bg: #111111;
    --footer-text: #f5f5f5;
}

/*======RESET ET TYPOGRAPHIE========*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== HEADER ===== */
header {
    background-color: var(--background-panel);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
}

#brand-cont {
    display: flex;
    align-items: center;
    position: relative;
    gap: 0.8rem;
    text-decoration: none;
}

.logo-brand {
    width: 100px;
    position: absolute;
    left: 0;
    height: auto;
}

#logo-brand-dark {
    display: none;
}

html[data-theme='dark'] #logo-brand-light {
    display: none;
}
html[data-theme='dark'] #logo-brand-dark {
    display: block;
}

#name-brand {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-left: 5rem;
}

#menu ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

#menu ul li a {
    text-decoration: none;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

#menu ul li a:hover {
    color: var(--accent-color);
}

/* Styles pour les sélecteurs et le burger */
#utility-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

#theme-toggle, #theme-toggle-mobile {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

#theme-toggle:hover, #theme-toggle-mobile:hover {
    color: var(--accent-color);
}

.lang-selector select {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px 8px;
    background-color: var(--background-panel);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.lang-selector select:focus {
    border-color: var(--accent-color);
}

#burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

#burger span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

/* Nouveau style CSS pour le menu mobile */
#mobile-menu {
    display: none;
    background-color: var(--background-panel);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease-in-out;
}

#mobile-menu.is-open {
    display: block;
}

#mobile-menu ul {
    list-style: none;
    padding: 1rem;
}

#mobile-menu ul li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

#mobile-menu ul li a {
    text-decoration: none;
    color: var(--text-primary);
}

#mobile-menu ul li a:hover {
    color: var(--accent-color);
}

/* ===== BARRE DE RECHERCHE ===== */
.search-bar {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--background-panel);
}

.search-bar input {
    width: 100%;
    max-width: 600px;
    padding: 10px 15px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease-in-out;
    background-color: var(--background-panel);
    color: var(--text-primary);
}

.search-bar input::placeholder{
    color: var(--text-primary);
}

.search-bar input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.1);
}

/* ===== LAYOUT 3 COLONNES ===== */
.doc-container {
    display: grid;
    grid-template-columns: 280px 1fr 240px;
    gap: 40px;
    padding: 40px;
    flex: 1;
}

.doc-nav, .doc-toc, .doc-content {
    background-color: var(--background-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

/* ===== NAVIGATION DANS LES THÈMES ===== */
.doc-nav {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.doc-nav h3 {
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-left: 10px;
}

.doc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-nav li {
    margin-bottom: 5px;
}

.doc-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease-in-out;
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    border-left: 2px solid transparent;
}

.doc-nav a:hover {
    color: var(--text-primary);
    background-color: var(--background-light);
}

.doc-nav a.active {
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--background-light);
    border-left-color: var(--accent-color);
}

/* ===== CONTENU PRINCIPAL ===== */
.doc-content {
    padding: 40px;
}

.doc-content h1, .doc-content h2, .doc-content h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.doc-content p {
    line-height: 1.8;
    margin-bottom: 1.5em;
}

.doc-content ul, .doc-content ol {
    margin-left: 40px;
}

#no-results-message {
    text-align: center;
    padding: 40px 20px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-style: italic;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* ===== TABLE DES MATIÈRES (TOC) ===== */
.doc-toc {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.doc-toc h3 {
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.doc-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-toc ul ul {
    /* Style de la sous-liste */
    list-style: none;
    padding-left: 20px;
    margin-top: 5px;
}

.doc-toc li {
    margin-bottom: 5px;
}

.doc-toc a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease-in-out;
    display: block;
    padding: 5px 10px;
    font-size: 0.95rem;
    border-left: 2px solid transparent;
}

.doc-toc a:hover {
    color: var(--text-primary);
}

.doc-toc a.active {
    font-weight: 600;
    color: var(--text-primary);
    border-left-color: var(--accent-color);
}

/* Hiérarchie dans le TOC */
.doc-toc li > a {
    padding-left: 10px;
}

.doc-toc ul ul li a {
    padding-left: 30px;
}

/* ===== FOOTER ===== */
footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 20px 10px;
    text-align: center;
    font-size: 0.9rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.footer-content p {
    margin: 0 0 8px 0;
}

.footer-content nav a {
    color: var(--footer-text);
    text-decoration: none;
    margin: 0 6px;
    transition: color 0.3s ease;
}

.footer-content nav a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    #menu, #utility-menu #theme-toggle, #utility-menu .lang-selector {
        display: none;
    }
    #burger {
        display: flex;
    }
    .doc-container {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 20px;
    }
    .doc-nav, .doc-toc {
        display: none;
    }
}

@media (max-width: 768px) {
    #header-section {
        padding: 1.5rem;
    }
    .doc-container {
        padding: 15px;
        gap: 0;
    }
    .doc-content {
        box-shadow: none;
        border-radius: 0;
        padding: 20px 15px;
    }
}