/* Page-specific styles for leaderboards.html */
main {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

    .page-header h2 {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

.nav-button-container {
    text-align: center;
    margin-bottom: 2rem;
}

.nav-button {
    text-decoration: none;
    background-color: #007bff;
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: inline-block;
}

    .nav-button:hover {
        background-color: #0056b3;
        color: white !important;
        text-decoration: none;
    }

.category-selector {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.selector-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: center;
}

#category-select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

    #category-select:hover {
        border-color: #007bff;
    }


/* Leaderboard table */
.leaderboard-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: visible;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.leaderboard-header {
    background-color: #333;
    color: white;
    padding: 1.5rem;
    text-align: center;
}

    .leaderboard-header h3 {
        color: white;
        margin: 0;
        font-size: 1.4rem;
    }

.leaderboard-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}

    .leaderboard-table col.col-rank {
        width: 12%;
    }

    .leaderboard-table col.col-player {
        width: 50%;
    }

    .leaderboard-table col.col-stat1 {
        width: 19%;
    }

    .leaderboard-table col.col-stat2 {
        width: 19%;
    }


    .leaderboard-table th {
        background-color: #f8f9fa;
        padding: 1rem 0.5rem;
        text-align: left;
        font-weight: bold;
        border-bottom: 2px solid #ddd;
        border-left: none;
        border-right: none;
        border-top: none;
        position: relative;
        transition: background-color 0.3s, border-color 0.3s;
    }

        .leaderboard-table th.sortable {
            cursor: pointer;
        }

            .leaderboard-table th.sortable:hover {
                background-color: #e9ecef;
            }

        .leaderboard-table th .sort-indicator {
            float: right;
            margin-left: 5px;
            font-size: 0.8em;
        }


    .leaderboard-table td {
        padding: 0.8rem 0.5rem;
        border-bottom: 1px solid #eee;
        border-left: none;
        border-right: none;
        border-top: none;
        position: relative;
        vertical-align: middle;
        word-wrap: break-word;
        overflow-wrap: break-word;
        transition: border-color 0.3s;
    }

        .leaderboard-table th:nth-child(1),
        .leaderboard-table td:nth-child(1) {
            text-align: center;
        }

        .leaderboard-table th:nth-child(2),
        .leaderboard-table td:nth-child(2) {
            text-align: left;
        }

        .leaderboard-table th:nth-child(3),
        .leaderboard-table td:nth-child(3) {
            text-align: center;
        }

        .leaderboard-table th:nth-child(4),
        .leaderboard-table td:nth-child(4) {
            text-align: center;
        }

    .leaderboard-table tr:hover {
        background-color: #f8f9fa;
    }

.rank-cell {
    font-weight: bold;
}

.player-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

    .player-cell > div {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        flex-grow: 1;
        min-width: 0;
        flex-basis: 0;
    }


    .player-cell:hover .player-name a {
        color: #007bff !important;
        text-decoration: underline !important;
    }

.team-logo {
    width: 32px;
    height: 32px;
    border-radius: 2px;
    flex-shrink: 0;
}

.player-name {
    font-weight: bold;
    font-size: 1.05rem;
}

    .player-name .player-name-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .player-name a {
        color: #2c5aa0;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        max-width: 100%;
        vertical-align: middle;
    }

.rookie-badge {
    background-color: #6c757d;
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    line-height: 1;
    flex-shrink: 0;
}

.all-star-badge {
    color: gold;
    text-shadow: 0 0 2px #a18000;
    font-size: 1.1em;
    line-height: 1;
    flex-shrink: 0;
}

