/* Players hub — premium data table. Renders inside .main (light tokens).
   Reusable people-table patterns (.identity-cell, .id-chip, .badge--with-dot)
   live in components.css; this file owns the page toolbar, table density,
   sort indicator and pagination. */

/* ─── Toolbar ─────────────────────────────────────────────────────────── */
.players-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.players-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.players-search__icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}
.players-filter__search { width: 100%; padding-left: 34px; }
/* Beat `.main .select { width: 100% }` so the filter selects size to content
   and sit inline in the flex toolbar instead of each taking a full row. */
.players-toolbar select.players-filter__select {
    width: auto;
    flex: 0 0 auto;
    min-width: 132px;
    max-width: 190px;
}

.players-filter-menu { position: relative; flex: 0 0 auto; }
.players-filter-menu summary {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 var(--space-base);
    list-style: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease;
}
.players-filter-menu summary::-webkit-details-marker { display: none; }
.players-filter-menu summary:hover { border-color: var(--color-text-muted); color: var(--color-text); }
.players-filter-menu[open] summary { border-color: var(--color-accent); color: var(--color-text); }
.players-filter-menu__body {
    position: absolute;
    z-index: 10;
    top: calc(100% + 6px);
    left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    width: min(440px, calc(100vw - 32px));
    padding: var(--space-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    box-shadow: var(--shadow-lg);
}
.players-filter-menu__field {
    display: grid;
    gap: 4px;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.players-count {
    flex: 1 1 auto;
    text-align: right;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    white-space: nowrap;
}

/* ─── Table ───────────────────────────────────────────────────────────── */
.players-table-card { position: relative; }
.players-loading {
    position: absolute;
    inset: 0 0 auto 0;
    z-index: 2;
    height: 3px;
    overflow: hidden;
    color: transparent;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    animation: players-loading-slide 1s linear infinite;
}
@keyframes players-loading-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}
.players-table { min-width: 1120px; }

.players-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
}
.players-sort-btn:hover { color: var(--color-text); }
.players-sort-btn__arrow {
    font-size: 9px;
    line-height: 1;
    opacity: 0;
    transition: opacity 120ms ease;
}
.players-sort-btn.is-active { color: var(--color-text); }
.players-sort-btn.is-active .players-sort-btn__arrow { opacity: 1; color: var(--color-accent); }

.data-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table .col-actions .btn + .btn { margin-left: var(--space-xs); }

.players-time { white-space: nowrap; }
.players-muted { color: var(--color-text-muted); }
.players-chip-cell { cursor: help; }

/* ─── Pagination ──────────────────────────────────────────────────────── */
/* Sticky bottom bar — the table grows to full height (no nested scroll), so a
   plain footer ends up far below the fold on big pages. Pin it to the bottom of
   the .main scrollport (32px = --space-xl padding) and bleed to the edges so it
   reads as a real footer and is always reachable. */
.players-pagination {
    position: sticky;
    bottom: calc(-1 * var(--space-xl));
    z-index: 5;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-md) calc(-1 * var(--space-xl)) calc(-1 * var(--space-xl));
    padding: var(--space-base) var(--space-xl);
    background: var(--surface-raised);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 20px -12px rgba(16, 24, 40, 0.18);
}
.players-pagination__label {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    min-width: 96px;
    text-align: center;
}
.players-pagination__spacer { flex: 1 1 auto; }
.players-pagination__hint { color: var(--color-text-muted); font-size: var(--text-sm); }
.players-refresh-btn[disabled] { opacity: 0.6; pointer-events: none; }

@media (max-width: 700px) {
    .players-toolbar { flex-direction: column; align-items: stretch; }
    .players-search,
    .players-filter__select,
    .players-filter-menu { flex: 1 1 auto; }
    .players-count { text-align: left; }
    .players-filter-menu__body {
        position: static;
        width: auto;
        margin-top: 6px;
        grid-template-columns: 1fr;
    }
    .players-pagination {
        flex-wrap: wrap;
        /* main drops to 16px side / 24px bottom padding on mobile — match the
           sticky bleed to those so the bar pins flush without overflowing. */
        margin: var(--space-md) calc(-1 * var(--space-base)) calc(-1 * var(--space-lg));
        bottom: calc(-1 * var(--space-lg));
        padding-left: var(--space-base);
        padding-right: var(--space-base);
    }
    .players-pagination__spacer { display: none; }
}
