/* ========================================
   BLOCK 2: Page-Specific CSS (pvi-unassigned-photographers)
   (this page only; Block 1 lives in pvi-master-frame.css)

   Structurally the leaderboard stylesheet with three swaps: the
   compare tray becomes a selection tray, the checkbox column becomes
   a selection column, and the rank badge is replaced by issue badges
   plus the .pct-na dash used by records with no metrics.

   COLOR POLICY: every color in this file resolves to a Block 1 design
   token. The report cluster's private navy/slate palette (#1b1f2e,
   #252b3b, #dde1ea, #9ba5c0, #c8d0e0, #f6f8fc, #f8f9ff, #6c757d,
   #adb5bd, #2e9e6b …) has been mapped onto the frame tokens instead —
   dark chrome to --dark-grey, secondary chrome to --mid-grey, borders
   to --light-grey, panel fills to --surface, in-card dividers to
   --rule, text on dark to --light-grey / --white. Nothing here paints
   from a literal hex except the two shim tokens declared below, which
   are marked for promotion to Block 1.
   ======================================== */

/* ── Token shims — DELETE WHEN BLOCK 1 ADOPTS THEM ────────────────
   Two gaps in the Block 1 palette, declared here scoped to this page
   so nothing leaks into the frame chrome:

   1. --red. scoreColor() in pvi-shared.js returns var(--green) /
      var(--orange) / var(--red). Block 1 supplies --green (#5cb85c)
      and --orange (#f0ad4e) but not --red, so the low band would
      resolve to nothing. Aliased to --dull-red, the frame's existing
      danger accent — no new hex, and the value is already right on
      the day Block 1 declares --red itself.

   2. The green soft-fill pair. Block 1 has a complete amber cluster
      (--amber-warn / --amber-warn-bg / --amber-warn-text) and the red
      equivalent (--dull-red / --dull-red-bg), but no green counterpart
      for the same pattern, which the % Green pill needs to sit beside
      its amber and red siblings. These two are the only literal hexes
      in this file; they belong in the Block 1 palette as --green-bg /
      --green-text, completing the third cluster. ── */
.pv-content {
    --red:        var(--dull-red);
    --green-bg:   #eaf7ea;  /* parallel to --amber-warn-bg / --dull-red-bg */
    --green-text: #2f6b2f;  /* parallel to --amber-warn-text */

    font-size: 0.875rem;
    padding: 1.5rem;
}

/* Page title — red rule instead of the leaderboard's green, since
   this page is an exception queue rather than a ranking. */
.pv-page-title {
    font-size: 1.2rem; font-weight: 700; color: var(--dark-grey);
    border-left: 4px solid var(--green);
    padding-left: 0.65rem; margin-bottom: 1.25rem;
}
.pv-page-title-alert { border-left-color: var(--red); }
.pv-page-title-alert i { color: var(--red); }

/* ── Breadcrumb ────────────────────────────────────────────────────
   Leaderboard › current page, matching the photographer-activity
   page. The separator is generated in CSS (alt text "" keeps screen
   readers from announcing it); the plain declaration is the fallback
   for browsers without content alt-text support. ── */
.pv-breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.pv-breadcrumb ol {
    display: flex; flex-wrap: wrap; align-items: center;
    list-style: none; margin: 0; padding: 0;
}
.pv-breadcrumb li { color: var(--mid-grey); }
.pv-breadcrumb li + li::before {
    content: "\203A";
    content: "\203A" / "";
    padding: 0 0.35rem;
    color: var(--mid-grey);
}
.pv-breadcrumb a {
    color: var(--green);
    text-decoration: none;
}
.pv-breadcrumb a:hover,
.pv-breadcrumb a:focus-visible {
    color: var(--green-hover);
    text-decoration: underline;
}

/* ── Filter bar ────────────────────────────────────────────────────
   Stays in multi-column flex-wrap layout down to 600 px.
   Below 600 px an accordion toggle collapses the controls into a
   compact 2-column grid to minimize vertical height. ── */
.pv-filter-bar {
    background: var(--white);
    border: 1px solid var(--light-grey);
    border-radius: 6px;
    padding: 0.75rem 1rem 0.6rem;
    margin-bottom: 1.25rem;
}

