{% load static %}
<!DOCTYPE html>
<html lang="ru" data-bs-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}FitnessCenter{% endblock %}</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <link rel="stylesheet" href="{% static 'css/main.css' %}">
    {% block extra_head %}{% endblock %}
</head>
<body>
    <header class="navbar navbar-expand-lg border-bottom bg-gradient position-sticky top-0 z-3 backdrop-blur">
        <div class="container-fluid px-4">
            <a class="navbar-brand d-flex align-items-center gap-2" href="{% url 'home' %}">
                <img src="{% static 'img/logo.jpg' %}" alt="logo" class="brand-logo">
                <span class="fw-bold">FitnessCenter</span>
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav" aria-controls="mainNav" aria-expanded="false" aria-label="Переключить меню">
                <span class="navbar-toggler-icon"></span>
            </button>
            <nav class="collapse navbar-collapse" id="mainNav">
                <ul class="navbar-nav ms-auto align-items-lg-center gap-lg-3">
                    <li class="nav-item"><a class="nav-link" href="{% url 'home' %}">Главная</a></li>
                    <li class="nav-item"><a class="nav-link" href="#trainers">Тренеры</a></li>
                    <li class="nav-item"><a class="nav-link" href="#booking">Записаться</a></li>
                    <li class="nav-item"><a class="nav-link" href="#about">О клубе</a></li>
                    {% if user.is_authenticated %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'dashboard' %}">Кабинет</a></li>
                        <li class="nav-item"><a class="btn btn-outline-light" href="{% url 'logout' %}">Выйти</a></li>
                    {% else %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'login' %}">Войти</a></li>
                        <li class="nav-item"><a class="btn btn-accent" href="{% url 'register' %}">Регистрация</a></li>
                    {% endif %}
                </ul>
            </nav>
        </div>
    </header>

    <main class="py-4">
        <div class="container">
            {% if messages %}
                <div class="messages-stack">
                    {% for message in messages %}
                        <div class="alert alert-{{ message.tags|default:'info' }} shadow-sm" role="alert">
                            {{ message }}
                        </div>
                    {% endfor %}
                </div>
            {% endif %}
        </div>
        {% block content %}{% endblock %}
    </main>

    <footer class="footer py-5" id="booking">
        <div class="container">
            <div class="row align-items-center g-3">
                <div class="col-md-4">
                    <h4 class="fw-bold mb-3">Приобрести абонемент</h4>
                    <p class="text-secondary">Оставьте контакты — менеджер подберёт план за пару минут.</p>
                </div>
                <div class="col-md-8">
                    <form class="row g-3" aria-label="Заявка на абонемент">
                        <div class="col-md-4">
                            <input type="text" class="form-control form-control-lg" placeholder="Ф.И.О" required>
                        </div>
                        <div class="col-md-4">
                            <input type="tel" class="form-control form-control-lg" placeholder="+7 (___) ___-__-__" required>
                        </div>
                        <div class="col-md-4">
                            <select class="form-select form-select-lg" required>
                                <option value="" selected disabled>Выберите клуб</option>
                                {% for club in clubs %}
                                    <option>{{ club.name }} — {{ club.address }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-12 text-md-end">
                            <button class="btn btn-accent btn-lg" type="button">Позвоните мне</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="mt-4 small text-secondary">© {% now "Y" %} FitnessCenter — здоровое тело как стиль жизни.</div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
    {% block extra_js %}{% endblock %}
</body>
</html>
