/* Стили для страницы VK постов с галереей */
.vk-posts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.vk-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.vk-post-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
}

.vk-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Галерея миниатюр */
.post-gallery {
    margin: 0;
    background: #f8f9fa;
}

.gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    justify-content: center;
    min-height: 150px;
    align-items: center;
}

.thumbnail-container {
    position: relative;
    width: 100px;
    height: 100px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.thumbnail-container:hover {
    transform: scale(1.08);
    border-color: #3498db;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    z-index: 2;
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.5s ease;
}

.thumbnail:hover {
    transform: scale(1.1);
}

.image-counter {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    line-height: 1;
}

/* Счетчик изображений в шапке галереи */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f1f3f5;
    border-bottom: 1px solid #dee2e6;
}

.gallery-count {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.gallery-count i {
    margin-right: 5px;
}

/* Одиночное изображение (если только одно) */
.single-image-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.single-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.single-image:hover {
    transform: scale(1.05);
}

/* Контент поста */
.vk-post-content {
    padding: 20px;
}

.vk-post-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c3e50;
    line-height: 1.4;
}

.vk-post-text {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 0.95rem;
    max-height: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.vk-post-text:after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30%;
    height: 24px;
    background: linear-gradient(to right, transparent, white);
}

/* Мета-информация */
.vk-post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #6c757d;
    font-size: 0.85rem;
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
    margin-top: 15px;
}

.vk-post-stats {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #7f8c8d;
    font-weight: 500;
}

.stat-item i {
    font-size: 1rem;
}

.vk-post-date {
    color: #95a5a6;
    font-size: 0.85rem;
}

.vk-post-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #4a76a8;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.vk-post-link:hover {
    background: #3a5f8a;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(58, 95, 138, 0.2);
}

/* Lightbox (показывается через JavaScript) */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.lightbox-title {
    color: white;
    margin-top: 15px;
    font-size: 16px;
    padding: 0 20px;
    opacity: 0.9;
}

.lightbox-counter {
    position: absolute;
    top: -45px;
    left: 0;
    color: white;
    font-size: 14px;
    opacity: 0.8;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 8px;
}

.page-link {
    padding: 8px 15px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

.page-link:hover:not(.page-current):not(.disabled) {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

.page-current {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
}

.page-disabled, .disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
    margin-right: 15px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .vk-posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }

    .thumbnail-container {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 768px) {
    .vk-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .vk-posts-container {
        padding: 15px;
    }

    .vk-post-card {
        margin: 0;
    }

    .thumbnail-container {
        width: 80px;
        height: 80px;
    }

    .gallery-thumbnails {
        gap: 6px;
        padding: 12px;
    }

    .lightbox-img {
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    .vk-posts-container {
        padding: 10px;
    }

    .vk-post-content {
        padding: 15px;
    }

    .vk-post-title {
        font-size: 1.2rem;
    }

    .vk-post-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .vk-post-stats {
        width: 100%;
        justify-content: space-between;
    }

    .thumbnail-container {
        width: 70px;
        height: 70px;
    }

    .gallery-thumbnails {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 5px;
        flex-wrap: nowrap;
    }

    .gallery-thumbnails::-webkit-scrollbar {
        height: 4px;
    }

    .gallery-thumbnails::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
    }
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vk-post-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.vk-post-card:nth-child(1) { animation-delay: 0.1s; }
.vk-post-card:nth-child(2) { animation-delay: 0.2s; }
.vk-post-card:nth-child(3) { animation-delay: 0.3s; }
.vk-post-card:nth-child(4) { animation-delay: 0.4s; }
.vk-post-card:nth-child(5) { animation-delay: 0.5s; }
.vk-post-card:nth-child(6) { animation-delay: 0.6s; }

/* Индикатор загрузки изображений */
.thumbnail-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}