<!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>
        @if($user->role === 'seller' && $user->shop_name)
            {{ $user->shop_name }} - Boutique
        @else
            Boutique de {{ $user->name }}
        @endif
    </title>
    <link rel="icon" type="image/svg+xml" href="{{ asset('favicon.svg') }}">
    <link rel="icon" type="image/x-icon" href="{{ 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: #10b981;
            --primary-dark: #059669;
            --secondary: #14233c;
            --accent: #F59E0B;
            --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --gradient-2: linear-gradient(135deg, #10b981 0%, #059669 100%);
        }

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

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

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

        /* TOP BAR PROFESSIONNEL */
        .top-bar {
            background: var(--secondary);
            color: #fff;
            padding: 10px 0;
            font-size: 0.9rem;
        }

        .top-bar a {
            color: #fff;
            text-decoration: none;
            margin: 0 15px;
            transition: color 0.3s;
        }

        .top-bar a:hover {
            color: var(--accent);
        }

        /* NAVIGATION STICKY */
        .main-nav {
            background: #fff;
            box-shadow: 0 2px 15px rgba(0,0,0,0.05);
            padding: 15px 0;
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .brand-logo {
            font-family: 'Playfair Display', serif;
            font-size: 2rem;
            font-weight: 900;
            color: var(--secondary);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .brand-logo i {
            color: var(--accent);
            font-size: 1.8rem;
        }

        .nav-links {
            display: flex;
            gap: 30px;
            align-items: center;
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .nav-links a {
            color: var(--secondary);
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s;
        }

        .nav-links a:hover {
            color: var(--primary);
        }

        .cart-wrapper {
            position: relative;
        }

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

        .cart-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
            color: #fff;
        }

        .cart-badge {
            position: absolute;
            top: -8px;
            right: -8px;
            background: #ef4444;
            color: #fff;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
            font-weight: 700;
            transition: all 0.3s ease;
        }

        .cart-badge.bounce {
            animation: badgeBounce 0.6s ease;
        }

        @keyframes badgeBounce {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.5); }
        }

        /* Mini Panier Dropdown */
        .mini-cart {
            position: absolute;
            top: calc(100% + 15px);
            right: 0;
            width: 350px;
            background: #fff;
            border-radius: 16px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.2);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            transition: all 0.3s ease;
            z-index: 1001;
            max-height: 400px;
            overflow: hidden;
        }

        .cart-wrapper:hover .mini-cart,
        .mini-cart.show {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .mini-cart-header {
            padding: 15px 20px;
            background: var(--gradient-2);
            color: #fff;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .mini-cart-header h5 {
            margin: 0;
            font-weight: 600;
            font-size: 1rem;
        }

        .mini-cart-items {
            max-height: 220px;
            overflow-y: auto;
            padding: 10px;
        }

        .mini-cart-item {
            display: flex;
            gap: 12px;
            padding: 10px;
            border-bottom: 1px solid #f1f5f9;
        }

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

        .mini-cart-item img {
            width: 50px;
            height: 50px;
            border-radius: 8px;
            object-fit: cover;
        }

        .mini-cart-item-info {
            flex: 1;
        }

        .mini-cart-item-name {
            font-weight: 600;
            font-size: 0.9rem;
            color: var(--secondary);
            margin-bottom: 3px;
        }

        .mini-cart-item-price {
            color: var(--primary);
            font-weight: 700;
            font-size: 0.85rem;
        }

        .mini-cart-item-qty {
            font-size: 0.8rem;
            color: #94a3b8;
        }

        .mini-cart-footer {
            padding: 15px 20px;
            background: #f9fafb;
            border-top: 2px solid #f1f5f9;
        }

        .mini-cart-total {
            display: flex;
            justify-content: space-between;
            margin-bottom: 15px;
            font-weight: 700;
        }

        .mini-cart-total span:last-child {
            color: var(--primary);
            font-size: 1.1rem;
        }

        .mini-cart-actions {
            display: flex;
            gap: 10px;
        }

        .mini-cart-actions a {
            flex: 1;
            padding: 10px 15px;
            border-radius: 8px;
            text-decoration: none;
            text-align: center;
            font-weight: 600;
            font-size: 0.9rem;
            transition: all 0.3s;
        }

        .btn-view-cart {
            background: #f1f5f9;
            color: var(--secondary);
        }

        .btn-view-cart:hover {
            background: #e2e8f0;
        }

        .btn-checkout {
            background: var(--gradient-2);
            color: #fff !important;
        }

        .btn-checkout:hover {
            box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
        }

        .mini-cart-empty {
            padding: 30px;
            text-align: center;
            color: #94a3b8;
        }

        .mini-cart-empty i {
            font-size: 3rem;
            margin-bottom: 15px;
            color: #e2e8f0;
        }

        /* Toast Notification */
        .cart-toast {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: #fff;
            padding: 20px 25px;
            border-radius: 16px;
            box-shadow: 0 15px 50px rgba(0,0,0,0.2);
            display: flex;
            align-items: center;
            gap: 15px;
            z-index: 9999;
            transform: translateX(150%);
            transition: transform 0.4s ease;
            max-width: 380px;
        }

        .cart-toast.show {
            transform: translateX(0);
        }

        .cart-toast-icon {
            width: 50px;
            height: 50px;
            background: var(--gradient-2);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 1.3rem;
            flex-shrink: 0;
        }

        .cart-toast-content h6 {
            margin: 0 0 5px 0;
            font-weight: 700;
            color: var(--secondary);
        }

        .cart-toast-content p {
            margin: 0;
            font-size: 0.9rem;
            color: #64748b;
        }

        .cart-toast-content .toast-link {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            margin-top: 8px;
        }

        .cart-toast-content .toast-link:hover {
            text-decoration: underline;
        }

        .cart-toast-close {
            position: absolute;
            top: 10px;
            right: 10px;
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            font-size: 1rem;
            padding: 5px;
        }

        .cart-toast-close:hover {
            color: #64748b;
        }

        .cart-toast-img {
            width: 60px;
            height: 60px;
            border-radius: 10px;
            object-fit: cover;
            flex-shrink: 0;
        }

        /* HERO SECTION */
        .hero-section {
            background: var(--gradient-1);
            padding: 100px 0 80px;
            position: relative;
            overflow: hidden;
        }

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

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

        .hero-content {
            text-align: center;
            color: #fff;
            position: relative;
            z-index: 2;
        }

        .hero-content h1 {
            font-size: 4rem;
            font-weight: 900;
            margin-bottom: 20px;
            text-shadow: 0 4px 20px rgba(0,0,0,0.2);
        }

        .hero-content p {
            font-size: 1.3rem;
            opacity: 0.95;
            max-width: 700px;
            margin: 0 auto 30px;
        }

        .hero-stats {
            display: flex;
            justify-content: center;
            gap: 50px;
            margin-top: 40px;
        }

        .stat-item {
            text-align: center;
        }

        .stat-number {
            font-size: 2.5rem;
            font-weight: 800;
            display: block;
        }

        .stat-label {
            font-size: 1rem;
            opacity: 0.9;
        }

        /* PRODUCTS SECTION */
        .products-section {
            padding: 80px 0;
        }

        .section-header {
            text-align: center;
            margin-bottom: 60px;
        }

        .section-header h2 {
            font-size: 3rem;
            font-weight: 800;
            color: var(--secondary);
            margin-bottom: 15px;
        }

        .section-header p {
            font-size: 1.2rem;
            color: #64748b;
        }

        /* PRODUCT CARDS */
        .product-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 30px;
        }

        .product-card {
            background: #fff;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0,0,0,0.06);
            transition: all 0.4s;
            position: relative;
        }

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

        .product-img-wrapper {
            position: relative;
            height: 350px;
            overflow: hidden;
            background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
        }

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

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

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

        .product-info {
            padding: 25px;
        }

        .product-category {
            font-size: 0.85rem;
            color: var(--primary);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 10px;
        }

        .product-title {
            font-size: 1.4rem;
            font-weight: 700;
            color: var(--secondary);
            margin-bottom: 12px;
            line-height: 1.3;
        }

        .product-description {
            color: #64748b;
            font-size: 0.95rem;
            line-height: 1.6;
            margin-bottom: 20px;
        }

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

        .product-price {
            font-size: 1.8rem;
            font-weight: 800;
            color: var(--primary);
            font-family: 'Playfair Display', serif;
        }

        .product-price small {
            font-size: 1rem;
            font-weight: 600;
            color: #94a3b8;
        }

        .add-to-cart {
            background: var(--gradient-2);
            color: #fff;
            padding: 12px 28px;
            border-radius: 50px;
            border: none;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            text-decoration: none;
        }

        .add-to-cart:hover {
            transform: scale(1.05);
            box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
            color: #fff;
        }

        .btn-view-product {
            background: rgba(16, 185, 129, 0.1);
            border: 2px solid var(--accent);
            color: var(--accent);
            width: 45px;
            height: 45px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            text-decoration: none;
        }

        .btn-view-product:hover {
            background: var(--accent);
            color: white;
            transform: scale(1.1);
        }

        /* BOUTON VOIR PLUS */
        .btn-see-more {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            padding: 16px 40px;
            border-radius: 50px;
            font-size: 1.1rem;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
        }

        .btn-see-more:hover {
            transform: translateY(-3px);
            box-shadow: 0 15px 40px rgba(16, 185, 129, 0.4);
            color: white;
            background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
        }

        .btn-see-more i.fa-arrow-right {
            transition: transform 0.3s;
        }

        .btn-see-more:hover i.fa-arrow-right {
            transform: translateX(5px);
        }

        /* EMPTY STATE */
        .empty-state {
            text-align: center;
            padding: 80px 20px;
        }

        .empty-state i {
            font-size: 5rem;
            color: #cbd5e1;
            margin-bottom: 25px;
        }

        .empty-state h3 {
            font-size: 2rem;
            color: var(--secondary);
            margin-bottom: 15px;
        }

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

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

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

        .footer a:hover {
            color: var(--accent);
            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;
            transition: all 0.3s;
        }

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

        /* RESPONSIVE */
        @media (max-width: 768px) {
            .hero-content h1 { font-size: 2.5rem; }
            .product-grid { grid-template-columns: 1fr; }
            .hero-stats { flex-direction: column; gap: 30px; }
            .nav-links { display: none; }
        }
    </style>
