/* Стили галереи */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    aspect-ratio: 1 / 1;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.03);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Стили пагинации */
.gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.page-btn {
    padding: 8px 15px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.page-btn:hover {
    background: #e0e0e0;
}

.page-btn.active {
    background: #333;
    color: white;
    border-color: #333;
}

/* Стили модального окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    z-index: 1000;
    cursor: pointer;
}

.modal-content {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    margin: 0 auto;
}

.modal-content-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: default;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.prev-btn, .next-btn {
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -22px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    z-index: 1001;
}

.next-btn {
    right: 0;
    transform: rotate(180deg);
}

.prev-btn {
    left: 0;
    transform: rotate(180deg);
}

.close-btn:hover, .prev-btn:hover, .next-btn:hover {
    color: #ccc;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.pagination {
            display: flex;
            justify-content: center;
            margin: 30px 0;
            gap: 10px;
        }
        .page-link {
            padding: 8px 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            text-decoration: none;
            color: #333;
        }
        .page-link:hover {
            background: #f0f0f0;
        }
        .page-link.active {
            background: #333;
            color: white;
            border-color: #333;
        }

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    cursor: pointer;
}

.modal-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001; /* Важно: выше чем оверлей */
}

.modal-content {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    margin: 0 auto;
    cursor: default;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: -5px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 1002;
}

