/* Popular Posts Widget */
.popular-posts-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 14px -6px rgba(30, 58, 138, 0.12);
}

.popular-posts-widget h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popular-posts-widget h3::before {
    content: '🔥';
    font-size: 1.5rem;
}

.popular-post-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    transition: background 0.2s ease;
    margin-bottom: 0.5rem;
}

.popular-post-item:hover {
    background: #f8fafc;
}

.popular-rank {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

.popular-post-item:nth-child(1) .popular-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.popular-post-item:nth-child(2) .popular-rank {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

.popular-post-item:nth-child(3) .popular-rank {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.popular-post-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0;
}

.popular-post-link img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.popular-post-content {
    flex: 1;
    min-width: 0;
}

.popular-post-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.5rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.popular-post-link:hover .popular-post-title {
    color: #1e3a8a;
}

.popular-post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.popular-category {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.2rem 0.5rem;
    border-radius: 0.35rem;
    font-weight: 600;
    text-transform: capitalize;
}

.popular-views {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
    font-weight: 600;
}

.popular-views svg {
    opacity: 0.7;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark mode */
.dark-mode .popular-posts-widget {
    background: #1e293b;
    border-color: #334155;
}

.dark-mode .popular-posts-widget h3 {
    color: #60a5fa;
}

.dark-mode .popular-post-item:hover {
    background: #334155;
}

.dark-mode .popular-post-title {
    color: #f1f5f9;
}

.dark-mode .popular-post-link:hover .popular-post-title {
    color: #60a5fa;
}

.dark-mode .popular-category {
    background: #3b82f6;
    color: #eff6ff;
}

.dark-mode .popular-views {
    color: #94a3b8;
}

.dark-mode .spinner {
    border-color: #334155;
    border-top-color: #60a5fa;
}

/* Responsive */
@media (max-width: 768px) {
    .popular-posts-widget {
        padding: 1rem;
    }
    
    .popular-post-link img {
        width: 60px;
        height: 45px;
    }
    
    .popular-rank {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}
