/**
 * Komunitas+ Public Styles
 */

/* Leaderboard Styles */
.komunitas-leaderboard {
    margin: 20px 0;
    font-family: inherit;
}

.leaderboard-section {
    margin-bottom: 30px;
}

.leaderboard-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
}

.komunitas-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.komunitas-leaderboard-table th {
    background: #0073aa;
    color: #fff;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.komunitas-leaderboard-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
}

.komunitas-leaderboard-table tr:hover {
    background-color: #f9f9f9;
}

.komunitas-leaderboard-table tr:last-child td {
    border-bottom: none;
}

.komunitas-leaderboard-table .rank {
    font-weight: bold;
    text-align: center;
    width: 60px;
}

.komunitas-leaderboard-table .rank-1 {
    color: #ffd700;
    font-size: 18px;
}

.komunitas-leaderboard-table .rank-2 {
    color: #c0c0c0;
    font-size: 16px;
}

.komunitas-leaderboard-table .rank-3 {
    color: #cd7f32;
    font-size: 16px;
}

.komunitas-leaderboard-table .user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.komunitas-leaderboard-table .user img {
    border-radius: 50%;
    border: 2px solid #f0f0f1;
}

.komunitas-leaderboard-table .user-name {
    font-weight: 500;
    color: #333;
}

.komunitas-leaderboard-table .points {
    font-weight: bold;
    color: #0073aa;
    text-align: right;
}

.komunitas-leaderboard-table .activities {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Reward Tab Styles */
.komunitas-reward-tab {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.komunitas-reward-tab h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.reward-details {
    display: grid;
    gap: 15px;
}

.reward-details p {
    margin: 0;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    border-left: 4px solid #0073aa;
}

.reward-details strong {
    color: #0073aa;
}

.claim-reward-btn {
    background: #46b450 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: background-color 0.2s !important;
}

.claim-reward-btn:hover {
    background: #3d9c46 !important;
}

.reward-insufficient {
    color: #dc3232;
    font-style: italic;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
}

/* User Points Display */
.user-points-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f9f9f9;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-size: 14px;
    font-weight: 500;
}

.user-points-display .points-icon {
    color: #ffd700;
    font-size: 16px;
}

.user-points-display .points-value {
    color: #0073aa;
    font-weight: bold;
}

/* Points History */
.points-history {
    margin: 20px 0;
}

.points-history h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f1;
    background: #fff;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: #f9f9f9;
}

.history-details {
    flex: 1;
}

.history-action {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-action.positive {
    color: #46b450;
}

.history-action.negative {
    color: #dc3232;
}

.history-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 4px;
}

.history-date {
    color: #999;
    font-size: 12px;
}

.history-points {
    font-weight: bold;
    font-size: 16px;
}

.history-points.positive {
    color: #46b450;
}

.history-points.negative {
    color: #dc3232;
}

/* Loading States */
.komunitas-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.komunitas-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty States */
.komunitas-empty {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.komunitas-empty::before {
    content: '📊';
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .komunitas-leaderboard-table {
        font-size: 14px;
    }
    
    .komunitas-leaderboard-table th,
    .komunitas-leaderboard-table td {
        padding: 8px 10px;
    }
    
    .komunitas-leaderboard-table .user {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
    
    .komunitas-leaderboard-table .user img {
        width: 40px;
        height: 40px;
    }
    
    .reward-details {
        grid-template-columns: 1fr;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .history-points {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .komunitas-leaderboard-table {
        font-size: 12px;
    }
    
    .komunitas-leaderboard-table th,
    .komunitas-leaderboard-table td {
        padding: 6px 8px;
    }
    
    .komunitas-leaderboard-table .rank {
        width: 40px;
    }
    
    .komunitas-leaderboard-table .activities {
        display: none;
    }
}

/* BuddyBoss Integration Styles */
.bp-profile-points {
    background: #fff;
    border: 1px solid #e7e9ec;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bp-profile-points h4 {
    margin: 0 0 10px 0;
    color: #122b46;
    font-size: 16px;
    font-weight: 600;
}

.bp-points-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bp-points-icon {
    color: #ffd700;
    font-size: 20px;
}

.bp-points-value {
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
}

.bp-points-label {
    color: #666;
    font-size: 14px;
}

/* WooCommerce Integration Styles */
.woocommerce .komunitas-reward-tab {
    margin: 20px 0;
}

.woocommerce .reward-details {
    margin-top: 15px;
}

.woocommerce .claim-reward-btn {
    margin-top: 15px;
}

/* bbPress Integration Styles */
.bbp-topic-content .komunitas-leaderboard,
.bbp-reply-content .komunitas-leaderboard {
    margin: 15px 0;
}

/* Custom Theme Compatibility */
.theme-twenty-twenty-one .komunitas-leaderboard,
.theme-twenty-twenty-two .komunitas-leaderboard,
.theme-twenty-twenty-three .komunitas-leaderboard {
    font-family: var(--wp--preset--font-family--system);
}

.theme-twenty-twenty-one .komunitas-leaderboard-table th,
.theme-twenty-twenty-two .komunitas-leaderboard-table th,
.theme-twenty-twenty-three .komunitas-leaderboard-table th {
    background: var(--wp--preset--color--primary);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .komunitas-leaderboard-table {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .komunitas-leaderboard-table th {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .komunitas-leaderboard-table td {
        border-bottom-color: #4a5568;
    }
    
    .komunitas-leaderboard-table tr:hover {
        background-color: #4a5568;
    }
    
    .komunitas-leaderboard-table .user-name {
        color: #e2e8f0;
    }
    
    .komunitas-reward-tab {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .reward-details p {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .history-item {
        background: #2d3748;
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .history-item:hover {
        background: #4a5568;
    }
    
    .history-description {
        color: #a0aec0;
    }
    
    .history-date {
        color: #718096;
    }
}
