/* =====================================================================
   PLAYER STATISTICS PAGE  (load AFTER style.css)

   Layout: profile column on the LEFT (profile, shooting efficiency),
   statistics table on the RIGHT.

   The profile banner is themed by player-statistics.js, which sets
   --tc-a, --tc-mid, --tc-accent, --tc-accent-soft and --team-logo on
   .player-profile-card. Without them everything falls back to the
   normal CourtIQ blues, so an unknown team still looks fine.
   ===================================================================== */

/* ---------- layout ---------- */

.player-stats-page .player-stats-layout {
    grid-template-columns: minmax(430px, 480px) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    gap: 14px;
    align-items: start;
}

.player-stats-page .player-profile-card { grid-column: 1; grid-row: 1; }
.player-stats-page .shooting-card       { grid-column: 1; grid-row: 2; }
.player-stats-page .player-table-card   { grid-column: 2; grid-row: 1 / -1; min-height: 0; }

/* ---------- profile card: the main event ---------- */

.player-stats-page .player-profile-card {
    padding: 0 0 16px;
    overflow: hidden;
    border-color: var(--tc-accent-soft, #1b4165);
}

/* team-coloured banner */
.player-stats-page .profile-info {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin: 0 0 14px;
    padding: 26px 20px 22px;
    background: linear-gradient(115deg, var(--tc-a, #123d63) 0%, var(--tc-mid, #0f2f52) 55%, #0b203a 100%);
    box-shadow: inset 0 -3px 0 var(--tc-accent, #168cff);
}

/* faint half-court lines (same look as the teams banner) */
.player-stats-page .profile-info::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 78% 50%, transparent 0 62px, rgba(255, 255, 255, .08) 63px 65px, transparent 66px),
        linear-gradient(90deg, transparent calc(78% - 1px), rgba(255, 255, 255, .08) calc(78% - 1px) calc(78% + 1px), transparent calc(78% + 1px));
}

/* large faded team logo watermark on the right */
.player-stats-page .profile-info::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -26px;
    width: 230px;
    height: 230px;
    z-index: -1;
    pointer-events: none;
    transform: translateY(-50%);
    background: var(--team-logo, none) center / contain no-repeat;
    opacity: .18;
}

.player-stats-page .profile-avatar {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    background: rgba(7, 22, 45, .6);
    border: 3px solid var(--tc-accent, #35c5f4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #91abc9;
    font-size: 28px;
}

.player-stats-page .profile-id { min-width: 0; }

.player-stats-page .profile-info h3 {
    font-size: 24px;
    line-height: 1.15;
    margin: 0 0 6px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .4);
    overflow-wrap: anywhere;
}

.player-stats-page .profile-info p {
    font-size: 12px;
    color: rgba(255, 255, 255, .86);
}

.player-stats-page .profile-summary,
.player-stats-page .profile-tabs,
.player-stats-page .profile-stats {
    margin-left: 16px;
    margin-right: 16px;
}
.player-stats-page .profile-summary { margin-top: 0; }

/* style.css sets the tab row to width:100%; with side margins that overflowed the card */
.player-stats-page .profile-tabs {
    width: auto;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
}

.player-stats-page .profile-tab.active {
    background: var(--tc-accent, #168ceb);
    color: #07162d;
    font-weight: 700;
}
.player-stats-page .profile-tab:hover { background: var(--tc-accent, #168ceb); color: #07162d; }

.player-stats-page .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.player-stats-page .profile-stats strong { color: var(--tc-accent, #35c5f4); font-size: 16px; }

/* ---------- table: players first ---------- */

.player-stats-page .player-stats-table td { padding-top: 8px; padding-bottom: 8px; }

.player-stats-page .player-cell,
.player-stats-page .team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.player-stats-page .row-headshot {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    background: #1a2a42;
    border: 2px solid #1b4168;
}

.player-stats-page .player-cell-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.player-stats-page .row-team-logo {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    object-fit: contain;
}

.player-stats-page .team-cell span { color: #35c5f4; font-weight: 700; }

.player-stats-page .player-stats-table tbody tr:hover .row-headshot,
.player-stats-page .player-stats-table tbody tr.selected-player .row-headshot {
    border-color: #48c9ff;
}

/* the PPG column is the headline number */
.player-stats-page .player-stats-table td:nth-child(6) { color: #fff; font-weight: 700; }

/* ---------- shooting efficiency: room for the donuts ---------- */

.player-stats-page .shooting-card { padding: 18px 20px 20px; }

.player-stats-page .efficiency-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 10px;
}

.player-stats-page .efficiency-item { gap: 10px; }

.player-stats-page .donut {
    width: 100%;
    max-width: 78px;
}

.player-stats-page .donut span { font-size: 11px; font-weight: 700; }

/* ---------- smaller screens: stack, profile first ---------- */

@media (max-width: 1100px) {
    .player-stats-page .player-stats-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
    }
    .player-stats-page .player-profile-card,
    .player-stats-page .shooting-card,
    .player-stats-page .player-table-card {
        grid-column: 1;
        grid-row: auto;
    }
    .player-stats-page .profile-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
    .player-stats-page .efficiency-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .player-stats-page .profile-info { padding: 20px 16px 18px; }
    .player-stats-page .profile-avatar { width: 92px; height: 92px; }
    .player-stats-page .profile-info h3 { font-size: 20px; }
    .player-stats-page .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}