<mat-card class="my-3">
    <mat-card-header class="text-bg-teal d-flex rounded-top py-2 px-3">
        <div class="flex-fill">
            <mat-card-title>
                {{ title }}
            </mat-card-title>
        </div>
        <span class="flex-spacer"></span>
        <div class="align-self-center text-end">
            <span class="fs-5 font-light">{{ subtitle }}</span>
        </div>
    </mat-card-header>
    <mat-card-content class="p-0">
        <table class="table table-striped table-condensed border-top border-light">
            <thead>
                <tr role="row" class="text-bg-teal bg-opacity-50">
                    <th class="align-middle w-auto ps-4">
                        <div class="text-start">
                            #
                        </div>
                    </th>
                    <th class="align-middle w-auto">
                        <div class="text-start">
                            Name
                        </div>
                    </th>
                    <th class="align-middle w-auto">
                        <div class="d-flex align-items-center justify-content-end">
                            Avg
                            <mat-icon fontIcon="arrow_downward" class="ms-1 icon-xsmall"></mat-icon>
                        </div>
                    </th>
                    <th class="align-middle w-auto">
                        <div class="text-end">
                            Heroes
                        </div>
                    </th>
                    <th class="align-middle w-auto pe-4">
                        <div class="text-end">
                            Titans
                        </div>
                    </th>
                </tr>
            </thead>
            <tbody>
                @for (member of getChampionsByPower(); track member; let index = $index) {
                    <tr role="row" class="align-middle">
                        <td class="cell text-start ps-4">
                            {{ (index+1) }}
                        </td>
                        <td class="cell text-start">
                            <div class="d-flex {{ member.champion ? 'text-green' : 'text-red' }}">
                                <mat-icon [fontIcon]="member.champion ? 'gpp_good' : 'gpp_bad'" class="me-2 icon-small"></mat-icon>
                                {{ member.name }}
                            </div>
                        </td>
                        <td class="cell font-monospace text-end">
                            {{ ((member.heroes.power + member.titans.power) / 2) | number : '1.0-0' }}
                        </td>
                        <td class="cell font-monospace text-end">
                            <span [class]="member.heroes.power < guildAverageHeroesPower ? 'text-orange' : 'text-megna'">{{ member.heroes.power | number : '1.0' }}</span>
                        </td>
                        <td class="cell font-monospace text-end">
                            <span [class]="member.titans.power < guildAverageTitansPower ? 'text-orange' : 'text-megna'">{{ member.titans.power | number : '1.0' }}</span>
                        </td>
                    </tr>
                }
            </tbody>
            <tfoot>
                <tr role="row" class="bg-light fw-medium align-middle">
                    <td colspan="3" class="cell text-end fw-medium pe-sm-2">
                        Totals
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildTotalHeroesPower | number : '1.0' }}
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildTotalTitansPower | number : '1.0' }}
                    </td>
                </tr>
                <tr role="row" class="bg-teal text-bg-primary fw-medium align-middle">
                    <td colspan="3" class="cell text-end pe-sm-2">
                        Averages
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildAverageHeroesPower | number : '1.0' }}
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildAverageTitansPower | number : '1.0' }}
                    </td>
                </tr>
            </tfoot>
        </table>
    </mat-card-content>
</mat-card>
<div class="d-flex align-items-center ps-2 mb-3">
    <mat-icon fontIcon="gpp_good" class="me-2 icon-small text-megna"></mat-icon> <span class="d-inline-block">Champion signet</span>
    <mat-icon fontIcon="gpp_bad" class="ms-3 me-2 icon-small text-red"></mat-icon> <span class="d-inline-block">No Champion signet</span>
    <mat-icon fontIcon="fiber_manual_record" class="ms-3 me-2 icon-small text-orange"></mat-icon> <span class="d-inline-block">Below average</span>
    <mat-icon fontIcon="fiber_manual_record" class="ms-3 me-2 icon-small text-megna"></mat-icon> <span class="d-inline-block">Above average</span>
</div>