﻿/* =====================================================================
   statistics.css — Statistics page styles
   Matches the banner-photo + clean table design from the mockup.
   ===================================================================== */

/* ── Banner ──────────────────────────────────────────────────────────── */
.stats-banner {
    border-radius: 8px 8px 0 0;
    background-color: #1a3a5c; /* fallback when image not loaded */
    background-size: cover;
    background-position: center;
    padding: 18px 20px 14px;
    color: #fff;
}

.stats-banner-title {
    font-size: 24px;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    margin-bottom: 10px;
}

/* ── Banner nav rows ─────────────────────────────────────────────────── */
.stats-nav-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}

.stats-nav-divider {
    color: rgba(255,255,255,0.45);
    font-size: 16px;
    margin: 0 2px;
}

.stats-nav-pill {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    border: 1.5px solid rgba(255,255,255,0.5);
    color: #fff;
    background: rgba(0,0,0,0.25);
    font-family: Arial, sans-serif;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

    .stats-nav-pill.active {
        background: #fff;
        color: #1a1a1a;
        border-color: #fff;
        text-shadow: none;
        font-weight: bold;
    }

/* ── Stat group tabs ─────────────────────────────────────────────────── */
.stats-sg-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.stats-sg-pill {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.9);
    background: transparent;
    font-family: Arial, sans-serif;
}

    .stats-sg-pill.active {
        background: rgba(255,255,255,0.22);
        border-color: rgba(255,255,255,0.7);
    }

/* ── Filter bar ──────────────────────────────────────────────────────── */
.stats-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: #f5f5f0;
    border: 1px solid #ddd;
    border-top: none;
    padding: 10px 16px;
}

.stats-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-filter-label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.stats-filter-bar select {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.stats-table {
    table-layout: fixed;
    width: 100%;
}

#stats-table-wrap {
    overflow-x: auto;
    width: 100%;
}

    .stats-table th.col-season,
    .stats-table td.col-season {
        width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stats-table td.col-name,
    .stats-table th.col-name {
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* ── Sort chip strip ─────────────────────────────────────────────────── */
.stats-sort-strip {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    padding: 9px 16px 8px;
    border: 1px solid #ddd;
    border-top: none;
    background: #fff;
}

.stats-sort-label {
    font-size: 12px;
    color: #777;
    margin-right: 2px;
}

.stats-col-chip {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    color: #555;
    background: #fff;
    font-family: Arial, sans-serif;
}

    .stats-col-chip.active {
        background: #1a3a5c;
        color: #fff;
        border-color: #1a3a5c;
    }

/* ── Stats card & table ──────────────────────────────────────────────── */
.stats-card {
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    min-height: 200px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: Arial, sans-serif;
}

    .stats-table thead th {
        padding: 8px 12px;
        text-align: left;
        background: #f0f0eb;
        border-bottom: 1px solid #ddd;
        font-weight: bold;
        font-size: 11px;
        color: #555;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        white-space: nowrap;
        cursor: pointer;
        user-select: none;
    }

        .stats-table thead th:hover {
            color: #1a3a5c;
        }

        .stats-table thead th.sorted {
            color: #1a3a5c;
        }

        .stats-table thead th.num,
        .stats-table td.num {
            text-align: right;
        }

    .stats-table tbody tr {
        border-bottom: 1px solid #eee;
    }

        .stats-table tbody tr:last-child {
            border-bottom: none;
        }

        .stats-table tbody tr:hover {
            background: #f9f9f5 !important;
        }

        .stats-table tbody tr.alt {
            background: cornsilk;
        }

    .stats-table td {
        padding: 8px 12px;
        font-size: 13px;
    }

        .stats-table td.sorted {
            font-weight: bold;
        }

.rank-cell {
    color: #888;
    font-size: 12px;
    min-width: 28px;
}

.entity-link {
    color: #185FA5;
    text-decoration: none;
    font-weight: bold;
}

    .entity-link:hover {
        text-decoration: underline;
    }

.sec-tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #e8f0f8;
    color: #1a3a5c;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Loading / error states ──────────────────────────────────────────── */
.stats-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: #777;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.stats-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #1a3a5c;
    border-radius: 50%;
    animation: stats-spin 0.7s linear infinite;
}

@keyframes stats-spin {
    to {
        transform: rotate(360deg);
    }
}

.stats-error {
    padding: 30px 20px;
    text-align: center;
    color: #a32d2d;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.stats-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #777;
    font-family: Arial, sans-serif;
    flex-wrap: wrap;
    gap: 8px;
}

.pg-info {
    color: #777;
}

.pg-btns {
    display: flex;
    gap: 3px;
    align-items: center;
}

.pg-btn {
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    font-family: Arial, sans-serif;
    min-width: 28px;
}

    .pg-btn.active {
        background: #1a3a5c;
        color: #fff;
        border-color: #1a3a5c;
    }

    .pg-btn:disabled {
        opacity: 0.35;
        cursor: default;
    }

.pg-ellipsis {
    padding: 0 4px;
    color: #aaa;
}

/* ── Responsive: narrow screens ──────────────────────────────────────── */
@media (max-width: 600px) {
    .stats-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .stats-filter-group {
        justify-content: space-between;
    }

    .stats-filter-bar select {
        flex: 1;
    }

    .stats-banner-title {
        font-size: 18px;
    }

    /* On small screens hide secondary stat columns — keep rank, name, active stat */
    .stats-table thead th.num:not(.sorted),
    .stats-table td.num:not(.sorted) {
        display: none;
    }

    .stats-sort-strip {
        gap: 4px;
    }
}

/* ── Column width constraints ────────────────────────────────────────── */
/* Use fixed layout so col widths are respected */
.stats-table {
    table-layout: fixed;
}

    /* Name columns: constrained, text truncates if needed */
    .stats-table th.col-name,
    .stats-table td.col-name {
        width: 160px;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Rank col: tight */
    .stats-table th.col-rank,
    .stats-table td.col-rank {
        width: 36px;
    }

    /* Grade col: tight */
    .stats-table th.col-grade,
    .stats-table td.col-grade {
        width: 44px;
    }

    /* Stat (num) cells: shrink to content */
    .stats-table td.num,
    .stats-table th.num {
        width: 64px;
        white-space: nowrap;
    }
