/**
 * Fix pour les articles de blog - Mise en page correcte
 * Corrige le décalage à droite et le défilement sous l'image
 */

/* Reset des marges et paddings pour éviter les décalages */
.article-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow-x: hidden; /* Empêche le défilement horizontal */
}

.article-container .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Grille de l'article - Layout avec sidebar à droite */
.article-grid {
    display: grid;
    grid-template-columns: 1fr 320px; /* Contenu principal + sidebar 320px */
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 0;
}

/* Article principal - Sans centrage car sidebar à droite */
.article-main {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden; /* Empêche le débordement du contenu */
}

/* Header de l'article */
.article-header {
    padding: 40px 40px 20px;
    position: relative;
}

/* Image principale - Correction du z-index et position */
.article-featured-image {
    margin: 30px -40px 30px;
    position: relative;
    z-index: 1; /* Empêche le contenu de passer dessous */
    background: #fff;
    overflow: hidden;
}

.article-featured-image img,
.article-featured-image .article-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px;
    object-fit: cover;
    position: relative;
    z-index: 2;
}

/* Contenu de l'article - Empêche le défilement sous l'image */
.article-content {
    padding: 20px 40px 40px;
    position: relative;
    z-index: 3; /* Au-dessus de l'image */
    background: #fff; /* Fond blanc pour masquer l'image si débordement */
    clear: both; /* Clear les flottants */
}

/* Fix pour les éléments flottants dans le contenu */
.article-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Styles pour le contenu */
.article-content h2 {
    margin: 40px 0 20px;
    padding-top: 20px;
    font-size: 1.8rem;
    color: #2c3e50;
    border-top: 1px solid #eee;
}

.article-content h2:first-child {
    border-top: none;
    padding-top: 0;
}

.article-content h3 {
    margin: 30px 0 15px;
    font-size: 1.4rem;
    color: #34495e;
}

.article-content p {
    margin: 0 0 20px;
    line-height: 1.8;
    color: #4a5568;
}

.article-content ul,
.article-content ol {
    margin: 0 0 20px;
    padding-left: 30px;
}

.article-content li {
    margin-bottom: 10px;
    line-height: 1.8;
}

.article-content blockquote {
    margin: 30px 0;
    padding: 20px 20px 20px 30px;
    background: linear-gradient(to right, #667eea 4px, #f7fafc 4px);
    border-radius: 5px;
    font-style: italic;
    color: #4a5568;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 30px auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Table of Contents */
.table-of-contents {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin: 30px 0;
    border-left: 4px solid #667eea;
}

.toc-title {
    margin: 0 0 15px;
    font-size: 1.2rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toc-list {
    margin: 0;
    padding-left: 20px;
}

.toc-list li {
    margin-bottom: 10px;
}

.toc-list a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

.toc-list a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Boutons de partage flottants - Position fixe */
.share-floating {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    animation-delay: 0.5s;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.share-floating-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 10px;
    font-weight: 600;
}

.share-floating-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    color: #4a5568;
}

.share-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.share-floating-btn.facebook:hover {
    background: #1877f2;
    color: #fff;
}

.share-floating-btn.twitter:hover {
    background: #1da1f2;
    color: #fff;
}

.share-floating-btn.linkedin:hover {
    background: #0077b5;
    color: #fff;
}

.share-floating-btn.whatsapp:hover {
    background: #25d366;
    color: #fff;
}

.share-floating-btn.email:hover {
    background: #ea4335;
    color: #fff;
}

.share-floating-btn.copy:hover {
    background: #667eea;
    color: #fff;
}

.share-floating-btn.copy.copied {
    background: #48bb78;
    color: #fff;
}

/* Sidebar des articles - À DROITE */
.article-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Widgets de la sidebar */
.article-sidebar .sidebar-widget {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.article-sidebar .widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Formulaire de recherche */
.article-sidebar .search-form {
    display: flex;
    gap: 8px;
}

.article-sidebar .search-field {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.article-sidebar .search-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.article-sidebar .search-submit {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.article-sidebar .search-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Liste des catégories */
.article-sidebar .category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-sidebar .category-list li {
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.article-sidebar .category-list li:last-child {
    border-bottom: none;
}

.article-sidebar .category-list a {
    color: #4a5568;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
}

.article-sidebar .category-list a:hover {
    color: #667eea;
}

/* Widget CTA */
.article-sidebar .cta-widget {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.article-sidebar .cta-widget .widget-title {
    color: white;
}

.article-sidebar .cta-widget p {
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.article-sidebar .cta-button {
    display: inline-block;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.article-sidebar .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Media Queries pour le responsive */
@media (max-width: 1200px) {
    .share-floating {
        display: none; /* Cache les boutons de partage sur tablette */
    }
    
    /* Garde la sidebar sur tablette */
    .article-grid {
        grid-template-columns: 1fr 280px; /* Réduit un peu la sidebar */
    }
}

@media (max-width: 1024px) {
    /* Sur tablette portrait, sidebar en dessous */
    .article-grid {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        position: static;
        margin-top: 40px;
    }
}

@media (max-width: 768px) {
    .article-header {
        padding: 30px 20px 15px;
    }
    
    .article-featured-image {
        margin: 20px -20px 20px;
    }
    
    .article-content {
        padding: 15px 20px 30px;
    }
    
    .article-content h2 {
        font-size: 1.5rem;
    }
    
    .article-content h3 {
        font-size: 1.2rem;
    }
    
    .table-of-contents {
        padding: 20px;
    }
}

/* Fix spécifique pour éviter le décalage à droite */
body.single-post {
    overflow-x: hidden;
}

.single article {
    max-width: 100%;
    overflow-x: hidden;
}

/* Fix pour les images WordPress avec légendes */
.wp-caption {
    max-width: 100% !important;
}

.wp-caption img {
    width: 100%;
    height: auto;
}

.wp-caption-text {
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Fix pour les galeries WordPress */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.gallery-item {
    margin: 0;
}

.gallery img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

/* Empêche tout débordement horizontal */
* {
    max-width: 100%;
}

pre {
    overflow-x: auto;
    max-width: 100%;
}

/* Fix pour le breadcrumb */
.breadcrumb-nav {
    background: #f8f9fa;
    padding: 15px 0;
    margin-bottom: 0;
}

.breadcrumb-nav .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-separator {
    margin: 0 10px;
    color: #cbd5e0;
}

/* Meta données de l'article */
.article-meta-top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.article-category {
    background: #667eea;
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.article-category:hover {
    background: #764ba2;
}

.article-date,
.article-reading-time {
    color: #718096;
    font-size: 0.95rem;
}

.article-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.3;
    color: #2c3e50;
    margin: 0 0 20px;
}

.article-excerpt {
    font-size: 1.15rem;
    color: #4a5568;
    line-height: 1.6;
    margin: 0 0 30px;
}

/* Auteur info (si présent) */
.author-box {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-top: 40px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.author-avatar {
    flex-shrink: 0;
}

.author-avatar img {
    border-radius: 50%;
    width: 60px;
    height: 60px;
}

.author-info h4 {
    margin: 0 0 10px;
    color: #2c3e50;
}

.author-bio {
    color: #4a5568;
    line-height: 1.6;
}