<!doctype html>
<html lang="fr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Blog - {{ $siteName ?? 'ATARA' }} | Actualités & Inspirations</title>
    <link rel="icon" type="image/x-icon" href="{{ $siteFavicon ?? asset('favicon.ico') }}">
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800;900&family=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    
    <style>
        :root {
            --primary-color: #10b981;
            --primary-dark: #059669;
            --secondary-color: #14233c;
            --accent-color: #F59E0B;
            --accent-purple: #8B5CF6;
            --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --gradient-2: linear-gradient(135deg, #10b981 0%, #059669 100%);
            --gradient-3: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --gradient-4: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body { 
            font-family: 'Poppins', sans-serif; 
            background: #f9fafb;
            overflow-x: hidden;
        }

        h1, h2, h3, h4, h5 { 
            font-family: 'Playfair Display', serif; 
            font-weight: 700;
        }

        /* HEADER (structure alignée avec home) */
        .header-section {
            background: linear-gradient(135deg, var(--secondary-color), #1e3a5f);
        }

        .header-top-area {
            background: rgba(0,0,0,0.2);
            padding: 10px 0;
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .header-social {
            list-style: none;
            padding: 0;
            margin: 0;
            display: flex;
            gap: 15px;
        }

        .header-social a {
            color: #fff;
            font-size: 14px;
            transition: color 0.3s;
        }

        .header-social a:hover {
            color: var(--accent-color);
        }

        .header-bottom-area {
            padding: 6px 0;
            background: #fff;
        }

        .site-logo {
            font-family: 'Playfair Display', serif;
            font-size: 1.4rem;
            font-weight: 800;
            color: #000;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        @media (max-width: 1200px) {
            .site-logo {
                font-size: 1.3rem;
            }
        }

        @media (max-width: 768px) {
            .site-logo {
                font-size: 1.1rem;
            }
        }

        @media (max-width: 576px) {
            .site-logo {
                font-size: 0.9rem;
            }
        }

        .site-logo i {
            color: #000;
        }

        .navbar {
            padding: 0;
            flex-direction: row !important;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }

        .navbar-collapse {
            width: 100%;
            justify-content: center;
            order: 3;
        }

        .main-menu {
            list-style: none;
            padding: 0;
            margin: 0;
            display: flex;
            gap: 6px;
            justify-content: space-between;
            width: 100%;
        }

        .main-menu li {
            flex: 1;
            display: flex;
            justify-content: center;
        }

        .main-menu a {
            color: #000;
            text-decoration: none;
            padding: 7px 12px;
            border-radius: 6px;
            transition: all 0.3s;
            font-weight: 500;
            text-transform: uppercase;
            font-size: 0.8rem;
            background: #f8f9fa;
            border: 1px solid #e0e0e0;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            min-height: 30px;
        }

        @media (max-width: 768px) {
            .main-menu a {
                padding: 5px 10px;
                font-size: 0.7rem;
                min-height: 28px;
            }
        }

        @media (max-width: 576px) {
            .main-menu a {
                padding: 4px 8px;
                font-size: 0.65rem;
                min-height: 26px;
            }
        }

        .main-menu a:hover {
            background: #fff;
            border-color: #000;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        .main-menu a.active {
            background: #000;
            color: #fff;
            border-color: #000;
            box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        }

        .header-action {
            display: flex;
            gap: 0;
            align-items: center;
        }

        .auth-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            padding: 0 25px;
        }

        .auth-section:first-child {
            border-right: 3px solid #000;
        }

        .auth-section-title {
            font-size: 0.9rem;
            font-weight: 700;
            color: #000;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            text-decoration: underline;
        }

        .auth-buttons {
            display: flex;
            gap: 15px;
        }

        .btn-auth {
            background: transparent;
            color: #000;
            padding: 8px 20px;
            border: 2px solid #000;
            border-radius: 50px;
            text-decoration: underline;
            font-weight: 700;
            transition: all 0.3s;
            display: inline-block;
            text-transform: uppercase;
            font-size: 0.9rem;
        }

        @media (max-width: 576px) {
            .btn-auth {
                padding: 6px 15px;
                font-size: 0.8rem;
            }
        }

        .btn-auth:hover {
            background: rgba(0,0,0,0.05);
            color: #000;
        }

        .navbar-toggler {
            border-color: rgba(255,255,255,0.3);
        }

        .navbar-toggler-icon {
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
        }

        @media (max-width: 991px) {
            .main-menu {
                flex-direction: column;
                gap: 10px;
                padding: 15px 0;
            }

            .main-menu a {
                padding: 5px 0;
            }

            .header-action {
                flex-direction: column;
                margin-top: 15px;
                width: 100%;
            }

            .auth-section {
                width: 100%;
                padding: 15px 0;
                border-right: none !important;
                border-bottom: 2px solid #000;
            }

            .auth-section:last-child {
                border-bottom: none;
            }

            .navbar-toggler {
                border-color: rgba(0, 0, 0, 0.3);
            }

            .navbar-toggler-icon {
                background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
            }
        }

        /* HERO HEADER */
        .page-header { 
            background: var(--gradient-1);
            color: #fff; 
            padding: 100px 0 120px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .page-header::before {
            content: '';
            position: absolute;
            width: 600px;
            height: 600px;
            background: rgba(255,255,255,0.1);
            border-radius: 50%;
            top: -300px;
            right: -200px;
            animation: float 6s ease-in-out infinite;
        }

        .page-header::after {
            content: '';
            position: absolute;
            width: 400px;
            height: 400px;
            background: rgba(255,255,255,0.1);
            border-radius: 50%;
            bottom: -200px;
            left: -100px;
            animation: float 8s ease-in-out infinite reverse;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0) rotate(0deg); }
            50% { transform: translateY(-30px) rotate(10deg); }
        }

        .page-header h1 {
            font-size: 4rem;
            font-weight: 900;
            margin-bottom: 20px;
            position: relative;
            z-index: 2;
            text-shadow: 0 4px 20px rgba(0,0,0,0.2);
        }

        .page-header p { 
            max-width: 700px; 
            margin: 0 auto;
            font-size: 1.3rem;
            opacity: 0.95;
            position: relative;
            z-index: 2;
        }

        /* SEARCH BAR */
        .search-section {
            margin-top: -60px;
            position: relative;
            z-index: 10;
        }

        .search-box {
            background: #fff;
            border-radius: 60px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.15);
            padding: 10px;
            display: flex;
            align-items: center;
        }

        .search-box input {
            border: none;
            outline: none;
            flex: 1;
            padding: 15px 25px;
            font-size: 1.1rem;
            border-radius: 50px;
        }

        .search-box button {
            background: var(--gradient-2);
            color: #fff;
            border: none;
            padding: 15px 40px;
            border-radius: 50px;
            font-weight: 600;
            transition: all 0.3s;
        }

        .search-box button:hover {
            transform: scale(1.05);
            box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
        }

        /* CATEGORIES */
        .category-pills {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            justify-content: center;
            margin: 40px 0;
        }

        .category-pill {
            background: #fff;
            padding: 12px 30px;
            border-radius: 50px;
            border: 2px solid #e5e7eb;
            cursor: pointer;
            transition: all 0.3s;
            font-weight: 600;
            color: #64748b;
        }

        .category-pill:hover, .category-pill.active {
            background: var(--gradient-2);
            color: #fff;
            border-color: transparent;
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
        }

        /* BLOG POSTS */
        .blog-section {
            padding: 80px 0;
        }

        .featured-post {
            background: #fff;
            border-radius: 25px;
            overflow: hidden;
            box-shadow: 0 15px 50px rgba(0,0,0,0.08);
            transition: all 0.4s;
            margin-bottom: 60px;
        }

        .featured-post:hover {
            transform: translateY(-10px);
            box-shadow: 0 25px 70px rgba(0,0,0,0.15);
        }

        .featured-post-img {
            height: 450px;
            background: var(--gradient-1);
            position: relative;
            overflow: hidden;
        }

        .featured-post-img img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.5s;
        }

        .featured-post:hover .featured-post-img img {
            transform: scale(1.1);
        }

        .featured-badge {
            position: absolute;
            top: 20px;
            left: 20px;
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(10px);
            padding: 8px 20px;
            border-radius: 50px;
            font-weight: 700;
            color: var(--accent-purple);
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .featured-content {
            padding: 40px;
        }

        .post-meta {
            display: flex;
            gap: 20px;
            margin-bottom: 15px;
            color: #94a3b8;
            font-size: 0.95rem;
        }

        .post-meta i {
            color: var(--primary-color);
        }

        .featured-content h2 {
            font-size: 2.5rem;
            margin-bottom: 20px;
            color: #1e293b;
        }

        .featured-content p {
            color: #64748b;
            font-size: 1.1rem;
            line-height: 1.8;
            margin-bottom: 25px;
        }

        .btn-read-more {
            background: var(--gradient-2);
            color: #fff;
            padding: 15px 40px;
            border-radius: 50px;
            text-decoration: none;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            transition: all 0.3s;
        }

        .btn-read-more:hover {
            transform: translateX(5px);
            box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
            color: #fff;
        }

        /* REGULAR POSTS */
        .post-card {
            background: #fff;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0,0,0,0.06);
            transition: all 0.4s;
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        .post-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 20px 60px rgba(0,0,0,0.12);
        }

        .post-img {
            height: 240px;
            background: var(--gradient-3);
            position: relative;
            overflow: hidden;
        }

        .post-img img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.5s;
        }

        .post-card:hover .post-img img {
            transform: scale(1.15) rotate(2deg);
        }

        .post-category {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(10px);
            padding: 6px 18px;
            border-radius: 50px;
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--primary-color);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .post-content {
            padding: 30px;
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .post-content h3 {
            font-size: 1.5rem;
            margin-bottom: 15px;
            color: #1e293b;
            line-height: 1.4;
        }

        .post-content p {
            color: #64748b;
            line-height: 1.7;
            margin-bottom: 20px;
            flex: 1;
        }

        .post-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-top: 20px;
            border-top: 2px solid #f1f5f9;
        }

        .post-author {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .author-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--gradient-2);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-weight: 700;
        }

        .author-info span {
            display: block;
            font-size: 0.85rem;
            color: #94a3b8;
        }

        .author-info strong {
            font-size: 0.95rem;
            color: #334155;
        }

        .post-date {
            color: #94a3b8;
            font-size: 0.9rem;
        }

        /* SIDEBAR */
        .sidebar-widget {
            background: #fff;
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.06);
            margin-bottom: 30px;
        }

        .sidebar-widget h4 {
            font-size: 1.5rem;
            margin-bottom: 20px;
            color: #1e293b;
        }

        .trending-item {
            display: flex;
            gap: 15px;
            padding: 15px 0;
            border-bottom: 1px solid #f1f5f9;
            transition: all 0.3s;
        }

        .trending-item:last-child {
            border-bottom: none;
        }

        .trending-item:hover {
            transform: translateX(5px);
        }

        .trending-number {
            font-size: 1.5rem;
            font-weight: 800;
            color: var(--primary-color);
            font-family: 'Playfair Display', serif;
        }

        .trending-content h5 {
            font-size: 1rem;
            margin-bottom: 5px;
            color: #1e293b;
        }

        .trending-content span {
            font-size: 0.85rem;
            color: #94a3b8;
        }

        .tag-cloud {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .tag {
            background: #f1f5f9;
            padding: 8px 20px;
            border-radius: 50px;
            font-size: 0.9rem;
            color: #64748b;
            transition: all 0.3s;
            text-decoration: none;
        }

        .tag:hover {
            background: var(--primary-color);
            color: #fff;
            transform: translateY(-2px);
        }

        /* NEWSLETTER CTA */
        .newsletter-cta {
            background: var(--gradient-1);
            border-radius: 25px;
            padding: 50px 40px;
            text-align: center;
            color: #fff;
            margin-top: 80px;
        }

        .newsletter-cta h3 {
            font-size: 2.5rem;
            margin-bottom: 15px;
        }

        .newsletter-form {
            display: flex;
            gap: 10px;
            max-width: 500px;
            margin: 30px auto 0;
        }

        .newsletter-form input {
            flex: 1;
            padding: 15px 25px;
            border: none;
            border-radius: 50px;
            font-size: 1rem;
        }

        .newsletter-form button {
            background: #fff;
            color: var(--accent-purple);
            padding: 15px 35px;
            border: none;
            border-radius: 50px;
            font-weight: 700;
            transition: all 0.3s;
        }

        .newsletter-form button:hover {
            transform: scale(1.05);
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        }

        /* FOOTER */
        footer { 
            background: linear-gradient(135deg, #0f172a, #1e293b);
            color: #cbd5e1; 
            padding: 60px 0 30px;
        }

        footer h5 {
            color: #fff;
            margin-bottom: 20px;
            font-size: 1.3rem;
        }

        footer a { 
            color: #94a3b8; 
            text-decoration: none;
            transition: all 0.3s;
            display: inline-block;
        }

        footer a:hover {
            color: var(--accent-color);
            transform: translateX(5px);
        }

        .social-links {
            display: flex;
            gap: 15px;
            margin-top: 20px;
        }

        .social-links a {
            width: 45px;
            height: 45px;
            background: rgba(255,255,255,0.1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            transition: all 0.3s;
        }

        .social-links a:hover {
            background: var(--primary-color);
            transform: translateY(-5px) rotate(5deg);
        }

        /* RESPONSIVE */
        @media (max-width: 768px) {
            .page-header h1 {
                font-size: 2.5rem;
            }

            .featured-post-img {
                height: 250px;
            }

            .featured-content h2 {
                font-size: 1.8rem;
            }

            .search-box {
                flex-direction: column;
                gap: 10px;
            }

            .category-pills {
                gap: 10px;
            }

            .category-pill {
                padding: 8px 20px;
                font-size: 0.9rem;
            }
        }
    </style>
</head>
<body>

<header class="header-section">
        <div class="header">
            <div class="header-top-area">
                <div class="container">
                    <div class="d-flex align-items-center justify-content-between flex-wrap">
                        <div class="header-top-left">
                            <div class="social-area">
                                <ul class="header-social">
                                    <li><a href="https://www.facebook.com/" target="_blank"><i class="fab fa-facebook-f"></i></a></li>
                                    <li><a href="https://twitter.com" target="_blank"><i class="fab fa-twitter"></i></a></li>
                                    <li><a href="https://www.linkedin.com" target="_blank"><i class="fab fa-linkedin-in"></i></a></li>
                                    <li><a href="https://www.instagram.com" target="_blank"><i class="fab fa-instagram"></i></a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="header-bottom-area">
                <div class="container">
                    <nav class="navbar navbar-expand-lg">
                        <a class="site-logo" href="{{ url('/') }}">
                            @if(!empty($siteLogo))<img src="{{ $siteLogo }}" alt="{{ $siteName ?? 'ATARA' }}" height="{{ $siteLogoHeight ?? 40 }}">@endif
                            @if($showLogoText)<span>{{ $siteName ?? 'ATARA' }}</span>@endif
                        </a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent">
                            <span class="navbar-toggler-icon"></span>
                        </button>
                        <div class="navbar-collapse collapse" id="navbarSupportedContent">
                            <ul class="navbar-nav main-menu me-auto ms-auto">
                                <li><a href="{{ url('/') }}">Accueil</a></li>
                                <li><a href="{{ route('about') }}">À Propos</a></li>
                                <li><a href="{{ route('shop.index') }}">Boutique</a></li>
                                <li><a href="{{ route('public.blog') }}" class="active">Blog</a></li>
                                <li><a href="{{ route('public.newsletter') }}">Newsletter</a></li>
                                <li><a href="{{ route('plan') }}">Plan d'investissement</a></li>
                                <li><a href="{{ route('contact') }}">Contact</a></li>
                            </ul>
                            <div class="header-action ms-auto">
                                <div class="auth-section">
                                    <div class="auth-section-title">ESPACE MEMBRE</div>
                                    <div class="auth-buttons">
                                        <a href="{{ route('member.login') }}" class="btn-auth">LOGIN</a>
                                        <a href="{{ route('member.register') }}" class="btn-auth">REGISTER</a>
                                    </div>
                                </div>
                                <div class="auth-section">
                                    <div class="auth-section-title">ESPACE VENDEUR</div>
                                    <div class="auth-buttons">
                                        <a href="{{ route('seller.login') }}" class="btn-auth">LOGIN</a>
                                        <a href="{{ route('seller.register') }}" class="btn-auth">REGISTER</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </nav>
                </div>
            </div>
        </div>
    </header>

<!-- HERO HEADER -->
<section class="page-header">
    <div class="container">
        <h1 data-aos="fade-up">Blog ATARA</h1>
        <p class="lead" data-aos="fade-up" data-aos-delay="100">Découvrez nos actualités, conseils d'experts et inspirations sur l'univers des bijoux de luxe et le marketing de réseau</p>
    </div>
</section>

<!-- SEARCH & FILTERS -->
<div class="search-section">
    <div class="container">
        <div class="search-box" data-aos="zoom-in">
            <form action="{{ route('public.blog') }}" method="GET" class="d-flex w-100" style="gap: 10px;">
                @if(!empty($activeCategory))
                    <input type="hidden" name="category" value="{{ $activeCategory }}">
                @endif
                <input type="text" name="q" value="{{ $searchQuery ?? '' }}" placeholder="Rechercher un article, un sujet...">
                <button type="submit"><i class="fas fa-search me-2"></i>Rechercher</button>
            </form>
        </div>
    </div>
</div>

<!-- CATEGORIES -->
<div class="container">
    <div class="category-pills" data-aos="fade-up" data-aos-delay="200">
        <a class="category-pill {{ empty($activeCategory) ? 'active' : '' }}" href="{{ route('public.blog', array_filter(['q' => $searchQuery ?? null])) }}">
            <i class="fas fa-star me-2"></i>Tous
        </a>
        @foreach(($categories ?? collect()) as $c)
            <a class="category-pill {{ ($activeCategory ?? null) === $c->category ? 'active' : '' }}" href="{{ route('public.blog', array_filter(['category' => $c->category, 'q' => $searchQuery ?? null])) }}">
                <i class="fas fa-folder me-2"></i>{{ $c->category }}
            </a>
        @endforeach
    </div>
</div>

<!-- BLOG CONTENT -->
<section class="blog-section">
    <div class="container">
        <div class="row g-4">
            <!-- MAIN CONTENT -->
            <div class="col-lg-8">
                
                <!-- FEATURED POST -->
                @php
                    $fp = $featuredPost ?? null;
                    $fpReadMin = $fp ? max(1, (int) ceil(str_word_count(strip_tags((string) $fp->content)) / 200)) : null;
                @endphp

                @if($fp)
                    <article class="featured-post" data-aos="fade-up">
                        <div class="featured-post-img">
                            <span class="featured-badge"><i class="fas fa-fire me-2"></i>À la Une</span>
                            @if(!empty($fp->featured_image))
                                <img src="{{ asset('storage/' . $fp->featured_image) }}" alt="{{ $fp->title }}" style="width: 100%; height: 100%; object-fit: cover;">
                            @else
                                <div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;">
                                    <i class="fas fa-gem" style="font-size: 8rem; color: rgba(255,255,255,0.3);"></i>
                                </div>
                            @endif
                        </div>
                        <div class="featured-content">
                            <div class="post-meta">
                                <span><i class="fas fa-user me-2"></i>{{ $fp->author->name ?? 'ATARA' }}</span>
                                <span><i class="fas fa-calendar me-2"></i>{{ optional($fp->published_at)->format('d/m/Y') }}</span>
                                <span><i class="fas fa-clock me-2"></i>{{ $fpReadMin }} min de lecture</span>
                            </div>
                            <h2>{{ $fp->title }}</h2>
                            <p>{{ $fp->excerpt ?: \Illuminate\Support\Str::limit(strip_tags($fp->content), 220) }}</p>
                            <a href="{{ route('public.blog.show', $fp->slug) }}" class="btn-read-more">
                                Lire l'article complet <i class="fas fa-arrow-right"></i>
                            </a>
                        </div>
                    </article>
                @else
                    <div class="alert alert-info" data-aos="fade-up">
                        Aucun article publié pour le moment.
                    </div>
                @endif

                <!-- REGULAR POSTS -->
                <div class="row g-4 mt-4">
                    @forelse($posts as $i => $post)
                        @php
                            $readMin = max(1, (int) ceil(str_word_count(strip_tags((string) $post->content)) / 200));
                            $initials = collect(explode(' ', trim((string) ($post->author->name ?? 'BE'))))
                                ->filter()
                                ->map(fn($p) => mb_substr($p, 0, 1))
                                ->take(2)
                                ->implode('');
                        @endphp
                        <div class="col-md-6" data-aos="fade-up" data-aos-delay="{{ 100 + (($i % 4) * 100) }}">
                            <article class="post-card" style="position: relative;">
                                <div class="post-img">
                                    <span class="post-category">{{ $post->category ?? 'Blog' }}</span>
                                    @if(!empty($post->featured_image))
                                        <img src="{{ asset('storage/' . $post->featured_image) }}" alt="{{ $post->title }}" style="width: 100%; height: 100%; object-fit: cover;">
                                    @else
                                        <div style="background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;">
                                            <i class="fas fa-newspaper" style="font-size: 4rem; color: rgba(255,255,255,0.5);"></i>
                                        </div>
                                    @endif
                                </div>
                                <div class="post-content">
                                    <h3>{{ \Illuminate\Support\Str::limit($post->title, 70) }}</h3>
                                    <p>{{ $post->excerpt ?: \Illuminate\Support\Str::limit(strip_tags($post->content), 140) }}</p>
                                    <a href="{{ route('public.blog.show', $post->slug) }}" class="stretched-link" aria-label="Lire l'article"></a>
                                    <div class="post-footer">
                                        <div class="post-author">
                                            <div class="author-avatar">{{ strtoupper($initials) }}</div>
                                            <div class="author-info">
                                                <strong>{{ $post->author->name ?? 'ATARA' }}</strong>
                                                <span>{{ optional($post->published_at)->format('d/m/Y') }}</span>
                                            </div>
                                        </div>
                                        <div class="post-date">
                                            <i class="fas fa-clock me-1"></i>{{ $readMin }} min
                                        </div>
                                    </div>
                                </div>
                            </article>
                        </div>
                    @empty
                        <div class="col-12">
                            <div class="alert alert-light">Aucun article trouvé.</div>
                        </div>
                    @endforelse
                </div>

                <div class="mt-4">
                    {{ $posts->links() }}
                </div>

            </div>

            <!-- SIDEBAR -->
            <div class="col-lg-4">
                
                <!-- TRENDING POSTS -->
                <div class="sidebar-widget" data-aos="fade-left">
                    <h4><i class="fas fa-fire me-2" style="color: var(--accent-color);"></i>Tendances</h4>

                    @forelse(($trending ?? collect()) as $idx => $t)
                        <a href="{{ route('public.blog.show', $t->slug) }}" class="trending-item" style="text-decoration: none; color: inherit;">
                            <div class="trending-number">{{ str_pad((string) ($idx + 1), 2, '0', STR_PAD_LEFT) }}</div>
                            <div class="trending-content">
                                <h5>{{ \Illuminate\Support\Str::limit($t->title, 55) }}</h5>
                                <span><i class="fas fa-eye me-1"></i>{{ number_format($t->views_count) }} vues</span>
                            </div>
                        </a>
                    @empty
                        <div class="text-muted">Aucune donnée.</div>
                    @endforelse
                </div>

                <!-- CATEGORIES -->
                <div class="sidebar-widget" data-aos="fade-left" data-aos-delay="100">
                    <h4><i class="fas fa-folder me-2" style="color: var(--primary-color);"></i>Catégories</h4>
                    <div class="d-flex flex-column gap-2">
                        <a href="{{ route('public.blog', array_filter(['q' => $searchQuery ?? null])) }}" class="d-flex justify-content-between align-items-center text-decoration-none" style="color: #64748b;">
                            <span><i class="fas fa-star me-2"></i>Toutes</span>
                            <span class="badge bg-light text-dark">{{ ($categories ?? collect())->sum('total') }}</span>
                        </a>
                        @foreach(($categories ?? collect()) as $c)
                            <a href="{{ route('public.blog', array_filter(['category' => $c->category, 'q' => $searchQuery ?? null])) }}" class="d-flex justify-content-between align-items-center text-decoration-none" style="color: #64748b;">
                                <span><i class="fas fa-folder me-2"></i>{{ $c->category }}</span>
                                <span class="badge bg-light text-dark">{{ $c->total }}</span>
                            </a>
                        @endforeach
                    </div>
                </div>

                <!-- TAGS -->
                <div class="sidebar-widget" data-aos="fade-left" data-aos-delay="200">
                    <h4><i class="fas fa-tags me-2" style="color: var(--accent-purple);"></i>Tags Populaires</h4>
                    <div class="tag-cloud">
                        @forelse(($tags ?? collect()) as $tag)
                            <a href="{{ route('public.blog', ['q' => $tag]) }}" class="tag">{{ $tag }}</a>
                        @empty
                            <span class="text-muted">Aucun tag.</span>
                        @endforelse
                    </div>
                </div>

                <!-- CTA CARD -->
                <div class="sidebar-widget" data-aos="fade-left" data-aos-delay="300" style="background: var(--gradient-2); color: #fff;">
                    <h4 style="color: #fff;"><i class="fas fa-rocket me-2"></i>Rejoignez-nous</h4>
                    <p style="color: rgba(255,255,255,0.9); margin-bottom: 20px;">Démarrez votre aventure dans le monde des bijoux de luxe dès aujourd'hui</p>
                    <a href="{{ route('member.register') }}" class="btn btn-light w-100" style="border-radius: 50px; font-weight: 700;">
                        <i class="fas fa-user-plus me-2"></i>S'inscrire Maintenant
                    </a>
                </div>

            </div>
        </div>

        <!-- NEWSLETTER CTA -->
        <div class="newsletter-cta" data-aos="zoom-in">
            <i class="fas fa-envelope-open" style="font-size: 3rem; margin-bottom: 20px; opacity: 0.9;"></i>
            <h3>Restez Connecté</h3>
            <p style="opacity: 0.95; margin-bottom: 0;">Recevez nos derniers articles, conseils exclusifs et offres spéciales directement dans votre boîte mail</p>
            <div class="newsletter-form">
                <form action="{{ route('newsletter.subscribe') }}" method="POST" class="d-flex w-100" style="gap: 10px;">
                    @csrf
                    <input type="email" name="email" placeholder="Votre adresse email" required>
                    <button type="submit"><i class="fas fa-paper-plane me-2"></i>S'abonner</button>
                </form>
            </div>
        </div>
    </div>
</section>

<!-- FOOTER -->
<footer>
    <div class="container">
        <div class="row g-4">
            <div class="col-lg-4">
                @if(!empty($siteLogo))<img src="{{ $siteLogo }}" alt="{{ $siteName ?? 'ATARA' }}" height="50" class="mb-3">@endif
                <h5>{{ $siteName ?? 'ATARA' }}</h5>
                <p style="color: #94a3b8; line-height: 1.8;">{{ $siteMetaDescription ?? 'Votre partenaire de confiance pour le succès dans l\'univers des bijoux de luxe. Construisez votre empire avec élégance.' }}</p>
                <div class="social-links">
                    @if(!empty($siteFacebook))<a href="{{ $siteFacebook }}" target="_blank"><i class="fab fa-facebook-f"></i></a>@endif
                    @if(!empty($siteTwitter))<a href="{{ $siteTwitter }}" target="_blank"><i class="fab fa-twitter"></i></a>@endif
                    @if(!empty($siteInstagram))<a href="{{ $siteInstagram }}" target="_blank"><i class="fab fa-instagram"></i></a>@endif
                    @if(!empty($siteWhatsapp))<a href="https://wa.me/{{ preg_replace('/[^0-9]/', '', $siteWhatsapp) }}" target="_blank"><i class="fab fa-whatsapp"></i></a>@endif
                </div>
            </div>
            
            <div class="col-lg-2">
                <h5>Navigation</h5>
                <div class="d-flex flex-column gap-2">
                    <a href="{{ route('home') }}"><i class="fas fa-home me-2"></i>Accueil</a>
                    <a href="{{ route('about') }}"><i class="fas fa-info-circle me-2"></i>À Propos</a>
                    <a href="{{ route('shop.index') }}"><i class="fas fa-shopping-bag me-2"></i>Boutique</a>
                    <a href="{{ route('plan') }}"><i class="fas fa-chart-line me-2"></i>Plan MLM</a>
                </div>
            </div>

            <div class="col-lg-3">
                <h5>Ressources</h5>
                <div class="d-flex flex-column gap-2">
                    <a href="{{ route('public.blog') }}"><i class="fas fa-blog me-2"></i>Blog</a>
                    <a href="{{ route('public.newsletter') }}"><i class="fas fa-envelope me-2"></i>Newsletter</a>
                    <a href="{{ route('contact') }}"><i class="fas fa-phone me-2"></i>Contact</a>
                    <a href="#"><i class="fas fa-question-circle me-2"></i>FAQ</a>
                </div>
            </div>

            <div class="col-lg-3">
                <h5>Contact</h5>
                <div class="d-flex flex-column gap-2" style="color: #94a3b8;">
                    @if(!empty($siteEmail))<p><i class="fas fa-envelope me-2" style="color: var(--primary-color);"></i><a href="mailto:{{ $siteEmail }}" style="color: inherit;">{{ $siteEmail }}</a></p>@endif
                    @if(!empty($sitePhone))<p><i class="fas fa-phone me-2" style="color: var(--primary-color);"></i><a href="tel:{{ preg_replace('/\s+/', '', $sitePhone) }}" style="color: inherit;">{{ $sitePhone }}</a></p>@endif
                    @if(!empty($siteAddress))<p><i class="fas fa-map-marker-alt me-2" style="color: var(--primary-color);"></i>{{ $siteAddress }}</p>@endif
                </div>
            </div>
        </div>
        
        <hr style="border-color: rgba(255,255,255,0.1); margin: 40px 0 30px;">
        
        <div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
            <span style="color: #94a3b8;">© {{ date('Y') }} {{ $siteName ?? 'ATARA' }}. {{ $siteCopyright ?? 'Tous droits réservés.' }}</span>
            <div class="d-flex gap-3">
                <a href="#">Politique de confidentialité</a>
                <a href="#">Conditions d'utilisation</a>
                <a href="#">Mentions légales</a>
            </div>
        </div>
    </div>
</footer>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>
    AOS.init({
        duration: 800,
        easing: 'ease-in-out',
        once: true,
        offset: 100
    });

    // Category filter interaction
    document.querySelectorAll('.category-pill').forEach(pill => {
        pill.addEventListener('click', function() {
            document.querySelectorAll('.category-pill').forEach(p => p.classList.remove('active'));
            this.classList.add('active');
        });
    });

    // Smooth scroll for internal links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            const target = document.querySelector(this.getAttribute('href'));
            if (target) {
                target.scrollIntoView({ behavior: 'smooth', block: 'start' });
            }
        });
    });
</script>

</body>
</html>
