/* ALGEBRIX - Feuille de style commune */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #6eafef 0%, #6eafef 100%);
    min-height: 100vh;
}

/* ===== HEADER ===== */
header {
    background: rgba(20, 2, 86, 0.3);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(20, 2, 86, 0.3);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    color: #e5e0a6;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s;
    z-index: 1001;
}

.logo:hover {
    transform: scale(1.05);
}

.logo::before {
    content: "∑";
    font-size: 2.5rem;
    #6eafef;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== BOUTON HAMBURGER ===== */
.menu-toggle {
    display: none; /* Caché par défaut sur desktop */
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    gap: 5px;
}

.menu-toggle span {
    display: flex !important;
    width: 28px;
    height: 3px;
    background: #e5e0a6;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* ===== NAVIGATION ===== */
nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: nowrap; /* Important : ne pas passer à la ligne */
}

nav a {
    color: #e5e0a6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    position: relative;
    white-space: nowrap; /* Important : ne pas couper le texte */
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #6eafef;
    transition: all 0.3s;
    transform: translateX(-50%);
}

nav a:hover::after {
    width: 80%;
}

nav a:hover {
    #6eafef;
}

.admin-btn {
    background: linear-gradient(135deg, #f4c430 0%, #daa520 100%);
    color: #2c2c2c !important;
    font-weight: bold;
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244, 196, 48, 0.4);
}

.admin-btn::after {
    display: none; /* Pas de soulignement pour le bouton admin */
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-top: 80px;
    padding: 4rem 20px 3rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.page-header h1 {
    font-size: 3rem;
    color: #2c2c2c;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header p {
    font-size: 1.3rem;
    color: #2c2c2c;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 20px;
}

/* ===== SECTIONS ===== */
.level-section {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-left: 5px solid #e5e0a6;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.level-section h2 {
    color: #e5e0a6;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== CHAPTERS ===== */
.chapters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.chapter-card {
    background: linear-gradient(135deg, #fffef0 0%, #fff9e6 100%);
    border-radius: 15px;
    padding: 1.5rem;
    border: 2px solid #e5e0a6;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #e5e0a6, #e4dd89);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.chapter-card:hover::before {
    transform: scaleX(1);
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(244, 196, 48, 0.3);
}

.chapter-card h3 {
    color: #d1b160;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* ===== EXERCISES ===== */
.exercise-list {
    list-style: none;
    margin-top: 1rem;
}

.exercise-list li {
    padding: 0.7rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.exercise-list li:last-child {
    border-bottom: none;
}

.exercise-link {
    color: #555;
    text-decoration: none;
    display: flex !important;
    padding-left: 1.5rem;
    position: relative;
    transition: all 0.3s;
}

.exercise-link::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #e5e0a6;
    font-weight: bold;
    transition: transform 0.3s;
}

.exercise-link:hover::before {
    transform: translateX(5px);
}

.exercise-link:hover {
    color: #d7b150;
    padding-left: 2rem;
}

/* ===== BADGES ===== */
.type-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.type-cours {
    background-color: #e3f2fd;
    color: #1976d2;
}

.type-exercice {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.type-qcm {
    background-color: #fff3e0;
    color: #f57c00;
}

.type-probleme {
    background-color: #ffebee;
    color: #c62828;
}

/* ===== NO CONTENT ===== */
.no-content {
    text-align: center;
    padding: 3rem 2rem;
    color: #888;
    font-style: italic;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}


/* ===== FOOTER ===== */
footer {
    background: #6375d8;
    color: #e5e0a6;
    text-align: center;
    padding: 3rem 20px;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #e5e0a6;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    #6eafef;
}

/* ===== ANIMATIONS ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 768px) {
    /* Afficher le bouton hamburger */
    .menu-toggle {
        display: flex !important;
    }

    /* Cacher le menu par défaut */
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 300px;
        height: 100vh;
        background: rgba(44, 44, 44, 0.98);
        backdrop-filter: blur(10px);
        padding-top: 80px;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
    }

    /* Montrer le menu quand actif */
    nav.active {
        right: 0;
    }

    /* Menu vertical */
    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    nav ul li {
        border-bottom: 1px solid rgba(244, 196, 48, 0.1);
    }

    nav a {
        display: flex !important;
        padding: 1.2rem 2rem;
        border-radius: 0;
    }

    nav a::after {
        display: none;
    }

    nav a:hover {
        background: rgba(244, 196, 48, 0.1);
    }

    .admin-btn {
        margin: 1rem 2rem;
        border-radius: 10px;
        text-align: center;
    }

    /* Overlay pour fermer le menu */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    body.menu-open::before {
        opacity: 1;
        visibility: visible;
    }

    body.menu-open {
        overflow: hidden;
    }

    /* Ajustements */
    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1.1rem;
    }

    .chapters {
        grid-template-columns: 1fr;
    }

    .logo {
        font-size: 1.5rem;
    }

    .logo::before {
        font-size: 2rem;
    }
}