/* Controls row — flex-wrap so filters sit 2–3 per line naturally */
.pv-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 0.2rem; }
.filter-group label {
    font-size: 0.7rem; color: var(--mid-grey); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.pv-filter-controls select,
.pv-filter-controls input[type="date"],
.pv-filter-controls input[type="text"] {
    font-size: 0.82rem; min-width: 120px;
}

/* Divider between filter row and sort/preset row */
.pv-filter-divider {
    border-top: 1px solid var(--rule);
    margin: 0.6rem 0;
}

/* Sort section sits on the same controls row */
.pv-sort-label {
    font-size: 0.7rem; color: var(--green); font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    align-self: center; padding-top: 0.1rem; white-space: nowrap;
}

/* Preset input */
.pv-preset-input { min-width: 140px; max-width: 180px; }

/* Apply / Save buttons */
.pv-filter-actions {
    display: flex; align-items: flex-end; gap: 0.4rem; margin-left: auto;
}

/* ── Narrow accordion toggle (visible only <600 px) ── */
.pv-filter-toggle {
    display: none;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--light-grey);
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem; font-weight: 600; color: var(--dark-grey);
    text-align: left; cursor: pointer;
    margin-bottom: 1rem;
}
.pv-filter-toggle .chevron { transition: transform .2s; display: inline-block; float: right; }
.pv-filter-toggle.open .chevron { transform: rotate(180deg); }

.pv-filter-collapsible { /* no hiding above 600px; JS controls display below it */ }

@media (max-width: 600px) {
    .pv-content { padding: 0.75rem; }
    .pv-filter-toggle { display: block; }
    /* Collapse the bar's chrome when closed; restore when open */
    .pv-filter-bar { padding: 0; border: none; background: transparent; margin-bottom: 0; }
    .pv-filter-bar:has(.pv-filter-collapsible.open) {
        padding: 0.75rem 1rem 0.6rem;
        border: 1px solid var(--light-grey);
        background: var(--white);
        margin-bottom: 1.25rem;
    }
    .pv-filter-collapsible { display: none; }
    .pv-filter-collapsible.open { display: block; }

    /* 2-column grid inside the collapsed accordion */
    .pv-filter-collapsible .pv-filter-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        align-items: start;
    }
    .pv-filter-collapsible .pv-filter-divider { grid-column: 1 / -1; }
    .pv-filter-collapsible .pv-sort-label { grid-column: 1 / -1; }
    .pv-filter-collapsible .pv-filter-actions {
        grid-column: 1 / -1;
        margin-left: 0; justify-content: flex-end;
    }
    .pv-filter-controls select,
    .pv-filter-controls input[type="date"],
    .pv-filter-controls input[type="text"] {
        min-width: unset; width: 100%;
    }
    .pv-preset-input { max-width: unset; width: 100%; }
    .pv-sel-tray-inner { flex-direction: column; align-items: stretch; }
    .pv-sel-tray .sel-tray-actions { justify-content: flex-end; }
}

/* ── Selection checkbox column ── */
.cb-col { width: 36px !important; min-width: 36px; text-align: center !important; padding: 0.3rem 0.25rem !important; }
.pv-sel { cursor: pointer; width: 16px; height: 16px; accent-color: var(--red); vertical-align: middle; }
.pv-lb-table tr.row-selected td { background: var(--dull-red-bg); }

/* ── Inline selection tray (between filter bar and table) ──
   Same shell as the leaderboard compare tray; destructive actions
   live here rather than in a persistent bar, so Delete and Hide are
   unreachable until a record is actually selected. ── */
.pv-sel-tray {
    background: var(--dark-grey); border-radius: 6px;
    padding: 0.6rem 1rem; margin-bottom: 1rem;
}
.pv-sel-tray-inner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.75rem;
}
.sel-tray-label {
    color: var(--light-grey); font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.sel-tray-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; flex: 1; min-width: 0; }
