<!doctype html>
<html lang="ru" class="h-100">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="icon" href="https://deev.space/media/favicon.ico" type="image/x-icon">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    <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=Raleway:wght@400;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">

    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">

    <title>Образовательный портал | Московский Политех</title>
</head>

<body class="d-flex flex-column h-100">
    <header>
        <nav class="site-navbar navbar navbar-dark">
            <div class="container-fluid px-4">
                <div class="logo navbar-brand">
                    <a href="{{ url_for('index') }}">
                        <img class="img-fluid" src="{{ url_for('static', filename='images/polytech_logo.png') }}" alt="polytech-logo">
                    </a>
                </div>
                <div class="d-flex align-items-center gap-3">
                    <a class="nav-link-item" href="{{ url_for('courses.index') }}">
                        <i class="fas fa-graduation-cap"></i> Курсы
                    </a>
                    {% if current_user.is_authenticated %}
                        <div class="dropdown d-flex">
                            <div class="profile-avatar" title="{{ current_user.full_name }}" id="dropdownMenuButton"
                                data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <img class="img-fluid rounded-circle cursor-pointer"
                                    src="{{ url_for('static', filename='images/default-profile-picture-300x300.jpeg') }}" alt="profile-pic">
                            </div>
                            <div class="dropdown-menu dropdown-menu-end site-dropdown" aria-labelledby="dropdownMenuButton">
                                <span class="dropdown-item-text small px-3 text-muted" style="color: white;">{{ current_user.full_name }}</span>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{ url_for('auth.logout') }}">
                                    <i class="fas fa-sign-out-alt me-2"></i>Выйти
                                </a>
                            </div>
                        </div>
                    {% else %}
                        <a class="btn-primary-red" href="{{ url_for('auth.login') }}">
                            <i class="fas fa-sign-in-alt me-1"></i>Войти
                        </a>
                    {% endif %}
                </div>
            </div>
        </nav>
    </header>

    <div class="alerts-area">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% for category, msg in messages %}
                <div class="alert alert-{{ category }} alert-dismissible fade show m-0 rounded-0 site-alert" role="alert">
                    {% if category == 'success' %}<i class="fas fa-check-circle me-2"></i>
                    {% elif category == 'danger' %}<i class="fas fa-exclamation-circle me-2"></i>
                    {% elif category == 'warning' %}<i class="fas fa-exclamation-triangle me-2"></i>
                    {% else %}<i class="fas fa-info-circle me-2"></i>{% endif %}
                    {{ msg }}
                    <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
            {% endfor %}
        {% endwith %}
    </div>

    <main class="main flex-grow-1">
       {% block content %}
       {% endblock %}
    </main>

    <footer class="site-footer">
        <div class="container">
            <div class="footer-content">
                <div class="footer-info">
                    <div class="footer-name">Деев Егор Викторович, ст. гр. 241-327</div>
                </div>
                <div class="footer-copy">&copy; 2026 Московский политехнический университет</div>
                <div class="footer-links">
                    <a href="mailto:egor@deev.space" title="Email"><i class="fas fa-envelope"></i></a>
                    <a href="https://deev.space" target="_blank" title="Сайт"><i class="fas fa-globe"></i></a>
                    <a href="https://t.me/Egor_Deev" target="_blank" title="Telegram"><i class="fab fa-telegram"></i></a>
                    <a href="https://github.com/EDeev" target="_blank" title="GitHub"><i class="fab fa-github"></i></a>
                </div>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2"
        crossorigin="anonymous"></script>

    <script defer src="{{ url_for('static', filename='main.js') }}"></script>
</body>

</html>
