/* ── Styles pour la page News ── */

/* ─── Grille ──────────────────────────────────────────── */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 2rem;
    align-items: start; /* ← clé : chaque carte prend sa propre hauteur */
}

/* ─── Carte ───────────────────────────────────────────── */
.news-card {
    display: flex;
    flex-direction: column;
    /* PAS de height fixe — la carte grandit avec son contenu */
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(7, 7, 77, 0.07);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(74, 108, 247, 0.08);
}
.dark .news-card {
    background: #1D2144;
    border-color: rgba(255,255,255,0.06);
}
.news-card:hover {
    box-shadow: 0 8px 32px rgba(74, 108, 247, 0.18);
    transform: translateY(-4px);
}

/* ─── Image ───────────────────────────────────────────── */
.news-card__image-wrapper {
    display: block;
    position: relative;
    width: 100%;
    /* Ratio 16/9 fixe — indépendant du texte */
    aspect-ratio: 16 / 9;
    overflow: hidden;
    flex-shrink: 0;
}
.news-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}
.news-card:hover .news-card__image {
    transform: scale(1.06);
}
.news-card__image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(41, 81, 149, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.news-card:hover .news-card__image-overlay {
    opacity: 1;
}
.news-card__read-icon {
    width: 40px;
    height: 40px;
    stroke: #fff;
    transform: translateX(-6px);
    transition: transform 0.3s ease;
}
.news-card:hover .news-card__read-icon {
    transform: translateX(0);
}

/* ─── Body ────────────────────────────────────────────── */
.news-card__body {
    display: flex;
    flex-direction: column;
    flex: 1; /* prend l'espace restant */
    padding: 1.5rem;
    gap: 0.75rem;
}

/* ─── Titre ───────────────────────────────────────────── */
.news-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    /* Limite à 3 lignes max avec ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card__title-link {
    color: #090e34;
    text-decoration: none;
    transition: color 0.2s;
}
.dark .news-card__title-link { color: #fff; }
.news-card__title-link:hover { color: #4A6CF7; }

/* ─── Extrait ─────────────────────────────────────────── */
.news-card__excerpt {
    font-size: 0.9rem;
    color: #959CB1;
    line-height: 1.65;
    /* Limite à 4 lignes avec ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card__excerpt p { margin: 0; }
.news-card__excerpt * { color: inherit !important; font-size: inherit !important; }

/* ─── Séparateur ──────────────────────────────────────── */
.news-card__divider {
    height: 1px;
    background: rgba(149, 156, 177, 0.15);
    margin-top: auto; /* pousse le footer en bas du body */
    flex-shrink: 0;
}
.dark .news-card__divider { background: rgba(255,255,255,0.08); }

/* ─── Footer ──────────────────────────────────────────── */
.news-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
    flex-shrink: 0;
}
.news-card__author {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.news-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(74,108,247,0.08);
    border: 2px solid rgba(74,108,247,0.2);
}
.news-card__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card__author-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1D2144;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .news-card__author-name { color: #fff; }
.news-card__author-role {
    display: block;
    font-size: 0.72rem;
    color: #959CB1;
}
.news-card__date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #959CB1;
    white-space: nowrap;
    flex-shrink: 0;
}
.news-card__date-icon { width: 14px; height: 14px; flex-shrink: 0; }

/* ─── CTA bas de carte ────────────────────────────────── */
.news-card__cta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4A6CF7;
    text-decoration: none;
    border-top: 1px solid rgba(74,108,247,0.1);
    background: rgba(74,108,247,0.03);
    transition: background 0.2s, color 0.2s, gap 0.2s;
    flex-shrink: 0;
}
.dark .news-card__cta {
    border-top-color: rgba(255,255,255,0.06);
    background: rgba(74,108,247,0.06);
}
.news-card__cta:hover {
    background: #4A6CF7;
    color: #fff;
    gap: 0.7rem;
}

/* ─── Pagination ──────────────────────────────────────── */
.news-pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}
/* Style Laravel pagination */
.news-pagination nav { display: flex; justify-content: center; }
.news-pagination .pagination {
    display: flex;
    gap: 0.4rem;
    list-style: none;
    margin: 0; padding: 0;
}
.news-pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4A6CF7;
    background: rgba(74,108,247,0.07);
    border: 1px solid rgba(74,108,247,0.15);
    text-decoration: none;
    transition: all 0.2s;
}
.news-pagination .page-item.active .page-link,
.news-pagination .page-item .page-link:hover {
    background: #4A6CF7;
    color: #fff;
    border-color: #4A6CF7;
}
.news-pagination .page-item.disabled .page-link {
    opacity: 0.4;
    pointer-events: none;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}