.sel-tag {
    background: var(--mid-grey); color: var(--light-grey); font-size: 0.76rem;
    padding: 0.2rem 0.6rem; border-radius: 4px;
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.sel-tag .rm-tag {
    cursor: pointer; color: var(--light-grey); border: none; background: none;
    padding: 0; font-size: 1.1rem; line-height: 1;
}
.sel-tag .rm-tag:hover { color: var(--white); }
.sel-tray-count { color: var(--light-grey); font-size: 0.72rem; white-space: nowrap; font-style: italic; }
.sel-tray-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* Re-assign target — sized to fit a code plus a name without pushing
   the button off the tray row */
.pv-reassign-select {
    font-size: 0.8rem; width: auto; min-width: 150px; max-width: 220px;
}

/* ── Re-Assign button ──
   Green from the frame token, not Bootstrap's .btn-success (#198754),
   so the action matches --green everywhere else in the system. Paired
   with Bootstrap's .btn for metrics, the same way .pv-btn-adjust is in
   Block 1 §7. Disabled state mirrors .save-btn:disabled. ── */
.pv-btn-reassign {
    background-color: var(--green);
    border: none;
    color: var(--white);
    font-weight: 600;
}
.pv-btn-reassign:hover,
.pv-btn-reassign:focus {
    background-color: var(--green-hover);
    color: var(--white);
}
.pv-btn-reassign:focus-visible {
    outline: none;
    box-shadow: 0 0 0 .2rem var(--focus-ring-blue);
}
.pv-btn-reassign:disabled {
    background-color: var(--green);
    color: var(--white);
    opacity: .5;
    cursor: not-allowed;
}

/* Pivot: checkbox in column header */
.pv-pivot-cb-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pv-pivot-cb { cursor: pointer; width: 15px; height: 15px; accent-color: var(--red); margin-top: 3px; }

/* ── Issue-type badges ──
   Color comes from the row's data-issue value, so the row partials
   need no class token — one less name to register and no chance of a
   badge class and a filter value drifting apart. Unmatched maps to
   the amber cluster, no-underscore to the red cluster; an unknown
   issue type falls back to neutral chrome rather than to no styling. ── */
.issue-badge {
    display: inline-block; font-size: 0.67rem; font-weight: 600;
    padding: 0.1rem 0.4rem; border-radius: 3px; vertical-align: middle;
    background: var(--surface); color: var(--dark-grey);
}
[data-issue="unmatched"] .issue-badge {
    background: var(--amber-warn-bg); color: var(--amber-warn-text);
}
[data-issue="no-underscore"] .issue-badge {
    background: var(--dull-red-bg); color: var(--dull-red);
}

/* Leaderboard-family table */
.pv-table-wrap { overflow-x: auto; }
/* NO zoom shim. A `zoom: 0.86` rule used to sit here for 1401-1550px, to
   shrink the table through the dead band between the old 1400px pivot
   breakpoint and the width at which the grid genuinely fit. pvPivot now
   measures whether the table fits instead of testing the viewport, so the
   dead band does not exist and the shim has nothing left to cover. It is
   also actively unhelpful: zoom rescales the box pvPivot measures, so a
   scaled wrapper would report fitting at widths where it does not. */
/* Stacked label for the pivot header row (Photographer + Select in one cell) */
.pv-pl-hdr { display: flex; flex-direction: column; gap: 3px; font-size: 0.68rem; font-weight: 700; color: var(--mid-grey); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.pv-lb-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--light-grey);
    border-radius: 6px;
    overflow: hidden;
}
.pv-lb-table th {
    background: var(--dark-grey);
    color: var(--light-grey);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 0.55rem 0.45rem;
    /* Headers WRAP, and that is what keeps this grid on one screen. Half
       these columns hold a 34px score pill under a label two or three times
       its width - AVG TIME/SUBJECT, AVG SUBJECTS, COMPOSITION, ENGAGEMENT -
       so with nowrap the header alone set the column width and the data had
       nothing to do with it. Two short lines cost one row of height once, at
       the top of the table, and give the width back on every column at once. */
    white-space: normal;
    cursor: pointer;
    user-select: none;
}
/* Hover lifts the header to --mid-grey — the frame has no dark-chrome
   hover token, and mid-grey is the palette's next step up from dark */
.pv-lb-table th:hover { background: var(--mid-grey); color: var(--white); }
/* The Select column is not sortable — no pointer, no hover shift */
.pv-lb-table th.cb-col { cursor: default; }
.pv-lb-table th.cb-col:hover { background: var(--dark-grey); color: var(--light-grey); }
.pv-lb-table th.sort-asc::after  { content: ' \25B2'; font-size: 0.65rem; }
.pv-lb-table th.sort-desc::after { content: ' \25BC'; font-size: 0.65rem; }

.pv-lb-table td {
    padding: 0.45rem 0.45rem;
    border-bottom: 1px solid var(--rule);
    /* Still nowrap by default: the metric columns are short values and a
       wrapped score pill looks broken. The three free-text columns opt out
       below. */
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.82rem;
}

/* ── The three free-text columns ───────────────────────────────────
   Photographer, Folder and School Code carry names, not measurements,
   and between them they were most of the overflow: an unmatched code
   is a 20-character timestamp (20260819181348-MW1_0) sitting beside a
   badge on one unbreakable line, then a folder name of similar length,
   then "Ritter Elementary". Held to one line those three columns alone
   ran past 800px.

   MATCHED BY POSITION, so this is coupled to column order the same way
   the delegated sort in pvi-shared.js is - it reads cellIndex at run
   time. The row partials' header comments already require the partial
   and the <thead> to agree on order; these rules are a third reader of
   that same contract. Reorder the columns and fix all three together.

   overflow-wrap: anywhere, not word-break: break-word, because the
   codes have no spaces to break at and `anywhere` also lets the cell
   report a narrow minimum width to the table layout algorithm - which
   is the part that actually shrinks the column rather than just
   re-flowing text inside a column already sized to the longest word. */