</head>
<body>

<!-- TOP BAR -->
<div class="top-bar">
    <div class="container">
        <div class="d-flex justify-content-between align-items-center">
            <div>
                <i class="fas fa-phone me-2"></i>{{ $user->phone ?? '+225 XX XX XX XX XX' }}
                <span class="mx-2">|</span>
                <i class="fas fa-envelope me-2"></i>{{ $user->email ?? 'contact@boutique.com' }}
            </div>
            <div>
                <a href="#"><i class="fab fa-facebook-f me-2"></i></a>
                <a href="#"><i class="fab fa-instagram me-2"></i></a>
                <a href="#"><i class="fab fa-twitter"></i></a>
            </div>
        </div>
    </div>
</div>

<!-- MAIN NAVIGATION -->
<nav class="main-nav">
    <div class="container">
        <div class="d-flex justify-content-between align-items-center">
            <a href="{{ route('user.shop', $user->username ?? $user->member_code ?? $user->id) }}" class="brand-logo">
                <i class="fas fa-gem"></i>
                <span>
                    @if($user->role === 'seller' && $user->shop_name)
                        {{ $user->shop_name }}
                    @else
                        Boutique de {{ $user->name }}
                    @endif
                </span>
            </a>

            <ul class="nav-links d-none d-lg-flex">
                <li><a href="{{ route('user.shop', $user->username ?? $user->member_code ?? $user->id) }}">Accueil</a></li>
                <li><a href="{{ route('user.shop.collection', $user->username ?? $user->member_code ?? $user->id) }}">Collection</a></li>
                <li><a href="{{ route('user.shop.about', $user->username ?? $user->member_code ?? $user->id) }}">À Propos</a></li>
                <li><a href="{{ route('user.shop.contact', $user->username ?? $user->member_code ?? $user->id) }}">Contact</a></li>
            </ul>

            <div class="cart-wrapper">
                <a href="{{ route('user.shop.cart', $user->username ?? $user->member_code ?? $user->id) }}" class="cart-btn">
                    <i class="fas fa-shopping-bag"></i>
                    Panier
                    <span class="cart-badge">0</span>
                </a>
                
                <!-- Mini Panier Dropdown -->
                <div class="mini-cart" id="miniCart">
                    <div class="mini-cart-header">
                        <h5><i class="fas fa-shopping-bag me-2"></i>Mon Panier</h5>
                        <span class="mini-cart-count">0 article(s)</span>
                    </div>
                    <div class="mini-cart-items" id="miniCartItems">
                        <div class="mini-cart-empty">
                            <i class="fas fa-shopping-basket"></i>
                            <p>Votre panier est vide</p>
                        </div>
                    </div>
                    <div class="mini-cart-footer">
                        <div class="mini-cart-total">
                            <span>Total</span>
                            <span id="miniCartTotal">0 FCFA</span>
                        </div>
                        <div class="mini-cart-actions">
                            <a href="{{ route('user.shop.cart', $user->username ?? $user->member_code ?? $user->id) }}" class="btn-view-cart">
                                <i class="fas fa-eye me-1"></i> Voir
                            </a>
                            <a href="{{ route('user.shop.checkout', $user->username ?? $user->member_code ?? $user->id) }}" class="btn-checkout">
                                <i class="fas fa-credit-card me-1"></i> Commander
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>

