.gallery-container {
    display: grid;  
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 2rem;
    cursor: pointer;
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.gallery-item:active::after {
    background: rgba(0, 0, 0, 0.2);
}

.gallery-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:active img {
    transform: scale(0.98);
}

/* Modal/Carousel Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    position: relative;
    max-width: 90%;
    height: 90vh;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.carousel-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: none;
}

.carousel-img.active {
    opacity: 1;
    display: block;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1002;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.close:hover {
    opacity: 1;
}

.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    transition: all 0.3s ease;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0.7;
}

.next {
    right: 20px;
}

.prev {
    left: 20px;
}

.prev:hover, .next:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
    width: 65px;
    height: 65px;
}

@media (max-width: 991px) {
    .gallery-item img {
        height: 350px;
    }
    .modal-content {
        max-width: 95%;
    }
    .prev, .next {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 767px) {
    .gallery-item img {
        height: 300px;
    }
    .prev, .next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}
