/* ===== VARIABLES ET RESET ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== MODE SOMBRE COMPLET ===== */
.back-dark .article-wrapper {
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --border-color: #475569;
}

.back-dark .article-wrapper {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.back-dark .article-wrapper .article-hero {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.back-dark .article-wrapper .search-module {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

/* Corrections pour les couleurs en dur */
.back-dark .article-wrapper .article-body p,
.back-dark .article-wrapper .article-body h2,
.back-dark .article-wrapper .article-body h3,
.back-dark .article-wrapper .article-body h4,
.back-dark .article-wrapper .article-body h5,
.back-dark .article-wrapper .article-body h6,
.back-dark .article-wrapper .article-body li,
.back-dark .article-wrapper .article-body td {
    color: var(--text-primary) !important;
}

.back-dark .article-wrapper .article-body blockquote {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%) !important;
    color: var(--text-primary) !important;
}

.back-dark .article-wrapper .recent-title,
.back-dark .article-wrapper .card-title,
.back-dark .article-wrapper .author-name,
.back-dark .article-wrapper .module-title,
.back-dark .article-wrapper .section-title {
    color: var(--text-primary) !important;
}

.back-dark .article-wrapper .recent-date,
.back-dark .article-wrapper .card-date,
.back-dark .article-wrapper .author-bio {
    color: var(--text-secondary) !important;
}

/* ===== LAYOUT PRINCIPAL ===== */
.article-wrapper {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    min-height: 100vh;
}

.article-wrapper .article-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.article-wrapper .article-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="%23ffffff" opacity="0.1"><polygon points="1000,100 1000,0 0,100"/></svg>');
    background-size: cover;
}

.article-wrapper .hero-container {
    position: relative;
    z-index: 2;
}

.article-wrapper .article-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.article-wrapper .breadcrumb-nav ul {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-wrapper .breadcrumb-nav li:not(:last-child)::after {
    content: '/';
    margin-left: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.article-wrapper .breadcrumb-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.article-wrapper .breadcrumb-nav a:hover {
    color: white;
    transform: translateY(-1px);
}

/* ===== CONTENU PRINCIPAL ===== */
.article-wrapper .main-content {
    position: relative;
}

.article-wrapper .article-content-wrapper {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    margin-top: -4rem;
    position: relative;
    z-index: 10;
    border: 1px solid var(--border-color);
}

.article-wrapper .featured-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.article-wrapper .featured-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.1) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

.article-wrapper .featured-image img {
    width: 100%;
    height: auto;
    transition: var(--transition-slow);
    transform: scale(1.01);
}

.article-wrapper .featured-image:hover img {
    transform: scale(1.03);
}

/* ===== CORPS DE L'ARTICLE ===== */
.article-wrapper .article-body {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.article-wrapper .article-body p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.article-wrapper .article-body h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 3rem 0 1.5rem;
    position: relative;
    padding-left: 1.5rem;
}

.article-wrapper .article-body h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-sm);
}

.article-wrapper .article-body blockquote {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-left: 4px solid var(--primary-color);
    padding: 2rem;
    margin: 2.5rem 0;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    position: relative;
    font-style: italic;
    box-shadow: var(--shadow-md);
}

.article-wrapper .article-body blockquote::before {
    content: '"';
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.2;
    position: absolute;
    top: -1rem;
    left: 1rem;
    font-family: serif;
}

/* ===== MÉTADONNÉES ===== */
.article-wrapper .article-metadata {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
    padding: 2.5rem 0;
    margin: 3rem 0;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.article-wrapper .metadata-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
}

.article-wrapper .tag-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.article-wrapper .tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-wrapper .tag-pill {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.article-wrapper .tag-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    transition: var(--transition-slow);
    z-index: -1;
}

.article-wrapper .tag-pill:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.article-wrapper .tag-pill:hover::before {
    left: 0;
}

/* ===== PARTAGE SOCIAL ===== */
.article-wrapper .social-share {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.article-wrapper .share-buttons {
    display: flex;
    gap: 0.75rem;
}

.article-wrapper .share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.article-wrapper .share-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    transition: var(--transition);
}

.article-wrapper .share-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-lg);
}

.article-wrapper .share-btn:hover::before {
    opacity: 0.1;
}

.article-wrapper .share-btn.facebook:hover { color: #1877f2; }
.article-wrapper .share-btn.twitter:hover { color: #1da1f2; }
.article-wrapper .share-btn.linkedin:hover { color: #0a66c2; }

/* ===== CARTE AUTEUR ===== */
.article-wrapper .author-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: start;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    margin: 3rem 0;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.article-wrapper .author-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.article-wrapper .author-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.article-wrapper .author-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.article-wrapper .author-bio {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.article-wrapper .author-role {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== NAVIGATION ===== */
.article-wrapper .article-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.article-wrapper .nav-prev, 
.article-wrapper .nav-next {
    position: relative;
}

.article-wrapper .nav-prev a, 
.article-wrapper .nav-next a {
    display: block;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.article-wrapper .nav-prev a::before, 
.article-wrapper .nav-next a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    transition: var(--transition-slow);
    z-index: -1;
}

.article-wrapper .nav-prev a:hover, 
.article-wrapper .nav-next a:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.article-wrapper .nav-prev a:hover::before, 
.article-wrapper .nav-next a:hover::before {
    left: 0;
}

/* ===== ARTICLES SIMILAIRES ===== */
.article-wrapper .related-articles {
    margin: 4rem 0;
}

.article-wrapper .section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
}

.article-wrapper .section-title::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-sm);
}

.article-wrapper .articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.article-wrapper .article-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
}

.article-wrapper .article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: var(--transition);
}

