{% extends "base.html" %}
{% load static %}

{% block title %}Cipher Shield{% endblock %}

{% block head %}
{{ block.super }}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Inter:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/custom.css' %}">
{% endblock %}

{% block content %}
<div class="container mx-auto px-4 py-8">
    <header class="mb-8 text-center">
        <h1 class="text-5xl font-bold font-poppins text-white">Cipher Shield</h1>
        <p class="text-gray-300 font-inter text-lg">The future of secure social networking.</p>
    </header>

    <div class="glass-card max-w-2xl mx-auto mb-8">
        <form method="post" class="p-6">
            {% csrf_token %}
            {{ form.as_p }}
            <button type="submit" class="w-full bg-teal-500 hover:bg-teal-600 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
                Post
            </button>
        </form>
    </div>

    <div class="space-y-6 max-w-2xl mx-auto">
        {% for post in posts %}
            <div class="glass-card">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 rounded-full bg-gray-700 flex items-center justify-center font-bold text-white text-xl">
                            {{ post.author.username.0|upper }}
                        </div>
                        <div class="ml-4">
                            <div class="flex items-center">
                                <p class="font-bold text-white font-poppins">{{ post.author.username }}</p>
                                <span class="intent-badge intent-{{ post.intent|lower }}" title="AI Intent Analysis: {{ post.intent }}"></span>
                            </div>
                            <p class="text-sm text-gray-400 font-inter">{{ post.created_at|date:"F d, Y, P" }}</p>
                        </div>
                    </div>
                    <p class="text-gray-200 font-inter">{{ post.content }}</p>
                </div>
            </div>
        {% empty %}
            <div class="glass-card text-center p-8">
                <p class="text-gray-400 font-inter">No posts yet. Be the first to share something!</p>
            </div>
        {% endfor %}
    </div>
</div>
{% endblock %}
