/**
 * v0.36.5.3.8 (5.3g) Phase 2 — heatmap.css
 *
 * Shared styling for Heatmap_Renderer output. Used by:
 *   - /stat/{id}/{year}/ multi-year heatmap (5.3g, MP §15.5 item 6)
 *   - /teams/ snapshot heatmap (v0.36.5.8 Class M, MP §12.4 #4)
 *   - /week/{year}/{week}/ weekly heatmap (NEW-B)
 *
 * Per master plan §12.5 cross-surface-drift risk: ALL heatmap consumers
 * share this stylesheet. Color policy lives here once.
 *
 * Color anchors taken from the existing tile/rank palette in
 * special-teams-card.css (#d4edda green family, #f8d7da red family) and
 * extended to a 5-stop quintile ramp.
 */

/* Container */
.nfl-heatmap {
    margin: 1.25rem 0;
}

.nfl-heatmap--empty {
    padding: 1.5rem;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    text-align: center;
    color: #50575e;
}

.nfl-heatmap__caption {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 0.5rem;
}

/* Horizontal scroll for narrow viewports */
.nfl-heatmap__grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #dcdcde;
    border-radius: 4px;
}

/* Grid table */
.nfl-heatmap__grid {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
    line-height: 1.2;
    background: #fff;
}

.nfl-heatmap__grid th,
.nfl-heatmap__grid td {
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid #f0f0f1;
    border-right: 1px solid #f0f0f1;
    white-space: nowrap;
}

.nfl-heatmap__grid tbody tr:last-child th,
.nfl-heatmap__grid tbody tr:last-child td {
    border-bottom: none;
}

.nfl-heatmap__grid th:last-child,
.nfl-heatmap__grid td:last-child {
    border-right: none;
}

/* Header cells */
.nfl-heatmap__corner {
    background: #f6f7f7;
    width: 64px;
    min-width: 64px;
}

.nfl-heatmap__col-header {
    background: #f6f7f7;
    color: #1d2327;
    font-weight: 600;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.nfl-heatmap__col-header.is-selected {
    background: #e7f1ff;
    color: #2271b1;
    box-shadow: inset 0 -2px 0 #2271b1;
}

.nfl-heatmap__col-header a,
.nfl-heatmap__row-header a {
    color: inherit;
    text-decoration: none;
}

.nfl-heatmap__col-header a:hover,
.nfl-heatmap__row-header a:hover {
    text-decoration: underline;
}

/* Row header (team abbr) */
.nfl-heatmap__row-header {
    background: #f6f7f7;
    color: #1d2327;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    padding-left: 12px;
    position: sticky;
    left: 0;
    z-index: 1;
    width: 64px;
    min-width: 64px;
}

/* Quintile cells. q1 = best 20%, q5 = worst 20%. Polarity flip is
 * handled at the data layer in Heatmap_Renderer::compute_quintiles —
 * q1 always means "best" regardless of higher-vs-lower-is-better.
 */
.nfl-heatmap__cell {
    color: #1d2327;
    font-variant-numeric: tabular-nums;
}

.nfl-heatmap__cell a {
    color: inherit;
    text-decoration: none;
    display: block;
    padding: 0;
    margin: 0;
}

.nfl-heatmap__cell a:hover {
    text-decoration: underline;
}

.nfl-heatmap__cell.is-q1 {
    background: #d4edda;
    color: #155724;
}

.nfl-heatmap__cell.is-q2 {
    background: #e6f3e1;
    color: #2c5e2a;
}

.nfl-heatmap__cell.is-q3 {
    background: #fff8e1;
    color: #856404;
}

.nfl-heatmap__cell.is-q4 {
    background: #fde4e4;
    color: #841a23;
}

.nfl-heatmap__cell.is-q5 {
    background: #f8d7da;
    color: #721c24;
}

.nfl-heatmap__cell.is-na {
    background: #f0f0f1;
    color: #8c8f94;
    font-style: italic;
}

@media (max-width: 600px) {
    .nfl-heatmap__grid {
        font-size: 0.78rem;
    }
    .nfl-heatmap__grid th,
    .nfl-heatmap__grid td {
        padding: 4px 6px;
    }
    .nfl-heatmap__corner,
    .nfl-heatmap__row-header {
        width: 48px;
        min-width: 48px;
    }
}
