/**
 * CMS Source - Feed Page CSS
 * Styles pour la page d'actualite / flux d'activite
 * @version 2.0.0 — Restyled to match site aesthetic
 */

/* =========================================================================
   HEADER — Gradient jaune vif
   Le trait blanc 20-directions du h1 est défini dans core/reset.css et utilise
   --heading-stroke-color. On laisse reset.css appliquer le contour en ne
   redefinissant PAS text-shadow ici.
   ========================================================================= */
.feed-header {
    background: var(--section-header-bg, linear-gradient(135deg, #ffc230 0%, #ffe066 50%, #ffb700 100%));
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.feed-header .header-icon {
    margin-bottom: 0.75rem;
    opacity: 0.9;
    font-size: 2.75rem;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.12));
}

.feed-header .page-title {
    color: #ffc230;
    font-size: 35px;
    font-weight: 800;
    margin-bottom: 0.5rem;
    /* text-shadow volontairement omis : laisse le trait blanc 20-directions
       de core/reset.css s'appliquer via --heading-stroke-color. */
}

.feed-header .page-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    max-width: 50ch;
    margin: 0 auto;
    font-weight: 600;
    text-shadow: #ed7500 1px 0 10px;
}

/* =========================================================================
   LAYOUT
   ========================================================================= */
.feed-layout {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.feed-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2.5rem;
    align-items: start;
}

.feed-main {
    min-width: 0;
}

.feed-sidebar {
    position: sticky;
    top: calc(var(--header-total, 100px) + 1rem);
}

/* =========================================================================
   THEMATIC SECTIONS
   ========================================================================= */
.feed-section {
    margin-bottom: 3rem;
}

.feed-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-sage, #A8BBA3);
}

.feed-section__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary, #111827);
}

