:root,
[data-bs-theme=light] {
    /* Branding principal */
    --bs-primary: #4b6cff;
    --bs-primary-rgb: 75, 108, 255;
    --bs-primary-text-emphasis: #2e3ca8;
    --bs-primary-bg-subtle: #dbe4ff;
    --bs-primary-border-subtle: #b0c0ff;

    /* Accent secondaire */
    --bs-secondary: #7c3aed;
    --bs-secondary-rgb: 124, 58, 237;
    --bs-secondary-text-emphasis: #5a2bbb;
    --bs-secondary-bg-subtle: #e8ddff;
    --bs-secondary-border-subtle: #d2b8ff;

    /* Couleur informative */
    --bs-info: #8b5cf6;
    --bs-info-rgb: 139, 92, 246;
    --bs-info-text-emphasis: #5b2bc2;
    --bs-info-bg-subtle: #efe6ff;
    --bs-info-border-subtle: #d7c4ff;

    /* Liens */
    --bs-link-color: #4b6cff;
    --bs-link-color-rgb: 75, 108, 255;
    --bs-link-hover-color: #7c3aed;
    --bs-link-hover-color-rgb: 124, 58, 237;

    --bs-focus-ring-color: rgba(75, 108, 255, 0.25);

    /* Les autres couleurs Bootstrap par défaut */
    --bs-success: #198754;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
    --bs-white: #fff;
    --bs-black: #000;
    --bs-gray: #6c757d;
    --bs-gray-dark: #343a40;

    /* Typo, ombres, rayons, etc. inchangés */
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-color: #212529;
    --bs-body-bg: #fff;
    --bs-border-radius: 0.375rem;
    --bs-border-color: #dee2e6;
}

