/* Custom override to widen main content area in Sphinx HTML output */
.wy-nav-content {
    max-width: 1200px !important;
}

/* Custom styles for Sphinx roles */
.greenbox {
    color: white;
    background-color: #2c9a43;
    font-weight: normal;
    padding: 2px 5px 1px 5px;
    border-radius: 5px;
}
.whitebox {
    color: black;
    background-color: white;
    font-weight: normal;
    padding: 2px 5px 1px 5px;
    border-radius: 5px;
}
.blackbox {
    color: white;
    background-color: black;
    font-weight: normal;
    padding: 2px 5px 1px 5px;
    border-radius: 5px;
}

/* Red box for important information */
.redbox {
    color: white;
    background-color: #dc3545;
    font-weight: normal;
    padding: 2px 5px 1px 5px;
    border-radius: 5px;
}

/* Important information box for top of page */
.important-info-box {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 20px auto;
    color: #721c24;
    font-weight: 500;
    width: fit-content;
}

.important-info-box h3 {
    color: #dc3545;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

.important-info-box p {
    margin-bottom: 8px;
}

.important-info-box p:last-child {
    margin-bottom: 0;
}

.important-info-box ul {
    margin-bottom: 8px;
    padding-left: 20px;
}

.important-info-box li {
    margin-bottom: 5px;
}

.pseudo-code {
    background-color: #f8f8f8;
    border-left: 3px solid #4CAF50;
    padding: 10px;
    font-family: monospace;
    color: #333;
}

/* Fix the size of mermaid diagrams */
pre[id^="width100"].mermaid svg { width: 100px; height: auto; display: block; margin: 0 auto;}
pre[id^="width200"].mermaid svg { width: 200px; height: auto; display: block; margin: 0 auto;}
pre[id^="width300"].mermaid svg { width: 300px; height: auto; display: block; margin: 0 auto;}
pre[id^="width400"].mermaid svg { width: 400px; height: auto; display: block; margin: 0 auto;}
pre[id^="width500"].mermaid svg { width: 500px; height: auto; display: block; margin: 0 auto;}
pre[id^="width600"].mermaid svg { width: 600px; height: auto; display: block; margin: 0 auto;}
pre[id^="width700"].mermaid svg { width: 700px; height: auto; display: block; margin: 0 auto;}
pre[id^="width800"].mermaid svg { width: 800px; height: auto; display: block; margin: 0 auto;}

.admonition.exercice {
    background: #fff8dc;
    border-left: 5px solid #f0ad4e;
}

.admonition.exercice .admonition-title {
    background: #f0ad4e;
    color: white;
}

div.highlight-python {
    background-color: #1ee196; 
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
}

div.highlight-c {
    background-color: #1ecbe1;
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
}

/* LLM Prompt Block Styling */
.llm-prompt-block {
    background-color: #1a1a1a;
    border: 2px solid #6366f1;
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.1);
}

.llm-prompt-header {
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 0.95em;
    border-bottom: 2px solid #6366f1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.llm-prompt-header::before {
    content: "💬";
}

.llm-prompt-content {
    color: #e0e0e0;
    padding: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    background-color: #242424;
}

.llm-prompt-content code {
    background-color: #3a3a3a;
    padding: 3px 8px;
    border-radius: 4px;
    color: #a3ff7f;
    border: 1px solid #4a4a4a;
}

/* Sphinx role styling inside prompts */
.llm-prompt-content .xref,
.llm-prompt-content .py-mod,
.llm-prompt-content .py-class,
.llm-prompt-content .py-func,
.llm-prompt-content .c-member {
    background-color: #c4b5fd;
    padding: 4px 10px;
    border-radius: 4px;
    color: #1f1f1f;
    border: none;
    text-decoration: none;
    font-weight: 500;
}

.llm-prompt-content a code {
    background-color: #c4b5fd;
    color: #1f1f1f;
}

/* Exercice Block Styling */
.exercice-block {
    background-color: #fff8f0;
    border: 2px solid #f97316;
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(249, 115, 22, 0.1);
}

.exercice-header {
    background: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
    color: white;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 0.95em;
    border-bottom: 2px solid #f97316;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercice-header::before {
    content: "✏️";
}

.exercice-content {
    color: #333;
    padding: 16px;
    background-color: #fff8f0;
    font-size: 0.95em;
    line-height: 1.6;
}

.exercice-content code {
    background-color: #f3e8dd;
    padding: 3px 8px;
    border-radius: 4px;
    color: #c65911;
    border: 1px solid #ddd3c9;
    font-family: 'Courier New', 'Monaco', monospace;
}

/* Sphinx role styling inside exercices */
.exercice-content .xref,
.exercice-content .py-mod,
.exercice-content .py-class,
.exercice-content .py-func,
.exercice-content .c-member {
    background-color: #fed7aa;
    padding: 4px 10px;
    border-radius: 4px;
    color: #7c2d12;
    border: none;
    text-decoration: none;
    font-weight: 500;
}

.exercice-content a code {
    background-color: #fed7aa;
    color: #7c2d12;
}

/* Exercice Solution Block Styling */
.exercice-solution {
    background-color: #5a1f0a;
    border: 1px solid #7c2d12;
    border-radius: 6px;
    margin: 16px 0 0 0;
    padding: 0;
    cursor: pointer;
}

.exercice-solution-title {
    background-color: #7c2d12;
    color: #fef3c7;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.95em;
    user-select: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exercice-solution-title:hover {
    background-color: #92400e;
}

.exercice-solution-content {
    padding: 14px;
    background-color: #4a1707;
    color: #fef3c7;
    font-size: 0.95em;
    line-height: 1.6;
}

.exercice-solution-content code {
    background-color: #7c2d12;
    padding: 2px 6px;
    border-radius: 3px;
    color: #fef08a;
    font-family: 'Courier New', 'Monaco', monospace;
}

.exercice-solution-content pre {
    background-color: #3d1407;
    color: #fef3c7;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    border: 1px solid #7c2d12;
}

.exercice-solution-content pre code {
    background-color: transparent;
    color: #fef3c7;
    padding: 0;
}

/* Tableau dans la solution */
.exercice-solution-content table {
    background-color: #3d1407 !important;
    border-collapse: collapse;
    margin: 10px 0;
}

.exercice-solution-content table th {
    background-color: #7c2d12 !important;
    color: #fef3c7 !important;
    padding: 8px !important;
    border: 1px solid #92400e !important;
    font-weight: bold !important;
}

.exercice-solution-content table td {
    background-color: #4a1707 !important;
    color: #fef3c7 !important;
    padding: 8px !important;
    border: 1px solid #7c2d12 !important;
}

.exercice-solution-content table tbody tr:nth-child(even) td {
    background-color: #3d1407 !important;
}

.exercice-solution-content table tbody tr:hover td {
    background-color: #5a1f0a !important;
}

.exercice-solution-content table tr td p,
.exercice-solution-content table tr th p {
    color: #fef3c7 !important;
    margin: 0 !important;
}

/* Highlight blocks dans la solution */
.exercice-solution-content .highlight {
    background-color: #fffacd !important;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
}

.exercice-solution-content .highlight pre {
    background-color: transparent !important;
    color: #1a0f0a !important;
    padding: 0;
    border: none;
}

.exercice-solution-content .highlight code {
    background-color: transparent !important;
    color: #1a0f0a !important;
    padding: 0;
}