/* =====================================================================
   PLAYER COMPARISON PAGE: Player Overview card  (load AFTER style.css)
   Same look as the Player Statistics profile card. Themed by
   comparison-overview.js, which sets --tc-a, --tc-mid, --tc-accent,
   --tc-accent-soft and --team-logo on the card. Without them everything
   falls back to the normal CourtIQ blues.
   ===================================================================== */

.comparison-main .card.overview-card {
    padding: 0 0 16px;
    overflow: hidden;
    border-color: var(--tc-accent-soft, rgba(75, 130, 181, .30));
}

/* the heading stays for screen readers; the banner replaces it visually */
.comparison-main .card.overview-card > h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.overview-card .ov-empty { padding: 20px; color: #91abc9; font-size: 13px; }

/* ---------- team-coloured banner ---------- */

.overview-card .ov-banner {
    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: 24px 20px 20px;
    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 */
.overview-card .ov-banner::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 on the right */
.overview-card .ov-banner::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -26px;
    width: 220px;
    height: 220px;
    z-index: -1;
    pointer-events: none;
    transform: translateY(-50%);
    background: var(--team-logo, none) center / contain no-repeat;
    opacity: .18;
}

.overview-card .ov-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--tc-accent, #35c5f4);
    background: rgba(7, 22, 45, .6);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
    overflow: hidden;
}

/* beat the generic .av sizing from style.css */
.comparison-page .overview-card .ov-avatar .av {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 50%;
}

.overview-card .ov-id { min-width: 0; }

.overview-card .ov-id b {
    display: block;
    margin: 0 0 6px;
    font-size: 22px;
    line-height: 1.15;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .4);
    overflow-wrap: anywhere;
}

.overview-card .ov-id small {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, .86);
}

/* ---------- summary, tabs, stat boxes ---------- */

.overview-card .ov-summary,
.overview-card .ov-tabs,
.overview-card .ov-stats {
    margin-left: 16px;
    margin-right: 16px;
}

.overview-card .ov-summary {
    margin-top: 0;
    margin-bottom: 14px;
    color: #c4d3e7;
    font-size: 12px;
    line-height: 1.6;
}
.overview-card .ov-summary:empty { display: none; }

.overview-card .ov-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.overview-card .ov-tab {
    border: none;
    background: #123b60;
    color: #dcecff;
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
}
.overview-card .ov-tab:hover,
.overview-card .ov-tab.active {
    background: var(--tc-accent, #168ceb);
    color: #07162d;
    font-weight: 700;
}
.overview-card .ov-tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.overview-card .ov-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.overview-card .ov-stats div {
    min-width: 0;
    padding: 12px;
    background: #0b203b;
    border: 1px solid #1a4165;
    border-radius: 7px;
}

.overview-card .ov-stats span {
    display: block;
    margin-bottom: 7px;
    font-size: 10px;
    color: #91abc9;
}

.overview-card .ov-stats strong {
    font-size: 16px;
    color: var(--tc-accent, #35c5f4);
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .overview-card .ov-avatar { width: 88px; height: 88px; }
    .overview-card .ov-id b { font-size: 20px; }
}

/* =====================================================================
   FILL THE CARDS (no empty space)
   Every card in a row is as tall as the tallest one. These rules let the
   content of each card (stats grid, charts) stretch to use that height.
   ===================================================================== */

/* cards become flex columns: title on top, content takes the rest */
.comparison-main .row > .card {
    display: flex;
    flex-direction: column;
}

.comparison-main .row > .card > h2 { flex: 0 0 auto; }

/* Player Overview keeps its own banner layout */
.comparison-main .row > .card.overview-card { display: block; }

/* ---------- Key Stats Comparison ---------- */
.comparison-main #keystats {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* the grid is built by player-comparison.js: 1 header row + 5 stat rows */
.comparison-main #keystats .ks {
    flex: 1 1 auto;
    height: 100%;
    gap: 10px;
    align-items: stretch;
    grid-template-rows: auto repeat(5, minmax(46px, 1fr));
}

.comparison-main #keystats .ks .lab,
.comparison-main #keystats .ks .val {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.comparison-main #keystats .ks .val { font-size: 18px; }
.comparison-main #keystats .ks .lab { font-size: 12px; }

/* ---------- Charts ---------- */
/* The wrapper grows with the card; the canvas fills the wrapper. Keeping the
   canvas out of the flow stops Chart.js from growing the card on every resize. */
.comparison-main .row > .card > .cv {
    position: relative;
    flex: 1 1 auto;
    height: auto;
    min-height: 300px;
}

.comparison-main .row > .card > .cv > canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

/* radar is the only chart in the tall top row: give it more room */
.comparison-main .row.r1 > .card > .cv { min-height: 360px; }

@media (max-width: 760px) {
    .comparison-main .row > .card > .cv,
    .comparison-main .row.r1 > .card > .cv { min-height: 280px; }
    .comparison-main #keystats .ks { grid-template-rows: auto repeat(5, minmax(40px, 1fr)); }
}