{% extends "admin_base.html" %}

{% block title %}Product Settings{% endblock %}
{% block header_title %}Product Landing Page{% endblock %}

{% block content %}
<div class="max-w-4xl mx-auto pb-12">
    <div class="mui-card p-8 lg:p-12">
        <div class="mb-10">
            <h3 class="text-2xl font-black text-gray-800 tracking-tight">Landing Page Configuration</h3>
            <p class="text-sm text-gray-400 font-medium">Customize your product display, pricing, and visual assets.</p>
        </div>

        <form method="POST" enctype="multipart/form-data" class="space-y-8">
            {{ form.hidden_tag() }}

            <!-- Basic Info Section -->
            <div class="space-y-6">
                <div class="flex items-center gap-2 mb-2">
                    <div class="w-1 h-6 bg-indigo-500 rounded-full"></div>
                    <h4 class="text-xs font-black text-gray-400 uppercase tracking-[0.2em]">General Information</h4>
                </div>

                <div class="grid grid-cols-1 gap-6">
                    <div>
                        <label
                            class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">Product
                            Display Name</label>
                        {{ form.product_name(class="w-full mui-input font-medium text-gray-700") }}
                    </div>

                    <div>
                        <label class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">Hero
                            Video URL (YouTube/Vimeo Embed)</label>
                        {{ form.video_url(class="w-full mui-input font-medium text-gray-700",
                        placeholder="https://www.youtube.com/embed/...") }}
                        <p class="text-[10px] text-indigo-400 mt-2 font-bold uppercase tracking-tight italic">
                            Recommended: Use embed link for compatibility.</p>
                    </div>
                </div>
            </div>

            <!-- Pricing Section -->
            <div class="space-y-6 pt-6 border-t border-gray-50">
                <div class="flex items-center gap-2 mb-2">
                    <div class="w-1 h-6 bg-emerald-500 rounded-full"></div>
                    <h4 class="text-xs font-black text-gray-400 uppercase tracking-[0.2em]">Pricing & Offers</h4>
                </div>

                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                    <div>
                        <label
                            class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">Selling
                            Price (৳)</label>
                        {{ form.price(class="w-full mui-input font-black text-emerald-600 text-lg") }}
                    </div>

                    <div>
                        <label class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">Old
                            Price (৳)</label>
                        {{ form.old_price(class="w-full mui-input font-bold text-gray-400 line-through") }}
                    </div>

                    <div class="md:col-span-2 lg:col-span-1">
                        <label class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">Base
                            Weight (Grams)</label>
                        {{ form.product_weight(class="w-full mui-input font-bold text-gray-700", placeholder="500") }}
                    </div>

                    <div>
                        <label class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">2-Pack
                            Discount (৳)</label>
                        {{ form.discount_amount(class="w-full mui-input font-bold text-indigo-600", placeholder="100")
                        }}
                    </div>

                    <div class="md:col-span-2 lg:col-span-1">
                        <label class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">3-Pack
                            Discount (৳)</label>
                        {{ form.discount_amount_3(class="w-full mui-input font-bold text-indigo-600", placeholder="200")
                        }}
                    </div>
                </div>
            </div>

            <!-- Details Section -->
            <div class="space-y-6 pt-6 border-t border-gray-50">
                <div class="flex items-center gap-2 mb-2">
                    <div class="w-1 h-6 bg-amber-500 rounded-full"></div>
                    <h4 class="text-xs font-black text-gray-400 uppercase tracking-[0.2em]">Product Details</h4>
                </div>

                <div>
                    <label class="block text-xs font-black text-gray-500 uppercase tracking-widest mb-2 ml-1">Short
                        Description</label>
                    {{ form.product_description(class="w-full mui-input font-medium text-gray-700 h-32") }}
                </div>
            </div>

            <!-- Visual Assets -->
            <div class="space-y-6 pt-6 border-t border-gray-50">
                <div class="flex items-center gap-2 mb-2">
                    <div class="w-1 h-6 bg-purple-500 rounded-full"></div>
                    <h4 class="text-xs font-black text-gray-400 uppercase tracking-[0.2em]">Visual Assets</h4>
                </div>

                <div class="mui-card bg-gray-50 p-6 border-2 border-dashed border-gray-100">
                    <div class="flex flex-col md:flex-row items-center gap-8">
                        <div class="relative group">
                            <div
                                class="w-40 h-40 bg-white rounded-2xl overflow-hidden shadow-sm border p-2 ring-4 ring-white group-hover:scale-105 transition">
                                {% if '/' in settings.image_path %}
                                <img src="{{ url_for('static', filename=settings.image_path) }}"
                                    class="w-full h-full object-cover rounded-xl">
                                {% else %}
                                <img src="{{ url_for('static', filename='images/' + settings.image_path) }}"
                                    class="w-full h-full object-cover rounded-xl">
                                {% endif %}
                            </div>
                            <div
                                class="absolute -bottom-2 -right-2 w-10 h-10 bg-emerald-500 text-white rounded-xl flex items-center justify-center shadow-lg">
                                <i class="fas fa-check text-xs"></i>
                            </div>
                        </div>

                        <div class="flex-grow space-y-4 text-center md:text-left">
                            <div>
                                <h5 class="text-lg font-black text-gray-800">Change Product Image</h5>
                                <p class="text-xs text-gray-400 font-bold uppercase tracking-tight">Recommended size:
                                    1200x1200px Square</p>
                            </div>
                            {{ form.image(class="block w-full text-xs text-gray-500 file:mr-6 file:py-3 file:px-6
                            file:rounded-xl file:border-0 file:text-[10px] file:font-black file:uppercase
                            file:bg-indigo-600 file:text-white hover:file:bg-indigo-700 file:transition cursor-pointer")
                            }}
                        </div>
                    </div>
                </div>
            </div>

            <!-- Action Button -->
            <div class="pt-10 flex justify-center md:justify-end">
                <button type="submit" class="mui-btn-primary w-full md:w-auto flex items-center justify-center gap-3">
                    <i class="fas fa-save"></i>
                    Save Product Settings
                </button>
            </div>
        </form>
    </div>
</div>
{% endblock %}