<!-- Toast Notification Panier -->
<div class="cart-toast" id="cartToast">
    <button class="cart-toast-close" onclick="hideCartToast()">
        <i class="fas fa-times"></i>
    </button>
    <img src="" alt="Produit" class="cart-toast-img" id="toastProductImg">
    <div class="cart-toast-content">
        <h6><i class="fas fa-check-circle text-success me-1"></i> Ajouté au panier!</h6>
        <p id="toastProductName">Produit ajouté</p>
        <a href="{{ route('user.shop.cart', $user->username ?? $user->member_code ?? $user->id) }}" class="toast-link">
            Voir le panier <i class="fas fa-arrow-right"></i>
        </a>
    </div>
</div>

<!-- HERO SECTION -->
<section class="hero-section">
    <div class="container">
        <div class="hero-content" data-aos="fade-up">
            <h1>Collection Bijoux Premium</h1>
            <p>Découvrez notre sélection exclusive de bijoux de luxe, chaque pièce raconte une histoire d'élégance et de raffinement</p>
            
            <div class="hero-stats" data-aos="fade-up" data-aos-delay="200">
                <div class="stat-item">
                    <span class="stat-number">{{ $totalProducts ?? $products->count() }}</span>
                    <span class="stat-label">Créations Uniques</span>
                </div>
                <div class="stat-item">
                    <span class="stat-number">100%</span>
                    <span class="stat-label">Qualité Garantie</span>
                </div>
                <div class="stat-item">
                    <span class="stat-number">24/7</span>
                    <span class="stat-label">Support Client</span>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- PRODUCTS SECTION -->