.pv-lb-table th:nth-child(-n+3),
.pv-lb-table td:nth-child(-n+3) {
    white-space: normal;
    overflow-wrap: anywhere;
}
.pv-lb-table td:nth-child(1) { max-width: 190px; }
.pv-lb-table td:nth-child(2) { max-width: 160px; }
.pv-lb-table td:nth-child(3) { max-width: 130px; }

/* The badge drops below the code rather than extending the line. It is
   inline-block so it never splits mid-badge; this only decides whether
   it shares line one. */
.pv-lb-table td:nth-child(1) .issue-badge { margin-left: 0 !important; }
.pv-lb-table tr:last-child td { border-bottom: none; }
.pv-lb-table tr:hover td { background: var(--surface); }

/* Scored cells — background painted by colorizeScored() from data-val */
.scored {
    display: inline-block;
    text-align: center; font-weight: 700;
    color: var(--white); border-radius: 4px;
    padding: 0.25rem 0.4rem;
    min-width: 34px;
}
.scored a { color: inherit; text-decoration: none; }

/* Trend indicator */
.trend-up   { color: var(--green); font-size: 1rem; }
.trend-down { color: var(--red); font-size: 1rem; }
.trend-flat { color: var(--mid-grey); font-size: 1rem; }

/* Green/Orange/Red pct pills — soft-fill siblings, one per cluster */
.pct-green  { background: var(--green-bg); color: var(--green-text); font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
.pct-orange { background: var(--amber-warn-bg); color: var(--amber-warn-text); font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
.pct-red    { background: var(--dull-red-bg); color: var(--dull-red); font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
/* Absent metric — a record with no parsable prefix has no score to band */
.pct-na     { color: var(--mid-grey); font-size: 0.82rem; }

/* NOTE: .save-section / .save-btn / .save-btn-secondary are Block 1 §7
   chrome and are deliberately NOT declared here. The green fill on
   .save-btn-secondary is the documented decision, not a bug. */

/* ── Column-pivot navigator ────────────────────────────────────────
   Styles the transposed table pvPivot builds in
   pvi-unassigned-photographers.js: metrics become rows, each record
   becomes a navigable column filling the available width. Prev/Next
   page through records that do not fit at once.
   Column width: 100px each; label column: 90px sticky left.

   NOT INSIDE A MEDIA QUERY, DELIBERATELY. These rules lived in
   @media (max-width: 1400px) while pvPivot fired on that same width, so
   the two agreed by construction. pvPivot now decides for itself, by
   measuring whether the table fits its container, and it can fire at any
   viewport width — so a media-gated rule would leave the pivot unstyled
   at exactly the widths a wide screen still cannot fit an 18-column grid.
   Do not put these back behind a width test. ── */
.pv-pivot { margin-bottom: 1.5rem; }
.pv-pivot-nav {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.pv-pivot-nav .pv-nav-pg {
    flex: 1; text-align: center; font-size: 0.78rem; color: var(--mid-grey);
}
.pv-pivot-tbl {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 0.82rem;
}
.pv-pivot-tbl thead th {
    background: var(--surface); border-bottom: 2px solid var(--light-grey);
    padding: 0.4rem 0.3rem; white-space: normal;
    vertical-align: middle; text-align: center;
    width: 100px; min-width: 100px; max-width: 100px;
}
.pv-pivot-tbl tbody td {
    padding: 0.3rem 0.3rem; border-bottom: 1px solid var(--rule);
    vertical-align: middle; word-break: break-word;
}
.pv-pivot-tbl tbody tr:last-child td { border-bottom: none; }
.pv-pl {
    position: sticky; left: 0; background: var(--surface);
    border-right: 2px solid var(--light-grey); font-size: 0.68rem;
    font-weight: 700; color: var(--mid-grey); text-transform: uppercase;
    letter-spacing: .03em; z-index: 2;
    width: 90px; min-width: 90px; max-width: 90px;
    padding: 0.3rem 0.4rem;
    /* Wraps rather than clips — this page's labels are long
       (Avg Time/Subject) and the codes are long (a timestamped
       filename), so word-break is set here and on .pv-pc */
    white-space: normal; word-break: break-word;
}
.pv-pivot-tbl thead .pv-pl { z-index: 3; }
/* Record columns: allow the code to wrap, center content */
.pv-pc {
    text-align: center;
    white-space: normal; word-break: break-word;
    width: 100px; min-width: 100px; max-width: 100px;
}
