/**
 * UXD Gallery Button - Lightbox Styles
 */

/* Button Styles */
.uxd-gallery-button-wrapper {
    display: block;
}

.uxd-gallery-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    outline: none;
    border: none;
    font-weight: 600;
    line-height: 1;
    box-sizing: border-box;
}

.uxd-gallery-btn:focus {
    outline: none;
}

.uxd-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.uxd-btn-icon svg {
    width: 1em;
    height: 1em;
}

/* Lightbox Overlay */
.uxd-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background-color: rgba(0, 0, 0, 0.9);
}

.uxd-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Header */
.uxd-lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.uxd-lightbox-counter {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
}

.uxd-lightbox-toolbar {
    display: flex;
    gap: 10px;
}

.uxd-lightbox-toolbar button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 18px;
	padding: 0;
}

.uxd-lightbox-toolbar button:hover {
    transform: scale(1.1);
}

/* Close Button */
.uxd-lightbox-header .uxd-lightbox-close {
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
	position: relative;
    top: 0;
	padding: 0;
}

.uxd-lightbox-close:hover {
    transform: rotate(90deg);
}

/* Main Content Area */
.uxd-lightbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
    position: relative;
    overflow: hidden;
}

.uxd-lightbox-content .uxd-lightbox-image-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uxd-lightbox-content .uxd-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.uxd-lightbox-content .uxd-lightbox-image.loaded {
    opacity: 1;
    transform: scale(1);
	max-height: -webkit-fill-available;
	box-shadow: none;
}

.uxd-lightbox-content .uxd-lightbox-image.zoomed {
    cursor: zoom-out;
    max-width: none;
    max-height: none;
}

/* Loading Spinner */
.uxd-lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: uxd-spin 0.8s linear infinite;
}

@keyframes uxd-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Navigation Arrows */
button.uxd-lightbox-prev,
button.uxd-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
    z-index: 10;
	padding: 10px;
}

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

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

.uxd-lightbox-prev:hover,
.uxd-lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.uxd-lightbox-prev:disabled,
.uxd-lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Caption */
.uxd-lightbox-caption {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 80%;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.uxd-lightbox-caption.visible {
    opacity: 1;
}

/* Thumbnails */
.uxd-lightbox-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
    display: flex;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.uxd-lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

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

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

.uxd-lightbox-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.uxd-lightbox-thumb:hover {
    opacity: 0.8;
}

.uxd-lightbox-thumb.active {
    opacity: 1;
    border-width: 2px;
    border-style: solid;
}

.uxd-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Autoplay Progress */
.uxd-lightbox-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #6366f1;
    width: 0;
    transition: width linear;
}

/* Fullscreen Mode */
.uxd-lightbox-overlay.fullscreen .uxd-lightbox-image {
    max-height: 100vh;
}

/* Zoom Mode */
.uxd-lightbox-content.zoom-mode {
    overflow: auto;
    cursor: grab;
}

.uxd-lightbox-content.zoom-mode:active {
    cursor: grabbing;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .uxd-lightbox-content {
        padding: 60px 20px;
    }
    
    .uxd-lightbox-prev,
    .uxd-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .uxd-lightbox-prev {
        left: 10px;
    }
    
    .uxd-lightbox-next {
        right: 10px;
    }
    
    .uxd-lightbox-toolbar button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .uxd-lightbox-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .uxd-lightbox-thumb {
        width: 50px;
        height: 50px;
    }
    
    .uxd-lightbox-thumbnails {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .uxd-lightbox-image {
        max-height: calc(100vh - 160px);
    }
}

/* Animation Classes */
.uxd-lightbox-slide-left .uxd-lightbox-image {
    animation: slideLeft 0.3s ease;
}

.uxd-lightbox-slide-right .uxd-lightbox-image {
    animation: slideRight 0.3s ease;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Touch Swipe Indicator */
.uxd-lightbox-swipe-hint {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    display: none;
}

@media (max-width: 768px) {
    .uxd-lightbox-swipe-hint {
        display: block;
    }
}

/* Hide scrollbar when lightbox is open */
body.uxd-lightbox-open {
    overflow: hidden;
}
