/* ===== CSS DÉDIÉ AUX ARTICLES ===== */
/* Approche méthodique : mobile-first, puis desktop */

/* === 1. VARIABLES CSS === */
:root {
    --article-font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --article-color-primary: #2c3e50;
    --article-color-secondary: #6c757d;
    --article-color-accent: #007bff;
    --article-bg-light: #f8f9fa;
    --article-spacing-xs: 0.5rem;
    --article-spacing-sm: 1rem;
    --article-spacing-md: 1.5rem;
    --article-spacing-lg: 2rem;
    --article-spacing-xl: 3rem;
    --article-border-radius: 12px;
    --article-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === 2. LAYOUT PRINCIPAL === */
.article-page {
    min-height: 100vh;
    background-color: var(--article-bg-light);
    padding: 0.75rem 0 var(--article-spacing-lg) 0 !important; /* Petite marge raisonnable : 0.75rem */
    font-family: var(--article-font-family);
}

/* Forcer la suppression du padding Bootstrap */
.container-fluid.article-page {
    padding-top: 0 !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* FORCER LE LAYOUT BOOTSTRAP DEUX COLONNES */
.article-page .row {
    display: flex !important;
    flex-wrap: wrap;
    margin-top: 0 !important; /* Suppression de la marge du haut des rows */
}

/* Forcer la première row à coller au haut */
.article-page .row:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.article-page .col-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

.article-page .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.article-page .col-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

/* === 3. EN-TÊTE ARTICLE === */
.article-header {
    margin-top: 1.5rem; /* Augmenté pour plus d'espace avec la navigation */
    margin-bottom: var(--article-spacing-md); /* Réduit encore plus : md au lieu de lg */
    padding-bottom: var(--article-spacing-lg);
    border-bottom: 3px solid #e9ecef;
}

.header-content {
    display: flex;
    align-items: flex-start;
    gap: var(--article-spacing-lg);
}

.header-text {
    flex-grow: 1;
    padding-top: 0; /* Suppression du padding pour aligner avec l'image */
}

.header-image {
    flex-shrink: 0;
    margin-top: 1rem; /* Descendre l'image miniature */
}

.header-main-img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
}



.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--article-color-primary);
    margin: 0 0 var(--article-spacing-xs) 0 !important; /* Réduit l'espacement vers l'accroche */
    line-height: 1.2;
    padding-top: 0 !important; /* Force la suppression du padding du haut */
}

.article-subtitle {
    font-size: 1.2rem;
    color: var(--article-color-secondary);
    font-style: italic;
    margin: 0;
    line-height: 1.4;
}

/* === 4. CONTENU PRINCIPAL === */
.article-content {
    background: white;
    border-radius: var(--article-border-radius);
    padding: var(--article-spacing-lg);
    box-shadow: var(--article-shadow);
    border: 1px solid #e9ecef;
    margin-bottom: var(--article-spacing-lg);
}

/* === 5. MÉTADONNÉES AUTEUR === */
.article-meta {
    padding: var(--article-spacing-sm) 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: var(--article-spacing-md);
}

.author-info {
    display: flex;
    align-items: center;
    gap: var(--article-spacing-sm);
}

.author-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--article-color-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.author-details {
    flex-grow: 1;
}

.author-name {
    font-weight: 600;
    color: var(--article-color-primary);
    margin-bottom: 0.25rem;
}

.article-date {
    font-size: 0.9rem;
    color: var(--article-color-secondary);
    margin-bottom: 0.25rem;
}

