/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --transition: all 0.3s ease;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    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-color: #f8f9fa;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
}

/* ========================================
   NAVIGATION
   ======================================== */
nav {
    background: var(--primary);
    color: white;
    padding: 1rem 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.logo span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ========================================
   HEADER PRINCIPAL
   ======================================== */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    text-align: center;
    padding: 5rem 2rem;
    margin-bottom: 3rem;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.3rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 2rem;
}

.tagline {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.8);
    max-width: 600px;
    margin: 0 auto 2rem;
}

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

section {
    margin: 4rem 0;
}

h2 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary);
    display: inline-block;
}

/* ========================================
   CARDS - PAGE ACCUEIL
   ======================================== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: var(--transition);
    border-left: 4px solid var(--secondary);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.card p {
    color: #666;
    margin-bottom: 1rem;
}

.card-icon {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-block;
    background: var(--secondary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    text-align: center;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: var(--secondary);
    color: white;
}

/* ========================================
   LINKS GRID - RESSOURCES
   ======================================== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.link-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: var(--transition);
    text-align: center;
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
}

.link-card .icon {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 0.8rem;
    display: block;
}

.link-card h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 3rem 2rem;
    margin-top: 4rem;
}

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

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

.footer-links a {
    color: rgba(255,255,255,0.7);
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.contact-info {
    margin: 1.5rem 0;
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
}

.copyright {
    color: rgba(255,255,255,0.6);
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

/* ========================================
   BREADCRUMB - PAGES COURS
   ======================================== */
.breadcrumb {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--gray);
    font-size: 0.95rem;
}

.breadcrumb a {
    color: var(--secondary);
    font-weight: 500;
}

.breadcrumb span:not(.icon) {
    color: var(--gray);
}

/* ========================================
   COURSE HEADER - PAGES COURS
   ======================================== */
.course-header {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 3rem;
}

.course-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.course-header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.course-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ========================================
   MAIN CONTENT - PAGES COURS
   ======================================== */
