<!-- templates/literary/author.tpl -->
{include file="header.tpl"}

<!-- 作者横幅 -->
<div class="hero-banner mb-4" style="background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%); color: white; padding: 50px 40px; border-radius: var(--border-radius);">
    <h1 style="font-size: 2.2rem; margin-bottom: 15px;">{$author_name}的文章</h1>
    <p style="font-size: 1.1rem; opacity: 0.9;">探索作者的文学世界</p>
    <div class="meta-item" style="background: rgba(255,255,255,0.2); color: white; margin-top: 15px; display: inline-block;">
        <span>📚</span> 共 {$pagination.total|default:0} 篇文章
    </div>
</div>

<!-- 作者文章列表 -->
{if $posts}
{foreach $posts as $post}
<article class="article-card">
    <h2 class="article-title">
        <a href="{build_url mod='post' id=$post.id}">{$post.title nofilter}</a>
    </h2>

    <div class="article-meta">
        <div class="meta-item">
            <span>📁</span> {$post.category}
        </div>
        <div class="meta-item">
            <span>📅</span> {$post.create_time|date_format:'Y-m-d H:i'}
        </div>
        <div class="meta-item">
            <span>👁️</span> {$post.views} 阅读
        </div>
        {if $post.comments}
        <div class="meta-item">
            <span>💬</span> {$post.comments} 评论
        </div>
        {/if}
    </div>

    <div class="article-excerpt">
        {$post.content|truncate:200}
    </div>

    <div class="article-footer">
        <a href="{build_url mod='post' id=$post.id}" class="read-more">阅读全文 →</a>
    </div>
</article>
{/foreach}

<!-- 分页 -->
{if $pagination.total_pages > 1}
<nav class="pagination">
    {if $pagination.has_prev}
    <a href="{build_url mod='author' author=$author_id page=$pagination.page_prev}" class="page-link">上一页</a>
    {/if}

    {foreach $pagination.display_pages as $p}
    {if $p == $pagination.page}
    <span class="page-link page-current">{$p}</span>
    {else}
    <a href="{build_url mod='author' author=$author_id page=$p}" class="page-link">{$p}</a>
    {/if}
    {/foreach}

    {if $pagination.has_next}
    <a href="{build_url mod='author' author=$author_id page=$pagination.page_next}" class="page-link">下一页</a>
    {/if}
</nav>
{/if}
{else}
<div class="article-card text-center">
    <div style="font-size: 3rem; margin-bottom: 20px; color: var(--text-light);">📝</div>
    <h2 style="color: var(--text-light);">该作者暂无文章</h2>
    <p style="color: var(--text-light);">这位作者还没有发布任何文章。</p>
    <a href="{build_url mod='index'}" class="read-more">返回首页</a>
</div>
{/if}

{include file="footer.tpl"}