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

{% block content %}
<!-- Hero Section -->
<section class="hero-section py-5 mb-5 position-relative overflow-hidden">
    <div class="container py-5 position-relative" style="z-index: 2;">
        <div class="row align-items-center">
            <div class="col-lg-6">
                <h1 class="display-3 fw-bold mb-4 animate-fade-in">GEAR UP FOR THE <span class="neon-text-purple">FUTURE</span></h1>
                <p class="lead text-secondary mb-5 fs-4">Experience high-performance marketplace for futuristic tech and gaming gear. Neural peripherals, VR, and RGB-infused hardware.</p>
                <div class="d-flex gap-3">
                    <a href="#store" class="btn btn-neon-purple px-4 py-3">Explore Gear</a>
                    <a href="#" class="btn btn-outline-light px-4 py-3 glass">New Arrivals</a>
                </div>
            </div>
            <div class="col-lg-6 d-none d-lg-block">
                <div class="position-relative">
                    <div class="hero-glow position-absolute top-50 start-50 translate-middle" style="width: 400px; height: 400px; background: radial-gradient(circle, rgba(188, 19, 254, 0.2) 0%, transparent 70%);"></div>
                    <img src="https://images.pexels.com/photos/7862591/pexels-photo-7862591.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" alt="Future Tech" class="img-fluid rounded-4 shadow-lg glass neon-border-blue animate-float">
                </div>
            </div>
        </div>
    </div>
    <!-- Background Accents -->
    <div class="position-absolute top-0 end-0 p-5 opacity-25">
        <div class="rounded-circle bg-purple shadow-lg" style="width: 300px; height: 300px; filter: blur(100px); background: var(--neon-purple);"></div>
    </div>
</section>

<div id="store" class="container py-5">
    <div class="row mb-5">
        <div class="col-md-8">
            <h2 class="mb-4">NEURAL <span class="neon-text-blue">CATALOG</span></h2>
            <div class="d-flex flex-wrap gap-2 mb-4">
                <a href="?" class="btn btn-sm {% if not current_category %}btn-neon-purple{% else %}btn-outline-secondary glass text-white{% endif %} px-3">ALL</a>
                {% for cat in categories %}
                <a href="?category={{ cat.slug }}{% if search_query %}&q={{ search_query }}{% endif %}" 
                   class="btn btn-sm {% if current_category == cat.slug %}btn-neon-purple{% else %}btn-outline-secondary glass text-white{% endif %} px-3">
                    {{ cat.name|upper }}
                </a>
                {% endfor %}
            </div>
        </div>
        <div class="col-md-4">
            <form action="." method="get" class="search-form">
                <div class="input-group glass rounded-pill p-1">
                    <input type="text" name="q" class="form-control bg-transparent border-0 text-white px-4" placeholder="Search gear..." value="{{ search_query }}">
                    <button class="btn btn-neon-purple rounded-pill px-4" type="submit"><i class="bi bi-search"></i></button>
                </div>
                {% if current_category %}
                <input type="hidden" name="category" value="{{ current_category }}">
                {% endif %}
            </form>
        </div>
    </div>

    <!-- Featured Products -->
    {% if not current_category and not search_query and featured_products %}
    <div class="mb-5">
        <h4 class="neon-text-purple mb-4">FEATURED TECH</h4>
        <div class="row g-4">
            {% for product in featured_products %}
            <div class="col-md-3">
                {% include "core/includes/product_card.html" with product=product %}
            </div>
            {% endfor %}
        </div>
    </div>
    {% endif %}

    <!-- Main Product Grid -->
    <div class="row g-4">
        {% for product in products %}
        <div class="col-lg-4 col-md-6">
            {% include "core/includes/product_card.html" with product=product %}
        </div>
        {% empty %}
        <div class="col-12 text-center py-5 glass neon-border-blue">
            <h3 class="text-secondary mb-3">NO GEAR FOUND IN THIS SECTOR</h3>
            <a href="?" class="btn btn-neon-purple">RESET NEURAL SEARCH</a>
        </div>
        {% endfor %}
    </div>
</div>

<style>
    .animate-fade-in {
        animation: fadeIn 1s ease-out;
    }
    .animate-float {
        animation: float 6s ease-in-out infinite;
    }
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes float {
        0% { transform: translateY(0px); }
        50% { transform: translateY(-20px); }
        100% { transform: translateY(0px); }
    }
    .product-card {
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        overflow: hidden;
    }
    .product-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 10px 30px rgba(0, 209, 255, 0.2);
        border-color: var(--neon-blue) !important;
    }
    .product-img-wrapper {
        height: 250px;
        overflow: hidden;
        background: #1a1a23;
    }
    .product-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s ease;
    }
    .product-card:hover .product-img {
        transform: scale(1.1);
    }
</style>
{% endblock %}
