/**
 * myst-styles.css
 * Styles améliorés pour le rendu des exercices MyST avec support thème sombre
 * VERSION PROFESSIONNELLE - Support complet accordéons et métadonnées
 */

/* ===== VARIABLES CSS POUR THÈMES ===== */
:root {
    --myst-bg-primary: #ffffff;
    --myst-bg-secondary: #f8f9fa;
    --myst-bg-tertiary: #e9ecef;
    --myst-text-color: #ecf0f1;
    --myst-text-muted: #6c757d;
    --myst-border-color: #dee2e6;
    --myst-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --myst-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Thème sombre pour les conteneurs MyST */
[style*="--v2-bg-primary"], 
[style*="--v2-bg-secondary"],
.myst-dark-theme {
    --myst-bg-primary: #2c3e50;
    --myst-bg-secondary: #34495e;
    --myst-bg-tertiary: #3d566e;
    --myst-text-color: #ecf0f1;
    --myst-text-muted: #bdc3c7;
    --myst-border-color: #5d6d7e;
    --myst-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --myst-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ===== STYLES GÉNÉRAUX POUR LES EXERCICES ===== */

.exercise-item {
    margin-bottom: 2rem;
    border-radius: 12px;
    background: var(--myst-bg-primary);
    box-shadow: var(--myst-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid var(--myst-border-color);
}

.exercise-item:hover {
    box-shadow: var(--myst-shadow-hover);
    transform: translateY(-2px);
}

.exercise-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--myst-border-color);
}

.exercise-header h5,
.exercise-header h6 {
    margin: 0;
    font-weight: 600;
    color: white;
}

.exercise-metadata {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.exercise-metadata .badge {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exercise-body {
    background: var(--myst-bg-secondary);
    color: var(--myst-text-color);
}

/* ===== STYLES QST (QUESTIONS OUVERTES) ===== */

.myst-qst {
    background: var(--myst-bg-secondary);
    border: 1px solid var(--myst-border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--myst-shadow);
}

.qst-header {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.qst-body {
    padding: 1.5rem;
    background: var(--myst-bg-primary);
    color: var(--myst-text-color);
}

.question-content .question-text {
    background: var(--myst-bg-tertiary);
    border-left: 4px solid #17a2b8;
    padding: 1rem;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--myst-text-color);
    margin: 0;
}

/* ===== STYLES QCM (QUESTIONS À CHOIX MULTIPLES) ===== */

.myst-qcm {
    background: var(--myst-bg-secondary);
    border: 1px solid var(--myst-border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--myst-shadow);
}

.qcm-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.qcm-body {
    padding: 1.5rem;
    background: var(--myst-bg-primary);
    color: var(--myst-text-color);
}

.qcm-body .question-text {
    background: var(--myst-bg-tertiary);
    border-left: 4px solid #007bff;
    padding: 1rem;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--myst-text-color);
    margin: 0;
}

/* ===== STYLES POUR LES CHOIX DE RÉPONSE ===== */

.choice-item,
.answer-choice {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    font-weight: 500;
}

.choice-item:hover,
.answer-choice:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.correct-choice,
.correct-answer {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    color: #155724;
}

.incorrect-choice,
.wrong-answer {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #dc3545;
    color: #721c24;
}

.choice-item i,
.answer-choice i {
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

/* ===== STYLES POUR LES ACCORDÉONS BOOTSTRAP ===== */

.accordion-item {
    background: var(--myst-bg-primary);
    border: 1px solid var(--myst-border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.accordion-button {
    background: var(--myst-bg-tertiary);
    color: var(--myst-text-color);
    border: none;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    border: none;
}

.accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    transition: transform 0.2s ease;
}

.accordion-button:not(.collapsed)::after {
    transform: rotate(-180deg);
}

.accordion-body {
    background: var(--myst-bg-primary);
    color: var(--myst-text-color);
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--myst-border-color);
}

/* ===== STYLES POUR LES POIDS COGNITIFS ===== */

.weights-section {
    background: var(--myst-bg-tertiary);
    border: 1px solid var(--myst-border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.weights-section h6 {
    color: var(--myst-text-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.weight-item {
    text-align: center;
}

.weight-item small {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--myst-text-muted);
}

.progress {
    height: 1.25rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
    overflow: hidden;
}

.progress-sm {
    height: 1rem;
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    transition: width 0.6s ease;
    font-weight: 600;
    font-size: 0.75rem;
}

.progress-bar small {
    font-size: 0.7rem;
    font-weight: 600;
}

/* ===== STYLES POUR LES SECTIONS ===== */

.hint-section,
.solution-section,
.choices-section {
    margin-bottom: 1rem;
}

.hint-section h6,
.solution-section h6,
.choices-section h6 {
    color: var(--myst-text-color);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.hint-content,
.solution-content {
    line-height: 1.6;
    color: var(--myst-text-color);
}

.hint-content i,
.solution-content i {
    margin-right: 0.5rem;
}

/* ===== STYLES POUR LES BADGES ===== */

.badge {
    display: inline-block;
    padding: 0.375em 0.75em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.bg-success { background-color: #28a745 !important; }
.badge.bg-warning { background-color: #3498db !important; color: #ffffff !important; }
.badge.bg-danger { background-color: #dc3545 !important; }
.badge.bg-info { background-color: #17a2b8 !important; }
.badge.bg-primary { background-color: #007bff !important; }
.badge.bg-secondary { background-color: #6c757d !important; }

/* ===== STYLES POUR LES ALERTES ===== */

.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-warning {
    color: #1a5276;
    background-color: #d4e6f5;
    border-color: #a9cce3;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* ===== STYLES RESPONSIFS ===== */

@media (max-width: 768px) {
    .exercise-item {
        margin-bottom: 1.5rem;
    }
    
    .exercise-header {
        padding: 0.75rem 1rem;
    }
    
    .qst-body,
    .qcm-body {
        padding: 1rem;
    }
    
    .question-text {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .choice-item,
    .answer-choice {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .exercise-metadata {
        gap: 0.25rem;
    }
    
    .exercise-metadata .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ===== STYLES POUR LES ANIMATIONS ===== */

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

.exercise-item {
    animation: fadeInUp 0.3s ease-out;
}

.accordion-collapse.show {
    animation: fadeInUp 0.2s ease-out;
}

/* ===== STYLES POUR L'AFFICHAGE DU CODE ET PRÉFORMATÉ ===== */

pre {
    background: var(--myst-bg-tertiary);
    color: var(--myst-text-color);
    border: 1px solid var(--myst-border-color);
    border-radius: 6px;
    padding: 1rem;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.4;
    overflow-x: auto;
}

code {
    background: var(--myst-bg-tertiary);
    color: var(--myst-text-color);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.875em;
}

/* ===== AMÉLIORATION DES STYLES POUR LES ENVIRONNEMENTS LATEX ===== */

.latex-enumerate,
.latex-itemize {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    color: var(--myst-text-color);
}

.latex-enumerate li,
.latex-itemize li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.latex-nested {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.item-label {
    font-weight: 600;
    color: #007bff;
    margin-right: 0.5rem;
}

.latex-section,
.latex-subsection,
.latex-subsubsection {
    color: var(--myst-text-color);
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

/* ===== STYLES POUR LES CONTENEURS D'EXERCICES LEGACY ===== */

.qcm-content,
.qst-content {
    background: var(--myst-bg-primary);
    color: var(--myst-text-color);
    padding: 1rem;
    border-radius: 8px;
}

.qcm-question,
.qst-question {
    background: var(--myst-bg-secondary);
    border: 1px solid var(--myst-border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.answers {
    margin-top: 1rem;
}

.hint,
.solution {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--myst-bg-tertiary);
    border-radius: 6px;
    border-left: 4px solid #17a2b8;
    color: var(--myst-text-color);
}

/* ===== UTILITAIRES DE COULEUR ===== */

.text-primary { color: #007bff !important; }
.text-secondary { color: #6c757d !important; }
.text-success { color: #28a745 !important; }
.text-info { color: #17a2b8 !important; }
.text-warning { color: #075eff !important; }
.text-danger { color: #dc3545 !important; }

.bg-light { background-color: var(--myst-bg-tertiary) !important; }

/* ===== STYLES POUR LES TRANSITIONS ===== */

* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ===== STYLES SPÉCIAUX POUR LE RENDU MATHJAX ===== */

.MathJax_Display {
    margin: 1rem 0;
}

mjx-container {
    margin: 0.5rem 0;
}

mjx-container[display="true"] {
    margin: 1rem 0;
} 