/* NBA detail popup (nba_popover.js): the framed value that opens it, the popover above 720 px, the bottom sheet at 720 px and under. */

/* Trigger: a compact framed value that keeps the value's own colour (nba-rec-hit / nba-rec-miss, direction tones). */
.nba-dpop-btn {
    position: relative;   /* holds its visually-hidden words inside a scrolling table (no page-wide sideways scroll) */
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    max-width: 100%;
    margin: -2px -6px;
    padding: 1px 5px;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: inherit;
    font: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: inherit;
    vertical-align: baseline;
    cursor: pointer;
}
.nba-dpop-btn::after {
    content: '';
    flex: 0 0 auto;
    width: 4px;
    height: 4px;
    margin: -3px 1px 0 0;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(45deg);
}
.nba-dpop-btn:hover,
.nba-dpop-btn:focus-visible { background: var(--bg-surface-alt); border-color: var(--border-strong); color: inherit; }
.nba-dpop-btn[aria-expanded="true"],
.nba-dpop-btn[aria-expanded="true"]:hover { background: var(--color-primary-soft); border-color: var(--color-primary); color: inherit; }
.nba-dpop-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.nba-dpop-val { min-width: 0; }
/* A server-drawn figure before nba_popover.js upgrades it: the trigger's box without its frame, so nothing shifts. */
.nba-dpop-slot { display: inline-flex; margin: -2px -6px; padding: 1px 15px 1px 5px; border: 1px solid transparent; }
.nba-num .nba-dpop-btn { justify-content: flex-end; text-align: right; }
.nba-pc-val .nba-dpop-btn,
.nba-pl-fact dd .nba-dpop-btn { margin: -2px 0; white-space: nowrap; }   /* a card / drawer value: aligned with its label, one line */

/* The one popup. */
.nba-dpop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1150;
    display: flex;
    flex-direction: column;
    width: min(460px, calc(100vw - 16px));
    max-height: min(480px, calc(100vh - 16px));
    box-sizing: border-box;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    text-align: left;
    font-weight: 400;
    outline: none;
}
.nba-dpop.is-groups { width: min(420px, calc(100vw - 16px)); }
.nba-dpop-arrow {
    position: absolute;
    top: -7px;
    width: 12px;
    height: 12px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    transform: rotate(45deg);
}
.nba-dpop.is-above .nba-dpop-arrow { top: auto; bottom: -7px; transform: rotate(225deg); }
.nba-dpop-head { position: relative; padding: 12px 40px 6px 14px; }
.nba-dpop-title { margin: 0; font-size: var(--font-size-md); font-weight: 700; line-height: 1.3; color: var(--text-primary); }
.nba-dpop-figure { margin-left: 6px; font-weight: 700; }
.nba-dpop-figure.nba-rec-hit  { color: var(--nba-rec-hit); }
.nba-dpop-figure.nba-rec-miss { color: var(--nba-rec-miss); }
.nba-dpop-sub { margin: 2px 0 0; font-size: var(--font-size-xs); color: var(--text-muted); }
.nba-dpop-x {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.nba-dpop-x:hover,
.nba-dpop-x:focus-visible { background: var(--bg-surface-alt); color: var(--text-primary); }
.nba-dpop-x:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.nba-dpop-lead {
    margin: 0;
    padding: 0 14px 10px;
    border-bottom: 1px solid var(--border-soft);
    font-size: var(--font-size-sm);
    line-height: 1.45;
    color: var(--text-secondary);
}
.nba-dpop-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 14px; }
.nba-dpop-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
    padding: 8px 14px;
    background: var(--bg-surface-alt);
    border-top: 1px solid var(--border-soft);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* One line per game or date. */
.nba-dpop-table { width: 100%; margin: 4px 0 8px; border-collapse: collapse; font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; }
.nba-dpop-table th,
.nba-dpop-table td { padding: 6px; border-bottom: 1px solid var(--border-soft); text-align: left; white-space: nowrap; color: var(--text-primary); }
.nba-dpop-table th:first-child,
.nba-dpop-table td:first-child { padding-left: 0; }
.nba-dpop-table th:last-child,
.nba-dpop-table td:last-child { padding-right: 0; }
.nba-dpop-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.nba-dpop-table .nba-num { text-align: right; }
.nba-dpop-table tbody tr:last-child td { border-bottom: 0; }
.nba-dpop-table .nba-dpop-opp { color: var(--text-secondary); }
.nba-dpop-mark { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.nba-dpop-mark.is-hit  { color: var(--color-success-strong); }
.nba-dpop-mark.is-miss { color: var(--color-danger-strong); }
.nba-dpop-table .nba-lean { font-size: 0.7rem; padding: 0 6px; }

/* States: loading skeleton, empty, error. */
.nba-dpop-state { margin: 14px 0; font-size: var(--font-size-sm); color: var(--text-secondary); }
.nba-dpop-state.is-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-primary); }
.nba-dpop-retry { width: auto; }
.nba-dpop-skel { display: grid; gap: 10px; margin: 12px 0 14px; }
.nba-dpop-skel i { display: block; height: 12px; border-radius: var(--radius-sm); background: var(--border); }
.nba-dpop-skel i:nth-child(2) { width: 88%; }
.nba-dpop-skel i:nth-child(3) { width: 94%; }
.nba-dpop-skel i:nth-child(4) { width: 70%; }
.nba-dpop-skel i { animation: motion-pulse var(--motion-loop) var(--ease-out) infinite; }
.nba-dpop-line { display: block; }   /* a stacked value inside a trigger (the Model record cell) */

/* Grouped list (Out): one section per team, one player per line, position first; also the card's inline list. */
.nba-dpop-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 8px 0 10px; }
.nba-dpop-group h3 {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0 0 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-soft);
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.nba-dpop-group h3 span { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-muted); }
.nba-dpop-group ul { margin: 0; padding: 0; list-style: none; }
.nba-dpop-group li { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-size: var(--font-size-sm); line-height: 1.35; }
.nba-dpop-pos { flex: 0 0 3.2ch; color: var(--text-muted); font-size: var(--font-size-xs); font-weight: 700; }
.nba-dpop-name { min-width: 0; overflow-wrap: anywhere; color: var(--text-primary); }
.nba-dpop-group .nba-dpop-none { margin: 0; padding: 3px 0; color: var(--text-muted); font-size: var(--font-size-sm); }

.nba-dpop-short { display: none; }
.nba-dpop-scrim { position: fixed; inset: 0; z-index: 1140; background: rgba(0, 0, 0, 0.45); }   /* the site's one overlay dim */
@media (min-width: 721px) { .nba-dpop-scrim { display: none; } }
@media (max-width: 720px) {
    .nba-dpop.is-sheet {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-height: 82vh;
        border-bottom: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .nba-dpop.is-sheet .nba-dpop-arrow { display: none; }
    .nba-dpop.is-sheet .nba-dpop-head { padding: 16px 44px 6px 14px; }
    .nba-dpop.is-sheet .nba-dpop-head::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 2px;
        background: var(--border-strong);
    }
    .nba-dpop.is-sheet .nba-dpop-x { top: 14px; }
    .nba-dpop.is-sheet .nba-dpop-foot { border-radius: 0; padding-bottom: 12px; }
    .nba-dpop .nba-dpop-groups { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .nba-dpop-table { font-size: var(--font-size-xs); }
    .nba-dpop-table th,
    .nba-dpop-table td { padding: 6px 4px; }
    .nba-dpop-hide-ph { display: none; }
    .nba-dpop-long { display: none; }
    .nba-dpop-short { display: inline; }
}
