/* Player Rankings Table Styles */

/* Frozen panes functionality */
.rankings-table-container {
    position: relative;
    overflow-x: auto;
}

/* Mobile only: Add height restriction for sticky headers to work */
@media (max-width: 768px) {
    .rankings-table-container {
        max-height: 70vh;
        overflow: auto;
    }
}

.table {
    position: relative;
}

/* Freeze header row */
.table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f5f5f5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
}

/* Freeze first column (position) */
.table th:first-child,
.table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: white;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

/* Freeze second column (player name) */
.table th:nth-child(2),
.table td:nth-child(2) {
    position: sticky;
    left: 50px; /* Width of first column */
    z-index: 5;
    background-color: white;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

/* Header intersection styling */
.table thead th:first-child,
.table thead th:nth-child(2) {
    z-index: 15;
    background-color: #f5f5f5;
}

/* Row hover effects for frozen columns */
.table tbody tr:hover td:first-child,
.table tbody tr:hover td:nth-child(2) {
    background-color: #f9f9f9;
}

/* Sortable table headers */
.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
    white-space: nowrap;
}

.sortable i.fas {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8em;
}

.sortable.sort-asc i.fas,
.sortable.sort-desc i.fas {
    opacity: 1;
}

.sortable.sort-asc i.fas::before {
    content: "\f0de"; /* fa-sort-up */
}

.sortable.sort-desc i.fas::before {
    content: "\f0dd"; /* fa-sort-down */
}

/* Highlight sorted column */
.table tbody td.sorted {
    background-color: rgba(211, 86, 2, 0.05);
}

/* Hover effect for sortable headers */
.sortable:hover {
    background-color: rgba(211, 86, 2, 0.1);
}

/* Animation for sorting */
.table tbody tr {
    transition: background-color 0.2s ease;
}

/* Rank badges */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 16px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.65rem;
    padding: 0 3px;
    margin-right: 2px;
}



.position-badge {
    background-color: #6c757d;
    color: white;
}

.division-rank-badge {
    background-color: var(--primary);
    color: white;
    margin-left:2px;
}

.overall-rank-badge {
    background-color: #ff9800;
    color: white;
}

.seed-badge {
    background-color: #28a745;
    color: white;
}

.elo-badge {
    background-color: #6c757d;
    color: white;
}

.rank-icon {
    margin-right: 3px;
    font-size: 0.5rem;
}

/* Single row filter controls */
.filter-controls.single-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.filter-controls.single-row .filter-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
}

.filter-controls.single-row .ranking-filter-group {
    min-width: 150px;
}

.filter-controls.single-row .search-filter-group {
    flex: 1.5;
    min-width: 200px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .filter-controls.single-row {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .filter-controls.single-row .filter-group {
        flex: 1 1 calc(33.33% - 15px);
        min-width: 120px;
    }
    
    .filter-controls.single-row .search-filter-group {
        flex: 1 1 100%;
        margin-top: 5px;
    }
}

@media (max-width: 768px) {
    .filter-section {
        padding: 15px;
    }
    
    .filter-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .filter-controls.single-row {
        gap: 10px;
    }
    
    .filter-controls.single-row .filter-group {
        flex: 1 1 calc(50% - 10px);
        margin-bottom: 10px;
    }
    
    .filter-group label {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .form-select, .form-control {
        font-size: 14px;
        padding: 8px 10px;
        height: 38px;
    }
}

@media (max-width: 576px) {
    .filter-section.mobile-friendly {
        padding: 12px;
        border-radius: 8px;
    }
    
    .filter-title {
        font-size: 16px;
        margin-bottom: 12px;
        text-align: center;
    }
    
    .filter-controls.single-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-controls.single-row .filter-group {
        flex: 1 1 100%;
        margin-bottom: 0;
        width: 100%;
    }
    
    .filter-group label {
        font-size: 14px;
        display: block;
        margin-bottom: 4px;
    }
    
    .form-select, .form-control {
        width: 100%;
        max-width: 100%;
        height: 40px;
        font-size: 15px;
        padding: 8px 12px;
        border-radius: 6px;
    }
    
    /* Make the ranking method more prominent */
    .filter-controls.single-row .ranking-filter-group {
        order: -1;
        background-color: rgba(211, 86, 2, 0.05);
        padding: 10px;
        border-radius: 6px;
        margin-bottom: 5px;
    }
    
    /* Make the search box more prominent */
    .filter-controls.single-row .search-filter-group {
        order: 1;
        margin-top: 5px;
    }
    
    .filter-controls.single-row .search-filter-group .form-control {
        height: 44px;
        font-size: 16px;
    }
}

/* Decider percentage column styling */
.table th[data-sort="decider_percentage"],
.table td:nth-child(10) { /* Decider % column */
    text-align: center;
    width: 80px;
    min-width: 70px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sortable i.fas {
        margin-left: 2px;
        font-size: 0.7em;
    }
    
    /* Adjust frozen columns for mobile - make them narrower */
    .table th:first-child, .table td:first-child {
        width: 35px;
        min-width: 35px;
        padding: 5px 4px;
        font-size: 0.8rem;
    }
    
    .table th:nth-child(2), .table td:nth-child(2) {
        left: 35px; /* Smaller first column on mobile */
        width: 120px;
        min-width: 120px;
        padding: 5px 6px;
    }
    

    
    /* Make badges smaller on mobile */
    .table td:nth-child(2) .rank-badge {
        font-size: 0.5rem;
        min-width: 18px;
        height: 12px;
        padding: 0 2px;
        margin-left: 1px;
    }
    
    /* Hide less important columns on mobile */
    .table th:nth-child(12), .table td:nth-child(12) { /* Game Points */
        display: none;
    }
    
    .table th:nth-child(14), .table td:nth-child(14) { /* Rating */
        display: none;
    }
    
    /* Adjust decider percentage column for mobile */
    .table th[data-sort="decider_percentage"],
    .table td:nth-child(10) {
        width: 60px;
        min-width: 50px;
        font-size: 0.85rem;
    }
}
