/* 排行榜页面样式 */
.rankings-page {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 36px;
    color: #2c3e50;
    margin-bottom: 10px;
}

.page-header h1 i {
    color: #f39c12;
    margin-right: 10px;
}

.page-header p {
    color: #7f8c8d;
    font-size: 16px;
}

/* 选择器容器 */
.selectors-container {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.selector-group {
    flex: 1;
    min-width: 150px;
}

.selector-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
}

.custom-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233498db' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.custom-select:hover {
    border-color: #3498db;
}

.custom-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-refresh {
    flex: 0 0 auto;
    padding: 12px 24px;
    font-size: 16px;
}

/* 我的排名卡片 */
.user-rank-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.rank-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.rank-card-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.rank-card-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.user-avatar-wrapper img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background-color: #2ecc71;
    border-radius: 50%;
    border: 2px solid #764ba2;
}

.user-rank-info {
    flex: 1;
}

.user-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.user-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.rank-number {
    font-size: 24px;
    font-weight: 700;
    color: #f1c40f;
}

.score-info {
    font-size: 14px;
    opacity: 0.9;
}

/* 排行榜列表容器 */
.rankings-list-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.rankings-header {
    display: flex;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.rankings-header > div {
    text-align: center;
}

.header-rank {
    width: 80px;
}

.header-user {
    flex: 1;
    text-align: left;
    padding-left: 20px;
}

.header-score {
    width: 120px;
}

.header-count {
    width: 120px;
}

/* 加载状态 */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-state p {
    color: #7f8c8d;
    font-size: 14px;
}

/* 空数据状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.empty-state i {
    font-size: 64px;
    color: #e0e0e0;
}

.empty-state p {
    color: #7f8c8d;
    font-size: 16px;
}

/* 排行榜数据 */
.ranking-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.ranking-item:hover {
    background-color: #f8f9fa;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item.is-self {
    background-color: rgba(52, 152, 219, 0.05);
}

.item-rank {
    width: 80px;
    text-align: center;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    color: #7f8c8d;
    background-color: #f0f0f0;
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: white;
    font-size: 18px;
    width: 48px;
    height: 48px;
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    color: white;
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #d35400 100%);
    color: white;
}

.item-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
}

.item-user img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #f0f0f0;
}

.user-details {
    flex: 1;
}

.user-nickname {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.user-username {
    font-size: 13px;
    color: #7f8c8d;
}

.certification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 50%;
    margin-left: 6px;
}

.certification-badge i {
    color: white;
    font-size: 12px;
}

.item-score {
    width: 120px;
    text-align: center;
}

.score-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #e74c3c;
}

.score-difficulty {
    display: inline-block;
    font-size: 12px;
    color: #7f8c8d;
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.item-count {
    width: 120px;
    text-align: center;
    font-size: 14px;
    color: #7f8c8d;
}

/* 加载更多 */
.load-more {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.btn-load-more {
    padding: 12px 32px;
    font-size: 16px;
}

/* 错误提示 */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    background-color: #e74c3c;
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.error-toast i {
    font-size: 20px;
}

.error-toast span {
    flex: 1;
}

.error-toast .close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    .page-header h1 {
        color: #ecf0f1;
    }

    .page-header p {
        color: #bdc3c7;
    }

    .custom-select {
        background-color: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }

    .rankings-list-container {
        background-color: #2c3e50;
    }

    .ranking-item:hover {
        background-color: #34495e;
    }

    .ranking-item.is-self {
        background-color: rgba(52, 152, 219, 0.2);
    }

    .ranking-item {
        border-bottom-color: #34495e;
    }

    .user-nickname {
        color: #ecf0f1;
    }

    .user-username {
        color: #95a5a6;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 28px;
    }

    .selectors-container {
        flex-direction: column;
        align-items: stretch;
    }

    .rankings-header {
        font-size: 12px;
        padding: 16px 12px;
    }

    .header-rank {
        width: 50px;
    }

    .header-user {
        padding-left: 10px;
    }

    .header-score,
    .header-count {
        width: 80px;
    }

    .ranking-item {
        padding: 12px;
    }

    .item-rank {
        width: 50px;
    }

    .rank-badge {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .rank-badge.rank-1 {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .item-user {
        padding-left: 10px;
        gap: 8px;
    }

    .item-user img {
        width: 40px;
        height: 40px;
    }

    .user-nickname {
        font-size: 14px;
    }

    .user-username {
        font-size: 11px;
    }

    .item-score,
    .item-count {
        width: 80px;
        font-size: 12px;
    }

    .score-value {
        font-size: 16px;
    }

    .score-difficulty {
        font-size: 10px;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 24px;
    }

    .user-rank-card {
        padding: 16px;
    }

    .rank-card-content {
        flex-direction: column;
        text-align: center;
    }

    .user-avatar-wrapper img {
        width: 80px;
        height: 80px;
    }

    .user-stats {
        justify-content: center;
    }

    .rankings-header,
    .ranking-item {
        padding: 10px 8px;
    }
}
