/* Giira stats pages -- dashboard, player explorer, player detail.
   Extends style.css tokens; chart ink tokens live in charts.js. */

.page-head {
    margin: 1.5rem 0 1rem;
}

.page-head h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.page-head .subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* --- stat tiles ------------------------------------------------------- */
.tile-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 1rem 0 1.5rem;
}

.stat-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}

.stat-tile .tile-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.stat-tile .tile-value {
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.2rem;
}

.stat-tile .tile-value.hero {
    font-size: 2.4rem;
    color: var(--gold);
}

.stat-tile .tile-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* --- chart cards ------------------------------------------------------ */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem 0.8rem;
    margin-bottom: 1.25rem;
}

.chart-card h3 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.chart-card .chart-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.chart-host {
    position: relative;
    width: 100%;
}

.chart-empty {
    color: var(--text-muted);
    padding: 1.5rem 0;
    text-align: center;
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: #222220;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
    color: var(--text-primary);
    z-index: 30;
    min-width: 110px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.chart-tooltip div { margin-top: 2px; color: var(--text-secondary); }
.chart-tooltip strong { color: var(--text-primary); }

.chart-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.1rem 0.2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }

.chart-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: baseline;
}

/* --- filter chips ----------------------------------------------------- */
.chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0.75rem 0 1rem;
}

.chip {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

.chip:hover { color: var(--text-primary); border-color: var(--gold-dark); }

.chip.active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold-light);
    font-weight: 600;
}

/* --- data tables ------------------------------------------------------ */
.stats-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.stats-table th {
    text-align: left;
    padding: 0.6rem 0.9rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.stats-table td {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stats-table tr:last-child td { border-bottom: none; }
.stats-table tbody tr:hover { background: var(--bg-card-hover); }

.stats-table a { color: var(--text-primary); text-decoration: none; }
.stats-table a:hover { color: var(--gold-light); }

.num-good { color: var(--high); }
.num-bad { color: var(--low); }

/* --- player search ---------------------------------------------------- */
.search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.search-input {
    flex: 1;
    min-width: 220px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
}

.search-input:focus { outline: none; border-color: var(--gold); }

.search-select {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
}

/* --- player detail header --------------------------------------------- */
.player-head {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin: 1.5rem 0 0.25rem;
}

.player-head h2 { font-size: 1.6rem; }

.team-chip {
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
}

/* --- player drill-down links (match tables + cards) -------------------- */
.player-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--border-light);
}

.player-link:hover {
    color: var(--gold-light);
    border-bottom-color: var(--gold);
}

nav a.nav-active { color: var(--gold-light); }

/* --- footer links ------------------------------------------------------ */
.footer-links {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-top: 0.4rem;
    font-size: 0.82rem;
}

.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--gold-light); }

@media (max-width: 640px) {
    .tile-row { grid-template-columns: repeat(2, 1fr); }
    .stat-tile .tile-value { font-size: 1.35rem; }
    .stat-tile .tile-value.hero { font-size: 1.8rem; }
}
