/* CSS pour les nouvelles fonctionnalités de gamification */

/* Animations dopamine pour les progrès utilisateur */
.progress-item {
    position: relative;
    overflow: visible;
}

.progress-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-in-out forwards;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.streak-glow {
    animation: streakGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 0 10px #ffd700;
}

@keyframes streakGlow {
    from { text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700; }
    to { text-shadow: 0 0 20px #ffd700, 0 0 30px #ffd700, 0 0 40px #ffd700; }
}

.points-pulse {
    animation: pointsPulse 1.5s ease-in-out infinite;
}

@keyframes pointsPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.progress-sparkles {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.progress-sparkles::before,
.progress-sparkles::after {
    content: '✨';
    position: absolute;
    font-size: 12px;
    animation: sparkle 2s ease-in-out infinite;
}

.progress-sparkles::after {
    animation-delay: 1s;
    top: 10px;
    left: 10px;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

.progress-ring-svg {
    transform: rotate(-90deg);
    animation: ringRotate 3s linear infinite;
}

@keyframes ringRotate {
    from { transform: rotate(-90deg); }
    to { transform: rotate(270deg); }
}

.level-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.level-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: levelShine 3s ease-in-out infinite;
}

@keyframes levelShine {
    0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.level-indicator {
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
}

.level-bar {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: 60%;
    border-radius: 2px;
    animation: levelProgress 2s ease-in-out infinite alternate;
}

@keyframes levelProgress {
    from { background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%); }
    to { background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%); }
}

/* Défi quotidien */
.daily-challenge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    color: white;
    position: relative;
    overflow: hidden;
}

.daily-challenge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: challengeShimmer 3s ease-in-out infinite;
}

@keyframes challengeShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.challenge-timer {
    background: rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: 20px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    animation: timerBlink 1s ease-in-out infinite alternate;
}

@keyframes timerBlink {
    from { background: rgba(255,255,255,0.2); }
    to { background: rgba(255,255,255,0.4); }
}

