/* ==========================================
   GAMIFICATION UI STYLES
   Study streaks, XP, levels, badges
   ========================================== */

/* Streak Banner */
.streak-banner {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d12 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.streak-fire {
    font-size: 48px;
    animation: flameAnimation 1s ease-in-out infinite;
}

@keyframes flameAnimation {

    0%,
    100% {
        transform: scale(1) rotate(-5deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

.streak-info h3 {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.streak-info h3 span {
    color: #D4AF37;
}

.streak-info p {
    color: #888;
    margin: 4px 0 0;
    font-size: 14px;
}

.streak-frozen {
    opacity: 0.5;
}

.streak-frozen .streak-fire {
    animation: none;
    filter: grayscale(100%);
}

/* XP & Level Display */
.xp-container {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d12 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #D4AF37, #A68B2C);
    color: #000;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 12px;
}

.level-badge svg {
    width: 16px;
    height: 16px;
}

.xp-progress-container {
    margin-top: 12px;
}

.xp-progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #D4AF37, #F4D56B);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

.xp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.xp-text {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}

.xp-text .current {
    color: #D4AF37;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d12 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stat-card .stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.stat-card.highlight {
    border-color: rgba(212, 175, 55, 0.5);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
}

.stat-card.highlight .stat-value {
    color: #D4AF37;
}

/* Badges Display */
.badges-container {
    margin: 16px 0;
}

.badges-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.badges-header h3 {
    color: #fff;
    margin: 0;
    font-size: 18px;
}

.badges-header .badge-count {
    background: rgba(212, 175, 55, 0.2);
    color: #D4AF37;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.badge-item {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d12 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.badge-item:hover {
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}

.badge-item .badge-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.badge-item .badge-name {
    font-size: 11px;
    color: #fff;
    font-weight: 500;
}

.badge-item.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.badge-item.locked .badge-icon {
    filter: blur(1px);
}

/* Daily Goals */
.daily-goals {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d12 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
}

.daily-goals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.daily-goals-header h3 {
    color: #fff;
    margin: 0;
    font-size: 18px;
}

.daily-goals-header .goal-status {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
}

.daily-goals-header .goal-status.completed {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.daily-goals-header .goal-status.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.goal-item:last-child {
    border-bottom: none;
}

.goal-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.goal-info {
    flex: 1;
}

.goal-info .goal-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.goal-info .goal-progress-text {
    color: #888;
    font-size: 12px;
    margin-top: 2px;
}

.goal-progress-bar {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #D4AF37, #F4D56B);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.goal-progress-fill.completed {
    background: linear-gradient(90deg, #4CAF50, #81C784);
}

/* Leaderboard */
.leaderboard {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d12 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.leaderboard-header h3 {
    color: #fff;
    margin: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.leaderboard-item.current-user {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.leaderboard-item .rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: 50%;
    font-size: 14px;
}

.leaderboard-item .rank.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}

.leaderboard-item .rank.silver {
    background: linear-gradient(135deg, #C0C0C0, #808080);
    color: #000;
}

.leaderboard-item .rank.bronze {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: #fff;
}

.leaderboard-item .rank.normal {
    background: rgba(255, 255, 255, 0.1);
    color: #888;
}

.leaderboard-item .user-info {
    flex: 1;
}

.leaderboard-item .user-name {
    color: #fff;
    font-weight: 500;
}

.leaderboard-item .user-level {
    color: #D4AF37;
    font-size: 12px;
}

.leaderboard-item .user-xp {
    color: #888;
    font-size: 14px;
    font-weight: 600;
}

/* XP Popup Animation */
.xp-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #D4AF37, #A68B2C);
    color: #000;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 24px;
    z-index: 9999;
    animation: xpPopup 1.5s ease forwards;
    pointer-events: none;
}

@keyframes xpPopup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    40% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(1);
    }
}

/* Badge Earned Modal */
.badge-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.badge-modal-content {
    text-align: center;
    padding: 40px;
    animation: badgeReveal 0.5s ease;
}

@keyframes badgeReveal {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.badge-modal .badge-icon-large {
    font-size: 80px;
    margin-bottom: 20px;
    display: block;
}

.badge-modal h2 {
    color: #D4AF37;
    font-size: 28px;
    margin: 0 0 8px;
}

.badge-modal p {
    color: #888;
    font-size: 16px;
    margin: 0 0 24px;
}

.badge-modal .xp-reward {
    display: inline-block;
    background: rgba(212, 175, 55, 0.2);
    color: #D4AF37;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    .badges-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .badge-item {
        padding: 12px;
    }

    .badge-item .badge-icon {
        font-size: 28px;
    }

    .streak-banner {
        padding: 16px;
    }

    .streak-fire {
        font-size: 36px;
    }

    .streak-info h3 {
        font-size: 20px;
    }
}