/* ===========================
   GAMIFICATION STYLES
   =========================== */

/* Micro Badge Notifications */
.micro-badge-notification {
    position: fixed;
    top: 80px;
    right: -400px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px;
    z-index: 1002;
    max-width: 350px;
    transition: right 0.3s ease;
    border-left: 4px solid var(--accent-color);
}

.micro-badge-notification.show {
    right: 24px;
}

.micro-badge-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.micro-badge-icon {
    font-size: 48px;
}

.micro-badge-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.micro-badge-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.micro-badge-xp {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-color);
}

/* Achievements Modal */
.achievements-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.achievements-modal h2 {
    font-size: 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-color);
}

.achievements-modal h3 {
    font-size: 20px;
    margin: 24px 0 16px;
    color: var(--text-primary);
}

/* Current Level Display */
.current-level {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 32px;
    border-radius: var(--radius-xl);
    text-align: center;
    margin-bottom: 32px;
}

.current-level h3 {
    color: white;
    opacity: 0.9;
    margin-bottom: 16px;
}

.level-display {
    font-size: 36px;
    font-weight: 800;
    margin: 16px 0;
}

.xp-progress {
    margin-top: 24px;
}

.xp-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.xp-fill {
    height: 100%;
    background: white;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.xp-text {
    font-size: 16px;
    opacity: 0.95;
}

/* Badges Grid */
.badges-section,
.micro-badges-section {
    margin-bottom: 32px;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.achievement-badge {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition);
    border: 2px solid var(--border-color);
}

.achievement-badge.unlocked {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border-color: var(--primary-color);
}

.achievement-badge.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-badge i {
    font-size: 48px;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.achievement-badge.locked i {
    color: var(--text-light);
}

.achievement-badge h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.achievement-badge p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.unlocked-tag {
    display: inline-block;
    background: var(--success-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.locked-tag {
    display: inline-block;
    background: var(--text-light);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Micro Badges Grid */
.micro-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.micro-achievement {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition);
}

.micro-achievement.unlocked {
    background: rgba(245, 158, 11, 0.1);
    border: 2px solid var(--accent-color);
}

.micro-achievement.locked {
    opacity: 0.4;
}

.micro-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.micro-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.micro-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Progress Celebration */
.progress-milestone {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    z-index: 2001;
    animation: bounceIn 0.6s ease;
}

.progress-milestone .celebration-icon {
    font-size: 80px;
    margin-bottom: 24px;
    animation: pulse 1.5s infinite;
}

.progress-milestone h2 {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.progress-milestone p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Streak Display */
.streak-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    animation: pulse 2s infinite;
}

.streak-display i {
    font-size: 20px;
}

/* Level Up Animation */
@keyframes levelUp {
    0% {
        transform: scale(0.5) rotate(-5deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.level-up-notification {
    animation: levelUp 0.6s ease;
}

/* XP Gain Animation */
@keyframes xpGain {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

.xp-gain-animation {
    position: absolute;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-color);
    animation: xpGain 1s ease forwards;
    pointer-events: none;
}

/* Confetti Effect */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    position: absolute;
    animation: confetti-fall 3s linear;
    z-index: 2000;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Share Button */
.share-progress-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    z-index: 999;
}

.share-progress-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

/* Leaderboard */
.leaderboard-container {
    background: white;
    padding: 24px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.leaderboard-title {
    font-size: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-color);
}

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

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.leaderboard-item:hover {
    background: rgba(16, 185, 129, 0.1);
    transform: translateX(4px);
}

.leaderboard-item.current-user {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.2));
    border: 2px solid var(--primary-color);
}

.leaderboard-rank {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

.leaderboard-rank.top-1 {
    color: #fbbf24;
    font-size: 32px;
}

.leaderboard-rank.top-2 {
    color: #9ca3af;
    font-size: 28px;
}

.leaderboard-rank.top-3 {
    color: #d97706;
    font-size: 24px;
}

.leaderboard-user {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.leaderboard-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.leaderboard-xp {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
}

/* Daily Challenge */
.daily-challenge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 24px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    border: 3px solid var(--accent-color);
}

.challenge-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.challenge-icon {
    font-size: 32px;
}

.challenge-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.challenge-description {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.challenge-reward {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .achievements-modal {
        padding: 20px;
    }
    
    .badges-grid {
        grid-template-columns: 1fr;
    }
    
    .micro-badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .share-progress-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
        bottom: 16px;
        right: 16px;
    }
}
