/**
 * Frontend styles — so_chj_facebook_feed
 *
 * Aligné sur le thème Housey : Nunito, couleurs brand, structure .blog-grid-item,
 * responsive breakpoints Bootstrap.
 */

/* ─── Conteneur grille ─────────────────────────────────── */

.so-chj-feed {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.so-chj-feed--grid.so-chj-feed--cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.so-chj-feed--grid.so-chj-feed--cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.so-chj-feed--list {
    grid-template-columns: 1fr;
}

/* ─── Card commune ─────────────────────────────────────── */

.so-chj-feed-item {
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    transition: box-shadow 0.3s ease;
}

.so-chj-feed-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ─── Card grid : lien global, hover scale ────────────── */

a.so-chj-feed-item--grid {
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 1;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

a.so-chj-feed-item--grid:hover {
    transform: scale(1.04);
    z-index: 2;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

a.so-chj-feed-item--grid .so-chj-feed-item__title {
    color: #3b3b3b;
}

a.so-chj-feed-item--grid:hover .so-chj-feed-item__title {
    color: #E22E86;
}

/* Date en haut du contenu (grid) */
.so-chj-feed-item__date {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 700;
    color: #A0DE48;
    padding-top: 12px;
    margin-bottom: 2px;
}

/* ─── Thumbnail ────────────────────────────────────────── */

.so-chj-feed-item__header {
    position: relative;
    overflow: hidden;
}

.so-chj-feed-item__thumbnail {
    overflow: hidden;
    line-height: 0;
}

.so-chj-feed-item__thumbnail img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.so-chj-feed-item:hover .so-chj-feed-item__thumbnail img {
    transform: scale(1.1);
}

.so-chj-feed-item__thumbnail a {
    display: block;
}

/* ─── Badge Facebook ───────────────────────────────────── */

.so-chj-feed-item__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #1877f2;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 2px;
    z-index: 1;
}

.so-chj-feed-item__badge .fa {
    margin-right: 4px;
}

.so-chj-feed-item__header--no-image {
    padding: 12px 15px 0;
}

.so-chj-feed-item__header--no-image .so-chj-feed-item__badge {
    position: static;
    display: inline-block;
}

/* ─── Contenu ──────────────────────────────────────────── */

.so-chj-feed-item__content {
    padding: 0 30px;
    flex: 1;
}

.so-chj-feed-item__categories {
    padding-top: 15px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.so-chj-feed-item__categories a {
    color: #A0DE48;
    text-decoration: none;
}

.so-chj-feed-item__categories a:hover {
    color: #E22E86;
}

.so-chj-feed-item__title {
    font-size: 1.125rem;
    line-height: 1.5;
    margin: 0 0 13px;
    padding-top: 5px;
    font-weight: 700;
}

.so-chj-feed-item__title a {
    color: #3b3b3b;
    text-decoration: none;
}

.so-chj-feed-item__title a:hover {
    color: #E22E86;
}

.so-chj-feed-item__excerpt {
    color: #6d7881;
    font-size: 0.9375rem;
    line-height: 2;
    margin-bottom: 15px;
}

/* ─── Footer ───────────────────────────────────────────── */

.so-chj-feed-item__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 15px 30px;
    border-top: 1px solid #e2e2e2;
    background: #fff;
}

.so-chj-feed-item__meta {
    font-size: 0.8125rem;
}

.so-chj-feed-item__meta time {
    color: #A0DE48;
    font-weight: 700;
}

.so-chj-feed-item__readmore {
    display: inline-block;
    font-size: 0.875rem;
    padding: 5px 20px;
    color: #fff;
    background: #E22E86;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.so-chj-feed-item__readmore:hover {
    background: #c4276d;
    color: #fff;
}

.so-chj-feed-item__fblink {
    display: inline-block;
    font-size: 0.875rem;
    padding: 5px 20px;
    color: #fff;
    background: #1877f2;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.so-chj-feed-item__fblink:hover {
    background: #145db2;
    color: #fff;
}

.so-chj-feed-item__fblink .fa {
    margin-left: 4px;
    font-size: 0.75rem;
}

/* ─── Pagination ───────────────────────────────────────── */

.so-chj-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
}

.so-chj-pagination__link {
    color: #E22E86;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
}

.so-chj-pagination__link:hover {
    color: #c4276d;
}

.so-chj-pagination__info {
    color: #6d7881;
    font-size: 0.8125rem;
}

/* ─── Erreur admin ─────────────────────────────────────── */

.so-chj-error {
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    padding: 12px 20px;
    margin: 10px 0;
    font-size: 14px;
}

/* ─── Layout compact-list ─────────────────────────────── */

/* Le max-height est calculé par JS (feed-full-height.js)
   lorsque full_height est actif. */

.so-chj-feed-wrapper {
    display: flex;
    flex-direction: column;
}

.so-chj-feed__title {
    font-size: 24px;
    font-weight: 700;
    color: #E22E86;
    margin: 0;
    padding: 0 0 12px;
    border-bottom: 2px solid #E22E86;
    flex-shrink: 0;
}

.so-chj-feed--compact-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    gap: 0;
}

