{% extends 'admin/base.html' %}

{% block title %}{{ company.name }} · Company Overview{% endblock %}

{% block content %}
<div class="page-header">
    <div>
        <h1 class="page-title">{{ company.name }}</h1>
        <p class="page-subtitle">Full profile and activity overview for this organisation.</p>
    </div>
    <div class="page-actions">
        <a class="btn btn-secondary" href="{{ url_for('admin.companies') }}">
            <i class="fa-light fa-arrow-left"></i>
            <span>Back to Companies</span>
        </a>
    </div>
</div>

<div class="stats-grid">
    <article class="stat-card">
        <header class="stat-header">
            <span class="stat-icon approved"><i class="fa-light fa-id-card-clip"></i></span>
            <span class="stat-label">Status</span>
        </header>
        <div class="stat-value status status-{{ company.status }}">{{ company.status|capitalize }}</div>
        <footer class="stat-footer">
            {% if company.is_verified %}
                Email verified
            {% else %}
                Email verification pending
            {% endif %}
        </footer>
    </article>
    <article class="stat-card">
        <header class="stat-header">
            <span class="stat-icon total"><i class="fa-light fa-address-book"></i></span>
            <span class="stat-label">Contacts</span>
        </header>
        <div class="stat-value">{{ metrics.contacts }}</div>
        <footer class="stat-footer">Total stored leads</footer>
    </article>
    <article class="stat-card">
        <header class="stat-header">
            <span class="stat-icon pending"><i class="fa-light fa-envelope-open-text"></i></span>
            <span class="stat-label">Email Campaigns</span>
        </header>
        <div class="stat-value">{{ metrics.email_campaigns }}</div>
        <footer class="stat-footer">Campaigns created by this company</footer>
    </article>
    <article class="stat-card">
        <header class="stat-header">
            <span class="stat-icon rejected"><i class="fa-light fa-phone-volume"></i></span>
            <span class="stat-label">Call Campaigns</span>
        </header>
        <div class="stat-value">{{ metrics.call_campaigns }}</div>
        <footer class="stat-footer">Voice campaigns launched</footer>
    </article>
</div>

<div class="card mt-5">
    <div class="card-header">
        <div>
            <h2 class="card-title">Company Information</h2>
            <p class="card-subtitle">Key details provided during registration.</p>
        </div>
    </div>
    <div class="card-body company-info">
        <dl>
            <div class="info-row">
                <dt>Name</dt>
                <dd>{{ company.name }}</dd>
            </div>
            <div class="info-row">
                <dt>Email</dt>
                <dd>{{ company.email }}</dd>
            </div>
            <div class="info-row">
                <dt>Website</dt>
                <dd>
                    {% if company.website %}
                        <a href="{{ company.website }}" target="_blank" rel="noopener">{{ company.website }}</a>
                    {% else %}
                        <span class="text-muted">Not provided</span>
                    {% endif %}
                </dd>
            </div>
            <div class="info-row">
                <dt>Created</dt>
                <dd>{{ company.created_at.strftime('%Y-%m-%d %H:%M') if company.created_at else 'N/A' }}</dd>
            </div>
            <div class="info-row">
                <dt>Last Updated</dt>
                <dd>{{ company.updated_at.strftime('%Y-%m-%d %H:%M') if company.updated_at else 'N/A' }}</dd>
            </div>
            <div class="info-row">
                <dt>Description</dt>
                <dd>{{ company.description or '—' }}</dd>
            </div>
            <div class="info-row">
                <dt>Instructions</dt>
                <dd>{{ company.instructions or '—' }}</dd>
            </div>
            <div class="info-row">
                <dt>Welcome Message</dt>
                <dd>{{ company.welcome_message or '—' }}</dd>
            </div>
        </dl>
    </div>
</div>
{% endblock %}

