/* =============================================================
   SALARY REPORT MODAL — salary_report_v4.css
   ============================================================= */

/* ── Backdrop + positioning ───────────────────────────────────── */
#salaryReportModal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

/* ── Modal shell ──────────────────────────────────────────────── */
.sr-modal {
    position: relative;
    background: #1a2332;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    width: min(1100px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

/* ── Header ───────────────────────────────────────────────────── */
.sr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #1a2942 100%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sr-title {
    font-size: 1rem;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.02em;
}

/* Right side of header: year selector + close */
.sr-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sr-year-select {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.82rem;
    padding: 4px 8px;
    cursor: pointer;
}
.sr-year-select:focus { outline: none; border-color: #3b82f6; }

.sr-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.12s, background 0.12s;
}
.sr-close:hover { color: #f1f5f9; background: rgba(255,255,255,0.08); }

/* ── Loading state ────────────────────────────────────────────── */
.sr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px;
    color: #64748b;
    font-size: 0.9rem;
}

.sr-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: srSpin 0.7s linear infinite;
}

/* Inline pts-loading indicator in column header */
.sr-pts-loading {
    font-size: 0.65rem;
    color: #64748b;
    font-style: italic;
    animation: srPulse 1.2s ease-in-out infinite;
}

@keyframes srSpin   { to { transform: rotate(360deg); } }
@keyframes srPulse  { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

.sr-error {
    padding: 16px 20px;
    color: #fca5a5;
    font-size: 0.85rem;
}

/* ── Summary bar ──────────────────────────────────────────────── */
.sr-summary-bar {
    display: flex;
    gap: 0;
    background: #151f2e;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    overflow-x: auto;
}

.sr-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    border-right: 1px solid rgba(255,255,255,0.06);
    min-width: 100px;
}

.sr-summary-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 3px;
    white-space: nowrap;
}

.sr-summary-value {
    font-size: 1rem;
    font-weight: 700;
    color: #10b981;
}

/* ── Toolbar (pos filters + sort controls) ────────────────────── */
.sr-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #1e2d3f;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.sr-pos-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.sr-pos-btn {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #334155;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}
.sr-pos-btn:hover  { border-color: #3b82f6; color: #93c5fd; }
.sr-pos-btn.active { background: rgba(59,130,246,0.15); border-color: #3b82f6; color: #93c5fd; }

.sr-sort-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.sr-sort-label {
    font-size: 0.72rem;
    color: #64748b;
    margin-right: 2px;
    white-space: nowrap;
}

.sr-sort-btn {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.sr-sort-btn:hover  { color: #cbd5e1; background: rgba(255,255,255,0.04); }
.sr-sort-btn.active { color: #f1f5f9; background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); }

/* ── Table wrapper ────────────────────────────────────────────── */
.sr-table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
}

/* ── Table ────────────────────────────────────────────────────── */
.sr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

/* Sticky header */
.sr-th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #1a2332;
    padding: 8px 10px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}

.sr-th-rank     { width: 36px; text-align: center; }
.sr-th-pos      { width: 50px; }
.sr-th-franchise{ max-width: 130px; }
.sr-th-num      { text-align: right; width: 72px; }
.sr-th-eff      { color: #7c3aed; } /* purple tint for efficiency cols */
.sr-th-type     { width: 100px; }

/* Data rows */
.sr-row {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.1s;
}
.sr-row:hover         { background: rgba(255,255,255,0.03); }
.sr-row-expired       { background: rgba(239,68,68,0.04); }
.sr-row-expiring      { background: rgba(245,158,11,0.04); }

.sr-td {
    padding: 7px 10px;
    color: #cbd5e1;
    vertical-align: middle;
}

.sr-td-rank {
    text-align: center;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Player name cell — flexbox for badge + name + meta */
.sr-td-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 150px;
}

.sr-player-name {
    font-weight: 600;
    color: #e2e8f0;
}

.sr-nfl-team {
    font-size: 0.7rem;
    color: #64748b;
}

.sr-age {
    font-size: 0.68rem;
    color: #475569;
    white-space: nowrap;
}

/* Position badge */
.sr-pos-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.sr-td-franchise {
    font-size: 0.78rem;
    color: #94a3b8;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-td-num  { text-align: right; }

/* Column-specific colors */
.sr-pts      { color: #e2e8f0; font-weight: 600; }
.sr-salary   { color: #10b981; font-weight: 700; }
.sr-ktc      { color: #7c3aed; font-weight: 600; }
.sr-eff      { color: #a78bfa; font-size: 0.78rem; } /* pay efficiency — purple */
.sr-ktc-eff  { color: #818cf8; font-size: 0.78rem; } /* value efficiency — indigo */

/* Contract status coloring */
.sr-expired  { color: #ef4444; font-weight: 700; }
.sr-expiring { color: #f59e0b; font-weight: 700; }

.sr-td-type {
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
}

/* ── Tier separator rows ──────────────────────────────────────── */
.sr-tier-row td  { padding: 0; }

.sr-tier-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px;
    background: rgba(99,102,241,0.08);
    border-top: 1px solid rgba(99,102,241,0.2);
    border-bottom: 1px solid rgba(99,102,241,0.2);
    flex-wrap: wrap;
}

.sr-tier-row-final .sr-tier-line {
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: none;
    background: rgba(255,255,255,0.02);
}

.sr-tier-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #a5b4fc;
    min-width: 50px;
}

/* Tier stat chips — each subtotal displayed as a pill */
.sr-tier-stat {
    font-size: 0.67rem;
    color: #64748b;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 4px;
    padding: 1px 7px;
    white-space: nowrap;
}

/* Distinct colors for each stat type */
.sr-tier-pts  { color: #cbd5e1; border-color: rgba(203,213,225,0.2); }
.sr-tier-eff  { color: #a78bfa; border-color: rgba(167,139,250,0.25); } /* pay eff */
.sr-tier-pct  { color: #34d399; border-color: rgba(52,211,153,0.25);  } /* % of pts */

/* ── Injury badges ────────────────────────────────────────────── */
.sr-inj-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.sr-inj-ir  { background: rgba(239,68,68,0.2);  color: #fca5a5; }
.sr-inj-out { background: rgba(239,68,68,0.2);  color: #fca5a5; }
.sr-inj-d   { background: rgba(249,115,22,0.2); color: #fdba74; }
.sr-inj-q   { background: rgba(245,158,11,0.15);color: #fcd34d; }

/* ── Empty state ──────────────────────────────────────────────── */
.sr-empty {
    padding: 40px;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

/* ── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .sr-modal {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .sr-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Hide lower-priority columns on small screens */
    .sr-th:nth-child(4),  .sr-td:nth-child(4),   /* Franchise */
    .sr-th:nth-child(8),  .sr-td:nth-child(8),   /* Pay Eff */
    .sr-th:nth-child(10), .sr-td:nth-child(10),  /* Value Eff */
    .sr-th:nth-child(11), .sr-td:nth-child(11) { /* Type */
        display: none;
    }
}
