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

{% block content %}
<!-- Hero Section -->
<section class="hero-section">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-lg-6 mb-5 mb-lg-0">
                <h1 class="display-3 mb-4">{% trans "Small Shipments," %}<br><span style="color: var(--accent-orange)">{% trans "Smart Delivery." %}</span></h1>
                <p class="lead mb-5 opacity-75">{% trans "masarX connects shippers with local car owners for fast, reliable, and trackable deliveries. Your cargo, our priority." %}</p>
                <div class="d-flex gap-3">
                    <a href="{% url 'shipment_request' %}" class="btn btn-masarx-primary">{% trans "Start Shipping" %}</a>
                    <a href="#how-it-works" class="btn btn-outline-light border-2 px-4 py-2" style="border-radius: 12px;">{% trans "Learn More" %}</a>
                </div>
            </div>
            <div class="col-lg-5 offset-lg-1">
                <div class="glass-card">
                    <h3 class="mb-4">{% trans "Track your Parcel" %}</h3>
                    <form method="GET" action="{% url 'index' %}">
                        <div class="input-group mb-3">
                            <input type="text" name="tracking_id" class="form-control tracking-input" placeholder="{% trans 'Enter Tracking ID (e.g. 5A2B...)' %}" value="{{ tracking_id|default:'' }}">
                            <button class="btn btn-masarx-primary px-4" type="submit">{% trans "Track" %}</button>
                        </div>
                    </form>
                    
                    {% if parcel %}
                    <div class="mt-4 p-3 bg-white bg-opacity-10 rounded-3 text-start" dir="ltr">
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <span class="text-uppercase small opacity-75">{% trans "Status" %}</span>
                            <span class="parcel-status-badge status-{{ parcel.status }}">{{ parcel.get_status_display }}</span>
                        </div>
                        <h5 class="mb-1">{{ parcel.description|truncatechars:30 }}</h5>
                        <p class="small mb-0 opacity-75">{% trans "From" %}: {{ parcel.pickup_address }}</p>
                        <p class="small mb-0 opacity-75">{% trans "To" %}: {{ parcel.delivery_address }}</p>
                    </div>
                    {% elif error %}
                    <div class="mt-3 text-danger small">
                        <i class="bi bi-exclamation-circle me-1"></i> {{ error }}
                    </div>
                    {% else %}
                    <p class="small opacity-50 mt-3 mb-0">{% trans "Enter your 10-character tracking ID to see live updates." %}</p>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</section>

<!-- Features Section -->
<section id="how-it-works" class="py-5 bg-white">
    <div class="container py-5">
        <div class="text-center mb-5">
            <h2 class="display-5">{% trans "How masarX Works" %}</h2>
            <p class="text-muted">{% trans "Simple steps to get your shipment moving" %}</p>
        </div>
        <div class="row g-4">
            <div class="col-md-4">
                <div class="p-4 border-0 card h-100 bg-transparent">
                    <div class="feature-icon">
                        <i class="bi bi-box-seam"></i>
                    </div>
                    <h4>1. {% trans "List your Parcel" %}</h4>
                    <p class="text-muted">{% trans "Enter shipment details, weight, and delivery addresses. It's quick and easy." %}</p>
                </div>
            </div>
            <div class="col-md-4">
                <div class="p-4 border-0 card h-100 bg-transparent">
                    <div class="feature-icon">
                        <i class="bi bi-truck"></i>
                    </div>
                    <h4>2. {% trans "Connect with Driver" %}</h4>
                    <p class="text-muted">{% trans "A verified car owner near you picks up the parcel and starts the journey." %}</p>
                </div>
            </div>
            <div class="col-md-4">
                <div class="p-4 border-0 card h-100 bg-transparent">
                    <div class="feature-icon">
                        <i class="bi bi-shield-check"></i>
                    </div>
                    <h4>3. {% trans "Secure Delivery" %}</h4>
                    <p class="text-muted">{% trans "Track your parcel in real-time until it reaches its destination safely." %}</p>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- CTA Section -->
<section class="py-5" style="background-color: var(--primary-dark); color: white;">
    <div class="container py-4 text-center">
        <h2 class="mb-4">{% trans "Ready to join the movement?" %}</h2>
        <div class="row justify-content-center gap-4">
            <div class="col-md-5 text-center">
                <p class="mb-3">{% trans "I want to send a parcel" %}</p>
                <a href="{% url 'register' %}" class="btn btn-masarx-primary">{% trans "Become a Shipper" %}</a>
            </div>
            <div class="col-md-5 text-center">
                <p class="mb-3">{% trans "I have a car and want to earn" %}</p>
                <a href="{% url 'register' %}" class="btn btn-outline-light border-2 px-4 py-2" style="border-radius: 12px;">{% trans "Become a Driver" %}</a>
            </div>
        </div>
    </div>
</section>
{% endblock %}