/*
===========================
    Bloc Code - Styles
===========================
*/

/* Conteneur principal pour le bloc code */
.wp-block-code {
    position: relative;
    margin: 32px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(25, 116, 76, 0.1);
    background: transparent;
    padding: 0 !important; /* Force le padding à 0 pour éviter les bords blancs */
}

/* Pseudo-élément pour l'en-tête avec les dots */
.wp-block-code::before {
    content: '';
    display: block;
    height: 40px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e9e9e9 100%);
    border-bottom: 1px solid rgba(25, 116, 76, 0.1);
    position: relative;
    margin: 0;
    padding: 0;
}

/* Ajout des dots de macOS dans l'en-tête - position fixe pour éviter le déplacement */
.wp-block-code::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ff5f56;
    box-shadow: 
        20px 0 0 #ffbd2e,
        40px 0 0 #27ca3f;
    z-index: 2;
    pointer-events: none; /* Empêche les interactions qui pourraient déplacer les dots */
}

/* Style pour l'élément code lui-même */
.wp-block-code code {
    display: block !important;
    padding: 24px 20px 20px !important;
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%) !important;
    color: #f8f8f2 !important;
    font-family: 'Fira Code', 'Monaco', 'Consolas', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    overflow-x: auto;
    white-space: pre !important;
    border: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    width: 100%;
    box-sizing: border-box;
}

/* Réinitialisation complète pour éviter les héritages indésirables */
.wp-block-code code::before,
.wp-block-code code::after {
    display: none !important;
    content: none !important;
}

/* Barre de défilement personnalisée */
.wp-block-code code::-webkit-scrollbar {
    height: 8px;
}

.wp-block-code code::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.wp-block-code code::-webkit-scrollbar-thumb {
    background: var(--systemoun-strong-color, #19744C);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wp-block-code code::-webkit-scrollbar-thumb:hover {
    background: var(--systemoun-strong-color-hover, #135A3B);
}

/* Variante claire pour certains contextes */
.wp-block-code.is-style-light {
    border-color: rgba(25, 116, 76, 0.2);
}

.wp-block-code.is-style-light code {
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%) !important;
    color: #2d3748 !important;
    border: 1px solid rgba(25, 116, 76, 0.1) !important;
}

/* Style pour les mots-clés de code (si vous utilisez une extension de syntaxe) */
.wp-block-code .token.keyword {
    color: var(--systemoun-strong-color, #19744C);
    font-weight: 600;
}

.wp-block-code .token.string {
    color: #2DAA73;
}

.wp-block-code .token.comment {
    color: #6c757d;
    font-style: italic;
}

.wp-block-code .token.number {
    color: #fd7e14;
}

.wp-block-code .token.function {
    color: #e83e8c;
}

/* Responsif pour mobile */
@media (max-width: 768px) {
    .wp-block-code {
        margin: 24px 0;
        border-radius: 8px;
    }
    
    .wp-block-code code {
        padding: 20px 16px 16px !important;
        font-size: 13px !important;
    }
    
    .wp-block-code::after {
        top: 12px;
        left: 12px;
        width: 10px;
        height: 10px;
        box-shadow: 
            16px 0 0 #ff5f56,
            32px 0 0 #27ca3f;
    }
}

/* Barre de défilement personnalisée */
.wp-block-code code::-webkit-scrollbar {
    height: 8px;
}

.wp-block-code code::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.wp-block-code code::-webkit-scrollbar-thumb {
    background: var(--systemoun-strong-color, #19744C);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wp-block-code code::-webkit-scrollbar-thumb:hover {
    background: var(--systemoun-strong-color-hover, #135A3B);
}

/* Variante claire pour certains contextes */
.wp-block-code.is-style-light {
    border-color: rgba(25, 116, 76, 0.2);
}

.wp-block-code.is-style-light code {
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    color: #2d3748;
    border: 1px solid rgba(25, 116, 76, 0.1);
}

/* Style pour les mots-clés de code (si vous utilisez une extension de syntaxe) */
.wp-block-code .token.keyword {
    color: var(--systemoun-strong-color, #19744C);
    font-weight: 600;
}

.wp-block-code .token.string {
    color: #2DAA73;
}

.wp-block-code .token.comment {
    color: #6c757d;
    font-style: italic;
}

.wp-block-code .token.number {
    color: #fd7e14;
}

.wp-block-code .token.function {
    color: #e83e8c;
}

/* Responsif pour mobile */
@media (max-width: 768px) {
    .wp-block-code {
        margin: 24px 0;
        border-radius: 8px;
    }
    
    .wp-block-code code {
        padding: 20px 16px 16px;
        font-size: 13px;
    }
    
    .wp-block-code::after {
        top: 12px;
        left: 12px;
        width: 10px;
        height: 10px;
        box-shadow: 
            16px 0 0 #ff5f56,
            32px 0 0 #27ca3f;
    }
}