/* =========================================================================
   N3XUS ADMANAGER V8.8 - OS SHELL STYLES (MASTER CALIBRATION FINAL)
   ========================================================================= */

.n3x-ad-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background-color: rgba(10, 10, 12, 0.9);
    border: 1px solid rgba(255, 40, 81, 0.15);
    border-radius: 2px;
    text-align: center;
    clear: both;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    
    /* Anti-CLS : Hauteur minimale */
    min-height: 280px; 
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
    
    /* MATRICE D'ATTENTE */
    background-image: 
        linear-gradient(rgba(255, 40, 81, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 40, 81, 0.04) 1px, transparent 1px);
    background-size: 15px 15px;
    
    /* CENTRAGE GLOBAL ABSOLU */
    margin: 2rem auto !important; 
    align-self: center !important; /* Neutralise les interférences Flexbox parents */
}

.n3x-ad-wrapper:hover {
    border-color: rgba(255, 40, 81, 0.4);
    box-shadow: inset 0 0 20px rgba(255, 40, 81, 0.05);
}

/* KERNEL HEADER : Barre de statut */
.n3x-ad-wrapper::before {
    content: '// SPONSOR_DATA_LINK';
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    color: var(--cyber-red, #ff2851);
    text-align: left;
    padding: 8px 15px;
    background: linear-gradient(90deg, rgba(255, 40, 81, 0.08) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 40, 81, 0.15);
    letter-spacing: 0.15em;
    margin-bottom: 15px;
}

/* =========================================================================
   MODIFICATEURS DE CONTEXTE DESKTOP
   ========================================================================= */

/* Sidebars : Forçage du centrage malgré la grille flex de l'OS */
aside.article-sidebar .sidebar-group {
    width: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center !important;
}

aside.article-sidebar .n3x-ad-wrapper { 
    max-width: 336px !important; 
}

/* Colonne Principale (Article) */
.article-main-column .n3x-ad-wrapper { 
    max-width: 100%; 
    min-height: 150px; 
}

/* Bottom Banner : Fix de la largeur (On évite l'étirement excessif) */
.article-main-column .n3x-ad-wrapper[data-ad-context="bottom-banner"] {
    max-width: 728px !important; 
    margin: 4rem auto !important; 
}

/* =========================================================================
   FALLBACK INTERNE (Tes propres campagnes)
   ========================================================================= */
.n3x-fallback-slot { 
    width: 100%; 
    padding: 0 15px 15px 15px; 
    display: flex;
    justify-content: center;
}

.n3x-sponsor-box { 
    width: 100%; 
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); 
}
.n3x-sponsor-box:hover { 
    transform: translateY(-4px); 
}

.n3x-sponsor-img {
    max-width: 100%;
    height: auto;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 2px;
    filter: grayscale(80%) contrast(1.1);
    transition: all 0.4s ease;
    display: block;
    margin: 0 auto;
}

.n3x-sponsor-box:hover .n3x-sponsor-img {
    filter: grayscale(0%) contrast(1);
    box-shadow: 0 10px 30px rgba(255, 40, 81, 0.15);
    border-color: rgba(255, 40, 81, 0.4);
}

/* Top Banner : Écrasement en mode "Lame Horizontale" (Ribbon) pour Desktop */
.n3x-ad-wrapper[data-ad-context="top-banner"] {
    min-height: 140px !important; /* 90px pub + 35px texte header + padding */
    max-width: 970px !important; /* Verrouille la largeur à la bannière max AdSense */
    margin-bottom: 2rem !important;
}

/* =========================================================================
   NUCLEAR OVERRIDE : MOBILE (< 768px)
   ========================================================================= */
