/* ============================================
   TOURNAMENT ROUND STATISTICS COMPONENT
   Standalone CSS for TournamentRoundStatistics component
   ============================================ */

.tournament-round-statistics {
    margin-bottom: 2rem;
}

/* ============================================
   FILTER BAR (matching player stats design)
   ============================================ */
.tournament-round-statistics .filter-bar-enhanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.875rem;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tournament-round-statistics .filter-group-enhanced {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

/* Refresh button group - make it align properly */
.tournament-round-statistics .filter-group-enhanced:last-child {
    display: flex;
    justify-content: flex-end;
}

.tournament-round-statistics .filter-label-enhanced {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4a5568;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tournament-round-statistics .filter-select-enhanced {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #2d3748;
    background: white;
    transition: all 0.15s ease;
    cursor: pointer;
    width: 100%;
}

.tournament-round-statistics .filter-select-enhanced:hover {
    border-color: #4299e1;
    background: #fafbfc;
}

.tournament-round-statistics .filter-select-enhanced:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.08);
    background: white;
}

/* Refresh button styling */
.tournament-round-statistics .btn {
    padding: 0.5rem 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}

.tournament-round-statistics .btn-outline-primary {
    color: #4299e1;
    border: 1px solid #4299e1;
    background: white;
}

.tournament-round-statistics .btn-outline-primary:hover:not(:disabled) {
    background: #4299e1;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.2);
}

.tournament-round-statistics .btn-outline-primary:active:not(:disabled) {
    transform: translateY(0);
}

.tournament-round-statistics .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tournament-round-statistics .btn svg {
    flex-shrink: 0;
}

/* ============================================
   STATISTICS CONTENT SECTION
   ============================================ */
.tournament-round-statistics .statistics-content {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.tournament-round-statistics .statistic-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #f7fafc;
    border-bottom: 1px solid #e5e7eb;
}

.tournament-round-statistics .statistic-title h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.tournament-round-statistics .round-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: linear-gradient(135deg, #4299e1 0%, #667eea 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ============================================
   TABLE STYLING (matching player stats cards)
   ============================================ */
.tournament-round-statistics .stats-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.tournament-round-statistics .stats-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f7fafc;
    border-bottom: 2px solid #e5e7eb;
}

.tournament-round-statistics .stats-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.tournament-round-statistics .stats-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.tournament-round-statistics .stats-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s;
}

.tournament-round-statistics .stats-table tbody tr:hover {
    background-color: #f9fafb;
}

.tournament-round-statistics .stats-table tbody tr:last-child {
    border-bottom: none;
}

.tournament-round-statistics .stats-table tbody td {
    padding: 16px;
}

.tournament-round-statistics .rank-col {
    width: 80px;
}

.tournament-round-statistics .player-col {
    min-width: 200px;
}

.tournament-round-statistics .score-col {
    text-align: right;
    width: 120px;
}

.tournament-round-statistics .game-col {
    text-align: center;
    width: 150px;
}

/* Rank badge styling */
.tournament-round-statistics .rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 700;
    font-size: 0.875rem;
}

.tournament-round-statistics .rank-badge.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.tournament-round-statistics .rank-badge.silver {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(156, 163, 175, 0.4);
}

.tournament-round-statistics .rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

/* Row highlighting for top ranks */
.tournament-round-statistics .stats-table tbody tr.rank-1 {
    background: rgba(251, 191, 36, 0.03);
}

.tournament-round-statistics .stats-table tbody tr.rank-2 {
    background: rgba(156, 163, 175, 0.03);
}

.tournament-round-statistics .stats-table tbody tr.rank-3 {
    background: rgba(205, 127, 50, 0.03);
}

.tournament-round-statistics .stats-table tbody tr.rank-1:hover,
.tournament-round-statistics .stats-table tbody tr.rank-2:hover,
.tournament-round-statistics .stats-table tbody tr.rank-3:hover {
    background: rgba(66, 153, 225, 0.05);
}

/* Text styling */
.tournament-round-statistics .player-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.9375rem;
}