.feed-section__title i {
    color: var(--color-sage, #A8BBA3);
    font-size: 1.15rem;
}

.feed-section__see-all {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-sage-dark, #8fa889);
    text-decoration: none;
    transition: gap 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.feed-section__see-all:hover {
    gap: 0.6rem;
    color: var(--color-sage, #A8BBA3);
}

.feed-section__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* Cards inside section grids: vertical layout */
.feed-section__grid .feed-card {
    grid-template-columns: 1fr;
}

.feed-section__grid .feed-card__image {
    width: 100%;
    height: 160px;
}

.feed-section__grid .feed-card__body {
    padding: 1rem;
}

.feed-section__empty {
    color: var(--text-muted, #6b7280);
    font-style: italic;
    padding: 2rem 1.5rem;
    text-align: center;
    background: var(--gray-50, #f9fafb);
    border-radius: 12px;
    border: 1px dashed var(--border-color, #e5e7eb);
}

/* =========================================================================
   CTA BUTTON
   ========================================================================= */
.feed-cta {
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.feed-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2rem;
    background: var(--color-sage, #A8BBA3);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 2px 10px rgba(168, 187, 163, 0.35);
}

.feed-cta__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 187, 163, 0.45);
    background: var(--color-sage-dark, #8fa889);
    color: white;
}

/* =========================================================================
   TYPE FILTER TABS / PILLS
   ========================================================================= */
.feed-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.feed-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
    background: var(--gray-50, #f9fafb);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.feed-filter-pill:hover {
    color: var(--color-sage-dark, #8fa889);
    background: white;
    border-color: var(--color-sage, #A8BBA3);
}

.feed-filter-pill.active {
    color: white;
    background: var(--color-sage, #A8BBA3);
    border-color: var(--color-sage, #A8BBA3);
    box-shadow: 0 2px 8px rgba(168, 187, 163, 0.3);
}

.feed-filter-pill i {
    font-size: 0.9rem;
}

/* =========================================================================
   FEED CARDS
   ========================================================================= */
.feed-cards {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.feed-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feed-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.feed-card__image {
    width: 180px;
    height: 140px;
    overflow: hidden;
    background: var(--color-cream, #F7F1DE);
}

.feed-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.feed-card:hover .feed-card__image img {
    transform: scale(1.05);
}

.feed-card:not(:has(.feed-card__image)) {
    grid-template-columns: 1fr;
}

.feed-card__body {
    /* Padding symetrique 20px : espace lisible autour du texte, et gap propre avec l'image. */
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.feed-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.feed-card__type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feed-card__type--post { background: rgba(168, 187, 163, 0.15); color: var(--color-sage-dark, #6d8f68); }
.feed-card__type--product { background: rgba(184, 124, 76, 0.12); color: var(--color-terracotta-dark, #9a6840); }
.feed-card__type--event { background: rgba(16, 185, 129, 0.1); color: #059669; }
.feed-card__type--discussion { background: rgba(99, 102, 241, 0.1); color: #4f46e5; }
.feed-card__type--wall_post { background: rgba(236, 72, 153, 0.1); color: #db2777; }
.feed-card__type--campaign { background: rgba(245, 158, 11, 0.1); color: #d97706; }
/* Merges du shared DB : trophee dore pour les niveaux, turquoise pour les nouveaux membres. */
.feed-card__type--level_up { background: rgba(234, 179, 8, 0.14); color: #a16207; }
.feed-card__type--new_member { background: rgba(20, 184, 166, 0.12); color: #0f766e; }

.feed-card__date {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
}

.feed-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
    line-height: 1.35;
}

.feed-card__title a {
    color: var(--text-primary, #111827);
    text-decoration: none;
    transition: color 0.15s;
}

.feed-card__title a:hover {
    color: var(--color-sage-dark, #8fa889);
}

.feed-card__excerpt {
    font-size: 0.875rem;
    color: var(--text-muted, #6b7280);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Le texte de l'excerpt est cliquable et pointe vers l'article cible.
   Pas de soulignement par defaut pour rester discret, soulignement au
   hover. La couleur reste celle du parent (.feed-card__excerpt) pour
   ne pas casser la hierarchie visuelle. */
.feed-card__excerpt-link,
.feed-card__excerpt-link:visited {
    color: inherit;
    text-decoration: none;
}
.feed-card__excerpt-link:hover,
.feed-card__excerpt-link:focus {
    color: var(--color-sage-dark, #6b8a64);
    text-decoration: underline;
}

.feed-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100, #f3f4f6);
}

.feed-card__author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feed-card__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.feed-card__avatar--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100, #f3f4f6);
    color: var(--text-muted, #6b7280);
    font-size: 1.1rem;
}

.feed-card__author-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary, #374151);
}

.feed-card__stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.feed-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.feed-card__stat:hover {
    color: var(--color-sage-dark, #8fa889);
}

.feed-card__like-btn.liked {
    color: #b30f0f;
}

.feed-card__like-btn.liked i::before {
    content: "\f415"; /* bi-heart-fill */
}

/* =========================================================================
   LOAD MORE
   ========================================================================= */
.feed-load-more {
    text-align: center;
    padding: 2rem 0;
}

.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
}

.btn-load-more.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.feed-sidebar .sidebar-section {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.feed-sidebar .sidebar-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-sage, #A8BBA3);
    color: var(--text-primary, #111827);
}

.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-item {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
}

.popular-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.popular-type-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.popular-type-post { background: rgba(168, 187, 163, 0.15); color: var(--color-sage-dark, #6d8f68); }
.popular-type-discussion { background: rgba(99, 102, 241, 0.1); color: #4f46e5; }
.popular-type-wall_post { background: rgba(236, 72, 153, 0.1); color: #db2777; }
.popular-type-event { background: rgba(16, 185, 129, 0.1); color: #059669; }
.popular-type-product { background: rgba(184, 124, 76, 0.12); color: var(--color-terracotta-dark, #9a6840); }
.popular-type-campaign { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.popular-type-level_up { background: rgba(234, 179, 8, 0.14); color: #a16207; }
.popular-type-new_member { background: rgba(20, 184, 166, 0.12); color: #0f766e; }

.popular-item a {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary, #111827);
    text-decoration: none;
    line-height: 1.4;
    margin: 0.2rem 0;
    transition: color 0.15s;
}

.popular-item a:hover {
    color: var(--color-sage-dark, #8fa889);
}

.popular-stats {
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.15rem;
}

.popular-stats i {
    margin-right: 0.15rem;
}

/* =========================================================================
   SOCIAL EMBEDS SECTION
   ========================================================================= */
.feed-section--social {
    margin-top: 1rem;
}

.feed-social-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.feed-social-embed {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.feed-social-embed h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
}

.feed-social-embed h4 .bi-facebook {
    color: #1877F2;
}

.feed-social-embed h4 .bi-instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feed-social-embed__frame {
    width: 100%;
    min-height: 300px;
}

.feed-social-embed__frame iframe {
    display: block;
    width: 100%;
}

.feed-social-embed__frame--placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 50%, #f5f3ff 100%);
    min-height: 300px;
}

.feed-social-embed__frame--placeholder .bi-instagram {
    font-size: 3rem;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.feed-social-embed__frame--placeholder p {
    color: var(--text-muted, #6b7280);
    font-size: 0.9375rem;
    margin: 0 0 1rem;
}

/* Sidebar social embeds */
.feed-social-embed--sidebar {
    margin-bottom: 1rem;
}

.feed-social-embed--sidebar .feed-social-embed__frame {
    min-height: 200px;
}

.feed-social-embed--sidebar .feed-social-embed__frame--placeholder {
    min-height: 200px;
    padding: 2rem 1rem;
}

/* Variantes par reseau (debordement chirurgical, desktop uniquement) ---------
   On scope a >=1025px car en dessous la sidebar passe a grid-template-columns:1fr
   (voir @media max-width:1024px plus bas) et l'etalement negatif casserait le
   mobile en provoquant un scroll horizontal. */
@media (min-width: 1025px) {
    .feed-social-embed--facebook {
        background: white;
        border-radius: 12px;
        overflow: hidden;
        min-width: 113%;
        margin-left: -20px;
    }

    .feed-social-embed--instagram {
        background: white;
        border-radius: 12px;
        overflow: hidden;
        min-width: 110%;
        margin-left: -13px;
    }
}

/* =========================================================================
   EMPTY STATE
   ========================================================================= */
.page-feed .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted, #6b7280);
}

.page-feed .empty-state i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1024px) {
    .feed-content-wrapper {
        grid-template-columns: 1fr;
    }

    .feed-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .feed-header {
        padding: 2rem 0 1.75rem;
    }

    .feed-header .page-title {
        font-size: 1.75rem;
    }

    .feed-card {
        grid-template-columns: 1fr;
    }

    .feed-card__image {
        width: 100%;
        height: 180px;
    }

    .feed-card__body {
        padding: 1rem;
    }

    .feed-filters {
        gap: 0.35rem;
    }

    .feed-filter-pill {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .feed-sidebar {
        grid-template-columns: 1fr;
    }

    .feed-section__grid {
        grid-template-columns: 1fr;
    }

    .feed-social-grid {
        grid-template-columns: 1fr;
    }

    .feed-section__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .feed-cta__button {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .feed-section__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .feed-header {
        padding: 1.5rem 0;
    }

    .feed-header .page-title {
        font-size: 1.5rem;
    }

    .feed-card__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
