:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #5A6466;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --bg-primary: #ffffff;
    --bg-secondary: var(--gray-50);
    --border-color: var(--gray-200);
}

[data-theme="dark"] {
    --text-primary: #f8f9fa;
    --text-secondary: #e9ecef;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --border-color: #404040;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
  }
  
  .container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 20rem;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: var(--bg-primary);
    padding: 32px 0 0 0;
    z-index: 10;
    position: fixed;
    height: 100vh;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-dark);
    font-weight: bold;
    font-size: 1.25rem;
    padding: 0 2rem 1.5rem 2rem;
    letter-spacing: -1px;
}

.sommaire {
    padding: 0 2rem;
}

.sommaire a {
    display: flex;
    align-items: center;
    padding: 0.25rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s, padding-left 0.2s;
}

.sommaire a:hover {
    background: var(--bg-secondary);
    color: var(--gray-700);
}

.sommaire a.active {
    background: var(--gray-100);
    color: var(--gray-700);
}

.sub-chapter-detail {
    padding-left: 1rem;
}

.content {
    flex: 1;
    padding: 2rem;
    margin-left: 20rem;
    background: var(--bg-primary);
    overflow-y: auto;
    text-align: left;
    box-sizing: border-box;
}

.markdown-content {
    max-width: 65ch;
    margin: 0 auto;
}

.content h1, .content h2, .content h3, .content h4 {
    text-align: left;
    margin-left: 0;
    padding-left: 0;
    color: var(--gray-700);
}

.content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);

}

.content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

.content h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.content p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.95em;
}

.content pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.content ul,
.content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 24px auto;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.content th,
.content td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.content th {
    background: var(--bg-secondary);
}

blockquote {
    background-color: var(--bg-secondary);
    border-left: 5px solid var(--gray-400);
    margin: 1.5em 5px;
    padding: 0.5em 5px;
}

blockquote p {
    padding-left: 30px;
    display: inline;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        margin-left: 0;
    }
    .sommaire {
        padding: 0 1rem;
    }
    .content {
        margin-left: 0;
        padding: 1rem;
    }
    .container {
        flex-direction: column;
    }
  }
  
  table {
    width: 100%; /* Utilise toute la largeur disponible */
    border-collapse: collapse; /* Supprime l'espacement entre les bordures des cellules */
    margin-bottom: 20px; /* Espacement après la table */
    background-color: #ffffff; /* Fond de la table */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Ombre portée légère pour la profondeur */
  }
  
  th, td {
    text-align: left; /* Alignement du texte dans les cellules */
    padding: 8px; /* Espacement interne dans les cellules */
    border-bottom: 1px solid #ddd; /* Bordure de séparation des lignes */
  }
  
  th {
    background-color: #f8f8f8; /* Fond des en-têtes de colonne */
    color: #333; /* Couleur du texte des en-têtes */
    font-weight: bold; /* Texte en gras pour les en-têtes */
  }
  
  tr:hover {
    background-color: #f5f5f5; /* Changement de fond au survol d'une ligne */
  }
  
  /* Style pour améliorer l'apparence des bordures de la table si nécessaire */
  table, th, td {
    border: 1px solid #ddd; /* Bordure légère autour de la table et des cellules */
  }
  
  /* Styliser les bordures et les rayures des lignes pour améliorer la lisibilité */
  /* Couleur de fond pour les lignes impaires */
  
  /*
  tbody tr:nth-child(odd) {
    background-color: #f9f9f9; 
  }
  */
  
  blockquote {
    background-color: #f7f7f7;
    border-left: 5px solid grey;
    margin: 1.5em 5px;
    padding: 0.5em 5px;
  }
  
  
  blockquote p {
    padding-left: 30px;;
    display: inline;
  }
  
.treeview, .treeview ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.tree-parent {
  position: relative;
  padding-left: 1.2em;
  font-weight: bold;
  margin-top: 1rem;
  cursor: pointer;
  color: var(--gray-700);
  padding: 0.25rem 0 0.25rem 1.2em;
  user-select: none;
}

.tree-parent::before {
  content: '▶';
  position: absolute;
  left: 0;
  top: 0.2em;
  font-size: 0.8em;
  transition: transform 0.2s;
  color: var(--gray-700);
}

.tree-parent.open::before {
  transform: rotate(90deg);
}

.tree-parent > ul {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.tree-sub-parent {
  position: relative;
  padding-left: 1.2em;
  font-weight: bold;
  margin-top: 0.5rem;
  cursor: pointer;
  color: var(--gray-700);
  user-select: none;
}
.tree-sub-parent::before {
  content: '▶';
  position: absolute;
  left: 0;
  top: 0.2em;
  font-size: 0.8em;
  transition: transform 0.2s;
  color: var(--gray-700);
}
.tree-sub-parent.open::before {
  transform: rotate(90deg);
}
.tree-sub-parent > ul {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  padding-left: 0.8rem;
  display: none;
}
.tree-sub-parent.open > ul {
  display: block;
}

.tree-child a {
  font-weight: normal;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  padding: 0.25rem 0.25rem;
  font-size: smaller;
  border-radius: 0.375rem;
  transition: background 0.2s, color 0.2s;
}

.tree-child a:hover {
  background: var(--bg-secondary);
  color: var(--gray-700);
}

.tree-child {
  position: relative;
}
.tree-child::before {
  content: '';
}

.mobile-header {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    height: 3.5rem;
    padding: 0 1rem;
    width: 100%;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .mobile-header .logo {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-dark);
    padding: 0;
    margin: 0;
  }

  .menu-toggle {
    display: inline-block;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 0.5rem;
    margin: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    border-right: 1px solid var(--border-color);
    padding-top: 3.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .container {
    flex-direction: column;
  }

  .content {
    margin-left: 0;
    padding: 1rem;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .markdown-content {
    max-width: 100%;
    padding: 0 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .content h1 {
    font-size: 1.75rem;
  }

  .content h2 {
    font-size: 1.5rem;
  }

  .content h3 {
    font-size: 1.25rem;
  }

  .content pre {
    margin: 0.5rem 0;
    padding: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
  }

  .content code {
    word-break: break-word;
  }

  body.menu-open {
    overflow: hidden;
    touch-action: none;
    position: fixed;
    width: 100%;
  }
}
  
.mermaid {
  background: var(--bg-primary);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  text-align: center;
}
  