/* Lightbox Styles */
.c-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    display: none;
}

.c-lightbox.c-active {
    display: flex;
    opacity: 1;
}

.c-lightbox-content {
    position: relative;
    margin: auto;
    display: flex;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 2rem;
}

.c-lightbox-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: flex 0.3s ease-in-out;
}

/* When right panel is hidden, expand left panel */
.c-lightbox-content.c-info-hidden .c-lightbox-left {
    flex: 1;
}

.c-lightbox-content.c-info-hidden .c-lightbox-right {
    display: none;
}

.c-lightbox-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 15px;
    min-height: 0; /* Allow container to shrink */
}

.c-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease-in-out;
}

.c-lightbox-right {
    flex: 0 0 350px;
    background: black;
    padding: 2rem;
    color: white;
    display: flex;
    flex-direction: column;
    margin: -2rem;
    margin-left: 0;
    padding-top: 8rem;
    text-align: right;
}

.c-lightbox-right.c-hidden {
    display: none;
}

/* Top controls container */
.c-lightbox-controls {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 10px;
    z-index: 1001;
    width: 400px; /* Match right panel width */
    justify-content: flex-end;
}

.c-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: white;
    cursor: pointer;
    background: black;
    border: none;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 1001;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding-bottom: 0.15em;
}

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

.c-lightbox-nav.c-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.c-lightbox-nav.c-disabled:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-50%);
}

.c-lightbox-prev {
    left: 15px;
}

.c-lightbox-next {
    right: 15px;
}

.c-lightbox-info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.c-lightbox-filename {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    word-break: break-word;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    padding-bottom: 15px;
}

.c-lightbox-meta {
    font-size: 1rem;
    line-height: 1.6;
    color: white;
    white-space: pre-wrap;
}

.c-lightbox-thumbnails {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding: 15px;
    max-width: 100%;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    flex-shrink: 0; /* Prevent thumbnails from being hidden */
}

.c-lightbox-thumbnails::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.c-lightbox-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.c-lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.c-lightbox-thumbnails::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.c-lightbox-thumbnail {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    opacity: 0.7;
}

.c-lightbox-thumbnail:hover {
    opacity: 1;
    transform: scale(1.05);
}

.c-lightbox-thumbnail.c-active {
    border-color: white;
    opacity: 1;
    transform: scale(1.1);
}

.c-lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox without info panel (for CMS collections) */
.c-lightbox-no-info .c-lightbox-content,
.c-lightbox-content-no-info {
    width: 100%;
    height: 100%;
    max-width: none;
}

.c-lightbox-no-info .c-lightbox-left,
.c-lightbox-content-no-info .c-lightbox-left {
    flex: 1;
    max-width: none;
}

.c-lightbox-no-info .c-lightbox-thumbnails,
.c-lightbox-content-no-info .c-lightbox-thumbnails {
    justify-content: center;
    max-width: 100%;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1200px) {
    .c-lightbox-content {
        width: 98%;
        max-width: none;
    }

    .c-lightbox-right {
        flex: 0 0 300px;
    }
}

/* Mobile responsive adjustments for lightbox */
@media (max-width: 768px) {
    .c-lightbox-content {
        flex-direction: column;
        gap: 10px;
        padding: 1rem;
    }

    .c-lightbox-left {
        flex: 1;
    }

    .c-lightbox-right {
        flex: none;
        max-height: 40%;
        padding: 15px;
        padding-top: 15px; /* Reset top padding on mobile */
        margin-top: 0; /* Reset margin-top on mobile */
    }
    
    .c-lightbox-controls {
        width: auto;
        right: 15px;
        top: 15px;
    }
    
    .c-lightbox-nav {
        padding: 10px 15px;
        font-size: 24px;
    }
    
    .c-lightbox-prev {
        left: 10px;
    }
    
    .c-lightbox-next {
        right: 10px;
    }

    .c-lightbox-thumbnails {
        max-height: 120px;
        padding: 10px;
        gap: 6px;
    }

    .c-lightbox-thumbnail {
        width: 45px;
        height: 45px;
    }
}