.so-chj-compact-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.so-chj-compact-item:first-child {
    border-top: 1px solid #e5e5e5;
}

.so-chj-compact-item:hover {
    background-color: #fdf2f7;
    text-decoration: none;
    color: inherit;
}

.so-chj-compact-item__thumb {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 6px;
    background: #f0f0f0;
}

.so-chj-compact-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.so-chj-compact-item__thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 1.5rem;
}

.so-chj-compact-item__content {
    flex: 1;
    min-width: 0;
}

.so-chj-compact-item__title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 4px;
    color: #3b3b3b;
}

.so-chj-compact-item__date {
    display: block;
    font-size: 0.75rem;
    color: #A0DE48;
    font-weight: 700;
    margin-bottom: 4px;
}

.so-chj-compact-item__excerpt {
    font-size: 0.8125rem;
    color: #6d7881;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.so-chj-compact-item__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #1877f2;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Modale ──────────────────────────────────────────── */

.so-chj-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.so-chj-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.so-chj-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.so-chj-modal__content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 560px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.25s ease;
}

.so-chj-modal[aria-hidden="false"] .so-chj-modal__content {
    transform: translateY(0);
}

.so-chj-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.so-chj-modal__close:hover {
    background: rgba(0, 0, 0, 0.75);
}

.so-chj-modal__image {
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    line-height: 0;
}

.so-chj-modal__image img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

.so-chj-modal__body {
    padding: 24px;
}

.so-chj-modal__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #3b3b3b;
    margin: 0 0 8px;
    line-height: 1.4;
}

.so-chj-modal__date {
    display: block;
    font-size: 0.8125rem;
    color: #A0DE48;
    font-weight: 700;
    margin-bottom: 16px;
}

.so-chj-modal__text {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: #6d7881;
    margin-bottom: 20px;
}

.so-chj-modal__text p {
    margin: 0 0 10px;
}

.so-chj-modal__link {
    display: inline-block;
    font-size: 0.875rem;
    padding: 8px 20px;
    color: #fff;
    background: #1877f2;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.so-chj-modal__link:hover {
    background: #145db2;
    color: #fff;
}

.so-chj-modal__link .fa {
    margin-left: 4px;
    font-size: 0.75rem;
}

/* ─── Barre de filtres par flux ───────────────────────── */

.so-chj-feed-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding: 0;
}

.so-chj-feed-filter-bar__item {
    display: inline-block;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    color: #3b3b3b;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.so-chj-feed-filter-bar__item:hover {
    background: #fdf2f7;
    border-color: #E22E86;
    color: #E22E86;
    text-decoration: none;
}

.so-chj-feed-filter-bar__item.is-active {
    background: #E22E86;
    border-color: #E22E86;
    color: #fff;
    box-shadow: 0 2px 8px rgba(226, 46, 134, 0.25);
}

.so-chj-feed-filter-bar__item.is-active:hover {
    background: #c9267a;
    border-color: #c9267a;
    color: #fff;
}

/* ─── Lien retour article ────────────────────────────── */

.so-chj-back-to-actualites {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #E22E86;
    border: 1px solid #E22E86;
    border-radius: 30px;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.so-chj-back-to-actualites:hover {
    background: #c4206f;
    border-color: #c4206f;
    color: #fff;
    text-decoration: none;
}

.so-chj-back-to-actualites .fa {
    font-size: 0.75rem;
}

/* ─── Grille : colonnes 4 et 5 ────────────────────────── */

.so-chj-feed--grid.so-chj-feed--cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.so-chj-feed--grid.so-chj-feed--cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* ─── Slider horizontal ───────────────────────────────── */

.so-chj-feed-slider {
    position: relative;
}

.so-chj-feed--slider {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 30px 0;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    margin-bottom: 0;
}

.so-chj-feed--slider.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
}

.so-chj-feed--slider::-webkit-scrollbar {
    display: none;
}