<section class="products-section">
    <div class="container">
        <div class="section-header" data-aos="fade-up">
            <h2>Notre Collection Exclusive</h2>
            <p>Des bijoux d'exception pour des moments inoubliables</p>
        </div>

        @if($products->count() > 0)
            <div class="product-grid">
                @foreach($products as $product)
                    <article class="product-card" data-aos="fade-up" data-aos-delay="{{ $loop->index * 100 }}">
                        <div class="product-img-wrapper">
                            @if($product->image)
                                <img src="{{ asset('storage/' . $product->image) }}" alt="{{ $product->name }}" class="product-img" loading="lazy">
                            @else
                                <div class="d-flex align-items-center justify-content-center h-100">
                                    <i class="fas fa-gem" style="font-size: 5rem; color: rgba(0,0,0,0.1);"></i>
                                </div>
                            @endif
                            
                            @if($product->stock > 0 && $product->stock < 10)
                                <span class="product-badge"><i class="fas fa-fire me-1"></i>Stock Limité</span>
                            @elseif($product->stock == 0)
                                <span class="product-badge" style="background: rgba(239, 68, 68, 0.95); color: #fff;">Épuisé</span>
                            @endif
                        </div>

                        <div class="product-info">
                            <div class="product-category">{{ $product->category->name ?? 'Bijoux' }}</div>
                            <h3 class="product-title">{{ $product->name }}</h3>
                            <p class="product-description">{{ Str::limit($product->description, 80) }}</p>

                            <div class="product-footer">
                                <div class="product-price">
                                    {{ number_format($product->price, 0, ',', ' ') }} <small>XOF</small>
                                </div>
                                
                                @if($product->stock > 0)
                                    <div class="d-flex gap-2 align-items-center">
                                        <a href="{{ route('user.shop.product', [$user->username ?? $user->member_code ?? $user->id, $product->id]) }}" class="btn-view-product">
                                            <i class="fas fa-eye"></i>
                                        </a>
                                        <button onclick="addToCart({{ $product->id }})" class="add-to-cart">
                                            <i class="fas fa-shopping-bag"></i>
                                            <span>Panier</span>
                                        </button>
                                    </div>
                                @else
                                    <button class="add-to-cart" disabled style="opacity: 0.6; cursor: not-allowed;">
                                        <i class="fas fa-times-circle"></i>
                                        <span>Rupture</span>
                                    </button>
                                @endif
                            </div>
                        </div>
                    </article>
                @endforeach
            </div>

            @if($showMoreButton ?? false)
                <div class="mt-5 d-flex justify-content-center" data-aos="fade-up">
                    <a href="{{ route('user.shop.collection', $user->username ?? $user->member_code ?? $user->id) }}" class="btn-see-more">
                        <i class="fas fa-gem me-2"></i>Voir toute la collection
                        <i class="fas fa-arrow-right ms-2"></i>
                    </a>
                </div>
            @endif
        @else
            <div class="empty-state" data-aos="fade-up">
                <i class="fas fa-gem"></i>
                <h3>Collection En Préparation</h3>
                <p class="text-muted">De nouvelles créations exceptionnelles arrivent bientôt</p>
            </div>
        @endif
    </div>
