/**
 * Flux Component - Social Feed Styles
 * Design inspired by Facebook embed cards
 * @package     Flux
 * @copyright   Copyright (C) 2024 Oui Systemes. All rights reserved.
 */

:root {
    --flux-columns: 2;
    --flux-gutter: 24px;
    --flux-primary: #0345bf;
    --flux-facebook: #1877f2;
    --flux-instagram: #e4405f;
    --flux-tiktok: #000000;
    --flux-border-radius: 8px;
    --flux-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --flux-shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.15);
    --flux-transition: all 0.3s ease;
    --flux-bg: #f5c6cb;
}

/* Import Expletus Sans font */
@import url('https://fonts.googleapis.com/css2?family=Expletus+Sans:wght@400;500;600;700&display=swap');

/* =========================================================================
   Page Container - Background image like reseaux-sociaux
   ========================================================================= */
.com-flux {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    padding: 2rem 0;
}

.com-flux.flux-board {
    margin-top: 15vh;
}

/* Apply background image to the main body when viewing flux - same as original */
body.com_flux #sp-main-body,
body.option-com_flux #sp-main-body {
    background-image: url('/images/2021/02/27/mloca-connexion.jpg');
    background-size: cover;
    background-position: center right;
    background-attachment: fixed;
    background-color: #e8a4ab;
    min-height: 100vh;
}

body.com_flux #sp-component,
body.option-com_flux #sp-component {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* =========================================================================
   Page Title - Expletus Sans Typography (White like original)
   ========================================================================= */
.flux-board-title {
    font-size: 5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
    line-height: 1.1;
    font-family: 'Expletus Sans', 'Impact', sans-serif;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.flux-board-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    color: #fff;
    margin-bottom: 5vh;
    font-family: 'Expletus Sans', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* =========================================================================
   Network Filters - Hidden to match original design
   ========================================================================= */
.flux-filters {
    display: none;
}

.flux-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--flux-transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.flux-filter-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.flux-filter-btn.active {
    background: var(--flux-facebook);
    color: #fff;
}

.flux-filter-btn .icon-facebook { color: var(--flux-facebook); }
.flux-filter-btn .icon-instagram { color: var(--flux-instagram); }
.flux-filter-btn .icon-tiktok { color: var(--flux-tiktok); }
.flux-filter-btn.active [class^="icon-"] { color: #fff; }

/* =========================================================================
   Grid Layout - Masonry 2 Columns
   ========================================================================= */
.flux-grid {
    column-count: 2;
    column-gap: var(--flux-gutter);
}

.flux-grid .flux-item {
    break-inside: avoid;
    margin-bottom: var(--flux-gutter);
}

@media (max-width: 768px) {
    .flux-grid {
        column-count: 1;
    }

    .flux-board-title {
        font-size: 2.5rem;
    }
}

/* =========================================================================
   Feed Item Card - Facebook Embed Style
   ========================================================================= */
.flux-item {
    position: relative;
    background: #fff;
    border-radius: var(--flux-border-radius);
    box-shadow: var(--flux-shadow);
    overflow: hidden;
    transition: var(--flux-transition);
    display: flex;
    flex-direction: column;
}

.flux-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--flux-shadow-hover);
}

/* =========================================================================
   Media Section with Badge
   ========================================================================= */
.flux-item-media {
    position: relative;
    overflow: hidden;
    background: #f0f2f5;
}

.flux-item-image,
.flux-item-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.flux-item:hover .flux-item-image,
.flux-item:hover .flux-item-thumbnail {
    transform: scale(1.03);
}

/* Facebook Badge Icon */
.flux-network-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.flux-badge-facebook {
    background: var(--flux-facebook);
}

.flux-badge-facebook::before {
    content: "\f09a";
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome;
}

.flux-badge-instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.flux-badge-instagram::before {
    content: "\f16d";
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome;
}

.flux-badge-tiktok {
    background: var(--flux-tiktok);
}

.flux-badge-tiktok::before {
    content: "\e07b";
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome;
}

/* =========================================================================
   Content Section - Show only share buttons
   ========================================================================= */
.flux-item-content {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}

