/* ===================================================================
   COMPONENTS/LIGHTBOX.CSS
   Lightbox Modal and Media Gallery
   =================================================================== */
/* ===== LIGHTBOX MODAL ===== */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
}

.lightbox-modal.active {
    display: flex;
}

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

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-caption {
    color: #fff;
    text-align: center;
    padding: 15px;
    font-size: 16px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 4px;
    transition: background 0.3s ease;
    z-index: 10000;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    top: 20px;
    right: 35px;
}

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

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

/* Make images clickable */
.media-container.image {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.media-container.image:hover {
    transform: scale(1.02);
    opacity: 0.9;
}


/* ===== MEDIA GALLERY GRID ===== */
/* Specific class for image galleries - always use grid layout when visible */
.toggle > .toggle > .toggle-content.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px 0;
}

/* Remove row/col structure for direct children */
.media-gallery > .row {
    display: contents;
}

.media-gallery > .row > [class*="col"] {
    display: contents;
}

/* Smart sizing based on number of images */
/* 1 image - centered, large */
.media-gallery .media-container.image:only-child,
.media-gallery .row:only-child .media-container.image:only-child {
    grid-column: 1 / -1;
    max-width: 600px;
    margin: 0 auto;
}

.media-gallery .media-container.image:only-child img,
.media-gallery .row:only-child .media-container.image:only-child img {
    height: 400px !important;
}

/* 2 images - 2 columns, larger */
.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(2),
.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(2) ~ * .media-container.image {
    grid-column: span 1;
}

.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(2) img,
.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(2) ~ * .media-container.image img {
    height: 300px !important;
}

/* 3 images - 3 columns, medium */
.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(3),
.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(3) ~ * .media-container.image {
    grid-column: span 1;
}

.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(3) img,
.media-gallery .row:only-child .media-container.image:first-child:nth-last-child(3) ~ * .media-container.image img {
    height: 250px !important;
}

/* 4+ images - default grid (200px height) */

/* Only hide when fully collapsed (jQuery will handle the animation) */
.toggle:not(.active) > .toggle > .toggle-content.media-gallery[style*="display: none"] {
    display: none;
}

.media-gallery .media-container.image {
    display: block;
    width: 100%;
    margin: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.media-gallery .media-container.image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.media-gallery .media-container.image:hover img {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 136, 204, 0.5);
}

/* Overlay effect on hover */
.media-gallery .media-container.image::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.media-gallery .media-container.image:hover::after {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .toggle-content {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .toggle-content {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .toggle-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 10px;
    }
    
    .media-container.image img {
        height: 150px;
    }
}


