/**
 * Advanced Features CSS
 * Personalized Recommendations, Gamification, Live Comments
 */

/* ================================
   PERSONALIZED RECOMMENDATIONS
   ================================ */
.personalized-recommendations-section {
    margin-top: 60px;
    padding: 40px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 20px;
    border: 2px solid #fbbf24;
    box-shadow: 0 10px 40px rgba(251, 191, 36, 0.2);
    position: relative;
    overflow: hidden;
}

.personalized-recommendations-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f59e0b, #fbbf24, #f59e0b);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.recommendations-header {
    margin-bottom: 30px;
}

.rec-title-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.rec-icon {
    color: #f59e0b;
    flex-shrink: 0;
    animation: starPulse 2s infinite;
}

@keyframes starPulse {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
    }
    50% { 
        transform: scale(1.1) rotate(5deg);
        filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
    }
}

.recommendations-header .tech-section-title {
    margin: 0 0 8px 0;
    color: #78350f;
    font-size: 1.75rem;
    font-weight: 800;
}

.recommendations-subtitle {
    color: #92400e;
    font-size: 0.95rem;
    margin: 0;
    font-weight: 600;
}

.rec-count {
    color: #a16207;
    font-size: 0.85rem;
    margin-left: 8px;
}

.recommendations-loading {
    text-align: center;
    padding: 60px 20px;
    color: #92400e;
}

.recommendations-loading p {
    margin-top: 16px;
    font-weight: 600;
}

.rec-empty {
    text-align: center;
    padding: 60px 20px;
    color: #92400e;
}

.rec-empty svg {
    margin-bottom: 16px;
    color: #f59e0b;
}

.rec-empty p {
    font-size: 1.05rem;
    font-weight: 600;
}

.rec-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #78350f;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    border: 1px solid #fbbf24;
}

.rec-badge.personalized {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.rec-badge svg {
    width: 14px;
    height: 14px;
}

/* Dark Mode for Recommendations */
body.dark-mode .personalized-recommendations-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #3b82f6;
}

body.dark-mode .personalized-recommendations-section::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #3b82f6);
}

body.dark-mode .rec-icon {
    color: #60a5fa;
}

body.dark-mode .recommendations-header .tech-section-title {
    color: #f1f5f9;
}

body.dark-mode .recommendations-subtitle,
body.dark-mode .rec-count {
    color: #cbd5e1;
}

body.dark-mode .recommendations-loading,
body.dark-mode .rec-empty {
    color: #cbd5e1;
}

body.dark-mode .rec-empty svg {
    color: #60a5fa;
}

body.dark-mode .rec-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: #3b82f6;
}

body.dark-mode .rec-badge.personalized {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

/* ================================
   GAMIFICATION WIDGET
   ================================ */
.gamification-widget {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid #fbbf24;
    box-shadow: 0 8px 24px rgba(251, 191, 36, 0.2);
}

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

.gamification-header h4 {
    margin: 0;
    color: #78350f;
    font-size: 1.25rem;
}

.user-level {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.gamification-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #92400e;
}

.stat-label {
    font-size: 0.75rem;
    color: #78350f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.5);
    height: 12px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 20px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.progress-text {
    text-align: center;
    color: #78350f;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
}

.badges-earned {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #fbbf24;
}

.badges-earned h5 {
    color: #78350f;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.badge {
    background: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: help;
}

.badge.locked {
    filter: grayscale(100%);
    opacity: 0.3;
}

.badge.unlocked {
    animation: badgeUnlock 0.5s ease;
}

@keyframes badgeUnlock {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Dark Mode for Gamification */
body.dark-mode .gamification-widget {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #3b82f6;
}

body.dark-mode .gamification-header h4 {
    color: #f1f5f9;
}

body.dark-mode .stat-item {
    background: #1e293b;
}

body.dark-mode .stat-value,
body.dark-mode .stat-label,
body.dark-mode .progress-text {
    color: #f1f5f9;
}

body.dark-mode .badges-earned h5 {
    color: #f1f5f9;
}

body.dark-mode .badge {
    background: #334155;
}

/* ================================
   LIVE COMMENTS INDICATOR
   ================================ */
.live-comments-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #10b981;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.comment-new-badge {
    display: inline-block;
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 8px;
    animation: newBadge 0.5s ease;
}

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

/* ================================
   ACHIEVEMENT TOAST
   ================================ */
.achievement-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    z-index: 99998;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.5s ease;
    max-width: 300px;
}

.achievement-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.achievement-toast-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.achievement-toast-icon {
    font-size: 2rem;
}

.achievement-toast-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.achievement-toast-message {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .gamification-stats {
        grid-template-columns: 1fr;
    }
    
    .badges-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .achievement-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
