/* Style pour le carrousel d'actualités SEO/IA - Version révisée et optimisée */
/* Reset général pour éviter les problèmes d'héritage */
.news-section * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.news-section {
    padding: 1rem 0;
    width: 100%;
}

.news-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

.news-header {
    text-align: center;
    margin-bottom: 30px;
}

.news-header h2 {
    font-size: 32px;
    color: #333;
    margin-bottom: 15px;
}

.news-header p {
    font-size: 20px;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

/* Structure du carrousel */
.news-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 40px; /* Espace pour les boutons de navigation */
}

/* Track qui contient tous les éléments - Optimisé */
.news-track {
    display: flex;
    flex-wrap: nowrap;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin: 0;
    padding: 10px 0;
    will-change: transform;
}

/* Cartes d'actualités - Optimisées */
.news-item {
    flex: 0 0 25%; /* Flexbox responsive par défaut */
    min-width: 280px;
    height: 350px;
    margin-right: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateZ(0); /* GPU acceleration */
    backface-visibility: hidden;
}

/* Contenu de l'actualité */
.news-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Catégorie */
.news-category {
    display: inline-block;
    padding: 4px 8px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Couleurs des catégories */
.news-category.seo {
    background-color: #e6f7ff;
    color: #0077cc;
}

.news-category.technique {
    background-color: #fff2e8;
    color: #d46b08;
}

.news-category.ia {
    background-color: #f6ffed;
    color: #52c41a;
}

/* Lien du titre */
.news-title-link {
    text-decoration: none;
    color: inherit;
    display: block; /* Pour que la zone cliquable couvre tout l'espace */
    margin-bottom: 12px;
}

/* Style du titre - Optimisé */
.news-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: #212121;
    margin: 0;
    /* Troncature optimisée du titre à 3 lignes */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    max-height: calc(1.4em * 3);
    transition: color 0.15s ease;
    contain: layout style;
}

.news-title-link:hover .news-title {
    color: #1976d2;
}

/* Style du résumé - Optimisé */
.news-summary {
    font-size: 14px;
    line-height: 1.5;
    color: #616161;
    margin: 0;
    flex-grow: 1;
    /* Troncature optimisée du résumé à 4 lignes */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    max-height: calc(1.5em * 4);
    contain: layout;
}

/* Pied de l'article */
.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Pousse au bas de l'élément */
    font-size: 12px;
    color: #9e9e9e;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* Source de l'actualité */
.news-source {
    font-weight: 500;
}

/* Date de l'actualité */
.news-date {
    font-style: italic;
}

/* Boutons de navigation */
.news-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

.news-nav.prev {
    left: 0;
}

.news-nav.next {
    right: 0;
}

.news-nav:hover {
    background-color: #f5f5f5;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Indicateur de chargement */
.news-loading {
    width: 100%;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    color: #757575;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Masquer les clones pour les lecteurs d'écran */
.clone {
    transition: opacity 0.2s;
}

/* Message d'erreur */
.news-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    color: #757575;
    padding: 20px;
}

/* Adaptation responsive optimisée */
@media (min-width: 1025px) {
    .news-item { flex: 0 0 25%; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .news-item { flex: 0 0 33.333%; }
    .news-carousel { padding: 0 50px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    .news-item { flex: 0 0 50%; min-width: 260px; }
    .news-carousel { padding: 0 45px; }
}

@media (max-width: 480px) {
    .news-item { 
        flex: 0 0 85%; 
        min-width: 240px;
        height: 320px;
    }
    .news-header h2 { font-size: 1.75rem; }
    .news-title { font-size: 16px; }
    .news-nav {
        width: 30px;
        height: 30px;
    }
    .news-carousel { padding: 0 35px; }
}
