/* ========================================
   Gallery Grid Layout
   ======================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--rad-s);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.gallery-item__image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

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

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

.gallery-item__image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover .gallery-item__image::after {
    opacity: 0.4;
}

.gallery-item__info {
    padding: 15px;
    background: #fff;
}

.gallery-item__title {
    line-height: 1.4;
}

.gallery-item__caption {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* ========================================
   Lightbox Styles
   ======================================== */
.gallery-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;
}

.gallery-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.lightbox-content img {
    max-width: 100% !important;
    max-height: 75vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
}

.lightbox-info {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    margin-top: 20px;
    border-radius: 8px;
    max-width: 600px;
    text-align: center;
}

.lightbox-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.lightbox-caption {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

/* Lightbox Controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #333;
    font-size: 40px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: #fff;
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    line-height: 1;
    padding-bottom: 5px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-counter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    z-index: 10001;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gallery-item__image {
        height: 220px;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .gallery-item__image {
        height: 180px;
    }
    
    .gallery-item__info {
        padding: 12px;
    }
    
    .gallery-item__title {
        font-size: 14px;
    }
    
    .gallery-item__caption {
        font-size: 13px;
    }
    
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-info {
        padding: 15px 20px;
        margin-top: 15px;
    }
    
    .lightbox-title {
        font-size: 18px;
    }
    
    .lightbox-caption {
        font-size: 14px;
    }
    
    .lightbox-counter {
        top: 15px;
        padding: 8px 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .gallery-item__image {
        height: 200px;
    }
    
    .lightbox-content {
        max-width: 95%;
    }
    
    .lightbox-content img {
        max-height: 60vh;
    }
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.lightbox-content img.loading {
    opacity: 0.5 !important;
}

#lightboxImage {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

