/* styles.css - Version unifiée pour tous les chapitres */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --text: #111827;
    --text-light: #4b5563;
    --text-lighter: #6b7280;
    --border: #e5e7eb;
    --bg: #f9fafb;
    --bg-light: #f3f4f6;
    --bg-dark: #1f2937;
    --success: #10b981;
    --warning: #ef4444;
    --info: #3b82f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden; /* Empêche le débordement horizontal */
}

/* Layout principal */
.content-wrapper {
    display: flex;
    min-height: calc(100vh - 120px);
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 25px 15px;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}

.sidebar h3 {
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 600;
}

.table-of-contents ul {
    list-style: none;
}

.table-of-contents li {
    margin-bottom: 8px;
    position: relative;
}

.table-of-contents a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-of-contents a:hover {
    background-color: var(--bg-light);
    color: var(--text);
}

.table-of-contents a.active {
    background-color: var(--primary);
    color: white;
}

.table-of-contents a.active i {
    color: white;
}

.table-of-contents i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    color: var(--text-lighter);
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Contenu principal */
.main-content {
    flex: 1;
    padding: 20px 30px;
    max-width: calc(100% - 280px);
    overflow-x: hidden;
}

/* En-tête */
.main-header {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 25px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-brand {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.logo i {
    margin-right: 12px;
    color: var(--primary);
    font-size: 1.3rem;
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-lighter);
}

.header-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.header-nav a {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.header-nav a:hover {
    background-color: var(--bg-light);
    color: var(--text);
}

.header-nav i {
    margin-right: 8px;
}

/* Sections de contenu */
.content-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 35px;
    margin-bottom: 35px;
}

.section-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.section-header h1 {
    font-size: 1.9rem;
    color: var(--text);
    display: flex;
    align-items: center;
    font-weight: 700;
}

.section-header h1 i {
    margin-right: 15px;
    color: var(--primary);
    font-size: 1.4rem;
}

.section-meta {
    color: var(--text-lighter);
    font-size: 0.9rem;
    margin-top: 8px;
}

.section-body {
    line-height: 1.7;
}

.section-body h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin: 30px 0 20px;
    font-weight: 600;
}

.section-body h3 {
    font-size: 1.2rem;
    color: var(--text);
    margin: 25px 0 15px;
    font-weight: 600;
}

.section-body p {
    margin-bottom: 18px;
    color: var(--text-light);
}

.section-body ul, .section-body ol {
    margin-bottom: 20px;
    padding-left: 25px;
}

.section-body li {
    margin-bottom: 8px;
    color: var(--text-light);
}

/* Boîtes spéciales */
.concept-box {
    background-color: #f8fafc;
    border-left: 4px solid var(--primary);
    padding: 20px;
    margin: 25px 0;
    border-radius: 0 8px 8px 0;
}

.concept-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.pro-tip {
    display: flex;
    background-color: #ecfdf5;
    border-left: 4px solid var(--success);
    padding: 20px;
    margin: 25px 0;
    border-radius: 0 8px 8px 0;
}

.pro-tip i {
    color: var(--success);
    margin-right: 15px;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.pro-tip-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.warning {
    display: flex;
    background-color: #fef2f2;
    border-left: 4px solid var(--warning);
    padding: 20px;
    margin: 25px 0;
    border-radius: 0 8px 8px 0;
}

.warning i {
    color: var(--warning);
    margin-right: 15px;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.warning-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Code */
pre[class*="language-"] {
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

code:not([class*="language-"]) {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--bg-light);
    color: var(--text);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Grilles et cartes */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin: 25px 0;
}

.example-card {
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.example-card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text);
    font-weight: 600;
}

.example-card pre {
    margin: 15px 0;
}

.example-card p {
    margin: 10px 0 0;
}

/* Pied de page */
.main-footer {
    background-color: var(--bg-dark);
    color: #fff;
    padding: 50px 0 25px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 25px;
}

.footer-col h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 10px;
}

.footer-col a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.footer-col a:hover {
    color: #fff;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 25px;
    border-top: 1px solid #374151;
    font-size: 0.9rem;
    color: #9ca3af;
    max-width: 1400px;
    margin: 0 auto;
    padding: 25px 25px 0;
}

.legal-links {
    display: flex;
    gap: 20px;
}

.legal-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s;
}

.legal-links a:hover {
    color: #fff;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.pagination a {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.pagination a:hover {
    background-color: var(--primary-dark);
}

.pagination i {
    margin: 0 6px;
}

/* Cartes de résumé */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin: 35px 0;
}

.summary-card {
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.summary-card i {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.summary-card h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--text);
    font-weight: 600;
}

.summary-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Conclusion */
.conclusion-text {
    background-color: #f8fafc;
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin: 30px 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .content-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 240px;
        padding: 20px 12px;
    }
    
    .main-content {
        padding: 30px 40px;
        max-width: calc(100% - 240px);
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 20px;
    }
    
    .main-content {
        padding: 25px;
        max-width: 100%;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-nav {
        margin-top: 15px;
        width: 100%;
        justify-content: space-between;
    }
    
    .content-section {
        padding: 25px;
    }
    
    .section-header h1 {
        font-size: 1.7rem;
    }
    
    .table-of-contents a {
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination a {
        justify-content: center;
        width: 100%;
    }
    
    .example-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .legal-links {
        justify-content: center;
    }
}