/* Hide header, read-more and view link - keep text and share buttons */
.flux-item-header,
.flux-read-more,
a.flux-item-link {
    display: none !important;
}

/* Show post text with proper styling */
.flux-item-text {
    display: block;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
    margin: 0 0 0.75rem;
    padding: 0;
    max-height: 4.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Page Header */
.flux-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.flux-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f0f0f0;
}

.flux-author-info {
    flex: 1;
}

.flux-author-name {
    font-weight: 600;
    color: #1877f2;
    font-size: 0.95rem;
    text-decoration: none;
    display: block;
}

.flux-author-name:hover {
    text-decoration: underline;
}

/* Post Text */
.flux-item-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1c1e21;
    margin: 0 0 1rem;
    flex: 1;
}

.flux-item-text a {
    color: var(--flux-facebook);
    text-decoration: none;
}

.flux-item-text a:hover {
    text-decoration: underline;
}

/* Read More Link */
.flux-read-more {
    color: var(--flux-facebook);
    font-weight: 500;
    cursor: pointer;
}

.flux-read-more:hover {
    text-decoration: underline;
}

/* =========================================================================
   Social Share Buttons - Visible
   ========================================================================= */
.flux-item-share {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0;
    border-top: none;
}

.flux-share-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--flux-transition);
}

.flux-share-btn:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.flux-share-facebook { background: #1877f2; }
.flux-share-twitter { background: #1da1f2; }
.flux-share-pinterest { background: #e60023; }
.flux-share-linkedin { background: #0077b5; }

/* =========================================================================
   Footer - Hidden to match original design
   ========================================================================= */
.flux-item-footer {
    display: none;
}

.flux-item-date {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.flux-item-date::before {
    content: "\f017";
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
    font-weight: 400;
}

.flux-item-stats {
    display: flex;
    gap: 1rem;
}

.flux-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #65676b;
}

.flux-stat-likes::before {
    content: "\2605";
    color: #f7b928;
}

/* =========================================================================
   View Post Link
   ========================================================================= */
.flux-item-link {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background: #f0f2f5;
    color: var(--flux-facebook);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--flux-transition);
    border-top: 1px solid #e4e6eb;
}

.flux-item-link:hover {
    background: var(--flux-facebook);
    color: #fff;
}

/* =========================================================================
   Empty State
   ========================================================================= */
.flux-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--flux-border-radius);
    color: #65676b;
}

.flux-empty p {
    font-size: 1.125rem;
    margin: 0;
}

/* =========================================================================
   Load More Button
   ========================================================================= */
.flux-load-more {
    text-align: center;
    margin-top: 2.5rem;
}

.flux-load-more-btn {
    padding: 0.875rem 2.5rem;
    background: #fff;
    border: 2px solid var(--flux-facebook);
    border-radius: 25px;
    color: var(--flux-facebook);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--flux-transition);
}

.flux-load-more-btn:hover {
    background: var(--flux-facebook);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.flux-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================================================
   Video Play Icon
   ========================================================================= */
.flux-item-video {
    position: relative;
}

.flux-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    transition: var(--flux-transition);
    border: 3px solid #fff;
}

.flux-item:hover .flux-play-icon {
    background: var(--flux-facebook);
    transform: translate(-50%, -50%) scale(1.1);
}

/* =========================================================================
   Scroll Animation System
   ========================================================================= */

