<!DOCTYPE html>
<html lang="fa" dir="rtl" data-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}پنل مدیریت فرنود{% endblock %}</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}?v=2026-premium">
    <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=Inter:wght@400;500;600;700;800&family=Vazirmatn:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <script src="https://unpkg.com/lucide@latest"></script>
    <link rel="icon" type="image/png" href="{{ url_for('static', filename='images/logo.png') }}">
    <script>
        // اعمال سریع تم قبل از رندر برای جلوگیری از چشمک
        (function() {
            var t = localStorage.getItem("farnoud_theme") || "dark";
            var c = localStorage.getItem("farnoud_color") || "blue";
            document.documentElement.setAttribute("data-theme", t);
            var colors = {
                blue: ["#3b82f6","#2563eb","#38bdf8"],
                purple: ["#a855f7","#9333ea","#c084fc"],
                green: ["#22c55e","#16a34a","#4ade80"],
                orange: ["#f59e0b","#d97706","#fbbf24"],
                pink: ["#ec4899","#db2777","#f472b6"],
                teal: ["#14b8a6","#0d9488","#2dd4bf"],
                red: ["#ef4444","#dc2626","#f87171"],
                indigo: ["#6366f1","#4f46e5","#818cf8"]
            };
            var col = colors[c] || colors.blue;
            document.documentElement.style.setProperty("--primary", col[0]);
            document.documentElement.style.setProperty("--primary-hover", col[1]);
            document.documentElement.style.setProperty("--accent", col[2]);
            document.documentElement.style.setProperty("--primary-soft", col[0] + "24");
            document.documentElement.style.setProperty("--primary-glow", col[0] + "59");
        })();
    </script>
</head>
<body class="app-body">
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <div class="flash-container">
                {% for category, message in messages %}
                    <div class="flash-message {{ category }}">{{ message }}</div>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}

    {% block content %}{% endblock %}

    <script src="{{ url_for('static', filename='js/main.js') }}?v=2026-premium"></script>
</body>
</html>
