/* Gallery-specific styles for Conway Construction Management */

/* Remove red divider from gallery sections */
.gallery-header.section-background {
    border-top: none;
}

/* Additional image protection for gallery */
.gallery-item img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Gallery Header */
.gallery-header {
    margin-top: 76px; /* Account for fixed navbar */
    min-height: 300px;
    display: flex;
    align-items: center;
}

.gallery-header h1 {
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Gallery Filters */
.gallery-filters .btn {
    border-radius: 25px;
    padding: 0.5rem 1.2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.gallery-filters .btn.active,
.gallery-filters .btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Gallery Grid */
.gallery-grid {
    min-height: 500px;
}

.gallery-item {
    position: relative;
    margin-bottom: 2rem;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

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

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Gallery items now use the same .gallery-overlay style as main page portfolio */

/* Lazy Loading Placeholder */
.gallery-item.loading {
    background: linear-gradient(45deg, #f0f0f0 25%, #e8e8e8 25%, #e8e8e8 50%, #f0f0f0 50%, #f0f0f0 75%, #e8e8e8 75%);
    background-size: 20px 20px;
    animation: loading-stripe 1s linear infinite;
}

@keyframes loading-stripe {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

.gallery-item img.lazy-load {
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

/* Load More Button */
.load-more {
    background: rgba(248, 253, 248, 0.5);
}

#loadMoreBtn {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

#loadMoreBtn:hover {
    background-color: #6B0000;
    border-color: #6B0000;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139,0,0,0.3);
}

#loadMoreBtn:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Gallery Modal Enhancements */
.modal-xl {
    max-width: 90vw;
}

#galleryModal .modal-content {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

#galleryModal .modal-body {
    background: #f8f9fa;
}

#galleryModal .modal-info {
    background: white;
    border-top: 3px solid var(--secondary-color);
}

.modal-loading {
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    border: none;
    color: white;
    font-size: 1.2rem;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.back-to-top:hover {
    background-color: #6B0000;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .gallery-header {
        margin-top: 60px;
        min-height: 200px;
        text-align: center;
    }
    
    .gallery-header h1 {
        font-size: 2rem;
    }
    
    .gallery-filters .btn {
        font-size: 0.9rem;
        padding: 0.4rem 1rem;
    }
    
    .gallery-item {
        margin-bottom: 1.5rem;
    }
    
    .gallery-item img {
        height: 200px;
    }
    
    .gallery-item .overlay {
        padding: 1rem;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .modal-xl {
        max-width: 95vw;
    }
}

@media (max-width: 576px) {
    .gallery-header {
        padding: 2rem 0;
    }
    
    .gallery-item img {
        height: 180px;
    }
    
    .gallery-filters {
        padding: 1rem 0;
    }
    
    .gallery-filters .btn {
        margin-bottom: 0.5rem;
    }
}

/* Filter Animation */
.gallery-item.filter-hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    margin-bottom: 0;
    height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.gallery-item.filter-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    transition: all 0.3s ease;
}

/* Loading States */
.gallery-loading {
    text-align: center;
    padding: 3rem 0;
    color: #6c757d;
}

.gallery-loading .spinner-border {
    margin-bottom: 1rem;
}

/* Navigation Active State */
.navbar .nav-link.active {
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
}