/* Initial hidden state for scroll animation */
.flux-item {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Visible state when scrolled into view */
.flux-item.flux-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Staggered delays for items in same row */
.flux-item:nth-child(odd).flux-visible {
    transition-delay: 0s;
}

.flux-item:nth-child(even).flux-visible {
    transition-delay: 0.15s;
}

/* Alternative animations for variety */
.flux-item:nth-child(4n+1) {
    transform: translateY(60px) translateX(-30px) scale(0.95);
}

.flux-item:nth-child(4n+2) {
    transform: translateY(60px) translateX(30px) scale(0.95);
}

.flux-item:nth-child(4n+3) {
    transform: translateY(80px) scale(0.9);
}

.flux-item:nth-child(4n+4) {
    transform: translateY(40px) rotateX(10deg) scale(0.95);
    transform-origin: center bottom;
}

/* Reset transform when visible */
.flux-item.flux-visible {
    transform: translateY(0) translateX(0) scale(1) rotateX(0);
}

/* Title and subtitle animations */
.flux-board-title {
    opacity: 0;
    transform: translateY(-30px);
    animation: fluxTitleReveal 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
}

.flux-board-subtitle {
    opacity: 0;
    transform: translateY(-20px);
    animation: fluxTitleReveal 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s forwards;
}

.flux-filters {
    opacity: 0;
    transform: translateY(20px);
    animation: fluxTitleReveal 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s forwards;
}

@keyframes fluxTitleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Parallax-like effect on scroll */
.flux-item-media img {
    transition: transform 0.4s ease-out;
}

.flux-item:hover .flux-item-media img {
    transform: scale(1.08);
}

/* Smooth content reveal inside cards */
.flux-item.flux-visible .flux-item-content {
    animation: fluxContentReveal 0.5s ease 0.3s forwards;
}

.flux-item .flux-item-content {
    opacity: 0;
}

@keyframes fluxContentReveal {
    to {
        opacity: 1;
    }
}

/* Load more button animation */
.flux-load-more {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.flux-load-more.flux-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================================
   Wall Layout Adjustments
   ========================================================================= */
.flux-layout-wall .flux-wall {
    column-count: var(--flux-columns);
    column-gap: var(--flux-gutter);
}

.flux-wall-item {
    break-inside: avoid;
    margin-bottom: var(--flux-gutter);
    background: #fff;
    border-radius: var(--flux-border-radius);
    box-shadow: var(--flux-shadow);
    overflow: hidden;
}

.flux-wall-item .flux-item-image {
    aspect-ratio: auto;
}

@media (max-width: 992px) {
    .flux-layout-wall .flux-wall {
        column-count: 2;
    }
}

@media (max-width: 576px) {
    .flux-layout-wall .flux-wall {
        column-count: 1;
    }
}

/* =========================================================================
   Timeline Layout
   ========================================================================= */
.flux-layout-timeline .flux-timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.flux-timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--flux-facebook), var(--flux-instagram));
    transform: translateX(-50%);
    border-radius: 2px;
}

.flux-timeline-item {
    position: relative;
    width: 45%;
    margin-bottom: 2rem;
}

.flux-timeline-left {
    margin-right: auto;
    padding-right: 2rem;
}

.flux-timeline-right {
    margin-left: auto;
    padding-left: 2rem;
}

.flux-timeline-marker {
    position: absolute;
    top: 20px;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 4px solid var(--flux-facebook);
    border-radius: 50%;
    z-index: 2;
}

.flux-timeline-left .flux-timeline-marker {
    right: -8px;
}

.flux-timeline-right .flux-timeline-marker {
    left: -8px;
}

@media (max-width: 768px) {
    .flux-timeline-line {
        left: 20px;
    }

    .flux-timeline-item {
        width: 100%;
        margin-left: 40px;
        padding-left: 1.5rem;
        padding-right: 0;
    }

    .flux-timeline-marker {
        left: -28px !important;
        right: auto !important;
    }
}

/* =========================================================================
   Carousel Layout
   ========================================================================= */
.flux-layout-carousel .flux-carousel-container {
    position: relative;
    padding: 0 50px;
}

.flux-carousel-item {
    background: #fff;
    border-radius: var(--flux-border-radius);
    box-shadow: var(--flux-shadow);
    overflow: hidden;
    height: 100%;
}

.com-flux .swiper-button-prev,
.com-flux .swiper-button-next {
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--flux-shadow);
}

.com-flux .swiper-button-prev:after,
.com-flux .swiper-button-next:after {
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.com-flux .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.com-flux .swiper-pagination-bullet-active {
    background: var(--flux-facebook);
}

/* =========================================================================
   Responsive Adjustments
   ========================================================================= */
@media (max-width: 576px) {
    body.com_flux #sp-component,
    body.option-com_flux #sp-component {
        padding: 1rem;
    }

    .flux-board-title {
        font-size: 2rem;
    }

    .flux-board-subtitle {
        font-size: 1.125rem;
    }

    .flux-item-content {
        padding: 1rem;
    }

    .flux-item-footer {
        padding: 0.625rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}