</section>

<!-- FOOTER -->
<footer class="footer">
    <div class="container">
        <div class="row g-4">
            <div class="col-lg-4">
                <h5>
                    <i class="fas fa-gem me-2" style="color: var(--accent);"></i>
                    @if($user->role === 'seller' && $user->shop_name)
                        {{ $user->shop_name }}
                    @else
                        Boutique de {{ $user->name }}
                    @endif
                </h5>
                <p style="color: #94a3b8; line-height: 1.8;">L'excellence dans l'art de la bijouterie. Chaque pièce est une œuvre d'art créée avec passion et savoir-faire.</p>
                <div class="social-links">
                    <a href="#"><i class="fab fa-facebook-f"></i></a>
                    <a href="#"><i class="fab fa-instagram"></i></a>
                    <a href="#"><i class="fab fa-twitter"></i></a>
                    <a href="#"><i class="fab fa-pinterest"></i></a>
                </div>
            </div>
            
            <div class="col-lg-2">
                <h5>Navigation</h5>
                <div class="d-flex flex-column gap-2">
                    <a href="{{ route('shop.index') }}"><i class="fas fa-home me-2"></i>Accueil</a>
                    <a href="{{ route('shop.index') }}"><i class="fas fa-gem me-2"></i>Collection</a>
                    <a href="{{ route('about') }}"><i class="fas fa-info-circle me-2"></i>À Propos</a>
                    <a href="{{ route('contact') }}"><i class="fas fa-phone me-2"></i>Contact</a>
                </div>
            </div>

            <div class="col-lg-3">
                <h5>Service Client</h5>
                <div class="d-flex flex-column gap-2">
                    <a href="#"><i class="fas fa-shipping-fast me-2"></i>Livraison</a>
                    <a href="#"><i class="fas fa-undo me-2"></i>Retours & Échanges</a>
                    <a href="#"><i class="fas fa-shield-alt me-2"></i>Garantie</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;">
                    <p><i class="fas fa-map-marker-alt me-2" style="color: var(--primary);"></i>
                        {{ $user->address ?? ($user->city ?? 'Abidjan') }}, {{ $user->country ?? 'Côte d\'Ivoire' }}
                    </p>
                    <p><i class="fas fa-phone me-2" style="color: var(--primary);"></i>{{ $user->phone ?? '+225 XX XX XX XX XX' }}</p>
                    <p><i class="fas fa-envelope me-2" style="color: var(--primary);"></i>{{ $user->email ?? 'contact@boutique.com' }}</p>
                </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') }} 
                @if($user->role === 'seller' && $user->shop_name)
                    {{ $user->shop_name }}
                @else
                    Boutique de {{ $user->name }}
                @endif
                . Tous droits réservés.
            </span>
            <div class="d-flex gap-3">
                <a href="#">Confidentialité</a>
                <a href="#">Conditions</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
    });

    // Smooth scroll
    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' });
            }
        });
    });

    // Variables globales pour le panier
    let cartItems = [];
    const username = '{{ $user->username ?? $user->member_code ?? $user->id }}';

    // Fonction pour afficher le toast
    function showCartToast(productName, productImage) {
        const toast = document.getElementById('cartToast');
        const toastImg = document.getElementById('toastProductImg');
        const toastName = document.getElementById('toastProductName');
        
        toastName.textContent = productName;
        toastImg.src = productImage || '/storage/products/default.png';
        
        toast.classList.add('show');
        
        // Cacher après 4 secondes
        setTimeout(() => {
            hideCartToast();
        }, 4000);
    }

    function hideCartToast() {
        document.getElementById('cartToast').classList.remove('show');
    }

    // Animation du badge
    function animateBadge() {
        const badge = document.querySelector('.cart-badge');
        badge.classList.add('bounce');
        setTimeout(() => badge.classList.remove('bounce'), 600);
    }

    // Mise à jour du mini-panier
    async function updateMiniCart() {
        try {
            const response = await fetch(`/u/${username}/cart-items`);
            const data = await response.json();
            
            const itemsContainer = document.getElementById('miniCartItems');
            const countEl = document.querySelector('.mini-cart-count');
            const totalEl = document.getElementById('miniCartTotal');
            const badgeEl = document.querySelector('.cart-badge');
            
            if (data.items && data.items.length > 0) {
                cartItems = data.items;
                let html = '';
                
                data.items.forEach(item => {
                    html += `
                        <div class="mini-cart-item">
                            <img src="${item.image || '/storage/products/default.png'}" alt="${item.name}">
                            <div class="mini-cart-item-info">
                                <div class="mini-cart-item-name">${item.name}</div>
                                <div class="mini-cart-item-price">${formatPrice(item.price)} FCFA</div>
                                <div class="mini-cart-item-qty">Qté: ${item.quantity}</div>
                            </div>
                        </div>
                    `;
                });
                
                itemsContainer.innerHTML = html;
                countEl.textContent = `${data.count} article(s)`;
                totalEl.textContent = `${formatPrice(data.total)} FCFA`;
                badgeEl.textContent = data.count;
            } else {
                itemsContainer.innerHTML = `
                    <div class="mini-cart-empty">
                        <i class="fas fa-shopping-basket"></i>
                        <p>Votre panier est vide</p>
                    </div>
                `;
                countEl.textContent = '0 article(s)';
                totalEl.textContent = '0 FCFA';
                badgeEl.textContent = '0';
            }
        } catch (error) {
            console.error('Erreur lors de la mise à jour du mini-panier:', error);
        }
    }

    // Formater le prix
    function formatPrice(price) {
        return new Intl.NumberFormat('fr-FR').format(price);
    }

    // Fonction pour ajouter au panier (reste dans l'écosystème)
    async function addToCart(productId) {
        const btn = event.target.closest('.add-to-cart');
        const originalContent = btn.innerHTML;
        
        // Récupérer les infos du produit depuis la carte
        const card = btn.closest('.product-card');
        const productName = card ? card.querySelector('.product-title')?.textContent : 'Produit';
        const productImg = card ? card.querySelector('.product-img')?.src : '';
        
        btn.disabled = true;
        btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> <span>Ajout...</span>';

        try {
            const response = await fetch(`/u/${username}/add-to-cart`, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'X-CSRF-TOKEN': '{{ csrf_token() }}'
                },
                body: JSON.stringify({ product_id: productId, quantity: 1 })
            });

            const data = await response.json();

            if (data.success) {
                // Mettre à jour le badge du panier
                document.querySelector('.cart-badge').textContent = data.cart_count;
                
                // Animer le badge
                animateBadge();
                
                // Mettre à jour le mini-panier
                await updateMiniCart();
                
                // Afficher le toast avec les infos du produit
                showCartToast(productName, productImg);
                
                // Montrer le mini-panier temporairement
                const miniCart = document.getElementById('miniCart');
                miniCart.classList.add('show');
                setTimeout(() => miniCart.classList.remove('show'), 3000);
                
                // Animation de succès sur le bouton
                btn.innerHTML = '<i class="fas fa-check"></i> <span>Ajouté!</span>';
                btn.style.background = 'linear-gradient(135deg, #10b981, #059669)';
                
                setTimeout(() => {
                    btn.innerHTML = originalContent;
                    btn.style.background = '';
                    btn.disabled = false;
                }, 2000);
            } else {
                throw new Error(data.message || 'Erreur lors de l\'ajout au panier');
            }
        } catch (error) {
            console.error('Erreur:', error);
            btn.innerHTML = '<i class="fas fa-times"></i> <span>Erreur</span>';
            setTimeout(() => {
                btn.innerHTML = originalContent;
                btn.disabled = false;
            }, 2000);
        }
    }

    // Mettre à jour le compteur du panier au chargement
    async function updateCartCount() {
        try {
            const response = await fetch(`/u/${username}/cart-count`);
            const data = await response.json();
            document.querySelector('.cart-badge').textContent = data.count || 0;
        } catch (error) {
            console.error('Erreur lors de la récupération du panier:', error);
        }
    }

    // Initialisation au chargement
    updateCartCount();
    updateMiniCart();
</script>

</body>
</html>
