/* Fresh Lightbox Gallery System - Unique Design 3 Implementation */
/* Inherits color variables from .dark theme in theme4.css */

/* Unique CSS Variables for Lightbox Gallery */
:root {
    --jl-lightbox-gallery-bg: var(--bg-secondary);
    --jl-lightbox-gallery-border: var(--border);
    --jl-lightbox-gallery-shadow: rgba(0, 0, 0, 0.1);
    --jl-lightbox-gallery-shadow-hover: rgba(0, 0, 0, 0.2);
    --jl-lightbox-gallery-overlay-bg: rgba(0, 0, 0, 0.7);
    --jl-lightbox-gallery-text-primary: var(--text-primary);
    --jl-lightbox-gallery-text-secondary: var(--text-secondary);
    --jl-lightbox-gallery-primary: var(--primary);
    --jl-lightbox-gallery-accent: var(--accent);
    --jl-lightbox-gallery-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --jl-lightbox-gallery-scale-hover: 1.05;
    --jl-lightbox-gallery-border-radius: 8px;
    --jl-lightbox-gallery-gap: 15px;
    --jl-lightbox-gallery-padding: 20px;
}

/* Lightbox Modal Styles */
#jl-lightbox-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.9) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#jl-lightbox-container .jl-lightbox-content {
    position: relative !important;
    max-width: 90% !important;
    max-height: 90% !important;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#jl-lightbox-container .jl-lightbox-media {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}

#jl-lightbox-container .jl-lightbox-media img,
#jl-lightbox-container .jl-lightbox-media video {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
}

/* Main Lightbox Gallery Container */
.jl-lightbox-gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--jl-lightbox-gallery-gap);
    padding: var(--jl-lightbox-gallery-padding);
    background: var(--jl-lightbox-gallery-bg);
    border-radius: var(--jl-lightbox-gallery-border-radius);
    margin: 20px 0;
}

/* Individual Gallery Item */
.jl-lightbox-gallery-item {
    position: relative;
    border-radius: var(--jl-lightbox-gallery-border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--jl-lightbox-gallery-transition);
    background: var(--bg-tertiary);
    box-shadow: 0 4px 15px var(--jl-lightbox-gallery-shadow);
}

.jl-lightbox-gallery-item:hover {
    transform: scale(var(--jl-lightbox-gallery-scale-hover));
    box-shadow: 0 8px 25px var(--jl-lightbox-gallery-shadow-hover);
}

/* Gallery Image Container */
.jl-lightbox-gallery-image {
    width: 100%;
    height: 200px;
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jl-lightbox-gallery-image img,
.jl-lightbox-gallery-image video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: var(--jl-lightbox-gallery-transition);
}

.jl-lightbox-gallery-item:hover .jl-lightbox-gallery-image img,
.jl-lightbox-gallery-item:hover .jl-lightbox-gallery-image video {
    transform: scale(1.05);
}

/* Override any other CSS that might affect gallery images */
.jl-lightbox-gallery-container .jl-lightbox-gallery-image img,
.jl-lightbox-gallery-container .jl-lightbox-gallery-image video {
    object-fit: cover !important;
    object-position: center !important;
    width: 100% !important;
    height: 100% !important;
}

/* Force override for any conflicting CSS */
.jl-lightbox-gallery-image img {
    object-fit: cover !important;
    object-position: center !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

.jl-lightbox-gallery-image video {
    object-fit: cover !important;
    object-position: center !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Gallery Overlay */
.jl-lightbox-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--jl-lightbox-gallery-overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--jl-lightbox-gallery-transition);
}

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

/* Overlay Icon */
.jl-lightbox-gallery-overlay-icon {
    font-size: 2rem;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--jl-lightbox-gallery-transition);
}

.jl-lightbox-gallery-item:hover .jl-lightbox-gallery-overlay-icon {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.7);
}

