/* === VARIABLES === */
:root {
    --primary: #3a0361;
    --secondary: #2a0252;
    --accent: #5e43ee;
    --dark: #0a0a0a;
    --light: #f8f9fa;
    --success: #4cc9f0;
    --warning: #f72585;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* === BASE === */
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    line-height: 1.7;
    color: #333;
    background-color: var(--light);
    margin: 0;
    font-size: 1.1rem;
}

.container {
    margin: 0 auto;
    padding: 0 20px;
    max-width: 1200px;
}

/* === HEADER === */
header {
    background: linear-gradient(135deg, var(--primary), var(--dark));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--accent);
    animation: pulse 2s infinite;
}

/* Navigation desktop */
.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.header-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Menu du cours - mobile seulement */
.course-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 8px 12px;
    border-radius: 4px;
    transition: var(--transition);
}

.course-menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.course-menu {
    position: absolute;
    top: 100%;
    right: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    transform: scale(0.95);
    opacity: 0;
    visibility: hidden;
    transform-origin: top right;
    transition: var(--transition);
    z-index: 90;
}

.course-menu.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

.course-menu h3 {
    color: var(--primary);
    margin: 0;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.course-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.course-menu li {
    border-bottom: 1px solid #f5f5f5;
}

.course-menu a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
}

.course-menu a:hover {
    background: rgba(114, 9, 183, 0.05);
    color: var(--primary);
}

.course-menu .current {
    background: rgba(114, 9, 183, 0.1);
    color: var(--primary);
    font-weight: 600;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* === MAIN LAYOUT === */
.lesson-container {
    display: flex;
    gap: 20px;
    margin: 1.5rem 0 3rem;
}

/* === SIDEBAR === */
.sidebar-full {
    width: 260px;
    flex-shrink: 0;
    background-color: #f4f4f4;
    padding: 1rem;
    border-right: 1px solid #ddd;
    height: calc(100vh - 100px);
    position: sticky;
    top: 80px;
    overflow-y: auto;
}

.sidebar-full h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    position: sticky;
    top: 0;
    background-color: #f4f4f4;
    padding: 0.5rem 0;
    z-index: 1;
}

.sidebar-full ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 2rem;
}

.sidebar-full li {
    margin-bottom: 0.4rem;
}

.sidebar-full a {
    color: #333;
    text-decoration: none;
    display: block;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-full a:hover,
.sidebar-full a.active {
    background-color: var(--primary);
    color: white;
}

/* Style pour la barre de défilement */
.sidebar-full::-webkit-scrollbar {
    width: 8px;
}

.sidebar-full::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sidebar-full::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.sidebar-full::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* === CONTENT === */
.lesson-content {
    flex-grow: 1;
    background: white;
    border-radius: var(--radius);
    padding: 1.8rem;
    box-shadow: var(--shadow);
}

.lesson-title {
    color: var(--dark);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.lesson-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: var(--accent);
}

h2 {
    color: var(--primary);
    margin: 2rem 0 1.2rem;
    font-size: 1.7rem;
}

h3 {
    color: var(--secondary);
    margin: 1.8rem 0 1rem;
    font-size: 1.4rem;
}

p {
    margin-bottom: 1.2rem;
    line-height: 1.7;
}

ul, ol {
    margin: 1.2rem 0 1.2rem 1.5rem;
}

li {
    margin-bottom: 0.6rem;
}

/* === COMPONENTS === */
.note {
    background: #e7f5ff;
    border-left: 4px solid var(--accent);
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.warning {
    background: #fff3bf;
    border-left: 4px solid #ffd43b;
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.tip {
    background: #ebfbee;
    border-left: 4px solid #2b8a3e;
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* === CODE BLOCKS === */
.code-block {
    background: #282c34;
    color: #abb2bf;
    padding: 1.2rem;
    border-radius: var(--radius);
    font-family: 'Fira Code', 'Consolas', monospace;
    margin: 1.5rem 0;
    overflow-x: auto;
    line-height: 1.5;
    font-size: 0.95rem;
    tab-size: 4;
}

/* PHP Syntax */
.php-tag { color: #c678dd; }
.php-keyword { color: #c678dd; font-weight: bold; }
.php-function { color: #61afef; }
.php-string { color: #98c379; }
.php-comment { color: #5c6370; font-style: italic; }
.php-variable { color: #e06c75; }
.php-operator { color: #56b6c2; }
.php-number { color: #d19a66; }

/* HTML Syntax */
.html-doctype { color: #abb2bf; }
.html-tag { color: #e06c75; }
.html-attribute { color: #d19a66; }
.html-value { color: #98c379; }
.html-comment { color: #5c6370; font-style: italic; }
.html-text { color: #abb2bf; }

/* === NAVIGATION === */
.lesson-navigation {
    display: flex;
    justify-content: space-between;
    margin: 2.5rem 0 1rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 600;
}

.nav-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* === FOOTER === */
footer {
    background: var(--dark);
    color: white;
    padding: 2.5rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.footer-column h3 {
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
    position: relative;
    color: white;
}

.footer-column h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column li {
    margin-bottom: 0.7rem;
}

.footer-column a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-column a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 1.2rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--accent);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #aaa;
    font-size: 0.9rem;
}

/* === BOUTON RETOUR EN HAUT === */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary);
    transform: translateY(-3px);
}

/* === RESPONSIVE === */
@media (max-width: 1023px) {
    .header-nav {
        display: none;
    }
    
    .course-menu-toggle {
        display: flex;
    }
    
    .sidebar-full {
        display: none;
    }
    
    .lesson-container {
        display: block;
    }
    
    .lesson-content {
        padding-left: 0;
    }
}

@media (max-width: 768px) {
    .course-menu {
        right: 10px;
        width: calc(100% - 20px);
        max-height: 60vh;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

/* Overlay pour les menus */
.overlay {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}