<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RSS Article Summaries - {{ generation_time.strftime('%B %d, %Y') }}</title>
    <style>
        /* Miniflux-inspired CSS Variables for Light Theme */
        :root {
            --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
            --body-color: #222;
            --body-background: #fff;
            --hr-border-color: #ddd;
            --title-color: #222;
            --link-color: #1a5490;
            --link-focus-color: #333;
            --link-hover-color: #333;
            --header-link-color: #777;
            --header-active-link-color: #222;
            --header-link-focus-color: #333;
            --header-link-hover-color: #333;
            --header-list-border-color: #ddd;
            --page-header-title-color: #222;
            --page-header-title-border-color: #ddd;
            --item-border-color: #ddd;
            --item-padding: 5px;
            --item-title-link-font-weight: 600;
            --item-status-read-title-link-color: #777;
            --item-meta-focus-color: #666;
            --item-meta-li-color: #ccc;
            --entry-header-border-color: #ddd;
            --entry-header-title-link-color: #222;
            --entry-content-color: #222;
            --entry-content-font-weight: 400;
            --entry-content-font-family: var(--font-family);
            --category-background-color: #f9f9f9;
            --category-border-color: #ddd;
            --category-color: #666;
            --category-link-color: #666;
            --category-link-hover-color: #333;
        }

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

        html {
            -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
        }

        body {
            font-family: var(--font-family);
            text-rendering: optimizeLegibility;
            color: var(--body-color);
            background: var(--body-background);
            margin: auto;
            max-width: 820px;
            padding: 20px;
        }

        h1, h2, h3 {
            color: var(--title-color);
        }

        a {
            color: var(--link-color);
            text-decoration: none;
        }

        a:hover, a:focus {
            color: var(--link-hover-color);
            text-decoration: underline;
        }

        /* Header */
        .page-header {
            margin-bottom: 30px;
            text-align: center;
        }

        .page-header h1 {
            font-weight: 500;
            border-bottom: 1px dotted var(--page-header-title-border-color);
            font-size: 2.5rem;
            padding-bottom: 10px;
            margin-bottom: 10px;
        }

        .generation-info {
            color: var(--item-meta-focus-color);
            font-size: 0.9em;
            margin-bottom: 10px;
        }

        .summary-stats {
            color: var(--item-meta-focus-color);
            font-size: 0.85em;
            font-style: italic;
        }

        /* Category Sections */
        .category-section {
            margin-bottom: 40px;
        }

        .category-header {
            font-size: 1.8rem;
            font-weight: 500;
            margin-bottom: 20px;
            padding-bottom: 5px;
            border-bottom: 1px dotted var(--hr-border-color);
        }

        .category-count {
            color: var(--item-meta-focus-color);
            font-weight: 400;
            font-size: 0.85em;
        }

        /* Article Items */
        .article-item {
            border: 1px dotted var(--item-border-color);
            margin-bottom: 20px;
            padding: var(--item-padding);
            padding: 15px;
            overflow: hidden;
        }

        .article-header {
            margin-bottom: 10px;
        }

        .article-title {
            font-size: 1.2rem;
            margin: 0 0 8px 0;
            line-height: 1.3;
        }

        .article-title a {
            font-weight: var(--item-title-link-font-weight);
            color: var(--entry-header-title-link-color);
        }

        .article-meta {
            color: var(--item-meta-focus-color);
            font-size: 0.8em;
            margin-bottom: 12px;
        }

        .article-meta-item {
            margin-right: 15px;
            display: inline-block;
        }

        .article-meta-item:not(:last-child):after {
            content: "|";
            color: var(--item-meta-li-color);
            margin-left: 15px;
        }

        .article-summary {
            font-size: 1rem;
            line-height: 1.5;
            color: var(--entry-content-color);
            margin-top: 10px;
        }

        .article-category {
            display: inline-block;
            font-size: 0.75em;
            background-color: var(--category-background-color);
            border: 1px solid var(--category-border-color);
            border-radius: 5px;
            margin-left: 8px;
            padding: 2px 6px;
            color: var(--category-color);
        }

        /* Footer */
        .page-footer {
            margin-top: 50px;
            padding-top: 20px;
            border-top: 1px dotted var(--hr-border-color);
            text-align: center;
            color: var(--item-meta-focus-color);
            font-size: 0.85em;
        }

        /* Responsive Design */
        @media (max-width: 620px) {
            body {
                padding: 10px;
            }
            
            .page-header h1 {
                font-size: 2rem;
            }
            
            .category-header {
                font-size: 1.5rem;
            }
            
            .article-meta-item {
                display: block;
                margin-right: 0;
                margin-bottom: 3px;
            }
            
            .article-meta-item:not(:last-child):after {
                content: "";
                margin-left: 0;
            }
        }
    </style>
</head>
<body>
    <header class="page-header">
        <h1>RSS Article Summaries</h1>
        <div class="generation-info">
            Generated on {{ generation_time.strftime('%B %d, %Y at %I:%M %p') }}
        </div>
        <div class="summary-stats">
            {{ total_articles }} articles across {{ total_categories }} categories
        </div>
    </header>

    <main>
        {% for category, articles in categories.items() %}
        <section class="category-section">
            <h2 class="category-header">
                {{ category }}
                <span class="category-count">({{ articles|length }} articles)</span>
            </h2>
            
            {% for article in articles %}
            <article class="article-item">
                <header class="article-header">
                    <h3 class="article-title">
                        <a href="{{ article.url }}" target="_blank" rel="noopener noreferrer">
                            {{ article.title }}
                        </a>
                        <span class="article-category">{{ article.category }}</span>
                    </h3>
                    
                    <div class="article-meta">
                        <span class="article-meta-item">
                            <strong>Source:</strong> <a href="{{ miniflux_url }}/feed/{{ article.feed_id }}/entries" target="_blank" rel="noopener noreferrer">{{ article.source }}</a>
                        </span>
                        {% if article.author %}
                        <span class="article-meta-item">
                            <strong>Author:</strong> {{ article.author }}
                        </span>
                        {% endif %}
                        <span class="article-meta-item">
                            <strong>Published:</strong> {{ article.published_at if article.published_at else 'Unknown' }}
                        </span>
                        {% if article.truncated %}
                        <span class="article-meta-item">
                            <em>Content truncated</em>
                        </span>
                        {% endif %}
                    </div>
                </header>
                
                <div class="article-summary">
                    {{ article.summary }}
                </div>
            </article>
            {% endfor %}
        </section>
        {% endfor %}
    </main>

    <footer class="page-footer">
        <p>Generated by RSS Summarization Agent</p>
        <p>Powered by Miniflux and Ollama AI</p>
    </footer>
</body>
</html>