.main-content {
    background: white;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.section {
    margin-bottom: 2rem;
}

/* ========================================
   STYLES SPÉCIFIQUES PAGES COURS
   ======================================== */

/* Definition boxes */
.definition {
    background: rgba(46, 204, 113, 0.1);
    border-left: 4px solid #27ae60;
    padding: 1.2rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.definition h4 {
    color: #27ae60;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

/* Note boxes */
.note {
    background: rgba(52, 152, 219, 0.1);
    border-left: 4px solid var(--secondary);
    padding: 1.2rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.note.warning {
    background: rgba(231, 76, 60, 0.1);
    border-left-color: var(--accent);
}

/* Example boxes */
.example {
    background: rgba(241, 196, 15, 0.1);
    border-left: 4px solid #f39c12;
    padding: 1.2rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.example h5 {
    color: #f39c12;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

/* Formula cards */
.formula-card {
    background: rgba(52, 152, 219, 0.08);
    border-left: 4px solid var(--secondary);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.formula,
.formula-large {
    background: rgba(44, 62, 80, 0.08);
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    font-size: 1.3rem;
    font-family: 'Cambria Math', 'Times New Roman', serif;
    margin: 1rem 0;
    letter-spacing: 0.5px;
}

.formula-large {
    padding: 1.2rem;
    font-size: 1.4rem;
    line-height: 1.6;
}

/* Properties */
.properties {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin: 1.5rem 0;
}

.properties ul {
    padding-left: 2rem;
    line-height: 1.8;
}

.properties li {
    margin-bottom: 0.5rem;
}

/* Process */
.process {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin: 1.5rem 0;
    border-left: 4px solid var(--accent);
}

.process h4 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-weight: 600;
}

.process ol {
    padding-left: 2rem;
    line-height: 1.8;
    margin-top: 1rem;
}

.process li {
    margin-bottom: 0.5rem;
}

/* Exercise */
.exercise {
    background: white;
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.exercise h4 {
    color: var(--accent);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.solution {
    background: rgba(231, 76, 60, 0.08);
    padding: 1.2rem;
    border-radius: 5px;
    margin-top: 1rem;
    display: none;
}

.solution.show {
    display: block;
}

.solution h5 {
    color: var(--accent);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

/* Resource list */
.resource-list {
    list-style: none;
    padding-left: 0;
    line-height: 1.8;
}

.resource-list li {
    padding-left: 1.5rem;
    position: relative;
}

.resource-list li:before {
    content: "•";
    color: var(--secondary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* ========================================
   CARD GRID - INFO CARDS
   ======================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.info-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid var(--secondary);
}

.info-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary);
    font-weight: 600;
}

/* ========================================
   DOWNLOAD SECTION
   ======================================== */
.download-section {
    margin: 2rem 0;
    padding-top: 1.5rem;
    border-top: 2px solid var(--light);
}

.download-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.download-btn {
    display: inline-block;
    background: var(--secondary);
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 5px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.download-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* ========================================
   NAVIGATION BUTTONS - ENTRE COURS
   ======================================== */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--light);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   TABLES
   ======================================== */
.simple-table,
.freq-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.simple-table th,
.simple-table td,
.freq-table th,
.freq-table td {
    padding: 0.8rem;
    text-align: center;
    border: 1px solid var(--light);
}

.simple-table th,
.freq-table th {
    background: var(--secondary);
    color: white;
    font-weight: 600;
}

.simple-table tr:nth-child(even),
.freq-table tr:nth-child(even) {
    background: rgba(255,255,255,0.3);
}

.freq-table .total-row {
    font-weight: bold;
    background: rgba(52, 152, 219, 0.1);
}

.simple-table {
    background: var(--light);
    border-radius: 5px;
    overflow: hidden;
}

.simple-table tr {
    border-bottom: 1px solid white;
}

/* ========================================
   CODE BLOCK
   ======================================== */
.code-block {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    line-height: 1.5;
}

.code-block code {
    color: #ecf0f1;
}

/* ========================================
   VISUALIZATIONS
   ======================================== */
.correlation-circle {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 2rem auto;
}

.circle-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px dashed rgba(52, 152, 219, 0.5);
}

.axis-h,
.axis-v {
    position: absolute;
    background: var(--gray);
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
}

.axis-v {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
}

.var {
    position: absolute;
    width: 60px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--secondary);
}

.dendrogram {
    position: relative;
    height: 200px;
    margin: 2rem 0;
    padding-left: 50px;
}

.dendro-line {
    position: absolute;
    background: var(--secondary);
}

.h1 { width: 40px; height: 2px; top: 30px; left: 0; }
.h2 { width: 40px; height: 2px; top: 70px; left: 0; }
.h3 { width: 40px; height: 2px; top: 110px; left: 0; }
.h4 { width: 40px; height: 2px; top: 150px; left: 0; }

.dendro-leaf {
    position: absolute;
    left: 50px;
    font-family: monospace;
    font-size: 0.9rem;
}

.dendro-leaf:nth-child(5) { top: 20px; }
.dendro-leaf:nth-child(6) { top: 40px; }
.dendro-leaf:nth-child(7) { top: 60px; }
.dendro-leaf:nth-child(8) { top: 80px; }
.dendro-leaf:nth-child(9) { top: 100px; }

.visualization {
    margin: 2rem 0;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    text-align: center;
}

.caption {
    font-style: italic;
    color: var(--gray);
    margin-top: 0.5rem;
    font-size: 0.9rem;
    text-align: center;
}

/* ========================================
   BACK TO TOP BUTTON
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: none;
    z-index: 999;
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 968px) {
    /* Navigation mobile */
    .menu-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 70px;
        right: -100%;
        flex-direction: column;
        background: var(--primary);
        width: 250px;
        height: calc(100vh - 70px);
        padding: 2rem;
        transition: var(--transition);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    }

    .nav-links.active {
        right: 0;
    }

    /* Headers */
    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .course-header h1 {
        font-size: 2rem;
    }

    /* Grids */
    .cards,
    .links-grid,
    .card-grid {
        grid-template-columns: 1fr;
    }

    /* Container */
    .container {
        padding: 0 1rem;
    }

    /* Navigation buttons */
    .navigation-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .navigation-buttons a {
        text-align: center;
    }

    /* Correlation circle */
    .correlation-circle {
        width: 250px;
        height: 250px;
    }

    /* Back to top */
    .back-to-top {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    nav,
    footer,
    .btn,
    .back-to-top {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card,
    .main-content,
    .info-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}