/* ═══════════════════════════════════════════════════════════════
   RESOURCES ML - MACHINE LEARNING VISUALIZATIONS
   Fichier: assets/css/resources-ml.css
   ═══════════════════════════════════════════════════════════════ */

/* ========================================
   NEURAL NETWORK VISUALIZATIONS STYLES
   ======================================== */

.neural-network-canvas {
    width: 100%;
    height: 450px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.neural-network-canvas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1), transparent 50%);
    pointer-events: none;
}

.neural-network-canvas canvas {
    width: 100%;
    height: 100%;
}

.architecture-diagram {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 40px rgba(240, 147, 251, 0.4);
}

.architecture-diagram svg {
    width: 100%;
    height: auto;
}

.ml-pipeline-diagram {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 40px rgba(79, 172, 254, 0.4);
}

.performance-chart-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body.dark-mode .performance-chart-container {
    background: rgba(30, 41, 59, 0.95);
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ensemble-architecture {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.model-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.model-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.model-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.model-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.model-accuracy {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feature-importance-viz {
    margin: 2rem 0;
}

.feature-bar {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.feature-label {
    width: 150px;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.feature-bar-fill {
    flex: 1;
    height: 30px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 6px;
    position: relative;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.feature-bar-fill:hover {
    transform: scaleX(1.02);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
}

.feature-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.confusion-matrix {
    display: grid;
    grid-template-columns: auto repeat(2, 1fr);
    grid-template-rows: auto repeat(2, 1fr);
    gap: 1px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin: 2rem auto;
    max-width: 400px;
}

.confusion-cell {
    background: white;
    padding: 1.5rem;
    text-align: center;
    font-weight: 700;
}

body.dark-mode .confusion-cell {
    background: #1e293b;
}

.confusion-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 800;
}

.confusion-value {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.confusion-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.5rem;
}

@keyframes neuronPulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.neuron-animated {
    animation: neuronPulse 2s ease-in-out infinite;
}

/* ========================================
   MOBILE RESPONSIVENESS - TABLET
   Max Width: 768px
   ======================================== */

@media (max-width: 768px) {
    .neural-network-canvas {
        height: 350px;
        margin: 1.5rem 0;
        border-radius: 12px;
    }
    
    .architecture-diagram,
    .ml-pipeline-diagram {
        padding: 1.5rem;
        margin: 1.5rem 0;
        border-radius: 12px;
    }
    
    .performance-chart-container {
        padding: 1.5rem;
        margin: 1.5rem 0;
        border-radius: 12px;
    }
    
    .chart-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .ensemble-architecture {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin: 1.5rem 0;
    }
    
    .model-card {
        padding: 1.25rem;
    }
    
    .model-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }
    
    .model-name {
        font-size: 1rem;
    }
    
    .model-accuracy {
        font-size: 1.75rem;
    }
    
    .feature-label {
        width: 120px;
        font-size: 0.85rem;
    }
    
    .feature-bar-fill {
        height: 28px;
    }
    
    .feature-value {
        font-size: 0.8rem;
        right: 8px;
    }
    
    .confusion-matrix {
        max-width: 350px;
        margin: 1.5rem auto;
    }
    
    .confusion-cell {
        padding: 1.25rem;
        font-size: 0.9rem;
    }
    
    .confusion-value {
        font-size: 1.6rem;
    }
    
    .confusion-label {
        font-size: 0.75rem;
    }
}

/* ========================================
   MOBILE RESPONSIVENESS - SMARTPHONE
   Max Width: 480px
   ======================================== */

@media (max-width: 480px) {
    .neural-network-canvas {
        height: 280px;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .architecture-diagram,
    .ml-pipeline-diagram {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .performance-chart-container {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .chart-title {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
        line-height: 1.3;
    }
    
    .ensemble-architecture {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1rem 0;
    }
    
    .model-card {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .model-icon {
        font-size: 2.25rem;
        margin-bottom: 0.5rem;
    }
    
    .model-name {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }
    
    .model-accuracy {
        font-size: 1.6rem;
    }
    
    .model-card p {
        font-size: 0.8rem;
        margin-top: 0.4rem;
    }
    
    .feature-bar {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1.25rem;
    }
    
    .feature-label {
        width: 100%;
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .feature-bar-fill {
        width: 100%;
        height: 26px;
    }
    
    .feature-value {
        font-size: 0.75rem;
        right: 6px;
    }
    
    .confusion-matrix {
        max-width: 100%;
        margin: 1rem 0;
        font-size: 0.85rem;
    }
    
    .confusion-cell {
        padding: 0.75rem 0.5rem;
    }
    
    .confusion-value {
        font-size: 1.3rem;
    }
    
    .confusion-label {
        font-size: 0.65rem;
        margin-top: 0.25rem;
    }
    
    .model-card:hover {
        transform: none;
    }
    
    .feature-bar-fill:hover {
        transform: none;
    }
}

/* ========================================
   MOBILE RESPONSIVENESS - VERY SMALL
   Max Width: 360px
   ======================================== */

@media (max-width: 360px) {
    .neural-network-canvas {
        height: 240px;
        margin: 0.75rem 0;
    }
    
    .architecture-diagram,
    .ml-pipeline-diagram,
    .performance-chart-container {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .chart-title {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .model-card {
        padding: 0.875rem;
    }
    
    .model-icon {
        font-size: 2rem;
    }
    
    .model-name {
        font-size: 0.875rem;
    }
    
    .model-accuracy {
        font-size: 1.5rem;
    }
    
    .feature-label {
        font-size: 0.75rem;
    }
    
    .feature-bar-fill {
        height: 24px;
    }
    
    .confusion-cell {
        padding: 0.5rem 0.25rem;
    }
    
    .confusion-value {
        font-size: 1.1rem;
    }
    
    .confusion-label {
        font-size: 0.6rem;
    }
}

/* ========================================
   SVG TEXT RESPONSIVENESS
   ======================================== */

@media (max-width: 768px) {
    .ml-pipeline-diagram svg text,
    .architecture-diagram svg text {
        font-size: 12px;
    }
    
    .ml-pipeline-diagram svg text:first-of-type,
    .architecture-diagram svg text:first-of-type {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .ml-pipeline-diagram svg text,
    .architecture-diagram svg text {
        font-size: 9px;
    }
    
    .ml-pipeline-diagram svg text:first-of-type,
    .architecture-diagram svg text:first-of-type {
        font-size: 14px;
    }
    
    .ml-pipeline-diagram svg text:nth-child(n+10),
    .architecture-diagram svg text:nth-child(n+15) {
        font-size: 8px;
    }
}

@media (max-width: 360px) {
    .ml-pipeline-diagram svg text,
    .architecture-diagram svg text {
        font-size: 7px;
    }
    
    .ml-pipeline-diagram svg text:first-of-type,
    .architecture-diagram svg text:first-of-type {
        font-size: 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   CODE BLOCKS - IMPROVED VISIBILITY
   Ajoutez cette section à la fin de resources-ml.css
   ═══════════════════════════════════════════════════════════════ */

/* Code block container */
.code-block {
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.code-header {
    background: #0f172a;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-lang {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.copy-code-btn {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-code-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

/* Code content - CORRECTION PRINCIPALE */
.code-content {
    background: #1e293b;
    color: #e2e8f0;  /* ✅ Texte blanc cassé pour meilleure lisibilité */
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre;
    tab-size: 4;
}

/* Amélioration de la lisibilité du texte */
.code-content pre {
    margin: 0;
    color: #e2e8f0;  /* ✅ Texte principal en blanc cassé */
}

/* Syntax highlighting (optionnel mais recommandé) */
.code-content .keyword {
    color: #c792ea;  /* Violet pour mots-clés (import, from, def, etc.) */
}

.code-content .string {
    color: #c3e88d;  /* Vert pour strings */
}

.code-content .comment {
    color: #697098;  /* Gris pour commentaires */
    font-style: italic;
}

.code-content .function {
    color: #82aaff;  /* Bleu pour fonctions */
}

.code-content .number {
    color: #f78c6c;  /* Orange pour nombres */
}

/* Dark mode adjustments */
body.dark-mode .code-block {
    background: #0f172a;
}

body.dark-mode .code-header {
    background: #020617;
}

body.dark-mode .code-content {
    background: #0f172a;
    color: #e2e8f0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .code-content {
        font-size: 0.85rem;
        padding: 1rem;
    }
    
    .code-header {
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 480px) {
    .code-content {
        font-size: 0.8rem;
        padding: 0.875rem;
        line-height: 1.5;
    }
    
    .copy-code-btn {
        padding: 0.3rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Scrollbar styling for code blocks */
.code-content::-webkit-scrollbar {
    height: 8px;
}

.code-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}