/* 
 * 存储共享状态跟踪和排行榜样式
 */

/* 共享状态容器 */
.sharing-stats-container {
    background-color: #f5f5f5;
    border-radius: 10px;
    margin: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none; /* 默认隐藏 */
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.stats-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.status-indicator {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background-color: #eee;
    color: #666;
}

.status-active {
    background-color: #1DB954;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

.status-paused {
    background-color: #f39c12;
    color: white;
}

.status-starting, .status-stopping {
    background-color: #3498db;
    color: white;
}

.stats-content {
    margin-bottom: 15px;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-label {
    color: #666;
}

.stats-value {
    font-weight: 500;
    color: #333;
}

.stats-row.highlight {
    background-color: rgba(29, 185, 84, 0.1);
    padding: 8px;
    border-radius: 5px;
    margin-top: 5px;
}

.stats-row.highlight .stats-value {
    color: #1DB954;
    font-weight: bold;
}

.stats-chart-container {
    height: 150px;
    margin-top: 10px;
}

/* 共享总结对话框 */
.sharing-summary-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    max-width: 90%;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #1DB954;
    color: white;
}

.summary-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.summary-content {
    padding: 15px;
}

.summary-stat {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.summary-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 40px;
    height: 40px;
    background-color: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-details {
    flex: 1;
}

.summary-value {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.summary-label {
    font-size: 12px;
    color: #666;
}

.summary-stat.highlight .summary-icon {
    background-color: rgba(29, 185, 84, 0.2);
}

.summary-stat.highlight .summary-value {
    color: #1DB954;
}

.summary-footer {
    padding: 10px 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.primary-btn {
    background-color: #1DB954;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 24px;
    font-weight: 500;
    cursor: pointer;
}

.primary-btn:hover {
    background-color: #18a449;
}

/* 排行榜样式 */
.sharing-leaderboard-container {
    background-color: #f5f5f5;
    border-radius: 10px;
    margin: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-header {
    margin-bottom: 15px;
}

.leaderboard-header h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.leaderboard-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    background: none;
    border: none;
    padding: 8px 15px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #1DB954;
}

.tab-btn.active {
    color: #1DB954;
    border-bottom-color: #1DB954;
    font-weight: 500;
}

.leaderboard-content {
    min-height: 200px;
    position: relative;
}

.leaderboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(29, 185, 84, 0.3);
    border-radius: 50%;
    border-top-color: #1DB954;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.leaderboard-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: #888;
    font-size: 14px;
    text-align: center;
}

.leaderboard-list {
    margin-top: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.leaderboard-item:hover {
    background-color: rgba(29, 185, 84, 0.05);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item .rank {
    width: 25px;
    text-align: center;
    font-weight: bold;
    color: #666;
    font-size: 14px;
}

.leaderboard-item .user-avatar {
    position: relative;
    margin: 0 10px;
}

.leaderboard-item .user-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.rank-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: 14px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.rank-first-icon {
    color: gold;
}

.rank-second-icon {
    color: silver;
}

.rank-third-icon {
    color: #cd7f32; /* 铜色 */
}

.leaderboard-item .user-info {
    flex: 1;
    min-width: 0; /* 防止溢出 */
}

.leaderboard-item .user-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item .user-contribution {
    font-size: 12px;
    color: #666;
}

.leaderboard-item .points {
    font-weight: bold;
    color: #1DB954;
}

.leaderboard-item.current-user {
    background-color: rgba(29, 185, 84, 0.1);
}

.leaderboard-item.rank-first {
    background-color: rgba(255, 215, 0, 0.1);
}

.leaderboard-item.rank-second {
    background-color: rgba(192, 192, 192, 0.1);
}

.leaderboard-item.rank-third {
    background-color: rgba(205, 127, 50, 0.1);
}

.leaderboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.refresh-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 13px;
}

.refresh-btn i {
    margin-right: 5px;
}

.refresh-btn:hover {
    color: #1DB954;
}

.user-rank {
    font-size: 13px;
    color: #666;
}

.user-rank span {
    font-weight: bold;
    color: #1DB954;
}

/* 共享P2P文件夹按钮 */
.share-p2p-button {
    background-color: #1DB954;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    margin: 10px auto;
    transition: background-color 0.2s ease;
}

.share-p2p-button i {
    margin-right: 8px;
}

.share-p2p-button:hover {
    background-color: #18a449;
}

.share-p2p-button.active {
    background-color: #e74c3c;
}

.share-p2p-button.active:hover {
    background-color: #c0392b;
}

/* P2P共享指南按钮 */
.p2p-guide-button {
    background: none;
    border: none;
    color: #1DB954;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
    margin: 5px auto;
    display: block;
}

.p2p-guide-button:hover {
    color: #18a449;
}

/* 适应移动设备 */
@media (max-width: 480px) {
    .stats-row {
        font-size: 12px;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .leaderboard-item .user-avatar img {
        width: 28px;
        height: 28px;
    }
    
    .leaderboard-item .rank {
        font-size: 12px;
    }
}