.team-name {
    color: #666;
    font-size: 0.9rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.stat-cell {
    font-weight: 500;
    text-align: center;
}

.first-place {
    background-color: gold;
    color: black;
    border-radius: 4px;
    padding: 2px 5px;
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 26px;
}

.second-place {
    background-color: silver;
    color: black;
    border-radius: 4px;
    padding: 2px 5px;
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 26px;
}

.third-place {
    background-color: #cd7f32;
    color: white;
    border-radius: 4px;
    padding: 2px 5px;
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 26px;
}

.table-controls {
    padding: 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

    .table-controls .control-item {
        margin: 0 0.5rem;
        display: inline-flex;
        gap: 0.3rem;
        align-items: center;
    }

        .table-controls .control-item > label {
            font-size: 0.95rem;
            margin-right: 0.25rem;
        }

        .table-controls .control-item select,
        .table-controls .control-item input[type="number"],
        .dropdown-toggle-btn {
            padding: 0.5rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
            background-color: #f8f9fa;
            color: #333;
            line-height: 1.5;
            transition: background-color 0.3s, border-color 0.3s, color 0.3s;
        }

        .table-controls .control-item select {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            padding-right: 1.5em;
            background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236c757d%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
            background-repeat: no-repeat;
            background-position: right .5em top 50%, 0 0;
            background-size: .65em auto, 100%;
        }


#min-games {
    width: 60px;
}

.dropdown-team-filter {
    position: relative;
    display: inline-block;
    min-width: 150px;
}

.dropdown-toggle-btn {
    width: 100%;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#team-filter-btn-text {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 5px;
}

.dropdown-arrow {
    font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
}

.dropdown-toggle-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.team-checklist-container.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 150px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: background-color 0.3s, border-color 0.3s;
}

    .team-checklist-container.dropdown-menu label {
        display: flex;
        align-items: center;
        padding: 0.35rem 0.6rem;
        cursor: pointer;
        font-size: 0.95rem;
        white-space: nowrap;
        border-bottom: 1px solid #f0f0f0;
        transition: background-color 0.3s, border-color 0.3s;
    }

        .team-checklist-container.dropdown-menu label:last-child {
            border-bottom: none;
        }

        .team-checklist-container.dropdown-menu label:hover {
            background-color: #e9ecef;
        }

    .team-checklist-container.dropdown-menu input[type="checkbox"] {
        margin-right: 0.6rem;
        flex-shrink: 0;
    }

/* Dark Mode Styles */
.dark-mode .page-header p {
    color: #aaa;
}

    .dark-mode .page-header p a {
        color: #f06292;
    }

.dark-mode .nav-button {
    background-color: #8ab4f8;
    color: #121212 !important;
}

    .dark-mode .nav-button:hover {
        background-color: #a7c7fa;
        color: #121212 !important;
    }

.dark-mode .category-selector,
.dark-mode .leaderboard-container {
    background-color: #1e1e1e;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.dark-mode #category-select {
    background-color: #2c2c2c;
    border-color: #444;
    color: #e0e0e0;
}

.dark-mode .leaderboard-table th {
    background-color: #2c2c2c;
    border-bottom-color: #444;
}

    .dark-mode .leaderboard-table th.sortable:hover {
        background-color: #383838;
    }

.dark-mode .leaderboard-table td {
    border-bottom-color: #333;
}

.dark-mode .leaderboard-table tr:hover {
    background-color: #2c2c2c;
}

.dark-mode .player-name a {
    color: #8ab4f8;
}

.dark-mode .player-cell:hover .player-name a {
    color: #a7c7fa !important;
}

.dark-mode .team-name {
    color: #aaa;
}

.dark-mode .rookie-badge {
    background-color: #9e9e9e;
    color: #121212;
}

.dark-mode .table-controls {
    background-color: #2c2c2c;
    border-bottom-color: #444;
}

    .dark-mode .table-controls .control-item select,
    .dark-mode .table-controls .control-item input[type="number"],
    .dark-mode .dropdown-toggle-btn {
        background-color: #383838;
        border-color: #555;
        color: #e0e0e0;
    }

    .dark-mode .table-controls .control-item select {
        background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23bbbbbb%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
    }

.dark-mode .team-checklist-container.dropdown-menu {
    background-color: #383838;
    border-color: #555;
}

    .dark-mode .team-checklist-container.dropdown-menu label {
        border-bottom-color: #4a4a4a;
    }

        .dark-mode .team-checklist-container.dropdown-menu label:hover {
            background-color: #4a4a4a;
        }

@media (max-width: 768px) {
    .leaderboard-table th, .leaderboard-table td {
        padding: 0.5rem 0.3rem;
        font-size: 0.9rem;
    }

    .team-logo {
        width: 28px;
        height: 28px;
    }

    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        display: none;
    }

    .leaderboard-table col.col-rank {
        width: 20%;
    }

    .leaderboard-table col.col-player {
        width: 55%;
    }

    .leaderboard-table col.col-stat1 {
        width: 25%;
    }

    .leaderboard-table col.col-stat2 {
        display: none;
    }

    .table-controls {
        gap: 0.5rem;
        align-items: stretch;
    }

        .table-controls .control-item {
            margin: 0.25rem 0;
            width: 100%;
            justify-content: space-between;
        }

            .table-controls .control-item > label {
                flex-shrink: 0;
                margin-right: 0.5rem;
            }

            .table-controls .control-item select,
            .table-controls .control-item input[type="number"],
            .dropdown-team-filter {
                flex-grow: 1;
                min-width: 100px;
            }

    .team-checklist-container.dropdown-menu {
        max-height: 120px;
    }
}