.challenge-progress-bar {
    background: rgba(255,255,255,0.2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.challenge-reward {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 14px;
}

.challenge-reward i {
    color: #ffd700;
    animation: giftBounce 2s ease-in-out infinite;
}

@keyframes giftBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Streaks et combo */
.streak-container {
    position: fixed;
    top: 120px;
    left: 30px;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-fire {
    font-size: 24px;
    animation: fireFlicker 1.5s ease-in-out infinite alternate;
}

@keyframes fireFlicker {
    from { transform: scale(1) rotate(-2deg); }
    to { transform: scale(1.1) rotate(2deg); }
}

.streak-number {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
}

.streak-label {
    font-size: 12px;
    color: #666;
}

.combo-multiplier {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    animation: comboGlow 1s ease-in-out infinite alternate;
}

@keyframes comboGlow {
    from { box-shadow: 0 0 5px rgba(255,193,7,0.5); }
    to { box-shadow: 0 0 15px rgba(255,193,7,0.8); }
}

/* Quiz amélioré */
.quiz-section {
    padding: 40px;
    position: relative;
    margin: 0 auto;
    z-index: 3;
    display: block;
}
.quiz-btn {
    position: relative;
    margin: 0 auto;
    z-index: 5 !important;
    display: block;
}
.quiz-difficulty-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 2;
}

.quiz-difficulty-badge.beginner {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.quiz-difficulty-badge.intermediate {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #333;
}

.quiz-difficulty-badge.expert {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.quiz-reward-preview {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.8);
    color: #ffd700;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.quiz-stats {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    font-size: 12px;
    opacity: 0.9;
    flex-wrap: nowrap;
}

.stat-item {
    white-space: nowrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gradient-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.gradient-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.gradient-btn:hover::before {
    left: 100%;
}

.title-glow {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.participation-counter {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.participation-counter i {
    color: #3498db;
}

/* Modal quiz améliorée */
.quiz-header-modal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: auto;
    margin-bottom: 20px;
}

.quiz-lives {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #e74c3c;
    font-weight: bold;
}

.quiz-lives i {
    animation: heartBeat 1.5s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.quiz-progress-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quiz-question-counter {
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

/* Classement thématique */
.theme-ranking {
    position: relative;
    z-index: 3;
    margin: 0 auto;
    max-width: none;
    padding: 0;
    width: 90%;
    box-sizing: border-box;
}

.ranking-header {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
}

.ranking-filter {
    display: flex;
    padding: 6px 4px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    min-height: 50px;
    height: auto;
    overflow-x: auto;
    align-items: center;
    justify-content: center;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid rgba(90, 110, 220, 0.18);
    background: rgba(102, 126, 234, 0.08);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2f3a66;
}

.filter-btn i {
    font-size: 0.95em;
}

.filter-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.55) 0%, rgba(118, 75, 162, 0.55) 100%);
    color: #ffffff;
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    border: 2px solid rgba(102, 126, 234, 0.35);
}
.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #5a86ff 60%, #4f64d9 100%);
    color: #ffffff;
    border-color: rgba(102, 126, 234, 0.55);
    transform: translateY(-2px);
    border: 2px solid rgba(102, 126, 234, 0.55);
}
.filter-btn.filter-btn--liked {
    border-color: #ffb199;
    background: #fff4ef;
    color: #b3482a;
    font-weight: 700;
}
.filter-btn.filter-btn--liked:hover,
.filter-btn.filter-btn--liked.active {
    background: linear-gradient(135deg, #ff7a59 0%, #ffb347 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(255, 122, 89, 0.25);
}

[data-theme="dark"] .filter-btn {
    border-color: rgba(162, 221, 255, 0.28);
    background: rgba(162, 221, 255, 0.08);
    color: #e7eeff;
}

[data-theme="dark"] .filter-btn:hover,
[data-theme="dark"] .filter-btn.active {
    background: linear-gradient(135deg, rgba(162, 221, 255, 0.55) 0%, rgba(120, 140, 255, 0.65) 100%);
    color: #ffffff;
    border-color: rgba(162, 221, 255, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .filter-btn.filter-btn--liked {
    border-color: rgba(255, 177, 153, 0.5);
    background: rgba(255, 122, 89, 0.12);
    color: #ffd2c4;
}

[data-theme="dark"] .filter-btn.filter-btn--liked:hover,
[data-theme="dark"] .filter-btn.filter-btn--liked.active {
    background: linear-gradient(135deg, rgba(255, 122, 89, 0.8) 0%, rgba(255, 179, 71, 0.8) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(255, 122, 89, 0.35);
}

.theme-ranking .articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
    grid-auto-rows: auto;
    justify-items: center;
    justify-content: center;
    width: 100%;
}
.theme-ranking .article-card {
    border: 2px solid rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
}
.theme-ranking .card-content {
    padding: 20px;
}
.theme-ranking .card-image-container {
    height: 200px;
}
/* Actions d'articles améliorées */
.reading-time-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
    pointer-events: none;
}
.view-controls {
    display: flex;
    gap: 5px;
}
.view-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.view-btn.active,
.view-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.article-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.interactive {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding: 8px;
    border-radius: 50%;
}

.interactive:hover {
    background: rgba(52, 152, 219, 0.1);
    transform: scale(1.1);
}

.like-icon.active {
    color: #e74c3c;
    animation: likeAnimation 0.6s ease-in-out;
}

@keyframes likeAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.like-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #e74c3c 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
}

.like-icon.active .like-burst {
    animation: burstEffect 0.6s ease-out;
}

@keyframes burstEffect {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

.bookmark-icon.active {
    color: #f39c12;
}

.share-icon:hover {
    color: #27ae60;
}


/* Pulse pour nouveaux badges */
.pulse {
    animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
    50% { box-shadow: 0 0 20px rgba(52, 152, 219, 0.8); }
}

/* Popup de récompenses */
.reward-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.reward-popup.active {
    opacity: 1;
    visibility: visible;
}

.reward-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    position: relative;
    max-width: 400px;
    width: 90%;
    animation: rewardSlideIn 0.5s ease-out;
}

@keyframes rewardSlideIn {
    from { transform: scale(0.5) translateY(-50px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.reward-animation {
    position: relative;
    margin-bottom: 20px;
}

.reward-icon {
    font-size: 60px;
    color: #ffd700;
    animation: rewardBounce 1s ease-in-out infinite alternate;
}

@keyframes rewardBounce {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-10px) scale(1.1); }
}

.reward-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.reward-particles::before,
.reward-particles::after {
    content: '✨';
    position: absolute;
    font-size: 20px;
    animation: particleFloat 2s ease-in-out infinite;
}

.reward-particles::after {
    animation-delay: 1s;
    top: 20px;
    left: 20px;
}

@keyframes particleFloat {
    0%, 100% { opacity: 0; transform: translateY(20px) scale(0); }
    50% { opacity: 1; transform: translateY(-20px) scale(1); }
}

.continue-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.3s ease;
}

.continue-btn:hover {
    transform: translateY(-2px);
}

/* Notifications toast */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 350px;
}

.notification-toast {
    background: white;
    border-left: 4px solid #3498db;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    animation: toastSlideIn 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.notification-toast.is-leaving {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification-toast.success {
    border-left-color: #27ae60;
}

.notification-toast.warning {
    border-left-color: #f39c12;
}

.notification-toast.error {
    border-left-color: #e74c3c;
}

[data-theme="dark"] .notifications-container {
    color: #e6e9f5;
}

[data-theme="dark"] .notification-toast {
    background: rgba(18, 20, 32, 0.95);
    border-left-color: #6c8cff;
    color: #e6e9f5;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .notification-toast.success {
    border-left-color: #3bd17b;
}

[data-theme="dark"] .notification-toast.warning {
    border-left-color: #f5b04b;
}

[data-theme="dark"] .notification-toast.error {
    border-left-color: #ff6b6b;
}

.notification-toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    animation: notificationProgress 4s linear;
}

@keyframes notificationProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Bouton retour en haut amélioré */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
}

.scroll-progress-ring {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
}

.scroll-progress-ring svg {
    transform: rotate(-90deg);
}

.scroll-progress-ring circle {
    stroke-dasharray: 100.53;
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .streak-container {
        position: static;
        margin: 20px 0;
        width: 100%;
    }
    
    .daily-challenge {
        margin: 20px 10px;
    }
    
    .ranking-filter {
        padding: 0 10px;
    }
    
    .quiz-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .reward-content {
        padding: 20px;
        margin: 20px;
    }
}
