/* Виджеты */
.widget {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.7) 0%, rgba(101, 67, 33, 0.6) 100%);
    border-radius: 12px;
    border: 1px solid rgba(139, 69, 19, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.widget:hover {
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.2);
    transform: translateY(-2px);
}

/* Заголовок виджета */
.widget-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.8) 0%, rgba(101, 67, 33, 0.7) 100%);
    border-bottom: 2px solid rgba(139, 69, 19, 0.9);
}

.widget-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Sylfaen', 'Arial Unicode MS', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.widget-icon {
    font-size: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.widget-subtitle {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #a0826d;
    font-weight: 400;
}

/* Контент виджета */
.widget-content {
    padding: 15px;
}

/* Список популярных постов */
.popular-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-post-item {
    margin-bottom: 15px;
    position: relative;
}

.popular-post-item:last-child {
    margin-bottom: 0;
}

.popular-post-link {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(139, 69, 19, 0.7);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.popular-post-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 69, 19, 0.1), transparent);
    transition: left 0.5s ease;
}

.popular-post-link:hover::before {
    left: 100%;
}

.popular-post-link:hover {
    background: rgba(139, 69, 19, 0.05);
    border-color: rgba(139, 69, 19, 0.3);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.15);
}

/* Ранг поста */
.popular-post-rank {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(139, 69, 19, 0.3);
}

.popular-post-item[data-rank="1"] .popular-post-rank {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #654321;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
}

.popular-post-item[data-rank="2"] .popular-post-rank {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: #333;
}

.popular-post-item[data-rank="3"] .popular-post-rank {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    color: #fff;
}

/* Миниатюра */
.popular-post-thumbnail {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(139, 69, 19, 0.1);
}

.popular-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.popular-post-link:hover .popular-post-thumbnail img {
    transform: scale(1.1);
}

/* Контент поста */
.popular-post-content {
    flex: 1;
    min-width: 0;
}

.popular-post-title {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c1810;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.popular-post-link:hover .popular-post-title {
    color: #8B4513;
}

/* Метаданные */
.popular-post-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #a0826d;
}

.meta-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.meta-views {
    font-weight: 600;
    color: #8B4513;
}

/* Теги */
.popular-post-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.post-tag-mini {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(139, 69, 19, 0.1);
    color: #8B4513;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(139, 69, 19, 0.2);
}

/* Подвал виджета */
.widget-footer {
    padding: 15px 20px;
    background: rgba(139, 69, 19, 0.6);
    border-top: 1px solid rgba(139, 69, 19, 0.8);
    text-align: center;
}

.widget-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.widget-link:hover {
    color: #f5f5e6;
    gap: 10px;
}

.link-arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.widget-link:hover .link-arrow {
    transform: translateX(4px);
}

/* Адаптивность */
@media (max-width: 768px) {
    .widget {
        margin-bottom: 20px;
    }

    .widget-header {
        padding: 15px;
    }

    .widget-title {
        font-size: 1.1rem;
    }

    .widget-content {
        padding: 10px;
    }

    .popular-post-link {
        padding: 10px;
        gap: 10px;
    }

    .popular-post-thumbnail {
        width: 50px;
        height: 50px;
    }

    .popular-post-title {
        font-size: 0.9rem;
    }

    .meta-item {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .popular-post-rank {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .popular-post-thumbnail {
        display: none;
    }

    .popular-post-meta {
        gap: 8px;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .widget {
        background: linear-gradient(135deg, rgba(139, 69, 19, 0.12) 0%, rgba(101, 67, 33, 0.08) 100%);
        border-color: rgba(139, 69, 19, 0.3);
    }

    .widget-header {
        background: linear-gradient(135deg, rgba(139, 69, 19, 0.2) 0%, rgba(101, 67, 33, 0.15) 100%);
    }

    .widget-title {
        color: #d4a574;
    }

    .popular-post-link {
        background: rgba(0, 0, 0, 0.2);
        border-color: rgba(139, 69, 19, 0.2);
    }

    .popular-post-link:hover {
        background: rgba(139, 69, 19, 0.15);
    }

    .popular-post-title {
        color: #e0e0e0;
    }

    .popular-post-link:hover .popular-post-title {
        color: #d4a574;
    }

    .widget-footer {
        background: rgba(0, 0, 0, 0.2);
    }
}

/* Анимация загрузки */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget {
    animation: fadeInUp 0.6s ease-out;
}

.popular-post-item {
    animation: fadeInUp 0.4s ease-out backwards;
}

.popular-post-item:nth-child(1) { animation-delay: 0.1s; }
.popular-post-item:nth-child(2) { animation-delay: 0.2s; }
.popular-post-item:nth-child(3) { animation-delay: 0.3s; }
.popular-post-item:nth-child(4) { animation-delay: 0.4s; }
.popular-post-item:nth-child(5) { animation-delay: 0.5s; }
