{% extends "base.html" %}

{% block title %}Дашборд - Домовой Бот{% endblock %}

{% block nav_dashboard %}active{% endblock %}

{% block extra_style %}
<style>
    .stat-card {
        border-radius: 10px;
        padding: 1.5rem;
        color: white;
        margin-bottom: 1rem;
        transition: transform 0.3s;
    }
    .stat-card:hover { transform: translateY(-5px); }
    .stat-card.primary { background: linear-gradient(135deg, #3498db, #2980b9); }
    .stat-card.success { background: linear-gradient(135deg, #27ae60, #229954); }
    .stat-card.info { background: linear-gradient(135deg, #17a2b8, #117a8b); }
    .stat-card.danger { background: linear-gradient(135deg, #e74c3c, #c0392b); }
    .stat-card .stat-value { font-size: 2.5rem; font-weight: bold; }
    .stat-card .stat-label { font-size: 0.9rem; opacity: 0.9; }
</style>
{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>Дашборд</h2>
    <div>
        <span class="text-muted">Админ: {{ username }}</span>
        <a href="/" class="btn btn-outline-primary btn-sm ms-2">
            <i class="bi bi-arrow-clockwise"></i> Обновить
        </a>
    </div>
</div>

<!-- Stats Cards -->
<div class="row">
    <div class="col-md-3">
        <a href="/users?filter=all" style="text-decoration: none;">
            <div class="stat-card primary">
                <div class="stat-value">{{ stats.users }}</div>
                <div class="stat-label">Пользователей</div>
            </div>
        </a>
    </div>
    <div class="col-md-3">
        <a href="/users?filter=verified" style="text-decoration: none;">
            <div class="stat-card success">
                <div class="stat-value">{{ stats.verified }}</div>
                <div class="stat-label">Верифицировано</div>
            </div>
        </a>
    </div>
    <div class="col-md-3">
        <a href="/users?filter=ig" style="text-decoration: none;">
            <div class="stat-card info">
                <div class="stat-value">{{ stats.ig }}</div>
                <div class="stat-label">Инициативная группа</div>
            </div>
        </a>
    </div>
    <div class="col-md-3">
        <a href="/users?filter=active_unverified" style="text-decoration: none;">
            <div class="stat-card danger">
                <div class="stat-value">{{ stats.active_unverified }}</div>
                <div class="stat-label">Активных (50+ сообщ.)</div>
            </div>
        </a>
    </div>
</div>

<!-- Additional Stats -->
<div class="row mt-3">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <i class="bi bi-megaphone"></i> Объявления
            </div>
            <div class="card-body">
                <h3 class="text-center">{{ stats.ads }}</h3>
                <p class="text-center text-muted">Активных объявлений</p>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <i class="bi bi-calendar-event"></i> События
            </div>
            <div class="card-body">
                <h3 class="text-center">{{ stats.schedules }}</h3>
                <p class="text-center text-muted">Предстоящих событий</p>
            </div>
        </div>
    </div>
</div>

<!-- Quick Actions -->
<div class="card mt-4">
    <div class="card-header">
        <i class="bi bi-lightning"></i> Быстрые действия
    </div>
    <div class="card-body">
        <a href="/users" class="btn btn-primary me-2">
            <i class="bi bi-people"></i> Пользователи
        </a>
        <a href="/broadcast" class="btn btn-success me-2">
            <i class="bi bi-broadcast"></i> Рассылки
        </a>
        <a href="/digests" class="btn btn-info me-2">
            <i class="bi bi-newspaper"></i> Дайджесты
        </a>
        <a href="/export" class="btn btn-secondary me-2">
            <i class="bi bi-download"></i> Экспорт
        </a>
    </div>
</div>
{% endblock %}