.tournament-round-statistics .score-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #4299e1;
}

.tournament-round-statistics .score-value.improvement {
    color: #10b981;
}

.tournament-round-statistics .game-number {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */
.tournament-round-statistics .loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.tournament-round-statistics .loading-container .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: round-stats-spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.tournament-round-statistics .loading-container p {
    color: #6b7280;
    font-size: 1rem;
}

.tournament-round-statistics .error-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 1.5rem;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    border-radius: 12px;
    color: #991b1b;
}

.tournament-round-statistics .error-message svg {
    flex-shrink: 0;
    color: #dc2626;
}

.tournament-round-statistics .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    background: #f7fafc;
    border-radius: 12px;
}

.tournament-round-statistics .empty-state svg {
    color: #cbd5e0;
    margin-bottom: 1rem;
}

.tournament-round-statistics .empty-state p {
    color: #6b7280;
    font-size: 1.125rem;
    margin: 0.5rem 0;
}

.tournament-round-statistics .empty-state small {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet breakpoint */
@media (max-width: 991px) {
    .tournament-round-statistics .filter-bar-enhanced {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Make refresh button span full width on smaller tablets */
    .tournament-round-statistics .filter-group-enhanced:last-child {
        grid-column: 1 / -1;
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    .tournament-round-statistics .filter-bar-enhanced {
        grid-template-columns: 1fr;
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .tournament-round-statistics .filter-group-enhanced {
        gap: 0.25rem;
    }

    .tournament-round-statistics .filter-label-enhanced {
        font-size: 0.75rem;
    }

    .tournament-round-statistics .filter-select-enhanced {
        padding: 0.5rem 0.625rem;
        font-size: 0.875rem;
    }

    /* Refresh button takes full width on mobile */
    .tournament-round-statistics .filter-group-enhanced:last-child {
        grid-column: 1;
    }

    .tournament-round-statistics .btn {
        width: 100%;
        padding: 0.625rem;
    }

    .tournament-round-statistics .statistic-title {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        padding: 1rem 1.25rem;
    }

    .tournament-round-statistics .statistic-title h3 {
        font-size: 1rem;
    }

    .tournament-round-statistics .round-badge {
        font-size: 0.8125rem;
        padding: 3px 10px;
    }

    .tournament-round-statistics .stats-table thead th {
        padding: 8px 10px;
        font-size: 0.6875rem;
    }

    .tournament-round-statistics .stats-table tbody td {
        padding: 10px;
    }

    .tournament-round-statistics .player-col {
        min-width: 120px;
    }

    .tournament-round-statistics .score-col,
    .tournament-round-statistics .game-col {
        width: auto;
        min-width: 70px;
    }

    .tournament-round-statistics .player-name {
        font-size: 0.8125rem;
    }

    .tournament-round-statistics .score-value {
        font-size: 1rem;
    }

    .tournament-round-statistics .game-number {
        font-size: 0.6875rem;
    }

    .tournament-round-statistics .rank-badge {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .tournament-round-statistics .rank-col {
        width: 60px;
    }
}

/* Small mobile breakpoint */
@media (max-width: 480px) {
    .tournament-round-statistics .filter-bar-enhanced {
        padding: 0.75rem;
        gap: 0.625rem;
    }

    .tournament-round-statistics .statistic-title {
        padding: 0.875rem 1rem;
    }

    .tournament-round-statistics .statistic-title h3 {
        font-size: 0.9375rem;
    }

    .tournament-round-statistics .stats-table thead th {
        padding: 6px 8px;
        font-size: 0.625rem;
    }

    .tournament-round-statistics .stats-table tbody td {
        padding: 8px;
    }

    .tournament-round-statistics .player-name {
        font-size: 0.75rem;
    }

    .tournament-round-statistics .score-value {
        font-size: 0.9375rem;
    }

    .tournament-round-statistics .rank-badge {
        width: 24px;
        height: 24px;
        font-size: 0.6875rem;
    }

    .tournament-round-statistics .rank-col {
        width: 50px;
    }
}
