/**
 * CM-Lightbox - Responsive CSS Styles
 * Version: 1.0.0
 * Author: CM Alpha
 */

 .cm-lightbox-toolbar button.cm-lightbox-close{
    background: rgb(158, 38, 38);
 }

 .cm-lightbox-toolbar button.cm-lightbox-close:hover{
    background: rgb(207, 17, 17);
 }
 
 
/* Overlay */
.cm-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.78);
}

.cm-lightbox-overlay.cm-lightbox-visible {
    opacity: 1;
}

/* Container - Changed to flex layout for proper stacking */
.cm-lightbox-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
}

/* Text Elements - Always in DOM, hidden when empty */
.cm-lightbox-top-text,
.cm-lightbox-bottom-text {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    color: #e2e2e2;
    padding: 10px 20px;
    margin: 0 auto;
    font-size: clamp(14px, 2vw, 18px);
    line-height: 1.4;
    transition: opacity 0.3s ease, height 0.3s ease;
    flex-shrink: 0; /* Prevent shrinking */
}
 
/* Hide empty text elements */
.cm-lightbox-top-text:empty,
.cm-lightbox-bottom-text:empty {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.cm-lightbox-top-text {
    order: 1;
}

.cm-lightbox-bottom-text {
    order: 3;
    z-index: 10003; /* Above thumbnails */
}

/* Content Wrapper - Takes remaining space */
.cm-lightbox-content-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1; /* Take remaining vertical space */
    overflow: hidden;
    order: 2;
}

/* Content - Fills wrapper while maintaining aspect ratio */
.cm-lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;

    box-sizing: border-box;
}

/* Images and media - Responsive sizing */
.cm-lightbox-content img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cm-lightbox-content iframe,
.cm-lightbox-content video {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

.cm-lightbox-content audio {
    display: block;
    width: auto;
    height: auto;
}

.cm-lightbox-content .cm-lightbox-image {
    /* Images fill their container */
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cm-lightbox-content .cm-lightbox-youtube,
.cm-lightbox-content .cm-lightbox-pdf,
.cm-lightbox-content .cm-lightbox-maps {
    width: 100%;
    height: 100%;
    border: none;
}

.cm-lightbox-content .cm-lightbox-audio-wrapper {
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-lightbox-content .cm-lightbox-html {
    background: white;
    padding: 20px;
    border-radius: 4px;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
}

.cm-lightbox-content .cm-lightbox-error {
    color: #ff0000;
    font-size: 16px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
}

/* Navigation Buttons */
.cm-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: clamp(51px, 10vw, 99px);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10004;
    padding: .0em .25em .2em .25em;
    line-height: 1;
    border-radius: 4px;
}

.cm-lightbox-nav:hover {
    background: rgba(98, 167, 118, 0.603);
}

.cm-lightbox-prev {
    left: 20px;
}

.cm-lightbox-next {
    right: 20px;
}

/* Toolbar */
.cm-lightbox-toolbar {
    position: absolute;
    top: 0px;
    right: 5px;
    display: flex;
    gap: 10px;
    z-index: 10005;
}

.cm-lightbox-toolbar button {
    background: rgb(0, 0, 0);
    border: solid thin white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
 

/* Thumbnails - Always in DOM, positioned correctly */
.cm-lightbox-thumbnails {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    overflow: hidden;
    order: 4;
    z-index: 10002;
    transition: opacity 0.3s ease, height 0.3s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Hide empty thumbnails */
.cm-lightbox-thumbnails:empty,
.cm-lightbox-thumbnails[style*="display: none"] {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.cm-lightbox-thumbnails-wrapper {
    display: flex;
    gap: 5px;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.cm-lightbox-thumbnail {
    flex: 0 0 75px;
    width: 75px;
    height: 50px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.cm-lightbox-thumbnail:hover {
    opacity: 0.8;
}

.cm-lightbox-thumbnail.active {
    opacity: 1;
    border-color: #fff;
}

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

.cm-lightbox-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    text-transform: uppercase;
}

/* Fullscreen Adjustments */
.cm-lightbox-overlay:fullscreen {
    background: #000;
}

.cm-lightbox-overlay:-webkit-full-screen {
    background: #000;
}

.cm-lightbox-overlay:-moz-full-screen {
    background: #000;
}

.cm-lightbox-overlay:-ms-fullscreen {
    background: #000;
}

/* Zoom Mode */
.cm-lightbox-content-wrapper.cm-lightbox-zoomed {
    overflow: auto;
    cursor: grab;
}

.cm-lightbox-content-wrapper.cm-lightbox-zoomed:active {
    cursor: grabbing;
}

/* Scrollbar Styling */
.cm-lightbox-thumbnails-wrapper::-webkit-scrollbar,
.cm-lightbox-content-wrapper::-webkit-scrollbar,
.cm-lightbox-html::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.cm-lightbox-thumbnails-wrapper::-webkit-scrollbar-track,
.cm-lightbox-content-wrapper::-webkit-scrollbar-track,
.cm-lightbox-html::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.cm-lightbox-thumbnails-wrapper::-webkit-scrollbar-thumb,
.cm-lightbox-content-wrapper::-webkit-scrollbar-thumb,
.cm-lightbox-html::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.cm-lightbox-thumbnails-wrapper::-webkit-scrollbar-thumb:hover,
.cm-lightbox-content-wrapper::-webkit-scrollbar-thumb:hover,
.cm-lightbox-html::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Loading State */
.cm-lightbox-content.cm-lightbox-loading {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-lightbox-content.cm-lightbox-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cm-lightbox-spin 1s linear infinite;
}

@keyframes cm-lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}
 
/* DURING TESTING ONLY */
/*

.cm-lightbox-overlay {
    background: red;
}

.cm-lightbox-content-wrapper {
    background: orange;
}

.cm-lightbox-thumbnails {
    width: 65%;
    margin-left: auto;
    margin-right: auto;
}

.cm-lightbox-top-text,
.cm-lightbox-bottom-text {
    max-width: 80vw;
    color: #000000;
    background: yellow;
}

.cm-lightbox-content {
    border: solid 10px green;
}
*/
 