.article-wrapper .article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.article-wrapper .article-card:hover::before {
    opacity: 1;
}

.article-wrapper .card-image {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.article-wrapper .card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.article-wrapper .article-card:hover .card-img {
    transform: scale(1.1);
}

.article-wrapper .card-content {
    padding: 1.5rem;
}

.article-wrapper .card-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.article-wrapper .card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.article-wrapper .card-title a:hover {
    color: var(--primary-color);
}

.article-wrapper .card-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== SIDEBAR ===== */
.article-wrapper .sidebar-main {
    position: sticky;
    top: 2rem;
}

.article-wrapper .sidebar-module {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.article-wrapper .sidebar-module:last-child {
    margin-bottom: 0;
}

.article-wrapper .module-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.article-wrapper .module-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-sm);
}

/* ===== RECHERCHE ===== */
.article-wrapper .search-module {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.article-wrapper .search-module .module-title {
    color: white;
}

.article-wrapper .search-module .module-title::after {
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
}

.article-wrapper .search-form {
    position: relative;
}

.article-wrapper .search-group {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.article-wrapper .search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 1rem;
}

.article-wrapper .search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.article-wrapper .search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

.article-wrapper .search-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 1rem 1.5rem;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.article-wrapper .search-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== ARTICLES RÉCENTS ===== */
.article-wrapper .recent-articles {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-wrapper .recent-item {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.article-wrapper .recent-item:last-child {
    border-bottom: none;
}

.article-wrapper .recent-item:hover {
    background: var(--bg-secondary);
    margin: 0 -1rem;
    padding: 0 1rem;
    border-radius: var(--radius-md);
}

.article-wrapper .recent-link {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    padding: 1rem 0;
    text-decoration: none;
    color: inherit;
}

.article-wrapper .recent-thumb {
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.article-wrapper .thumb-img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    transition: var(--transition);
}

.article-wrapper .recent-item:hover .thumb-img {
    transform: scale(1.1);
}

.article-wrapper .recent-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.article-wrapper .recent-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== CATÉGORIES ===== */
.article-wrapper .categories-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-wrapper .category-item {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.article-wrapper .category-item:last-child {
    border-bottom: none;
}

.article-wrapper .category-item:hover {
    background: var(--bg-secondary);
    margin: 0 -1rem;
    padding: 0 1rem;
    border-radius: var(--radius-md);
}

.article-wrapper .category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
}

.article-wrapper .category-link:hover {
    color: var(--primary-color);
}

.article-wrapper .category-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.article-wrapper .category-item:hover .category-count {
    background: var(--primary-color);
    color: white;
}

/* ===== TAGS CLOUD ===== */
.article-wrapper .tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-wrapper .cloud-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.article-wrapper .cloud-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    transition: var(--transition-slow);
    z-index: -1;
}

.article-wrapper .cloud-tag:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.article-wrapper .cloud-tag:hover::before {
    left: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .article-wrapper .article-content-wrapper {
        padding: 2rem 1.5rem;
        margin-top: -2rem;
    }
    
    .article-wrapper .article-metadata {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .article-wrapper .author-card {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }
    
    .article-wrapper .article-navigation {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .article-wrapper .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-wrapper .sidebar-main {
        position: static;
    }
}

@media (max-width: 480px) {
    .article-wrapper .article-hero {
        padding: 3rem 0;
    }
    
    .article-wrapper .article-content-wrapper {
        padding: 1.5rem 1rem;
    }
    
    .article-wrapper .sidebar-module {
        padding: 1.5rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes article-wrapper-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-wrapper .article-content-wrapper {
    animation: article-wrapper-fadeInUp 0.6s ease-out;
}

.article-wrapper .sidebar-module {
    animation: article-wrapper-fadeInUp 0.6s ease-out 0.2s both;
}

.article-wrapper .sidebar-module:nth-child(2) { animation-delay: 0.3s; }
.article-wrapper .sidebar-module:nth-child(3) { animation-delay: 0.4s; }
.article-wrapper .sidebar-module:nth-child(4) { animation-delay: 0.5s; }

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
    .article-wrapper * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== MODE SOMBRE ===== */
@media (prefers-color-scheme: dark) {
    .article-wrapper:root {
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --border-color: #334155;
    }
    
    .article-wrapper .article-body blockquote {
        background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    }
}