/**
 * Cellule Python exécutable [python_cell].
 * Tokens Tailwind utilisés uniquement via les classes du thème ;
 * ici on reste sur des valeurs CSS basiques pour ne pas dépendre du build Tailwind.
 */

.mc-py-cell {
    margin: 1.25rem 0;
    border: 1px solid #e2e8f0;          /* slate-200 */
    border-radius: 0.5rem;
    background: #f8fafc;                 /* slate-50 */
    overflow: hidden;
    font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.mc-py-cell__toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #1e293b;                 /* slate-800 */
    color: #e2e8f0;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
}

.mc-py-cell__run,
.mc-py-cell__reset {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 0;
    border-radius: 0.3rem;
    background: #0d9488;                 /* primary teal-600 */
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mc-py-cell__run:hover:not(:disabled) {
    background: #0f766e;                 /* primary-dark */
}

.mc-py-cell__run:disabled {
    opacity: 0.6;
    cursor: wait;
}

.mc-py-cell__reset {
    background: transparent;
    color: #cbd5e1;                      /* slate-300 */
    padding: 0.3rem;
}

.mc-py-cell__reset:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.mc-py-cell__status {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.85;
}

.mc-py-cell__status[data-state="loading"] { color: #fbbf24; }
.mc-py-cell__status[data-state="ok"]      { color: #34d399; }
.mc-py-cell__status[data-state="error"]   { color: #f87171; }

.mc-py-cell__editor {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: 0;
    background: white;
    color: #0f172a;
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.55;
    resize: vertical;
    outline: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    tab-size: 4;
}

.mc-py-cell__editor:focus {
    background: #fffbeb;                 /* amber-50, signal subtil */
}

.mc-py-cell--readonly .mc-py-cell__editor {
    background: #f1f5f9;                 /* slate-100 */
    cursor: default;
}

.mc-py-cell__output {
    display: none;
    margin: 0;
    padding: 0.75rem 1rem;
    background: #0f172a;                 /* slate-900 */
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    border-top: 1px solid #1e293b;
    max-height: 18rem;
    overflow-y: auto;
}

.mc-py-cell__output--visible {
    display: block;
}

.mc-py-cell__output--error {
    color: #fca5a5;                      /* red-300 */
    background: #1f1314;
}

.mc-py-cell__solution {
    padding: 0.5rem 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.88rem;
}

.mc-py-cell__solution summary {
    cursor: pointer;
    color: #0d9488;
    font-weight: 600;
    user-select: none;
}

.mc-py-cell__solution pre,
.mc-py-cell__solution pre code {
    color: #0f172a;                      /* slate-900 — lisible sur fond slate-50 (override .prose pre) */
}

.mc-py-cell__solution pre {
    margin: 0.5rem 0 0;
    padding: 0.6rem 0.8rem;
    background: #f8fafc;
    border-radius: 0.3rem;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    white-space: pre;
    overflow-x: auto;
}

/**
 * Encart d'exercice dans les tutos Python.
 * - .mc-exo-py--complete : ambre (mini-exercice de complétion)
 * - .mc-exo-py--atoi     : teal (exercice "À toi de jouer")
 */
.mc-exo-py {
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1rem;
    border-left: 4px solid #cbd5e1;     /* slate-300 fallback */
    background: transparent;
}

.mc-exo-py__title {
    margin: 0 0 0.4rem 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mc-exo-py > .mc-py-cell {
    margin-top: 0.5rem;
}

.mc-exo-py--complete {
    border-left-color: #f59e0b;          /* amber-500 */
    background: linear-gradient(to right, rgba(245, 158, 11, 0.05), transparent 30%);
}
.mc-exo-py--complete .mc-exo-py__title {
    color: #b45309;                      /* amber-700 */
}

.mc-exo-py--atoi {
    border-left-color: #0d9488;          /* primary teal-600 */
    background: linear-gradient(to right, rgba(13, 148, 136, 0.06), transparent 30%);
}
.mc-exo-py--atoi .mc-exo-py__title {
    color: #0f766e;                      /* primary-dark */
}

/* Mobile — bouton Exécuter plus large, statut en-dessous si peu de place */
@media (max-width: 480px) {
    .mc-py-cell__toolbar {
        flex-wrap: wrap;
    }
    .mc-py-cell__status {
        flex-basis: 100%;
        margin-left: 0;
        margin-top: 0.2rem;
    }
    .mc-py-cell__editor {
        font-size: 0.85rem;
    }
}