/* Gallery Title and Description Container */
.jl-lightbox-gallery-header {
    text-align: center;
    margin: 30px 0 35px 0;
    padding: 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gallery Title */
.jl-lightbox-gallery-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: var(--jl-lightbox-gallery-primary);
    text-align: center;
    padding: 20px 30px;
    position: relative;
    letter-spacing: -0.5px;
    line-height: 1.2;
    text-transform: uppercase;
    border: 3px solid var(--jl-lightbox-gallery-primary);
    border-radius: 8px;
    background: var(--jl-lightbox-gallery-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Gallery Description */
.jl-lightbox-gallery-description {
    font-size: 1rem;
    color: var(--jl-lightbox-gallery-text-secondary);
    line-height: 1.4;
    margin: 0 auto;
    max-width: 600px;
    padding: 0 20px;
    font-style: italic;
    opacity: 0.9;
}

/* Flat design - no shimmer effects */

/* Remove the old underline pseudo-elements since we're using glass morphism now */

/* Gallery Section Container */
.jl-lightbox-gallery-section {
    margin-bottom: 40px;
    background: var(--jl-lightbox-gallery-bg);
    border-radius: 12px;
    border: 1px solid var(--jl-lightbox-gallery-border);
    overflow: hidden;
}

/* Gallery Loading State */
.jl-lightbox-gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    background: var(--bg-tertiary);
    color: var(--jl-lightbox-gallery-text-secondary);
    font-style: italic;
}

/* Gallery Error State */
.jl-lightbox-gallery-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    background: var(--bg-tertiary);
    color: #e74c3c;
    border: 2px dashed #e74c3c;
    font-style: italic;
}

/* Gallery Empty State */
.jl-lightbox-gallery-empty {
    text-align: center;
    padding: 40px var(--jl-lightbox-gallery-padding);
    color: var(--jl-lightbox-gallery-text-secondary);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jl-lightbox-gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
        padding: 15px;
    }
    
    .jl-lightbox-gallery-image {
        height: 160px;
    }
    
    .jl-lightbox-gallery-overlay-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .jl-lightbox-gallery-title {
        font-size: 1.8rem;
        padding: 15px 20px;
        margin: 0 0 6px 0;
        border-width: 2px;
        border-radius: 6px;
    }
    
    .jl-lightbox-gallery-description {
        font-size: 0.9rem;
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .jl-lightbox-gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        padding: 12px;
    }
    
    .jl-lightbox-gallery-image {
        height: 140px;
    }
    
    .jl-lightbox-gallery-overlay-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .jl-lightbox-gallery-title {
        font-size: 1.5rem;
        padding: 12px 15px;
        margin: 20px 0 20px 0;
        border-width: 2px;
        border-radius: 6px;
    }
}

/* Animation Keyframes */
@keyframes jl-lightbox-gallery-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jl-lightbox-gallery-item {
    animation: jl-lightbox-gallery-fadeIn 0.6s ease-out;
}

/* Staggered Animation for Multiple Items */
.jl-lightbox-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.jl-lightbox-gallery-item:nth-child(2) { animation-delay: 0.2s; }
.jl-lightbox-gallery-item:nth-child(3) { animation-delay: 0.3s; }
.jl-lightbox-gallery-item:nth-child(4) { animation-delay: 0.4s; }
.jl-lightbox-gallery-item:nth-child(5) { animation-delay: 0.5s; }
.jl-lightbox-gallery-item:nth-child(6) { animation-delay: 0.6s; }

/* Focus States for Accessibility */
.jl-lightbox-gallery-item:focus {
    outline: 2px solid var(--jl-lightbox-gallery-primary);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .jl-lightbox-gallery-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .jl-lightbox-gallery-overlay-icon {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid white;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .jl-lightbox-gallery-item,
    .jl-lightbox-gallery-image img,
    .jl-lightbox-gallery-image video,
    .jl-lightbox-gallery-overlay,
    .jl-lightbox-gallery-overlay-icon {
        transition: none;
        animation: none;
    }
    
    .jl-lightbox-gallery-item:hover {
        transform: none;
    }
    
    .jl-lightbox-gallery-item:hover .jl-lightbox-gallery-image img,
    .jl-lightbox-gallery-item:hover .jl-lightbox-gallery-image video {
        transform: none;
    }
    
    .jl-lightbox-gallery-item:hover .jl-lightbox-gallery-overlay-icon {
        transform: none;
    }
}
