/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 40px;
}

/* 顶部导航 */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-container h1 {
    font-size: 24px;
    color: #667eea;
    font-weight: 700;
}

.nav-right {
    display: flex;
    gap: 15px;
}

.btn-refresh, .btn-back {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-refresh {
    background: #667eea;
    color: white;
}

.btn-refresh:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-back {
    background: #f5f5f5;
    color: #666;
}

.btn-back:hover {
    background: #e0e0e0;
}

/* 选项卡 */
.tabs {
    max-width: 1400px;
    margin: 30px auto 0;
    padding: 0 30px;
    display: flex;
    gap: 10px;
}

.tab {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.tab:hover {
    background: rgba(255, 255, 255, 1);
    color: #667eea;
}

.tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* 面板容器 */
.panel {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border-radius: 0 10px 10px 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.panel.active {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.panel-header h2 {
    font-size: 22px;
    color: #333;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group select,
.filter-group input[type="date"],
.filter-group input[type="text"] {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: #667eea;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 48px;
    opacity: 0.9;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-sub {
    font-size: 14px;
    opacity: 0.8;
}

/* 排行榜容器 */
.leaderboard-container {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
}

.leaderboard-header {
    background: #667eea;
    color: white;
    padding: 15px 20px;
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px;
    gap: 20px;
    font-weight: 600;
}

.leaderboard-list {
    max-height: 600px;
    overflow-y: auto;
}

.leaderboard-item {
    padding: 15px 20px;
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px;
    gap: 20px;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.3s;
}

.leaderboard-item:hover {
    background: white;
}

.rank-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.rank-1 { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); }
.rank-2 { background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%); }
.rank-3 { background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%); }
.rank-other { background: #9e9e9e; font-size: 16px; }

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.user-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.user-score {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

.trend-icon {
    font-size: 20px;
}

.trend-up { color: #4caf50; }
.trend-down { color: #f44336; }
.trend-same { color: #9e9e9e; }

/* 图表容器 */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#trend-chart {
    width: 100%;
    height: 400px;
}

/* 历史记录 */
.history-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.history-list {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.history-item h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.history-item p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* 趋势分析 */
.user-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    color: white;
}

.user-info-card .user-avatar {
    width: 80px;
    height: 80px;
    border: 3px solid white;
}

.user-details h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.user-details p {
    opacity: 0.9;
    font-size: 14px;
}

.trend-container {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
}

.trend-stats {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.trend-stat {
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trend-stat .label {
    color: #666;
    font-size: 14px;
}

.trend-stat .value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

/* 奖励管理 */
.reward-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.reward-prizes {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.prize-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.prize-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.prize-info {
    flex: 1;
}

.prize-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.prize-meta {
    font-size: 12px;
    color: #999;
}

.reward-history {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.reward-history h3 {
    color: #333;
    margin-bottom: 15px;
}

.reward-history-item {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

.reward-history-item .time {
    color: #999;
    font-size: 11px;
}

.reward-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.loading::before {
    content: '⏳';
    font-size: 32px;
    display: block;
    margin-bottom: 10px;
    animation: spin 2s linear infinite;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .history-container,
    .trend-container,
    .reward-container {
        grid-template-columns: 1fr;
    }

    .leaderboard-header,
    .leaderboard-item {
        grid-template-columns: 60px 1fr 100px;
    }

    .col-trend,
    .trend-icon {
        display: none;
    }
}
