/* ============================================================================
   COURS - Analyse et Exploration de Données
   Stylesheet global
   ============================================================================ */

/* Variables CSS */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --code-bg: #f3f4f6;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.btn-home {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn-home:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Page header */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 1rem;
    margin: 2rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Sections */
section {
    background: var(--card-bg);
    margin: 2rem 0;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.content-section h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-color);
}

.content-section h3 {
    color: var(--primary-dark);
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-section h4 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Objectives */
.objectives {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-left: 4px solid var(--primary-color);
}

.objectives ul {
    list-style: none;
}

.objectives li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
}

.objectives li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Boxes */
.definition-box,
.example-box,
.highlight-box {
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

.definition-box {
    background: #f0fdf4;
    border-left: 4px solid var(--success-color);
}

.example-box {
    background: #fffbeb;
    border-left: 4px solid var(--warning-color);
}

.highlight-box {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
}

.example-item {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
}

/* Code blocks - Enhanced macOS style with syntax highlighting */
.code-container {
    position: relative;
    margin: 25px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.code-header {
    background: #1e1e1e;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #3a3a3a;
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.code-dot.red { background: #ff5f56; }
.code-dot.yellow { background: #ffbd2e; }
.code-dot.green { background: #27c93f; }

.code-block {
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.code-block pre {
    padding: 1.5rem;
    margin: 0;
    background: #1e1e1e;
}

pre {
    margin: 0 !important;
    border-radius: 0 !important;
    background: #1e1e1e !important;
}

pre[class*="language-"] {
    padding: 25px !important;
    font-size: 0.95em;
    line-height: 1.6;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    background: #1e1e1e !important;
    color: #d4d4d4 !important;
}

.code-container pre[class*="language-"] {
    background: #1e1e1e !important;
}

.code-block code,
pre code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #d4d4d4;
    background: transparent;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
}

:not(pre) > code {
    background: #f4f4f4;
    padding: 3px 8px;
    border-radius: 4px;
    color: #e83e8c;
    font-weight: 500;
}

/* Syntax Highlighting - VS Code Dark Theme */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6a9955;
    font-style: italic;
}

.token.punctuation {
    color: #d4d4d4;
}

.token.namespace {
    opacity: 0.7;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #b5cea8;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #ce9178;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #d4d4d4;
    background: transparent;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #c586c0;
}

.token.function,
.token.class-name {
    color: #dcdcaa;
}

.token.regex,
.token.important,
.token.variable {
    color: #4ec9b0;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

/* Python specific */
.language-python .token.keyword {
    color: #569cd6;
}

.language-python .token.string {
    color: #ce9178;
}

.language-python .token.function {
    color: #dcdcaa;
}

.language-python .token.decorator {
    color: #4ec9b0;
}

.language-python .token.builtin {
    color: #4ec9b0;
}

.language-python .token.comment {
    color: #6a9955;
    font-style: italic;
}

/* SQL specific */
.language-sql .token.keyword {
    color: #569cd6;
    font-weight: bold;
}

.language-sql .token.string {
    color: #ce9178;
}

.language-sql .token.function {
    color: #4ec9b0;
}

.language-sql .token.operator {
    color: #d4d4d4;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:hover {
    background: var(--bg-color);
}

.tools-table th {
    background: var(--primary-dark);
}

/* Lifecycle diagram */
.lifecycle-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
    gap: 0.5rem;
}

.lifecycle-step {
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
    min-width: 120px;
}

.arrow {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: bold;
}

/* Architecture diagram */
.architecture-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
    gap: 0.5rem;
}

.arch-step {
    background: var(--secondary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
    min-width: 250px;
}

.arch-arrow {
    color: var(--secondary-color);
    font-size: 2rem;
    font-weight: bold;
}

/* Accordion */
.accordion {
    margin: 1.5rem 0;
}

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    background: var(--bg-color);
    padding: 1rem 1.5rem;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-header:hover {
    background: var(--border-color);
}

.accordion-header:after {
    content: "▼";
    transition: transform 0.3s;
}

.accordion-header.active:after {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 1.5rem;
}

.accordion-content.active {
    max-height: 2000px;
    padding: 1.5rem;
}

/* Library showcase */
.library-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.library-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.library-card h4 {
    color: var(--primary-color);
    margin-top: 0;
}

/* Comparison */
.comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.comparison-col {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Quiz */
.quiz-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.quiz-intro {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

#quiz-container {
    margin: 2rem 0;
}

.quiz-question {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.quiz-question h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.quiz-options {
    list-style: none;
}

.quiz-options li {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: var(--bg-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.quiz-options li:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

.quiz-options li.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.quiz-options li.correct {
    background: #dcfce7;
    border-color: var(--success-color);
}

.quiz-options li.incorrect {
    background: #fee2e2;
    border-color: var(--danger-color);
}

.quiz-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.quiz-results {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
    margin-top: 2rem;
}

.quiz-results.hidden {
    display: none;
}

.quiz-results h3 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--success-color);
    margin: 1rem 0;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-color);
}

/* Key points */
/* Ressources complémentaires */
.resources-section {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.resources-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.resource-item {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.resource-item h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.resource-item ul {
    list-style: none;
    padding: 0;
}

.resource-item li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.resource-item li:before {
    content: "🔗";
    position: absolute;
    left: 0;
}

.resource-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.resource-item a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Visionneur PDF */
.pdf-viewer-section {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.pdf-viewer-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.pdf-container {
    position: relative;
    width: 100%;
    height: 800px;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: #f9fafb;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Responsive pour les petits écrans */
@media (max-width: 768px) {
    .pdf-container {
        height: 600px;
    }
}

@media (max-width: 480px) {
    .pdf-container {
        height: 400px;
    }
}

.key-points {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--warning-color);
}

.key-points ul {
    list-style: none;
}

.key-points li {
    padding: 0.5rem 0;
    padding-left: 2rem;
    position: relative;
}

.key-points li:before {
    content: "💡";
    position: absolute;
    left: 0;
}

/* Navigation */
.page-navigation {
    display: flex;
    justify-content: space-between;
    margin: 2rem 0;
    gap: 1rem;
}

/* Footer */
footer {
    background: var(--text-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

/* Cards (for index) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .lifecycle-diagram {
        flex-direction: column;
    }

    .arrow {
        transform: rotate(90deg);
    }

    .page-navigation {
        flex-direction: column;
    }

    .comparison {
        grid-template-columns: 1fr;
    }

    .library-showcase {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Print styles */
@media print {
    .navbar,
    .page-navigation,
    .quiz-section,
    footer {
        display: none;
    }

    body {
        background: white;
    }

    section {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

