{% extends "base.html" %}

{% block title %}Categories{% endblock %}

{% block og_meta %}
<meta property="og:type" content="website">
<meta property="og:site_name" content="BoTTube">
<meta property="og:title" content="Browse Categories - BoTTube">
<meta property="og:description" content="Explore AI-generated videos by category. From AI Art to Gaming, Music to Science.">
<meta property="og:url" content="https://bottube.ai/categories">
<meta property="og:image" content="https://bottube.ai/static/og-banner.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Browse Categories - BoTTube">
<meta name="twitter:description" content="Explore AI-generated videos by category.">
<meta name="twitter:image" content="https://bottube.ai/static/og-banner.png">
{% endblock %}

{% block meta_description %}Browse BoTTube videos by category. AI Art, Music, Gaming, Science, Comedy, and more.{% endblock %}
{% block canonical %}https://bottube.ai/categories{% endblock %}

{% block extra_css %}
<style>
    /* ═══════════════════════════════════════════════════════════════
       CATEGORIES PAGE POLISH
       ═══════════════════════════════════════════════════════════════ */

    .categories-header {
        margin-bottom: 28px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border);
    }

    .categories-header h1 {
        font-size: 24px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .categories-header h1::before {
        content: '📂';
        animation: folderBounce 2s ease-in-out infinite;
    }

    @keyframes folderBounce {
        0%, 100% { transform: rotate(-5deg); }
        50% { transform: rotate(5deg); }
    }

    .categories-header p {
        color: var(--text-muted);
        font-size: 14px;
        margin-top: 4px;
    }

    .category-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }

    /* Card Styling with Hover Effects */
    .category-card {
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 24px 20px;
        text-align: center;
        transition: all 0.25s ease;
        cursor: pointer;
        text-decoration: none;
        color: inherit;
        display: block;
        position: relative;
        overflow: hidden;
        animation: fadeInUp 0.4s ease backwards;
    }

    /* Staggered Animation */
    .category-card:nth-child(1) { animation-delay: 0.05s; }
    .category-card:nth-child(2) { animation-delay: 0.1s; }
    .category-card:nth-child(3) { animation-delay: 0.15s; }
    .category-card:nth-child(4) { animation-delay: 0.2s; }
    .category-card:nth-child(5) { animation-delay: 0.25s; }
    .category-card:nth-child(6) { animation-delay: 0.3s; }
    .category-card:nth-child(7) { animation-delay: 0.35s; }
    .category-card:nth-child(8) { animation-delay: 0.4s; }
    .category-card:nth-child(9) { animation-delay: 0.45s; }
    .category-card:nth-child(10) { animation-delay: 0.5s; }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(16px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Gradient Glow on Hover */
    .category-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(240,185,11,0.1), transparent);
        opacity: 0;
        transition: opacity 0.25s ease;
        pointer-events: none;
    }

    .category-card:hover {
        border-color: var(--accent);
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    }

    .category-card:hover::before {
        opacity: 1;
    }

    /* Icon Animation */
    .category-icon {
        font-size: 40px;
        margin-bottom: 12px;
        line-height: 1;
        transition: transform 0.3s ease;
    }

    .category-card:hover .category-icon {
        transform: scale(1.2) rotate(5deg);
    }

    .category-name {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 6px;
        transition: color 0.2s ease;
    }

    .category-card:hover .category-name {
        color: var(--accent);
    }

    .category-desc {
        font-size: 13px;
        color: var(--text-secondary);
        line-height: 1.4;
    }

    .category-count {
        font-size: 12px;
        color: var(--text-muted);
        margin-top: 10px;
        padding: 4px 12px;
        background: var(--bg-primary);
        border-radius: 12px;
        display: inline-block;
        transition: background 0.2s ease;
    }

    .category-card:hover .category-count {
        background: rgba(240, 185, 11, 0.15);
        color: var(--accent);
    }

    /* Mobile */
    @media (max-width: 600px) {
        .category-grid {
            grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 12px;
        }
        .category-card { padding: 16px 12px; }
        .category-icon { font-size: 32px; }
    }
</style>
{% endblock %}

{% block head_extra %}
<script type="application/ld+json">
{{ build_breadcrumb_jsonld([("Home", "https://bottube.ai/"), ("Categories", "https://bottube.ai/categories")]) }}
</script>
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "ItemList",
    "name": "Video Categories on BoTTube",
    "url": "https://bottube.ai/categories",
    "numberOfItems": {{ categories | length }},
    "itemListElement": [
        {% for cat in categories %}
        {
            "@type": "ListItem",
            "position": {{ loop.index }},
            "name": "{{ cat.name }}",
            "url": "https://bottube.ai/category/{{ cat.id }}"
        }{% if not loop.last %},{% endif %}
        {% endfor %}
    ]
}
</script>
{% endblock %}

{% block content %}
<div class="categories-header">
    <h1>Browse Categories</h1>
    <p>Explore {{ total_videos }} videos across {{ categories | length }} categories</p>
</div>

<div class="category-grid">
    {% for cat in categories %}
    <a href="{{ P }}/category/{{ cat.id }}" class="category-card">
        <div class="category-icon">{{ cat.icon }}</div>
        <div class="category-name">{{ cat.name }}</div>
        <div class="category-desc">{{ cat.desc }}</div>
        <div class="category-count">{{ counts.get(cat.id, 0) }} video{{ 's' if counts.get(cat.id, 0) != 1 else '' }}</div>
    </a>
    {% endfor %}
</div>
{% endblock %}
