{% extends 'base.html' %}
{% block title %}Settings - Astron Hosts LTD{% endblock %}
{% block content %}
<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="card shadow-lg rounded-4 border-0">
                <div class="card-body py-5">
                    <div class="mb-3 text-center">
                        <i class="bi bi-gear display-3 text-primary"></i>
                    </div>
                    <h2 class="fw-bold mb-3 display-5 text-center">Settings</h2>
                    <p class="text-muted mb-4 text-center">Manage your preferences, budget, currency, password, and more.</p>
                    {% if messages %}
                        {% for message in messages %}
                            <div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
                                {{ message }}
                                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                            </div>
                        {% endfor %}
                    {% endif %}
                    <div class="row g-4">
                        <div class="col-md-6">
                            <div class="card border-0 shadow-sm rounded-4 h-100">
                                <div class="card-body">
                                    <h6 class="fw-semibold mb-3"><i class="bi bi-cash-coin me-2"></i>Budget & Currency</h6>
                                    <form method="post" novalidate>
                                        {% csrf_token %}
                                        <div class="mb-3">
                                            <label for="id_monthly_budget" class="form-label">Monthly Budget</label>
                                            {{ budget_form.monthly_budget }}
                                            {% for error in budget_form.monthly_budget.errors %}
                                                <div class="invalid-feedback d-block">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                        <div class="mb-3">
                                            <label for="id_yearly_budget" class="form-label">Yearly Budget</label>
                                            {{ budget_form.yearly_budget }}
                                            {% for error in budget_form.yearly_budget.errors %}
                                                <div class="invalid-feedback d-block">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                        <div class="mb-3">
                                            <label for="id_preferred_currency" class="form-label">Preferred Currency</label>
                                            {{ budget_form.preferred_currency }}
                                            {% for error in budget_form.preferred_currency.errors %}
                                                <div class="invalid-feedback d-block">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                        <button type="submit" name="save_budget" class="btn btn-primary w-100">Save Budget & Currency</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card border-0 shadow-sm rounded-4 h-100">
                                <div class="card-body">
                                    <h6 class="fw-semibold mb-3"><i class="bi bi-person-circle me-2"></i>Profile</h6>
                                    <form method="post" novalidate>
                                        {% csrf_token %}
                                        <div class="mb-3">
                                            <label for="id_first_name" class="form-label">First Name</label>
                                            {{ profile_form.first_name }}
                                            {% for error in profile_form.first_name.errors %}
                                                <div class="invalid-feedback d-block">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                        <div class="mb-3">
                                            <label for="id_last_name" class="form-label">Last Name</label>
                                            {{ profile_form.last_name }}
                                            {% for error in profile_form.last_name.errors %}
                                                <div class="invalid-feedback d-block">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                        <div class="mb-3">
                                            <label for="id_email" class="form-label">Email</label>
                                            {{ profile_form.email }}
                                            {% for error in profile_form.email.errors %}
                                                <div class="invalid-feedback d-block">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                        <button type="submit" name="save_profile" class="btn btn-primary w-100">Save Profile</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card border-0 shadow-sm rounded-4 h-100">
                                <div class="card-body text-center">
                                    <h6 class="fw-semibold mb-3"><i class="bi bi-key me-2"></i>Password & Security</h6>
                                    <a href="{% url 'password_change' %}" class="btn btn-outline-primary w-100">Change Password</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 