/* Custom Lightbox Styles */
.custom-lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    animation: lightboxFadeIn 0.3s ease-out;
}

.custom-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    overflow: hidden;
    animation: lightboxSlideIn 0.3s ease-out;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-counter {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 400px;
}

.lightbox-image-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    max-height: 70vh;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 10px;
    transition: opacity 0.3s ease-out;
}

.lightbox-loading {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px; height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-caption {
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-caption p {
    color: white;
    margin: 0;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Gallery Item Styles */
.gallery-item { 
    background: white; 
    border-radius: 20px; 
    overflow: hidden; 
    transition: var(--transition-smooth); 
    border: 1px solid rgba(0, 0, 0, 0.05); 
}

.gallery-item:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1); 
}

.gallery-image { 
    height: 250px; 
    position: relative; 
}

.gallery-img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: var(--transition-smooth); 
}

.gallery-overlay { 
    position: absolute; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(0, 0, 0, 0.7); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    opacity: 0; 
    transition: var(--transition-smooth);
    pointer-events: none; /* Allow clicks to pass through to image */
}

.gallery-item:hover .gallery-overlay { 
    opacity: 1; 
}

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

.gallery-icon { 
    color: white; 
    font-size: 2rem; 
    transform: scale(0.8); 
    transition: var(--transition-smooth);
    pointer-events: none; /* Icon doesn't need to be clickable */
}

.gallery-item:hover .gallery-icon { 
    transform: scale(1); 
}

.gallery-caption { 
    background: rgba(248, 250, 252, 0.8); 
    border-top: 1px solid rgba(0, 0, 0, 0.05); 
}

.gallery-link { 
    text-decoration: none; 
    color: inherit; 
    display: block;
    position: relative;
}

.gallery-link:hover { 
    color: inherit; 
}

/* Edit Mode Specific Styles */
.gallery-img.changeable {
    cursor: pointer;
}

.gallery-img.changeable:hover {
    outline: 2px solid var(--primary-green);
    outline-offset: -2px;
}

body.edit-mode .gallery-overlay { 
    pointer-events: none !important; 
}

body.edit-mode .gallery-overlay-content { 
    pointer-events: none !important; 
}

body.edit-mode .gallery-icon { 
    pointer-events: none !important; 
}

/* Animations */
@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes lightboxSlideIn {
    from { 
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .lightbox-container {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-header {
        padding: 0.75rem 1rem;
    }
    
    .lightbox-nav {
        width: 40px; height: 40px;
    }
    
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
    
    .lightbox-caption {
        padding: 0.75rem 1rem;
    }
    
    .gallery-image { 
        height: 200px; 
    } 
    
    .gallery-icon { 
        font-size: 1.5rem; 
    } 
}

@media (max-width: 576px) { 
    .gallery-image { 
        height: 180px; 
    } 
}
