/* =============================================
   PATRIOTS ROSTER — MODERN REDESIGN
   ============================================= */

:root {
    --pf-navy:       #0d1b2a;
    --pf-navy-mid:   #1a2f45;
    --pf-navy-light: #223650;
    --pf-silver:     #9eadbd;
    --pf-silver-lt:  #c8d6e0;
    --pf-red:        #c8102e;
    --pf-red-lt:     #f5c2cb;
    --pf-gold:       #d4a017;
    --pf-white:      #f5f7f9;
    --pf-bg:         #f0f3f6;
    --pf-border:     #dde3ea;
    --pf-ps-bg:      #eef3ff;
    --pf-ps-border:  #c5d4f0;
    --pf-ir-bg:      #fff2f3;
    --pf-ir-border:  #f5c2cb;
    --pf-green:      #2d7a4f;
    --font-head:     'Barlow Condensed', sans-serif;
    --font-body:     'Barlow', sans-serif;
    --rd1:           #ffd700;
    --rd2:           #e8e8e8;
    --rd3:           #cd7f32;
    --rd4:           #b8c8d8;
    --rd5:           #d0e8d0;
    --rd6:           #e8d8f0;
    --rd7:           #f0e8d0;
    --udfa:          #e8e8e8;
}

.pf-roster-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px 48px;
    font-family: var(--font-body);
    color: var(--pf-navy);
}

.pf-roster-wrap * {
    box-sizing: border-box;
}

.pf-roster-header {
    background: var(--pf-navy);
    color: white;
    padding: 20px 24px 16px;
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}
.pf-roster-header h1 {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    margin: 0;
}
.pf-roster-year-badge {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    background: var(--pf-red);
    color: white;
    padding: 3px 10px;
    border-radius: 2px;
    letter-spacing: 0.05em;
}
.pf-roster-hdr-count {
    font-family: var(--font-head);
    font-size: 0.95rem;
    color: var(--pf-silver);
    letter-spacing: 0.03em;
    margin-left: auto;
}

