/**
 * Image Lightbox Styles
 * Full-screen image viewer with carousel
 */

.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
}

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

.lightbox-close i {
    color: #fff;
    font-size: 24px;
}

/* Navigation Buttons */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

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

.lightbox-prev i,
.lightbox-next i {
    color: #fff;
    font-size: 28px;
}

/* Image Counter */
.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10001;
}

.lightbox-counter span {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* Attached Files Grid */
.content-attached-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.content-file-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-file-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.content-file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 150px;
    max-height: 300px;
}

/* "+X more" overlay for galleries with 5+ images */
.more-images-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.content-file-item:hover .more-images-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.more-images-count {
    color: #fff;
    font-size: 48px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    user-select: none;
}

/* Gallery layout variations */
/* 2 images side by side */
.content-attached-files[data-total="2"] {
    grid-template-columns: repeat(2, 1fr);
}

/* 3 images in adaptive grid */
.content-attached-files[data-total="3"] {
    grid-template-columns: repeat(3, 1fr);
}

/* 4+ images in 2x2 grid */
.content-attached-files[data-total="4"],
.content-attached-files[data-total="5"],
.content-attached-files[data-total="6"],
.content-attached-files[data-total="7"],
.content-attached-files[data-total="8"],
.content-attached-files[data-total="9"],
.content-attached-files[data-total="10"],
.content-attached-files[data-total="11"],
.content-attached-files[data-total="12"],
.content-attached-files[data-total="13"],
.content-attached-files[data-total="14"],
.content-attached-files[data-total="15"],
.content-attached-files[data-total="16"],
.content-attached-files[data-total="17"],
.content-attached-files[data-total="18"],
.content-attached-files[data-total="19"],
.content-attached-files[data-total="20"] {
    grid-template-columns: repeat(2, 1fr);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
    }

    .lightbox-prev {
        left: 15px;
    }

    .lightbox-next {
        right: 15px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }

    .lightbox-counter {
        bottom: 15px;
        padding: 8px 16px;
    }

    .content-attached-files {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
    }

    .more-images-count {
        font-size: 32px;
    }
}

/* Single image layout */
.content-attached-files[data-count="1"] {
    grid-template-columns: 1fr;
}

.content-attached-files[data-count="1"] .content-file-item img {
    max-height: 500px;
}

/* Two images side-by-side */
.content-attached-files[data-count="2"] {
    grid-template-columns: repeat(2, 1fr);
}
