/* ==========================================
   Leaderboard Section Styles
   ========================================== */

.leaderboard-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    margin: 40px 0;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.2);
}

.leaderboard-section h2 {
    margin-bottom: 10px;
    color: #5a67d8;
}

.leaderboard-section>p {
    color: #4a5568;
    margin-bottom: 30px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 1em;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.tab-button:hover {
    color: #5a67d8;
}

.tab-button.active {
    color: #5a67d8;
    border-bottom-color: #5a67d8;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9em;
    font-weight: 600;
    color: #2d3748;
}

.filter-group select {
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-group select:hover {
    border-color: #5a67d8;
}

.filter-group select:focus {
    outline: none;
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.1);
}

/* Table Container */
.table-container {
    overflow-x: auto;
    position: relative;
    margin-bottom: 20px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.leaderboard-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

/* Sticky First Column */
.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: inherit;
}

.leaderboard-table tbody tr:nth-child(even) td:first-child {
    background: #f7fafc;
}

.leaderboard-table tbody tr:nth-child(odd) td:first-child {
    background: white;
}

.leaderboard-table tbody tr:hover td:first-child {
    background: #edf2f7;
}

.leaderboard-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.leaderboard-table td small {
    display: block;
    font-size: 0.75rem;
    margin-top: 4px;
    line-height: 1.4;
}

/* Zebra Stripes */
.leaderboard-table tbody tr:nth-child(even) {
    background: #f7fafc;
}

.leaderboard-table tbody tr:hover {
    background: #edf2f7;
}

/* Version Column */
.version-cell {
    font-weight: 700;
    color: #2d3748;
    font-family: 'Fira Code', monospace;
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2d3748;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.version-badge.baseline {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
}

/* Config Column */
.config-cell {
    color: #2d3748;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.5;
}

.config-cell small {
    color: #718096;
    font-size: 0.85em;
    font-weight: 400;
}

/* Date Column */
.date-cell {
    color: #718096;
    font-size: 0.9em;
}

/* Metric Cells with Trends */
.metric-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-value {
    font-weight: 600;
    color: #2d3748;
}

.metric-trend {
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: #e53e3e;
    /* 红色 - 表示提升/进步 */
    font-weight: 600;
}

.trend-down {
    color: #38a169;
    /* 绿色 - 表示下降/减少 */
    font-weight: 600;
}

.trend-neutral {
    color: #a0aec0;
}

/* Action Buttons */
.action-cell {
    white-space: nowrap;
}

.btn-details {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Expanded Details */
.details-row {
    display: none;
}

.details-row.show {
    display: table-row;
}

.details-cell {
    padding: 24px !important;
    background: #f7fafc !important;
    border-left: 4px solid #5a67d8;
}

.details-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-section {
    background: white;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.detail-section h4 {
    color: #2d3748;
    margin-bottom: 12px;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-section p {
    color: #4a5568;
    margin: 6px 0;
    font-size: 0.9em;
    line-height: 1.6;
}

.detail-section strong {
    color: #2d3748;
    font-weight: 600;
}

/* Command Block */
.command-block {
    background: #2d3748;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
    position: relative;
    margin-top: 8px;
    overflow-x: auto;
}

.btn-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-copy.copied {
    background: #48bb78;
    border-color: #48bb78;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: #2d3748;
    margin-bottom: 8px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #5a67d8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .leaderboard-section {
        padding: 24px 16px;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .leaderboard-table {
        font-size: 0.85em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 8px;
    }

    .details-content {
        grid-template-columns: 1fr;
    }

    .version-cell {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .tab-button {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .leaderboard-table {
        font-size: 0.8em;
    }

    .btn-details {
        padding: 6px 12px;
        font-size: 0.85em;
    }
}