.pf-roster-controls-panel {
    background: white;
    border-bottom: 1px solid var(--pf-border);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    position: sticky;
    top: 55px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pf-roster-search-box {
    position: relative;
    flex: 1 1 200px;
    min-width: 160px;
}
.pf-roster-search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1.5px solid var(--pf-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.95rem;
}
.pf-roster-search-box input:focus { border-color: var(--pf-navy-mid); outline: none; }
.pf-roster-search-box::before {
    content: '🔍';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    pointer-events: none;
}

.pf-roster-filter-select {
    padding: 8px 10px;
    border: 1.5px solid var(--pf-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color .2s;
    flex-shrink: 0;
}
.pf-roster-filter-select:focus { border-color: var(--pf-navy-mid); outline: none; }

.pf-roster-btn-reset {
    padding: 8px 14px;
    background: var(--pf-navy);
    color: white;
    border: none;
    border-radius: 4px;
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.pf-roster-btn-reset:hover { background: var(--pf-navy-mid); }

.pf-roster-player-count {
    font-family: var(--font-head);
    font-size: 0.88rem;
    color: var(--pf-silver);
    letter-spacing: 0.02em;
    margin-left: auto;
    flex-shrink: 0;
}
.pf-roster-player-count span { color: var(--pf-navy); font-weight: 700; }

.pf-roster-section-header {
    background: var(--pf-navy);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-top: 18px;
    border-radius: 4px 4px 0 0;
}
.pf-roster-section-header .pf-roster-sec-label {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.pf-roster-section-header .pf-roster-sec-badge {
    background: rgba(255,255,255,0.15);
    color: white;
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 2px;
}
.pf-roster-ir-header     { background: #8b1c2a; }
.pf-roster-ps-header     { background: #1b3a6b; }
.pf-roster-psi-header    { background: #1b5c6b; }
.pf-roster-nri-header    { background: #4a3a00; }
.pf-roster-pup-header    { background: #5c2d6b; }
.pf-roster-fut-header    { background: #1a4a2a; }
.pf-roster-reserve-header{ background: #2a2a2a; }
.pf-roster-exempt-header { background: #6b1a00; }
.pf-roster-fa-header     { background: #003a4a; }

.pf-roster-table-wrap {
    overflow-x: auto;
    background: white;
    border: 1px solid var(--pf-border);
    border-top: 0;
    border-radius: 0 0 4px 4px;
    margin-bottom: 4px;
}

/* Highly specific table rules to override theme defaults */
.pf-roster-wrap table.pf-roster-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-family: var(--font-body) !important;
    font-size: 0.93rem !important;
    margin: 0 !important;
}

.pf-roster-wrap table.pf-roster-table thead tr {
    background: #eef1f5 !important;
    border-bottom: 2px solid var(--pf-border) !important;
}

.pf-roster-wrap table.pf-roster-table th {
    font-family: var(--font-head) !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: var(--pf-navy) !important;
    padding: 9px 10px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    user-select: none !important;
    text-align: left !important;
    border-right: 1px solid var(--pf-border) !important;
    border-top: none !important;
    border-left: none !important;
}
.pf-roster-wrap table.pf-roster-table th:last-child { border-right: 0 !important; }
.pf-roster-wrap table.pf-roster-table th:hover { background: #e0e6ee !important; }
.pf-roster-wrap table.pf-roster-table th.pf-roster-sorted-asc, 
.pf-roster-wrap table.pf-roster-table th.pf-roster-sorted-desc { color: var(--pf-red) !important; }
.pf-roster-wrap table.pf-roster-table th .pf-roster-sort-arrow { opacity: 0.35; font-size: 0.65rem; margin-left: 3px; }
.pf-roster-wrap table.pf-roster-table th.pf-roster-sorted-asc .pf-roster-sort-arrow,
.pf-roster-wrap table.pf-roster-table th.pf-roster-sorted-desc .pf-roster-sort-arrow { opacity: 1; color: var(--pf-red); }

.pf-roster-wrap table.pf-roster-table tbody tr {
    border-bottom: 1px solid var(--pf-border) !important;
    transition: background .1s !important;
}
.pf-roster-wrap table.pf-roster-table tbody tr:last-child { border-bottom: 0 !important; }
.pf-roster-wrap table.pf-roster-table tbody tr:hover { background: #f4f8fc !important; }

.pf-roster-wrap table.pf-roster-table tbody tr.pf-roster-row-ir { background: var(--pf-ir-bg) !important; }
.pf-roster-wrap table.pf-roster-table tbody tr.pf-roster-row-ps { background: var(--pf-ps-bg) !important; }

.pf-roster-wrap table.pf-roster-table td {
    padding: 8px 10px !important;
    border-right: 1px solid var(--pf-border) !important;
    border-top: none !important;
    border-left: none !important;
    border-bottom: none !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}
.pf-roster-wrap table.pf-roster-table td:last-child { border-right: 0 !important; }

.pf-roster-col-num   { width: 48px; text-align: center !important; font-weight: 700; font-family: var(--font-head); font-size: 1rem; color: var(--pf-navy-mid); }
.pf-roster-col-name  { min-width: 160px; }
.pf-roster-col-pos   { width: 60px; text-align: center !important; }
.pf-roster-col-age   { width: 50px; text-align: center !important; }
.pf-roster-col-ht    { width: 60px; text-align: center !important; }
.pf-roster-col-wt    { width: 60px; text-align: center !important; }
.pf-roster-col-exp   { width: 60px; text-align: center !important; }
.pf-roster-col-draft { width: 80px; text-align: center !important; }
.pf-roster-col-sig   { width: 80px; text-align: center !important; }

.pf-roster-player-name-cell { 
    font-weight: 600; 
    color: var(--pf-navy);
    line-height: 1.2;
}

.pf-roster-badge-pos {
    display: inline-block;
    background: var(--pf-navy);
    color: white;
    font-family: var(--font-head);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 2px;
    text-align: center;
    min-width: 30px;
}
.pf-roster-badge-pos.pf-roster-pos-QB { background: #7a1e1e; }
.pf-roster-badge-pos.pf-roster-pos-RB { background: #1e5c7a; }
.pf-roster-badge-pos.pf-roster-pos-FB { background: #1e4a7a; }
.pf-roster-badge-pos.pf-roster-pos-WR { background: #3a1e7a; }
.pf-roster-badge-pos.pf-roster-pos-TE { background: #1e7a5c; }
.pf-roster-badge-pos.pf-roster-pos-OL { background: #4a5568; }
.pf-roster-badge-pos.pf-roster-pos-DL { background: #2d4a1e; }
.pf-roster-badge-pos.pf-roster-pos-LB { background: #6b4e1e; }
.pf-roster-badge-pos.pf-roster-pos-DB { background: #1e3d7a; }
.pf-roster-badge-pos.pf-roster-pos-K  { background: #5a1e7a; }
.pf-roster-badge-pos.pf-roster-pos-P  { background: #7a1e6b; }
.pf-roster-badge-pos.pf-roster-pos-LS { background: #4a4a4a; }

.pf-roster-rd-pill {
    display: inline-block;
    font-family: var(--font-head);
    font-size: 0.78rem;
    min-width: 28px;
    text-align: center;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #444;
}
.pf-roster-rd-pill.pf-roster-rd1 { background: var(--rd1); border-color: #c8a800; color: #222; }
.pf-roster-rd-pill.pf-roster-rd2 { background: var(--rd2); border-color: #aaa; color: #333; }
.pf-roster-rd-pill.pf-roster-rd3 { background: var(--rd3); border-color: #a05a10; color: white; }
.pf-roster-rd-pill.pf-roster-rd4 { background: var(--rd4); border-color: #8090a8; color: #222; }
.pf-roster-rd-pill.pf-roster-rd5 { background: var(--rd5); border-color: #5a9c6a; color: #222; }
.pf-roster-rd-pill.pf-roster-rd6 { background: #6a2fa0; border-color: #4e1f7a; color: white; }
.pf-roster-rd-pill.pf-roster-rd7 { background: var(--rd7); border-color: #b09060; color: #333; }
.pf-roster-rd-pill.pf-roster-udfa { background: #888; border-color: #666; color: white; }

.pf-roster-expiring { color: var(--pf-red); font-weight: 700; }

.pf-roster-exempt-icon { color: var(--pf-red); font-size: 0.85rem; cursor: help; margin-left: 4px; }

.pf-roster-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.pf-roster-stat-card {
    background: white;
    border: 1px solid var(--pf-border);
    border-radius: 6px;
    overflow: hidden;
}
.pf-roster-stat-card-header {
    background: var(--pf-navy);
    color: white;
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 9px 14px;
}
.pf-roster-stat-card-body { padding: 12px 14px; }

.pf-roster-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f3f6;
    font-size: 0.84rem;
}
.pf-roster-stat-row:last-child { border-bottom: 0; }
.pf-roster-stat-row .pf-roster-stat-label { color: #555; }
.pf-roster-stat-row .pf-roster-stat-val { 
    font-weight: 700; 
    font-family: var(--font-head); 
    font-size: 1rem;
    color: var(--pf-navy); 
}
.pf-roster-stat-row .pf-roster-stat-bar-wrap { flex: 1; margin: 0 10px; height: 4px; background: #eee; border-radius: 2px; overflow: hidden; }
.pf-roster-stat-row .pf-roster-stat-bar { height: 100%; background: var(--pf-navy); border-radius: 2px; transition: width .4s; }
.pf-roster-stat-row .pf-roster-stat-bar.pf-roster-bar-red  { background: var(--pf-red); }
.pf-roster-stat-row .pf-roster-stat-bar.pf-roster-bar-gold { background: var(--pf-gold); }

tr.pf-roster-hidden-row { display: none !important; }

.pf-roster-no-results {
    text-align: center;
    padding: 24px;
    color: var(--pf-silver);
    font-family: var(--font-head);
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: none;
}

.pf-roster-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 0 4px;
}
.pf-roster-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #555;
}
.pf-roster-legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

[data-pf-roster-tip] { position: relative; }
[data-pf-roster-tip]:hover::after {
    content: attr(data-pf-roster-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--pf-navy);
    color: white;
    font-family: var(--font-head);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 200;
    letter-spacing: 0.02em;
    pointer-events: none;
}

@media (max-width: 700px) {
    .pf-roster-col-ht, .pf-roster-col-wt, .pf-roster-col-exp { display: none !important; }
    .pf-roster-wrap table.pf-roster-table th.pf-roster-th-ht, 
    .pf-roster-wrap table.pf-roster-table th.pf-roster-th-wt, 
    .pf-roster-wrap table.pf-roster-table th.pf-roster-th-exp { display: none !important; }

    /* Mobile: collapse controls panel */
    .pf-roster-controls-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
    }

    .pf-roster-controls-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 11px 16px;
        background: white;
        border: none;
        cursor: pointer;
        font-family: var(--font-head);
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--pf-navy);
    }

    .pf-roster-toggle-chevron {
        margin-left: auto;
        transition: transform 0.2s ease;
    }

    .pf-roster-controls-panel.pf-controls-open .pf-roster-toggle-chevron {
        transform: rotate(180deg);
    }

    .pf-roster-controls-inner {
        display: none;
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px 12px;
        border-top: 1px solid var(--pf-border);
    }

    .pf-roster-controls-panel.pf-controls-open .pf-roster-controls-inner {
        display: flex;
    }

    .pf-roster-search-box {
        flex: none;
        min-width: unset;
        width: 100%;
    }

    .pf-roster-filter-select {
        width: 100%;
    }

    .pf-roster-btn-reset {
        width: 100%;
    }

    .pf-roster-player-count {
        margin-left: 0;
        padding: 6px 0 2px;
        text-align: center;
    }
}

/* Hide toggle button on desktop */
@media (min-width: 701px) {
    .pf-roster-controls-toggle { display: none; }
    .pf-roster-controls-inner {
        display: contents; /* Let children participate in flex layout normally */
    }
}