/* Variables CSS pour la cohérence */
:root {
    --sidebar-width: 280px;
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --text-color: #2c3e50;
    --bg-light: #f8f9fa;
    --border-color: #e9ecef;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* Amélioration de la typographie */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
}

/* Header au-dessus du sommaire */
header {
    position: relative;
    z-index: 1001;
}

/* Layout principal avec sidebar */
.page-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar de navigation - Nouvelle approche */
.table-of-contents {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow-y: auto;
    z-index: 1002;
    transform: translateX(-100%);
    transition: var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.table-of-contents.active {
    transform: translateX(0);
}

/* Spacer pour pousser le contenu sous le header */
.toc-spacer {
    height: 140px;
    flex-shrink: 0;
}

.toc-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.toc-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    text-align: center;
}

.toc-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-nav li {
    margin-bottom: 0.3rem;
}

.toc-nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.85rem;
    border-left: 3px solid transparent;
    line-height: 1.3;
}

.toc-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(5px);
}

.toc-nav a.active {
    background: rgba(255,255,255,0.2);
    color: white;
    border-left-color: #f39c12;
    font-weight: 600;
}

/* Bouton menu mobile */
.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1003;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.menu-toggle:hover {
    background: #2980b9;
    transform: scale(1.1);
}

/* Overlay pour mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contenu principal */
.main-content {
    flex: 1;
    margin-left: 0;
    transition: var(--transition);
}

/* Bouton retour en haut */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #2980b9;
    transform: translateY(-3px);
}

/* Améliorations des sections */
.section-anchor {
    scroll-margin-top: 2rem;
}

.section-title {
    position: relative;
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
    margin: 2rem 0 1.5rem 0;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Responsive Design */
@media (min-width: 1200px) {
    .table-of-contents {
        transform: translateX(0);
        position: fixed;
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
    }
    
    .menu-toggle {
        display: none;
    }
}

@media (max-width: 1199px) {
    .table-of-contents {
        width: 300px;
    }
    
    .toc-spacer {
        height: 120px;
    }
    
    .toc-content {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .table-of-contents {
        width: 280px;
    }
    
    .toc-spacer {
        height: 100px;
    }
    
    .toc-content {
        padding: 1.5rem 1rem;
    }
    
    .responsive-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 1rem !important;
        margin: 1rem 0 !important;
    }
    
    .responsive-container {
        padding: 1rem !important;
        margin: 1rem 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Force le responsive sur tous les conteneurs */
    div[style*="display: grid"] {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Correction des images */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Correction des tableaux */
    table {
        width: 100% !important;
        overflow-x: auto !important;
        display: block !important;
        white-space: nowrap !important;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .responsive-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        padding: 0.75rem !important;
    }
    
    .responsive-container {
        padding: 0.75rem !important;
        margin: 0.75rem 0 !important;
    }

    .table-of-contents {
        width: 260px;
    }
    
    .toc-spacer {
        height: 80px;
    }
    
    .toc-content {
        padding: 1rem 0.75rem;
    }
}

/* Animations et micro-interactions */
.responsive-container {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.responsive-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Amélioration de la lisibilité */
h3, h4, h5 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

/* Focus states pour l'accessibilité */
.toc-nav a:focus,
.menu-toggle:focus,
.back-to-top:focus {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
}

/* Styles pour la navigation au clavier */
.keyboard-navigation .toc-nav a:focus,
.keyboard-navigation .menu-toggle:focus,
.keyboard-navigation .back-to-top:focus {
    outline: 3px solid #f39c12;
    outline-offset: 2px;
}

/* Animation d'entrée */
.responsive-container {
    transition: opacity 0.6s ease, transform 0.6s ease;
} 