[data-bs-theme=dark] {
    --bs-primary: #5e7eff;
    --bs-primary-rgb: 94, 126, 255;
    --bs-primary-text-emphasis: #4b6cff;
    --bs-primary-bg-subtle: #1a234a;
    --bs-primary-border-subtle: #3c5ae0;

    --bs-secondary: #8b5cf6;
    --bs-secondary-rgb: 139, 92, 246;
    --bs-secondary-text-emphasis: #7c3aed;
    --bs-secondary-bg-subtle: #2a1d4a;
    --bs-secondary-border-subtle: #5a2bbb;

    --bs-info: #9f7cf8;
    --bs-info-rgb: 159, 124, 248;
    --bs-info-text-emphasis: #8b5cf6;
    --bs-info-bg-subtle: #2d2149;
    --bs-info-border-subtle: #5b2bc2;

    --bs-link-color: #5e7eff;
    --bs-link-color-rgb: 94, 126, 255;
    --bs-link-hover-color: #8b5cf6;
    --bs-link-hover-color-rgb: 139, 92, 246;

    --bs-focus-ring-color: rgba(94, 126, 255, 0.25);

    --bs-body-color: #ced4da;
    --bs-body-bg: #1a1a1a;
    --bs-border-color: #444;
    --bs-tertiary-bg: #2b3035;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #3c5ae0;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-focus-shadow-rgb: 75, 108, 255;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #344fc0;
    --bs-btn-active-border-color: transparent;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: transparent;
    border: none;
    /* Gradient background applied directly */
    background: linear-gradient(135deg, #4b6cff, #7c3aed);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3c5ae0, #6b2fcb);
}

.btn-primary:active,
.btn-primary.active {
    background: linear-gradient(135deg, #344fc0, #5e28b2);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: linear-gradient(135deg, #4b6cff, #7c3aed);
    opacity: 0.65;
}

.list-group {
    --bs-list-group-color: var(--bs-body-color);
    --bs-list-group-bg: var(--bs-body-bg);
    --bs-list-group-border-color: var(--bs-border-color);
    --bs-list-group-border-width: var(--bs-border-width);
    --bs-list-group-border-radius: var(--bs-border-radius);
    --bs-list-group-item-padding-x: 1rem;
    --bs-list-group-item-padding-y: 0.5rem;
    --bs-list-group-action-color: var(--bs-secondary-color);
    --bs-list-group-action-hover-color: var(--bs-emphasis-color);
    --bs-list-group-action-hover-bg: var(--bs-tertiary-bg);
    --bs-list-group-action-active-color: var(--bs-body-color);
    --bs-list-group-action-active-bg: var(--bs-secondary-bg);
    --bs-list-group-disabled-color: var(--bs-secondary-color);
    --bs-list-group-disabled-bg: var(--bs-body-bg);

    --bs-list-group-active-color: #fff;
    --bs-list-group-active-bg: #4b6cff;
    --bs-list-group-active-border-color: transparent;

    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: var(--bs-list-group-border-radius);
}

/* Apply gradient to active list items */
.list-group-item.active {
    background: linear-gradient(135deg, #4b6cff, #7c3aed);
}

.list-group-item {
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease, border-left 0.3s ease;
    border-left: 4px solid transparent;
}

.list-group-item.active {
    border-left: 4px solid #7c3aed;
    /* couleur violette visible */
    font-weight: 500;
    color: #fff;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #000 100%);
    color: #FFF;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


[data-bs-theme=dark] .card {
    background-color: #2c2c2c !important;
    color: #fff !important;
    /* gris foncé */
    border: 1px solid #444;
}

.container-fluid {
    flex: 1;
}

h1,
h2 {
    color: #2c3e50;
}

[data-bs-theme=dark] h1,
[data-bs-theme=dark] h2 {
    color: #f0f0f0;
}


[data-bs-theme=dark] .list-group {
    --bs-list-group-color: #fff;
    --bs-list-group-bg: #2c2c2c;
}

.section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

[data-bs-theme=dark] .section {
    background: #2c2c2c;
    color: #fff;
}

[data-bs-theme=dark] .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

pre {
    border-radius: 8px;
    margin-top: 10px;
}

/* --- MOBILE SIDEBAR & LAYOUT FIXES --- */
.mobile-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    background: white;
    overflow-y: hidden;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
    display: none;
    /* Make it a drawer from bottom */
    top: auto;
    height: 80vh;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.mobile-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    width: 100%;
    margin: 0 !important;
    z-index: 1040;
    /* Ensure above content but below sidebar */
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* Spacer to prevent content from being hidden behind fixed footer on mobile */
@media (max-width: 767.98px) {
    body {
        padding-bottom: 80px;
    }
}

@media screen and (min-width: 768px) {
    .mobile-fixed {
        position: relative;
        background-color: transparent;
        border-top: none;
        padding: 0;
        z-index: auto;
        width: auto;
        box-shadow: none;
    }
}

.mobile-sidebar .sidebar-header {
    background: white;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.mobile-sidebar .list-group {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

[data-bs-theme=dark] .mobile-sidebar,
[data-bs-theme=dark] .mobile-fixed,
[data-bs-theme=dark] .mobile-sidebar .sidebar-header {
    background-color: #212529;
    color: white;
    border-color: #444;
}

/* Ensure padding for fixed navbar */
body {
    padding-top: 60px !important;
    /* Increased to prevent navbar from hiding breadcrumb */
}

/* ========================================
   FOOTER PREMIUM STYLES
   ======================================== */

/* Footer Premium Base Styles */
.footer-premium {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    position: relative;
    overflow: hidden;
}

.footer-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* Footer Links */
.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--bs-primary);
    transform: translateX(5px);
}

/* Social Links */
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-radius: 50%;
    margin-right: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-link:hover {
    background: var(--bs-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
}

/* Footer Contact */
.footer-contact i {
    width: 20px;
}

/* Footer Brand */
.footer-brand h3 {
    letter-spacing: -0.5px;
}

/* Dark Mode Support for Footer */
[data-bs-theme=dark] .footer-premium {
    background: linear-gradient(135deg, #0a0f1a 0%, #151b2b 100%);
}

[data-bs-theme=dark] .footer-links a {
    color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme=dark] .footer-links a:hover {
    color: var(--bs-primary);
}

[data-bs-theme=dark] .social-link {
    background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme=dark] .social-link:hover {
    background: var(--bs-primary);
}

/* ========================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Hide footer on mobile for chapter pages to avoid conflicts with fixed bottom navigation */
@media (max-width: 767.98px) {
    body:has(.mobile-fixed) .footer-premium {
        display: none !important;
    }
}