.so-chj-feed--slider > .so-chj-feed-item {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Peek effect: les cartes sont dimensionnées pour que la suivante
   dépasse légèrement à droite (~60px visible).
   Formule : (100% - N*gap - peek) / N  où  gap=30px, peek=60px */

.so-chj-feed--slider.so-chj-feed--cols-2 > .so-chj-feed-item {
    flex-basis: calc((100% - 120px) / 2);
}

.so-chj-feed--slider.so-chj-feed--cols-3 > .so-chj-feed-item {
    flex-basis: calc((100% - 150px) / 3);
}

.so-chj-feed--slider.so-chj-feed--cols-4 > .so-chj-feed-item {
    flex-basis: calc((100% - 180px) / 4);
}

.so-chj-feed--slider.so-chj-feed--cols-5 > .so-chj-feed-item {
    flex-basis: calc((100% - 210px) / 5);
}

/* ─── Barre de navigation slider (sous le slider) ────── */

.so-chj-feed-slider__nav {
    display: flex;
    width: 100%;
}

.so-chj-feed-slider__arrow {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 0;
    border: none;
    background: #fafafa;
    color: #3b3b3b;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
    position: relative;
}

.so-chj-feed-slider__prev {
    border-radius: 0 0 0 6px;
    border-right: 1px solid #eee;
}

.so-chj-feed-slider__next {
    border-radius: 0 0 6px 0;
}

.so-chj-feed-slider__arrow:hover {
    background: #f0f0f0;
    color: #E22E86;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
}

.so-chj-feed-slider__arrow:active {
    background: #e8e8e8;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.12);
}

.so-chj-feed-slider__arrow:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.so-chj-feed-slider__arrow .fa {
    font-size: 0.75rem;
}

/* ─── Responsive ───────────────────────────────────────── */

@media (max-width: 1280px) {
    .so-chj-feed--grid.so-chj-feed--cols-4:not(.so-chj-feed--slider) {
        grid-template-columns: repeat(3, 1fr);
    }

    .so-chj-feed--slider.so-chj-feed--cols-4 > .so-chj-feed-item {
        flex-basis: calc((100% - 120px) / 3);
    }
}

@media (max-width: 1200px) {
    .so-chj-feed--grid.so-chj-feed--cols-5:not(.so-chj-feed--slider) {
        grid-template-columns: repeat(4, 1fr);
    }

    .so-chj-feed--slider.so-chj-feed--cols-5 > .so-chj-feed-item {
        flex-basis: calc((100% - 180px) / 4);
    }
}

@media (max-width: 992px) {
    .so-chj-feed--grid.so-chj-feed--cols-3:not(.so-chj-feed--slider),
    .so-chj-feed--grid.so-chj-feed--cols-4:not(.so-chj-feed--slider),
    .so-chj-feed--grid.so-chj-feed--cols-5:not(.so-chj-feed--slider) {
        grid-template-columns: repeat(2, 1fr);
    }

    .so-chj-feed--slider.so-chj-feed--cols-3 > .so-chj-feed-item,
    .so-chj-feed--slider.so-chj-feed--cols-4 > .so-chj-feed-item,
    .so-chj-feed--slider.so-chj-feed--cols-5 > .so-chj-feed-item {
        flex-basis: calc((100% - 120px) / 2);
    }
}

@media (max-width: 768px) {
    .so-chj-feed--grid:not(.so-chj-feed--slider),
    .so-chj-feed--grid.so-chj-feed--cols-3:not(.so-chj-feed--slider),
    .so-chj-feed--grid.so-chj-feed--cols-4:not(.so-chj-feed--slider),
    .so-chj-feed--grid.so-chj-feed--cols-5:not(.so-chj-feed--slider) {
        grid-template-columns: 1fr;
    }

    .so-chj-feed--slider > .so-chj-feed-item {
        flex-basis: 85% !important;
    }

    .so-chj-feed-item__content {
        padding: 0 20px;
    }

    .so-chj-feed-item__footer {
        padding: 12px 20px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .so-chj-feed-item__thumbnail img {
        height: 180px;
    }
}

@media (max-width: 576px) {
    .so-chj-feed-filter-bar {
        gap: 8px;
    }

    .so-chj-feed-filter-bar__item {
        padding: 6px 14px;
        font-size: 0.8125rem;
    }

    .so-chj-feed {
        gap: 20px;
    }

    .so-chj-feed-item__thumbnail img {
        height: 160px;
    }

    .so-chj-feed--slider > .so-chj-feed-item {
        flex-basis: 90% !important;
    }

    .so-chj-feed-slider__arrow {
        padding: 10px 0;
        font-size: 0.8125rem;
    }

    .so-chj-compact-item {
        gap: 12px;
        padding: 10px 12px;
    }

    .so-chj-compact-item__thumb {
        width: 56px;
        height: 56px;
    }

    .so-chj-compact-item__title {
        font-size: 0.8125rem;
    }

    .so-chj-compact-item__excerpt {
        -webkit-line-clamp: 1;
    }

    .so-chj-modal__content {
        width: 95%;
        max-height: 90vh;
        border-radius: 6px;
    }

    .so-chj-modal__body {
        padding: 16px;
    }

    .so-chj-modal__image img {
        max-height: 200px;
    }
}
