<mat-card class="my-3">
    <mat-card-header class="bg-megna text-bg-primary 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="table-responsive p-0">
        <table class="table table-striped table-condensed border-top border-light">
            <thead>
                <tr role="row" class="bg-megna text-bg-primary bg-opacity-50">
                    <th scope="col" class="align-middle w-auto ps-4">
                        <div class="text-start">
                            #
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="d-flex align-items-center text-start">
                            Name
                            <mat-icon fontIcon="arrow_upward" class="ms-1 icon-xsmall"></mat-icon>
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-start">
                            ID
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-start">
                            Last Login
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-start">
                            Dismissal Delay
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            Dungeon
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            Activity
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            Prestige
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            War Fights
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            Adventures
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            Score
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto">
                        <div class="text-end">
                            Name
                        </div>
                    </th>
                    <th scope="col" class="align-middle w-auto pe-4">
                        <div class="text-end">
                            Rewards
                        </div>
                    </th>
                </tr>
            </thead>
            <tbody>
                @for (member of getMembersByName(); 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">
                            <mat-icon [fontIcon]="member.champion ? 'gpp_good' : 'gpp_bad'" class="me-2 icon-small {{ member.champion ? 'text-green' : 'text-muted' }}"></mat-icon>
                            <span [class]="member.champion ? 'text-green' : ''">{{ member.name }}</span>
                        </div>
                    </td>
                    <td class="cell font-monospace text-start">
                        <span class="me-3">{{ member.id }}</span>
                    </td>
                    <td class="cell font-monospace text-start">
                        <span class="me-3">{{ member.lastLoginTime + '000' | date: 'dd/MM HH:mm' }}</span>
                    </td>
                    <td class="cell font-monospace text-start">
                        <span [class]="member.inactivity.daysLeft < daysToWarn ? 'text-red' : ''">{{ member.inactivity.dropDelay }}</span>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ member.stat.todayDungeonActivity | number : '1.0' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                <span [class]="member.stat.dungeonActivitySum < guildSumAverages.titanite ? 'text-orange' : 'text-megna'">{{ member.stat.dungeonActivitySum | number : '1.0' }}</span>
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ member.stat.todayActivity | number : '1.0' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                <span [class]="member.stat.activitySum < guildSumAverages.activity ? 'text-orange' : 'text-megna'">{{ member.stat.activitySum | number : '1.0' }}</span>
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ member.stat.todayPrestige | number : '1.0' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                <span [class]="member.stat.prestigeSum < guildSumAverages.prestige ? 'text-orange' : 'text-megna'">{{ member.stat.prestigeSum | number : '1.0' }}</span>
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <span [class]="!member.champion ? 'text-muted' : member.clanWarSum < guildSumAverages.war ? 'text-orange' : 'text-megna'">{{ member.clanWarSum }}</span>
                    </td>
                    <td class="cell font-monospace text-end">
                        <span [class]="member.adventureSum < guildSumAverages.adventure ? 'text-orange' : 'text-megna'">{{ member.adventureSum }}</span>
                    </td>
                    <td class="cell font-monospace text-end">
                        <span [class]="member.score < guildSumAverages.score ? 'text-orange' : 'text-megna'">{{ member.score | number : '1.0' }}</span>
                    </td>
                    <td class="cell text-start">
                        <div class="d-flex">
                            <span [class]="member.champion ? 'text-green' : ''">{{ member.name }}</span>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end pe-4">
                        <span [class]="member.rewards < guildSumAverages.rewards ? 'text-orange' : 'text-megna'">{{ member.rewards | number : '1.0' }}</span>
                    </td>
                </tr>
                }
            </tbody>
            <tfoot>
                <tr role="row" class="bg-light fw-medium align-middle">
                    <td colspan="5" class="cell text-end fw-medium pe-sm-2">
                        Totals
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ guildTodayTotal.titanite | number : '1.0' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                {{ guildSumTotal.titanite | number : '1.0' }}
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ guildTodayTotal.activity | number : '1.0' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                {{ guildSumTotal.activity | number : '1.0' }}
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ guildTodayTotal.prestige | number : '1.0' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                {{ guildSumTotal.prestige | number : '1.0' }}
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildSumTotal.war | number : '1.0' }}
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildSumTotal.adventure | number : '1.0' }}
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildSumTotal.score | number : '1.0' }}
                    </td>
                    <td colspan="2" class="cell font-monospace text-end pe-4">
                        {{ guildSumTotal.rewards }}
                    </td>
                </tr>
                <tr role="row" class="bg-megna text-bg-primary fw-medium align-middle">
                    <td colspan="5" class="cell text-end pe-sm-2">
                        Averages
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ guildTodayAverages.titanite | number : '1.0-1' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                {{ guildSumAverages.titanite | number : '1.0-1' }}
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ guildTodayAverages.activity | number : '1.0-1' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                {{ guildSumAverages.activity | number : '1.0-1' }}
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        <div class="hstack gap-2">
                            <div class="value px-1 ms-auto">
                                {{ guildTodayAverages.prestige | number : '1.0-1' }}
                            </div>
                            <div class="vr"></div>
                            <div class="value px-1">
                                {{ guildSumAverages.prestige | number : '1.0-1' }}
                            </div>
                        </div>
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildSumAverages.war | number : '1.0-1' }}
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildSumAverages.adventure | number : '1.0-1' }}
                    </td>
                    <td class="cell font-monospace text-end">
                        {{ guildSumAverages.score | number : '1.0-1' }}
                    </td>
                    <td colspan="2" class="cell font-monospace text-end pe-4">
                        {{ guildSumAverages.rewards | number : '1.0-1' }}
                    </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-muted"></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-red"></mat-icon> <span class="d-inline-block">Inactivity &gt; {{ daysToWarn }} days</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>