@media (max-width: 768px) {
    .n3x-ad-wrapper {
        /* LARGEUR MATHÉMATIQUE : 100% de l'écran moins 15px de chaque côté */
        width: calc(100vw - 30px) !important; 
        max-width: none !important;
        
        /* CENTRAGE ABSOLU : On ignore les paddings du parent (Hack V8) */
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        
        margin: 3rem 0 !important;
        min-height: 320px; 
        
        /* BORDURES RESTAURÉES : Encadrement strict du bloc */
        border: 1px solid rgba(255, 40, 81, 0.25) !important; 
        background-color: #050505 !important; 
        border-radius: 2px !important;
    }

    /* Exception : La bannière TOP peut rester Full-Bleed ou s'aligner, on force la marge */
    .n3x-ad-wrapper[data-ad-context="top-banner"] {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }

    /* Affinage du texte header sur petit écran */
    .n3x-ad-wrapper::before {
        font-size: 0.6rem;
        padding: 10px 15px;
    }

    /* Réintégration d'un peu de couleur pour les images custom sur mobile */
    .n3x-sponsor-img {
        filter: grayscale(30%) contrast(1.1); 
    }
    
    /* =========================================================================
   FIX V8.9 : OBLITÉRATION DU GOUFFRE SPATIAL ET ÉCRASEMENT TOP BANNER
   ========================================================================= */

/* 1. Remontée mécanique de la zone pub (On la plaque sous le titre) */
.top-banner-container {
    position: relative;
    z-index: 20;
    max-width: 1500px;
    /* Le hero a 6rem de vide en bas. On remonte de 5rem pour coller au texte */
    margin: -5rem auto 1.5rem auto !important; 
    padding: 0 2rem;
}

/* 2. Destruction du "vide" géant de style.css (.article-layout a 6rem de padding) */
.single-article-viewer .article-layout {
    padding-top: 1rem !important;
}

/* 3. Blindage de la bannière TOP (La fameuse Lame Horizontale) */
.n3x-ad-wrapper[data-ad-context="top-banner"] {
    min-height: 0 !important; /* Annule la sécurité de 280px pour cette zone */
    height: auto !important;
    padding-bottom: 12px; /* Dégagement sous l'image */
    max-width: 970px !important;
}

/* 4. Forçage Absolu de l'image Fallback (Ton "COMING SOON") */
.n3x-ad-wrapper[data-ad-context="top-banner"] .n3x-sponsor-img {
    max-height: 90px !important; /* INTERDIT à l'image de dépasser 90px de haut */
    width: auto !important;
    object-fit: contain;
}
/* =========================================================================
   FIX V8.10 : NATIVE ARCHIVE GRID AD INJECTION
   ========================================================================= */

/* Le parent conteneur dans la grille */
.n3x-archive-ad-block {
    width: 100%;
    height: 100%;
    min-height: 380px;
    display: block;
}

/* Prise de contrôle du wrapper AdManager généré à l'intérieur */
.n3x-archive-ad-block .n3x-ad-wrapper {
    margin: 0 !important; /* Neutralise le margin: 2rem auto global */
    width: 100%;
    height: 100%;
    min-height: 380px;
    background-color: #0a0a0c; /* Se fond dans la grille */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Force le header ::before à rester tout en haut */
}

/* Verrouillage du header (// SPONSOR_DATA_LINK) */
.n3x-archive-ad-block .n3x-ad-wrapper::before {
    flex-shrink: 0; /* Interdit l'écrasement du texte */
    margin-bottom: 0; 
}

/* Zone de contenu de la pub (Fallback ou Iframe) */
.n3x-archive-ad-block .n3x-fallback-slot,
.n3x-archive-ad-block .n3x-ad-wrapper > div:not(.sponsor-header) {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
}

/* L'ASSET PUB : Plus large, centré, ratio respecté */
.n3x-archive-ad-block .n3x-sponsor-img,
.n3x-archive-ad-block iframe {
    width: 100% !important;
    max-width: 90% !important; /* 90% de largeur pour imposer la dominance visuelle */
    height: auto !important;
    max-height: 300px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    /* Arrêt définitif des glitches de survol */
    transform: none !important; 
}

/* Override du hover pour l'image spécifique à l'archive (Désactive le "bond" qui pète la grille) */
.n3x-archive-ad-block .n3x-sponsor-box:hover {
    transform: none !important;
}

.n3x-archive-ad-block .n3x-sponsor-box:hover .n3x-sponsor-img {
    filter: grayscale(0%) contrast(1.1);
    box-shadow: 0 0 30px rgba(255, 40, 81, 0.2);
    transform: scale(1.02); /* Léger zoom interne très stable */
}
}