/* ================================================================
   Article Custom Styles - Ayi NEDJIMI Consultants
   Version: Complete from Production
   ================================================================ */

/* ===== Base Styles ===== */
[x-cloak] { display: none !important; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== Article Hero ===== */
.article-hero { 
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #1e1b4b 100%); 
    padding: 5rem 0; 
    text-align: center; 
    position: relative; 
    overflow: hidden; 
}
.article-hero::before { 
    content: ''; 
    position: absolute; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 70%); 
}

/* ===== Article Content ===== */
.article-content { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 4rem 2rem;
    font-size: 1.125rem !important;
    line-height: 1.75 !important;
}
.article-content h2 { scroll-margin-top: 120px; margin-top: 6rem; margin-bottom: 2.5rem; position: relative; }
.article-content h2::before {
    content: '';
    position: absolute;
    top: -3rem;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}
.article-content h3 { scroll-margin-top: 120px; margin-top: 3rem; margin-bottom: 1.5rem; }
.article-content ul { list-style: none; padding-left: 0; }

/* ===== Article Wrapper ===== */
.article-wrapper {
    position: relative;
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== Reading Progress Bar ===== */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ===== Sidebar Table of Contents ===== */
#sidebar-toc {
    position: sticky;
    top: 140px;
    float: left;
    margin-left: -320px;
    width: 280px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    z-index: 40;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

#sidebar-toc::-webkit-scrollbar { width: 6px; }
#sidebar-toc::-webkit-scrollbar-track { background: rgba(31, 41, 55, 0.5); border-radius: 3px; }
#sidebar-toc::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.5); border-radius: 3px; }
#sidebar-toc::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.7); }

#sidebar-toc h3 {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #8b5cf6;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

#sidebar-toc ul { list-style: none; padding: 0; margin: 0; }
#sidebar-toc li { margin-bottom: 0.5rem; }
#sidebar-toc a {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}
#sidebar-toc a:hover {
    color: #d1d5db;
    background: rgba(139, 92, 246, 0.1);
    border-left-color: rgba(139, 92, 246, 0.5);
    transform: translateX(4px);
}
#sidebar-toc a.active {
    color: #fff;
    background: rgba(139, 92, 246, 0.2);
    border-left-color: #8b5cf6;
    font-weight: 600;
}

/* Responsive: hide sidebar on medium and small screens */
@media (max-width: 1800px) {
    #sidebar-toc { display: none; }
}
@media (min-width: 1801px) {
    .article-content { padding-left: 2rem; }
}

/* ===== Section Navigation ===== */
.section-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4rem 0 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
}

.section-nav-btn {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(139, 92, 246, 0.1);
    color: #d1d5db;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
}
.section-nav-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.section-nav-btn svg { width: 1.25rem; height: 1.25rem; }
.section-nav-btn.prev svg { margin-right: 0.5rem; }
.section-nav-btn.next svg { margin-left: 0.5rem; }

