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

{% block title %}{{ product.name }} - UMKM Pemagarsari{% endblock %}

{% block content %}
<section class="py-5">
    <div class="container">
        <nav aria-label="breadcrumb" class="mb-4">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{% url 'home' %}" class="text-decoration-none text-orange">Beranda</a></li>
                <li class="breadcrumb-item active" aria-current="page">{{ product.name }}</li>
            </ol>
        </nav>

        <div class="row g-5">
            <div class="col-md-6">
                <div class="bg-white rounded-4 p-2 shadow-sm">
                    <div class="product-img-wrapper rounded-3" style="height: 450px;">
                        {% if product.image %}
                        <img src="{{ product.image.url }}" alt="{{ product.name }}" class="img-fluid w-100 h-100 object-fit-cover rounded-3">
                        {% else %}
                        <i class="fa-solid fa-image fa-4x"></i>
                        {% endif %}
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="ps-lg-4">
                    <span class="badge bg-orange mb-2 px-3 py-2 rounded-pill">{{ product.category.name }}</span>
                    <h1 class="fw-bold mb-3">{{ product.name }}</h1>
                    <div class="d-flex align-items-center mb-4">
                        <div class="bg-light p-2 rounded-3 me-3">
                            <i class="fa-solid fa-shop text-orange"></i>
                        </div>
                        <div>
                            <p class="mb-0 small text-muted">Dijual oleh</p>
                            <h6 class="fw-bold mb-0">{{ product.shop.name }}</h6>
                        </div>
                    </div>

                    <h2 class="product-price mb-4" style="font-size: 2.5rem;">Rp {{ product.price|floatformat:0 }}</h2>
                    
                    <div class="mb-4">
                        <h6 class="fw-bold">Deskripsi Produk</h6>
                        <p class="text-muted">{{ product.description|linebreaks }}</p>
                    </div>

                    <div class="card border-0 bg-light rounded-4 p-4 mb-4">
                        <div class="d-flex align-items-center mb-3">
                            <i class="fa-solid fa-circle-info text-orange me-2"></i>
                            <h6 class="fw-bold mb-0">Cara Pemesanan</h6>
                        </div>
                        <p class="small text-muted mb-0">Klik tombol di bawah untuk terhubung langsung dengan WhatsApp penjual. Pesan otomatis akan terisi dengan detail produk ini.</p>
                    </div>

                    <div class="d-grid">
                        <a href="{{ product.whatsapp_link }}" target="_blank" class="btn btn-whatsapp btn-lg py-3 rounded-pill">
                            <i class="fa-brands fa-whatsapp me-2"></i>Pesan via WhatsApp Sekarang
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- Related Products Placeholder -->
<section class="py-5 bg-light mt-5">
    <div class="container text-center">
        <h4 class="fw-bold mb-4">Dukung UMKM Lainnya</h4>
        <div class="row g-4 opacity-50">
            <!-- Simulated related products -->
            <div class="col-md-3">
                <div class="bg-white p-4 rounded-4 shadow-sm">
                    <div class="bg-light mb-3 rounded" style="height: 150px;"></div>
                    <div class="bg-light w-75 h-25 mb-2 mx-auto"></div>
                    <div class="bg-light w-50 h-25 mx-auto"></div>
                </div>
            </div>
            <div class="col-md-3 d-none d-md-block">
                <div class="bg-white p-4 rounded-4 shadow-sm">
                    <div class="bg-light mb-3 rounded" style="height: 150px;"></div>
                    <div class="bg-light w-75 h-25 mb-2 mx-auto"></div>
                    <div class="bg-light w-50 h-25 mx-auto"></div>
                </div>
            </div>
             <div class="col-md-3 d-none d-md-block">
                <div class="bg-white p-4 rounded-4 shadow-sm">
                    <div class="bg-light mb-3 rounded" style="height: 150px;"></div>
                    <div class="bg-light w-75 h-25 mb-2 mx-auto"></div>
                    <div class="bg-light w-50 h-25 mx-auto"></div>
                </div>
            </div>
             <div class="col-md-3 d-none d-md-block">
                <div class="bg-white p-4 rounded-4 shadow-sm">
                    <div class="bg-light mb-3 rounded" style="height: 150px;"></div>
                    <div class="bg-light w-75 h-25 mb-2 mx-auto"></div>
                    <div class="bg-light w-50 h-25 mx-auto"></div>
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}
