{% extends "group_admin/base.html" %}
{% block title %}Dashboard{% endblock %}
{% block content %}
<h2 class="mb-4"><i class="bi bi-gear-fill text-warning me-2"></i>Group Admin: {{ session.get('group_name') }}</h2>

<div class="row g-3 mb-4">
    <div class="col-md-3">
        <div class="card border-0 bg-secondary bg-opacity-25">
            <div class="card-body text-center">
                <div class="fs-2 fw-bold text-warning">{{ stats.member_count }}</div>
                <div class="text-muted">Members</div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <div class="card border-0 bg-secondary bg-opacity-25">
            <div class="card-body text-center">
                <div class="fs-2 fw-bold {{ 'text-success' if stats.db_configured else 'text-danger' }}">
                    {{ 'Yes' if stats.db_configured else 'No' }}
                </div>
                <div class="text-muted">DB configured</div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <div class="card border-0 bg-secondary bg-opacity-25">
            <div class="card-body text-center">
                <div class="fs-2 fw-bold text-info">{{ stats.admin_count }}</div>
                <div class="text-muted">Admins</div>
            </div>
        </div>
    </div>
</div>

<div class="row g-3">
    <div class="col-md-6">
        <div class="card border-secondary h-100">
            <div class="card-header">
                <i class="bi bi-people-fill me-2"></i>Quick Access
            </div>
            <div class="card-body d-flex flex-column gap-2">
                <a href="{{ url_for('group_admin.members') }}" class="btn btn-outline-warning">
                    <i class="bi bi-people-fill me-2"></i>Manage Members
                </a>
                <a href="{{ url_for('group_admin.database') }}" class="btn btn-outline-info">
                    <i class="bi bi-database-fill-gear me-2"></i>Configure Database
                </a>
                <a href="{{ url_for('panel.dashboard') }}" class="btn btn-outline-success">
                    <i class="bi bi-speedometer2 me-2"></i>Open Panel
                </a>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="card border-secondary h-100">
            <div class="card-header"><i class="bi bi-info-circle me-2"></i>Group Info</div>
            <div class="card-body">
                <dl class="row mb-0">
                    <dt class="col-sm-5">Name</dt>
                    <dd class="col-sm-7">{{ session.get('group_name') }}</dd>
                    <dt class="col-sm-5">Your Role</dt>
                    <dd class="col-sm-7"><span class="badge bg-warning text-dark">Admin</span></dd>
                    <dt class="col-sm-5">Database</dt>
                    <dd class="col-sm-7">
                        {% if stats.db_configured %}
                        <span class="text-success"><i class="bi bi-check-circle-fill me-1"></i>Connected</span>
                        {% else %}
                        <span class="text-danger"><i class="bi bi-x-circle-fill me-1"></i>Not configured</span>
                        {% endif %}
                    </dd>
                </dl>
            </div>
        </div>
    </div>
</div>
{% endblock %}
