/* Gamification System Styles */

/* Notifications */
.points-notification,
.badge-notification,
.level-up-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    min-width: 280px;
    max-width: 350px;
}

.points-notification.show,
.badge-notification.show,
.level-up-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.points-notification-content,
.badge-notification-content,
.level-up-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.points-icon,
.badge-icon,
.level-up-icon {
    font-size: 2em;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.points-amount {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 2px;
}

.points-message {
    font-size: 0.9em;
    opacity: 0.9;
}

.badge-title,
.level-up-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 2px;
}

.badge-name,
.level-up-level {
    font-size: 0.9em;
    opacity: 0.9;
}

.badge-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 4px;
}

.badge-level-bronze {
    background: #cd7f32;
}

.badge-level-silver {
    background: #c0c0c0;
}

.badge-level-gold {
    background: #ffd700;
    color: #333;
}

.badge-level-platinum {
    background: #e5e4e2;
    color: #333;
}

/* Achievement Modal */
.achievement-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.achievement-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.achievement-modal {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.achievement-modal-overlay.show .achievement-modal {
    transform: scale(1);
}

.achievement-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.achievement-modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.achievement-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.achievement-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.achievement-modal-body {
    padding: 30px 25px;
    text-align: center;
}

.achievement-icon {
    font-size: 4em;
    color: #ffd700;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.achievement-title {
    font-size: 1.8em;
    margin: 0 0 10px 0;
    color: #333;
}

.achievement-description {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.achievement-rewards {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.points-reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
}

.achievement-progress {
    margin: 20px 0;
}

.progress-bar {
    background: #e9ecef;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.9em;
    color: #666;
}

.achievement-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    text-align: center;
}

.claim-achievement-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.claim-achievement-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.claim-achievement-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Leaderboard Styles */
.marketdope-leaderboard {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.leaderboard-title {
    margin: 0 0 20px 0;
    color: #333;
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.current-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #333;
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #ddd 100%);
    color: #333;
}

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

.rank {
    font-size: 1.5em;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.user-avatar {
    margin: 0 15px;
}

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

.user-info {
    flex: 1;
}

.user-name {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 5px;
}

.user-stats {
    font-size: 0.9em;
    opacity: 0.8;
}

.stat-value {
    font-weight: bold;
    margin-right: 5px;
}

.user-badges {
    font-size: 0.8em;
    opacity: 0.7;
}

/* Badge Styles */
.user-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.badge-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
}

.badge-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.badge-item.badge-bronze {
    border-top: 4px solid #cd7f32;
}

.badge-item.badge-silver {
    border-top: 4px solid #c0c0c0;
}

.badge-item.badge-gold {
    border-top: 4px solid #ffd700;
}

.badge-item.badge-platinum {
    border-top: 4px solid #e5e4e2;
}

.badge-icon {
    font-size: 3em;
    margin-bottom: 15px;
    color: #667eea;
}

.badge-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.badge-description {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 15px;
}

.badge-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #999;
}

.badge-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9em;
    max-width: 250px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.badge-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.badge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Achievement Styles */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.achievement-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.achievement-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.achievement-item.completed {
    border-left: 5px solid #28a745;
}

.achievement-item.claimed {
    opacity: 0.8;
    background: #f8f9fa;
}

.achievement-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.achievement-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.achievement-icon {
    font-size: 2.5em;
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
}

.achievement-item.completed .achievement-icon {
    color: #ffd700;
}

.achievement-title {
    font-size: 1.3em;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.achievement-description {
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.achievement-progress {
    margin: 10px 0;
}

.achievement-claimed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #28a745;
    font-weight: bold;
    padding: 10px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 6px;
}

/* Loading and Error States */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-spinner::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-left-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

.error-message,
.no-data,
.no-achievements {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Points Display */
.user-points-display {
    font-weight: bold;
    color: #667eea;
}

.animated-points-counter {
    font-size: 1.5em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Level Display */
[data-user-level] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
    display: inline-block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .points-notification,
    .badge-notification,
    .level-up-notification {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .achievement-modal {
        width: 95%;
        margin: 10px;
    }
    
    .user-badges-grid,
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .leaderboard-item {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .user-avatar {
        order: -1;
    }
    
    .rank {
        min-width: 40px;
        font-size: 1.2em;
    }
    
    .user-avatar img {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .achievement-modal-body {
        padding: 20px 15px;
    }
    
    .achievement-icon {
        font-size: 3em;
    }
    
    .achievement-title {
        font-size: 1.5em;
    }
    
    .leaderboard-item {
        padding: 10px;
    }
    
    .badge-item {
        padding: 15px;
    }
    
    .badge-icon {
        font-size: 2.5em;
    }
}