/* --- Решетка на галерията --- */
.gallery-grid {
    display: grid;
    gap: 15px;
    justify-content: center;
}

/* Десктоп: 5 колони × 4 реда = 20 снимки на страница */
@media (min-width: 993px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 100px);
        grid-auto-rows: 100px;
    }
}

/* Мобилно: 2 колони × 5 реда = 10 снимки на страница */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 100px);
        grid-auto-rows: 100px;
        justify-content: center;
    }
}

.gallery-item {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    background-color: #f4f4f4;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.gallery-item img.loaded {
    opacity: 1;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

/* Бутони за категории */
.gallery-buttons {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Pagination */
.pagination-container {
    text-align: center;
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.page-btn {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.3s;
}

.page-btn.active {
    background-color: #000;
    color: #fff;
    border-color: #000;
}

.page-btn:hover:not(.active) {
    background-color: #f0f0f0;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0; left: 0; right:0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lightbox-img {
    max-width: 90%;
    max-height: 80%;
    border-radius: 8px;
}

.lightbox-controls {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.lightbox-controls .page-btn {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
}

.close {
    position: absolute;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    top: 80px;
    right: 20px;
}