.article-category {
    display: inline-block;
    background: var(--article-color-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* === 6. IMAGE PRINCIPALE === 
   Styles déplacés dans .header-main-img 
*/

/* === 7. CONTENU TEXTE === */
.article-text {
    font-size: 1.0rem;
    line-height: 1.7;
    color: var(--article-color-primary);
    margin: var(--article-spacing-md) 0;
}

.article-text h1, 
.article-text h2, 
.article-text h3, 
.article-text h4 {
    color: var(--article-color-primary);
    margin-top: var(--article-spacing-lg);
    margin-bottom: var(--article-spacing-sm);
    font-weight: 600;
}

.article-text p {
    margin-bottom: var(--article-spacing-sm);
}

/* === 8. GALERIE IMAGES === */
.article-gallery {
    margin-top: var(--article-spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--article-spacing-md);
}

.article-secondary-img {
    max-width: 400px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: block;
    margin: var(--article-spacing-sm) auto;
}

.article-secondary-img:hover {
    transform: scale(1.02);
}

/* === 9. SIDEBAR PIÈCES JOINTES === */
.attachments-sidebar {
    padding-left: var(--article-spacing-sm);
}

.sidebar-attachments {
    background: white;
    border-radius: var(--article-border-radius);
    padding: var(--article-spacing-md);
    box-shadow: var(--article-shadow);
    border: 1px solid #e9ecef;
    position: sticky;
    top: var(--article-spacing-lg);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--article-color-primary);
    margin-bottom: var(--article-spacing-md);
    padding-bottom: var(--article-spacing-xs);
    border-bottom: 2px solid var(--article-color-accent);
    display: flex;
    align-items: center;
    gap: var(--article-spacing-xs);
}

/* === 10. ITEMS PIÈCES JOINTES === */
.attachment-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: var(--article-spacing-sm);
    margin-bottom: var(--article-spacing-sm);
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: var(--article-spacing-xs);
    transition: all 0.3s ease;
}

.attachment-item:hover {
    background: #e9ecef;
    border-color: var(--article-color-accent);
    transform: translateY(-1px);
}

.attachment-icon {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.attachment-icon .fa-file-pdf {
    color: #dc3545;
}

.attachment-icon .fa-file-word {
    color: #0d6efd;
}

.attachment-icon .fa-file-excel {
    color: #198754;
}

.attachment-icon .fa-file {
    color: var(--article-color-secondary);
}

.attachment-info {
    flex-grow: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--article-color-primary);
    word-break: break-word;
}

.attachment-download {
    background: var(--article-color-accent);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}

.attachment-download:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
    transform: scale(1.05);
}

/* === 11. RESPONSIVE DESIGN === */

/* Tablettes */
@media (max-width: 991.98px) {
    .attachments-sidebar {
        margin-top: var(--article-spacing-lg);
        padding-left: 0;
    }
    
    .sidebar-attachments {
        position: static;
    }
    
    .attachment-item {
        flex-direction: column;
        text-align: center;
        gap: var(--article-spacing-xs);
    }
    
    .attachment-icon {
        margin-bottom: var(--article-spacing-xs);
    }
}

/* === 11. MÉTADONNÉES EN EN-TÊTE === */
.article-meta-header {
    margin-top: var(--article-spacing-md);
    display: flex;
    gap: var(--article-spacing-md);
    flex-wrap: wrap;
    color: var(--article-color-secondary);
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--article-spacing-xs);
    padding: var(--article-spacing-xs) var(--article-spacing-sm);
    background-color: white;
    border-radius: var(--article-border-radius);
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.meta-item i {
    color: var(--article-color-accent);
    font-size: 0.85rem;
}

.meta-item span {
    font-weight: 500;
}

/* Responsive pour les métadonnées */
@media (max-width: 768px) {
    .article-meta-header {
        justify-content: center;
        gap: var(--article-spacing-sm);
    }
    
    .meta-item {
        font-size: 0.85rem;
        padding: var(--article-spacing-xs);
    }
}

/* === 9. IMAGES D'ARTICLES (POSITIONS LARAVEL) === */
/* Images "top" - anciennes Laravel finissant par "00" */
.article-images-top {
    margin: var(--article-spacing-md) 0;
    text-align: center;
}

.article-top-img {
    max-width: 100%;
    height: auto;
    max-height: 300px; /* Limite la hauteur */
    width: auto; /* Maintient les proportions */
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    margin: var(--article-spacing-sm) 0;
}

/* Images "bottom" - anciennes Laravel normales */
.article-images-bottom {
    margin: var(--article-spacing-md) 0;
    text-align: center;
}