/* ===== SVG Container ===== */
.svg-container {
    background: linear-gradient(135deg, #1e1b4b 0%, #1f2937 100%);
    padding: 3rem;
    border-radius: 1rem;
    margin: 2rem auto;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
    position: relative;
}
.svg-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}
.svg-container::after {
    content: '🔍 Cliquer pour agrandir';
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    color: rgba(139, 92, 246, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.svg-container:hover::after { opacity: 1; }
svg { max-width: 100%; height: auto; }

/* ===== Prose Typography ===== */
.prose { color: #D1D5DB; max-width: none; }
.prose h2 { 
    color: #FFF; 
    border-bottom: 2px solid #374151; 
    padding-bottom: 0.75rem; 
    margin-top: 3em; 
    margin-bottom: 1.5em; 
    font-size: 1.8em; 
    font-weight: 800; 
}
.prose h3 { 
    color: #f87171; 
    margin-top: 2.5em; 
    margin-bottom: 1em; 
    font-size: 1.5em; 
    font-weight: 700; 
}
.prose h4 { 
    color: #fb923c; 
    margin-top: 2em; 
    font-size: 1.25em; 
    font-weight: 600; 
}
.prose a { 
    color: #fb923c; 
    text-decoration: none; 
    border-bottom: 1px dotted #fb923c; 
    transition: all 0.3s; 
}
.prose a:hover { 
    border-bottom-style: solid; 
    color: #f87171; 
}
.prose strong { color: #FFF; font-weight: 600; }
.prose em { color: #9CA3AF; }
.prose p { margin-top: 1.25em; margin-bottom: 1.25em; }
.prose ul, .prose ol { 
    padding-left: 1.75rem; 
    margin: 1.5rem 0; 
    color: #e5e7eb; 
}
.prose li { margin-top: 0.5em; margin-bottom: 0.5em; }

/* Code blocks */
.prose code { 
    color: #e5e7eb; 
    background-color: #2b3649; 
    padding: 0.2em 0.5em; 
    margin: 0; 
    font-size: 90%; 
    border-radius: 4px; 
    font-family: 'Courier New', Consolas, monospace; 
}
.prose pre { 
    background-color: #1f2937; 
    padding: 1.5em; 
    border-radius: 8px; 
    overflow-x: auto; 
    border: 1px solid #374151; 
    margin: 2rem 0;
}
.prose pre code { 
    font-size: 0.9em; 
    background: transparent; 
    padding: 0; 
    color: #E0E7FF;
}

/* Tables */
.prose table { border-collapse: collapse; width: 100%; margin: 2rem 0; }
.prose th { 
    background: #1f2937; 
    color: #f87171; 
    font-weight: 700; 
    padding: 1rem; 
    border: 1px solid #374151; 
    text-align: left; 
}
.prose td { padding: 0.75rem 1rem; border: 1px solid #374151; }
.prose tr:nth-child(even) { background: rgba(31, 41, 55, 0.3); }
.prose tr:hover { background: #374151; }

/* Blockquotes */
.prose blockquote { 
    color: #9CA3AF; 
    border-left: 4px solid #EF4444; 
    padding: 1rem 1.5rem; 
    font-style: italic; 
    background: rgba(239, 68, 68, 0.05); 
    border-radius: 0.5rem; 
    margin: 2rem 0;
}

/* ===== Info/Warning/Defense Boxes ===== */
.attack-number { 
    background: linear-gradient(135deg, #DC2626, #EA580C); 
    color: white; 
    padding: 0.5rem 1rem; 
    border-radius: 9999px; 
    font-weight: 800; 
    display: inline-block; 
    margin-right: 0.75rem; 
    font-size: 1.1em; 
}

.defense-box { 
    background: rgba(34, 197, 94, 0.1); 
    border-left: 4px solid #22C55E; 
    padding: 1.5rem; 
    border-radius: 0.5rem; 
    margin: 2rem 0; 
}
.defense-box h4 { color: #22C55E !important; margin-top: 0; }

.warning-box { 
    background: rgba(251, 146, 60, 0.1); 
    border-left: 4px solid #FB923C; 
    padding: 1.5rem; 
    border-radius: 0.5rem; 
    margin: 2rem 0; 
}
.warning-box h4 { color: #FB923C !important; margin-top: 0; }

.info-box, .info-box-ia { 
    background: rgba(59, 130, 246, 0.1); 
    border-left: 4px solid #3B82F6; 
    padding: 1.5rem; 
    border-radius: 0.5rem; 
    margin: 2rem 0; 
}
.info-box h4, .info-box-ia h4 { color: #3B82F6 !important; margin-top: 0; }

.success-box { 
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(22, 163, 74, 0.1) 100%); 
    border-left: 4px solid #22c55e; 
    padding: 1.5rem; 
    border-radius: 0.5rem; 
    margin: 2rem 0; 
}

.highlight-box {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(236, 72, 153, 0.08) 100%);
    border-left: 4px solid #8b5cf6;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0.5rem;
    max-width: 1152px !important;
}

.cta-box { 
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(234, 88, 12, 0.15)); 
    border: 2px dashed #DC2626; 
    padding: 2.5rem; 
    border-radius: 1rem; 
    margin: 3rem 0; 
    text-align: center; 
}

/* ===== Table of Contents (Inline) ===== */
.table-of-contents, .toc-box { 
    background: #1f2937; 
    border: 1px solid #374151; 
    border-radius: 0.75rem; 
    padding: 2rem; 
    margin: 2rem 0; 
}
.table-of-contents h2, .table-of-contents h3,
.toc-box h2, .toc-box h3 { 
    color: #fff !important; 
    margin-top: 0 !important; 
    border: none !important;
    padding-bottom: 0 !important;
}
.table-of-contents ul, .toc-box ul { list-style: none; padding-left: 0; margin: 0; }
.table-of-contents li, .toc-box li { padding: 0.5rem 0; border-bottom: 1px solid #374151; }
.table-of-contents li:last-child, .toc-box li:last-child { border-bottom: none; }
.table-of-contents a, .toc-box a { color: #fb923c; font-weight: 500; text-decoration: none; border-bottom: none !important; }
.table-of-contents a:hover, .toc-box a:hover { color: #f87171; }

/* TOC container alignment */
.article-content .toc-container { max-width: 1152px !important; text-align: left !important; }
.article-content .toc-container ol { max-width: 100% !important; width: 100% !important; text-align: left !important; padding-left: 0 !important; margin-left: 0 !important; }
.article-content .toc-container li { max-width: 100% !important; width: 100% !important; text-align: left !important; }
.article-content .toc-container li.flex { justify-content: flex-start !important; flex-direction: row !important; align-items: flex-start !important; text-align: left !important; }
.article-content .toc-container a { text-align: left !important; display: block !important; width: 100% !important; }

/* ===== Author Bio ===== */
.author-bio {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(236, 72, 153, 0.08) 100%);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 1.5rem;
    padding: 3rem;
    margin: 5rem auto 3rem;
    max-width: 1200px;
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
    position: relative;
    overflow: hidden;
}
.author-bio::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}
.author-container {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}
.author-photo {
    border-radius: 50%;
    border: 5px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 15px 35px rgba(139, 92, 246, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== SVG Grid ===== */
.svg-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; margin: 3rem 0; }
@media (min-width: 768px) { .svg-grid { grid-template-columns: repeat(2, 1fr); } }
.svg-grid-item {
    background: linear-gradient(135deg, #1e1b4b 0%, #1f2937 100%);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}
.svg-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}
.svg-caption { text-align: center; margin-top: 1rem; font-size: 0.875rem; color: #9ca3af; font-style: italic; }

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.lightbox.active { display: flex; }
.lightbox-content { max-width: 95%; max-height: 90vh; overflow: auto; }
.lightbox-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: white;
    width: 3rem; height: 3rem;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.lightbox-close:hover { background: rgba(139, 92, 246, 0.4); transform: scale(1.1); }

/* ===== Section Badge ===== */
.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: white;
    margin-right: 1rem;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* ===== Width Uniformity ===== */
.article-content .text-lg { font-size: 1.125rem !important; line-height: 1.75 !important; }
.article-content > *:not(.svg-container):not(.section-nav):not(#sidebar-toc):not(.overflow-x-auto):not(.toc-container):not(table):not(aside) {
    max-width: 1152px !important;
    width: 100% !important;
}
.article-content p, .article-content ul, .article-content ol, .article-content blockquote,
.article-content h3, .article-content h4, .article-content h5, .article-content > strong {
    max-width: 1152px !important;
}
.article-content > strong { display: block !important; max-width: 1152px !important; width: 100% !important; margin-bottom: 0.75rem; }
.article-content p strong, .article-content p em, .article-content li strong, .article-content li em {
    max-width: none !important; display: inline !important; width: auto !important;
}
.article-content ul, .article-content ol { max-width: 1152px !important; width: 100% !important; }
.article-content li { font-size: 1.125rem !important; line-height: 1.75 !important; max-width: 100% !important; }
.article-content li.flex span { max-width: none !important; flex: 1 1 auto; }
.article-content span { max-width: none !important; }
.article-content [class*="max-w-"]:not(.svg-container):not(.section-nav):not(.toc-container):not([class*="svg-"]) { max-width: 1152px !important; }
.article-content > div:not(.svg-container):not(.section-nav):not(.toc-container):not(.overflow-x-auto):not([class*="svg-"]) { max-width: 1152px !important; }
.article-content .svg-container, .article-content [class*="svg-"] { max-width: 100% !important; }
.article-content table, .article-content .overflow-x-auto { max-width: 100% !important; width: 100% !important; }
.article-content h2, .article-content .svg-container, .article-content .section-nav, #sidebar-toc { max-width: 100% !important; }
.article-content p, .article-content > strong, .article-content li,
.article-content > div:not(.svg-container):not(.section-nav):not(.toc-container) { text-align: left !important; }

/* ===== Tool Cards ===== */
.tool-card {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid #374151;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
    transition: all 0.3s;
}
.tool-card:hover { border-color: #fb923c; transform: translateY(-2px); }

/* ===== Category Tags ===== */
.article-category { 
    display: inline-block; 
    background: #374151; 
    color: #d1d5db; 
    padding: 0.25rem 0.75rem; 
    border-radius: 0.375rem; 
    font-size: 0.875rem; 
    margin-bottom: 1rem; 
}
.category-vectorielles { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.category-optimisation { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.category-forensics { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.category-securite { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

/* ===== Gradient Text ===== */
.gradient-text-ia { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    background-clip: text;
}
.gradient-text-forensics {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Article Navigation ===== */
.nav-article { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1.5rem 0; 
    margin-top: 3rem;
    border-top: 1px solid #374151;
}
.nav-prev, .nav-next { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    padding: 0.75rem 1.5rem; 
    background: #1f2937; 
    border-radius: 0.5rem; 
    transition: all 0.3s; 
    text-decoration: none; 
    color: #d1d5db; 
}
.nav-prev:hover, .nav-next:hover { background: #374151; color: #fff; }

/* ===== Step/Section Numbers ===== */
.step-number, .section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    border-radius: 50%;
    margin-right: 1rem;
}

/* ===== Forensics specific ===== */
.forensic-artifact {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.forensic-path {
    font-family: 'Courier New', monospace;
    background: #1f2937;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: #60a5fa;
}

/* ===== Badge Animation ===== */
.badge-new { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .7; }
}
