<article class="col-md-3 mb-5 {if isset($smarty.session.user) and $smarty.session.user.user_status == 2} pb-5 {/if}" style="border-radius: 100px ;">
    <div class="card h-100 shadow article-card  rounded-4" style="border-width: 2px; overflow: hidden;">
        
        {* IMAGE (partie supérieure - plus grande) *}
        <div class="ratio ratio-4x3">
            <a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"></a>
            <img src="{$smarty.env.IMG_PROJECT_PATH}{$objProject->getThumbnail()}"
                 class="w-100 h-100 object-fit-cover"
                 alt=""
                 loading="lazy">
                 </a>
        </div>
        
        {* CONTENU (photo profil + infos) *}
        <div class="card-body p-3 bg-light">
            <div class="d-flex align-items-start gap-3">
                {* PHOTO DE PROFIL (cercle à gauche - plus grand) *}
                <a href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}">
                <img src="{$smarty.env.IMG_USER_PATH}{$objProject->getUser_image() ?? "images.jpg"}"
     				class="rounded-circle flex-shrink-0 border border-2 border-white"
     				style="width: 64px; height: 64px; object-fit: cover; margin-top: 8px;"
     				alt="Photo de profil">
                </a>
                {* INFOS À DROITE *}
                <div class="flex-grow-1">
                    <h3 class="h6 fw-bold mb-2 mt-1">{$objProject->getTitle()}</h3>
                    <p class="small text-muted mb-1">
                        <i class="bi bi-person"></i> 
                        <a href="index.php?ctrl=user&action=user&pseudo={$objProject->getCreatorname()}" 
                           class="text-decoration-none text-muted"
                           style="position: relative; z-index: 2;">
                            {$objProject->getCreatorname()}
                        </a>
                    </p>
                    <p class="small text-muted mb-0">
                        <i class="bi bi-geo-alt">Colmar</i>
                    </p>
                </div>
            </div>
            
            <div class="d-flex justify-content-between align-items-center mt-3">
                <small class="text-muted">
                    <i class="bi bi-clock"><time>{$objProject->getCreation_date()}</time></i> 
                </small>
				{if $objProject->getStatus() != "refusé"}
                <a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"
                   class="btn btn-sm btn-primary">
                    Voir →
                </a>
				{/if}
            </div>
            
            {if isset($smarty.session.user)}
                {if $smarty.session.user.user_id == $objProject->getUser_id()}
                    <a href="index.php?ctrl=project&action=addedit_project&id={$objProject->getId()}"
                       class="btn btn-sm btn-outline-secondary mt-2 w-100"
                       style="position: relative; z-index: 2;">
                        Editer
                    </a>
                {/if}
            {/if}
        </div>
        
        {* BOUTONS EN BAS *}
        {if isset($smarty.session.user)
            and $smarty.session.user.user_status == 2
            and $objProject->getStatus() == "en_attente"}
            <div class="card-footer bg-white border-top-0 p-2">
                <div class="d-flex gap-2">
                    <a class="btn btn-sm btn-success flex-fill" 
                       href="?ctrl=project&action=accept&id={$objProject->getId()}" 
                       name="toPublished">Accepter</a>
                    <a class="btn btn-sm btn-warning flex-fill" 
                       href="?ctrl=project&action=refuse&id={$objProject->getId()}" 
                       name="toRefused">Refuser</a>
                    <a class="btn btn-sm btn-danger flex-fill" 
                       href="index.php?ctrl=project&action=delete&id={$objProject->getId()}" 
                       name="toDelete" 
					   onclick="return confirm('Attention ! Êtes-vous sûr de vouloir supprimer ce projet ? Cette action est irréversible.');">
					   Supprimer</a>
                </div>
            </div>
        {elseif $objProject->getStatus() == "refusé"}
            <div class="card-footer bg-white border-top-0 p-2">
                <p class="text-danger fw-bold text-center mb-0 small">Projet refusé</p>
            </div>
        {/if}
    </div>
</article>
