/* ============================================================
   fantasy-player-tool.css — Fantasy Player Tool Page

   Scoring settings + season selector + stat toggles + sortable table
   Dark theme matching the existing NBA Shot Chart Explorer
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- TOP BAR --- */
.top-bar {
    background-color: #16213e;
    padding: 14px 24px;
    border-bottom: 2px solid #e94560;
    text-align: center;
    position: relative;
}

.back-link {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #8892a8;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.back-link:hover {
    color: #e94560;
}

.app-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
}

.app-subtitle {
    font-size: 13px;
    color: #8892a8;
    margin-top: 2px;
}

/* --- COLLAPSIBLE PANELS --- */
.panel {
    background-color: #16213e;
    border-bottom: 1px solid #2a2a4a;
}

.panel-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #8892a8;
    transition: color 0.2s;
}

.panel-toggle:hover {
    color: #e94560;
}

.panel-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.panel-body {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.panel-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* --- SCORING SETTINGS --- */
.scoring-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 6px 24px 16px;
    max-width: 900px;
    margin: 0 auto;
}

.scoring-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scoring-item label {
    font-size: 12px;
    font-weight: 600;
    color: #c0c8d8;
    min-width: 36px;
    text-align: right;
}

.scoring-item input {
    width: 56px;
    padding: 5px 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    background-color: #0f3460;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.scoring-item input:focus {
    border-color: #e94560;
}

/* --- SEASON SELECTOR --- */
.season-bar {
    background-color: #121d36;
    border-bottom: 1px solid #2a2a4a;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.season-bar .selector-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #e94560;
    letter-spacing: 1px;
}

.season-select {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    background-color: #0f3460;
    color: #ffffff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.season-select:focus {
    border-color: #e94560;
}

.player-count {
    font-size: 12px;
    color: #5a6a8a;
    margin-left: auto;
}

/* --- VISIBLE STATS PANEL --- */
.stats-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 6px 24px 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.stats-checkboxes label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #c0c8d8;
    cursor: pointer;
    user-select: none;
}

.stats-checkboxes input[type="checkbox"] {
    accent-color: #e94560;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* --- TABLE CONTAINER --- */
.table-container {
    flex: 1;
    padding: 12px 16px 32px;
    overflow-x: auto;
}

/* --- PLAYER TABLE --- */
.player-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1100px;
}

.player-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.player-table th {
    background-color: #16213e;
    border-bottom: 2px solid #e94560;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8892a8;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: color 0.15s;
    text-align: right;
}

.player-table th:hover {
    color: #e94560;
}

.player-table th.sorted {
    color: #e94560;
}

.player-table th .sort-arrow {
    font-size: 9px;
    margin-left: 3px;
    opacity: 0;
    transition: opacity 0.15s;
}

.player-table th.sorted .sort-arrow {
    opacity: 1;
}

/* Left-align text columns */
.player-table th.col-rk,
.player-table th.col-name,
.player-table th.col-team,
.player-table th.col-pos {
    text-align: left;
}

.player-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #1e2a48;
    color: #d0d8e8;
    text-align: right;
    white-space: nowrap;
}

/* Left-align text columns */
.player-table td.col-rk,
.player-table td.col-name,
.player-table td.col-team,
.player-table td.col-pos {
    text-align: left;
}

.player-table td.col-name {
    font-weight: 600;
    color: #ffffff;
}

.player-table td.col-rk {
    color: #5a6a8a;
    font-weight: 600;
}

/* Alternating row stripes */
.player-table tbody tr:nth-child(even) {
    background-color: rgba(15, 52, 96, 0.2);
}

.player-table tbody tr:hover {
    background-color: rgba(233, 69, 96, 0.08);
}

/* Fantasy columns highlighted */
.player-table th.col-fantasy,
.player-table td.col-fantasy {
    color: #4ecca3;
    font-weight: 700;
}

.player-table th.col-fantasy {
    color: #4ecca3;
    border-bottom-color: #4ecca3;
}

/* --- LOADING STATE --- */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #5a6a8a;
    font-size: 16px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #2a2a4a;
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .top-bar {
        padding: 12px 16px;
    }

    .back-link {
        position: static;
        transform: none;
        display: block;
        margin-bottom: 6px;
        text-align: left;
    }

    .scoring-grid {
        padding: 6px 16px 16px;
        gap: 8px 14px;
    }

    .season-bar {
        padding: 10px 16px;
        flex-wrap: wrap;
    }

    .stats-checkboxes {
        padding: 6px 16px 16px;
    }

    .table-container {
        padding: 8px 8px 24px;
    }
}