.article-bottom-img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    width: auto;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    margin: var(--article-spacing-sm) 0;
}

/* Images "gallery" - nouvelles Symfony */
.article-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--article-spacing-sm);
    margin: var(--article-spacing-md) 0;
}

.article-gallery-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    transition: transform 0.3s ease;
}

.article-gallery-img:hover {
    transform: scale(1.05);
}

/* Image miniature dans le contenu */
.article-miniature {
    text-align: center;
    margin: var(--article-spacing-md) 0;
}

.article-miniature-img {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    width: auto;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
}

/* Image miniature dans l'en-tête (vue_article) */
.header-image {
    flex-shrink: 0;
    margin-right: var(--article-spacing-md);
}

.header-miniature-img {
    width: 120px !important;
    height: 120px !important;
    object-fit: contain; /* Changé de 'cover' à 'contain' pour préserver les proportions des logos */
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    background: white; /* Fond blanc pour les logos transparents */
    padding: 8px; /* Petit padding pour éviter que les logos touchent les bords */
}

/* Mobile */
@media (max-width: 768px) {
    /* Suppression des marges latérales sur mobile */
    .article-page .col-2 {
        display: none; /* Cache les colonnes de marge */
    }
    
    .article-page .col-8,
    .article-page .col-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* Layout mobile : contenu pleine largeur */
    .article-page .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Pièces jointes sous le contenu sur mobile */
    .attachments-sidebar {
        order: 2; /* Place les pièces jointes après le contenu */
        padding-left: 0;
        margin-top: var(--article-spacing-lg);
        width: 100% !important;
    }
    
    .article-content {
        order: 1; /* Place le contenu en premier */
        width: 100% !important;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .article-subtitle {
        font-size: 1.1rem;
    }
    
    .article-content {
        padding: var(--article-spacing-sm);
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .header-text {
        padding-top: 0; /* Pas de padding sur mobile */
    }
    
    .header-main-img {
        width: 120px;
        height: 120px;
        margin-bottom: var(--article-spacing-sm);
    }
    
    .author-info {
        flex-direction: column;
        text-align: center;
        gap: var(--article-spacing-xs);
    }
    
    .article-gallery {
        grid-template-columns: 1fr;
    }
    
    .attachment-item {
        padding: var(--article-spacing-sm);
    }
    
    .sidebar-title {
        font-size: 1rem;
    }
    
    /* Images responsive sur mobile */
    .article-top-img,
    .article-bottom-img,
    .article-miniature-img {
        max-height: 200px; /* Plus petites sur mobile */
    }
    
    /* Miniature header plus petite sur mobile */
    .header-miniature-img {
        width: 80px !important;
        height: 80px !important;
    }
    
    .article-gallery {
        grid-template-columns: 1fr; /* Une seule colonne sur mobile */
    }
    
    .article-gallery-img {
        height: 150px; /* Plus petites sur mobile */
    }
}

/* === 12. STYLES POUR LES IMAGES === */

/* Images de galerie (nouvelles Symfony) */
.article-gallery {
    margin: var(--article-spacing-lg) 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--article-spacing-sm);
}

.article-gallery-img {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    transition: transform 0.3s ease;
}

.article-gallery-img:hover {
    transform: scale(1.05);
}

/* Images en haut */
.article-images-top {
    margin: var(--article-spacing-lg) 0;
    text-align: center;
}

.article-top-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    margin: var(--article-spacing-sm) 0;
}

/* Images en bas - disposition en grille centrée */
.article-images-bottom {
    margin: var(--article-spacing-lg) 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--article-spacing-sm);
}

.article-bottom-img {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
    flex: 0 1 auto;
}

/* Responsive pour images en bas */
@media (max-width: 768px) {
    .article-bottom-img {
        max-width: 250px;
    }
}

/* Image miniature en en-tête */
.header-miniature-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--article-border-radius);
    box-shadow: var(--article-shadow);
}

/* === 13. CLEARFIX POUR LE FLOAT === */
.article-text::after {
    content: "";
    display: table;
    clear: both;
}
