/**
 * WPFF Lightbox - Pure CSS (No Dependencies!)
 * Custom Lightbox Styles
 * @version 2.0.0
 */

/* Prevent body scroll */
html.wpff-lb-open {
    overflow: hidden;
}

/* Main container */
.wpff-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wpff-lightbox.wpff-lb-visible {
    opacity: 1;
    visibility: visible;
}

/* Backdrop */
.wpff-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

/* Container */
.wpff-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.wpff-lightbox-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 20px;
    display: flex;
    gap: 10px;
}

.wpff-lightbox-toolbar button {
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.wpff-lightbox-toolbar button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wpff-lightbox-toolbar button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Content */
.wpff-lightbox-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 100px 120px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .wpff-lightbox-content {
        padding: 80px 20px 120px;
    }
}

/* Slider */
.wpff-lb-slider {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.wpff-lb-slides {
    direction: ltr;
    display: flex;
    height: 100%;
    transition: transform 0.4s ease;
    will-change: transform;
}

.wpff-lb-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wpff-lb-slide-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Image */
.wpff-lb-image-wrap {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpff-lb-image {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Video container */
.wpff-lb-video-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
}

.wpff-lb-video-iframe,
.wpff-lb-video-html5 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video poster */
.wpff-lb-video-poster {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wpff-lb-video-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wpff-lb-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.wpff-lb-play-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    transform: translate(-50%, -50%) scale(1.1);
}

.wpff-lb-play-btn svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
    margin-left: 5px;
}

/* Caption */
.wpff-lb-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
}

/* Navigation buttons */
.wpff-lb-prev,
.wpff-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

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

.wpff-lb-prev:focus,
.wpff-lb-next:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.wpff-lb-prev {
    left: 20px;
}

.wpff-lb-next {
    right: 20px;
}

.wpff-lb-prev.disabled,
.wpff-lb-next.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 768px) {
    .wpff-lb-prev,
    .wpff-lb-next {
        width: 40px;
        height: 40px;
    }
    
    .wpff-lb-prev {
        left: 10px;
    }
    
    .wpff-lb-next {
        right: 10px;
    }
}

/* Counter */
.wpff-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 14px;
    border-radius: 20px;
    z-index: 10;
}

/* Thumbnails */
.wpff-lightbox-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: rgba(0, 0, 0, 0.8);
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 9;
}

.wpff-lb-thumbs-container {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    height: 100%;
}

.wpff-lb-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.wpff-lb-thumb:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.5);
}

.wpff-lb-thumb.active {
    opacity: 1;
    border-color: #fff;
}

.wpff-lb-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Scrollbar for thumbnails */
.wpff-lightbox-thumbnails::-webkit-scrollbar {
    height: 8px;
}

.wpff-lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

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

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

/* Loading animation */
@keyframes wpff-lb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wpff-lb-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpff-lb-spin 0.8s linear infinite;
    z-index: 10;
}

/* Entrance animation */
@keyframes wpff-lb-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wpff-lightbox.wpff-lb-visible .wpff-lightbox-container {
    animation: wpff-lb-fadeIn 0.3s ease;
}

/* Touch feedback */
.wpff-lb-slider {
    cursor: grab;
}

.wpff-lb-slider:active {
    cursor: grabbing;
}

/* Responsive */
@media (max-width: 768px) {
    .wpff-lightbox-content {
        padding: 60px 10px 100px;
    }
    
    .wpff-lightbox-toolbar {
        padding: 10px;
    }
    
    .wpff-lightbox-toolbar button {
        width: 40px;
        height: 40px;
    }
    
    .wpff-lb-image {
        max-height: calc(100vh - 160px);
    }
    
    .wpff-lb-video-container {
        max-width: 100%;
    }
    
    .wpff-lightbox-thumbnails {
        height: 80px;
    }
    
    .wpff-lb-thumb {
        width: 60px;
        height: 60px;
    }
    
    .wpff-lb-play-btn {
        width: 60px;
        height: 60px;
    }
    
    .wpff-lb-play-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* High DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .wpff-lb-thumb img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Print */
@media print {
    .wpff-lightbox {
        display: none !important;
    }
}

/* Accessibility */
.wpff-lb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
.wpff-lightbox *:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wpff-lightbox,
    .wpff-lb-slides,
    .wpff-lb-thumb,
    .wpff-lb-prev,
    .wpff-lb-next,
    .wpff-lb-play-btn {
        transition: none !important;
        animation: none !important;
    }
}

/* Prevent text selection during drag */
.wpff-lb-slider * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Smooth rendering */
.wpff-lb-slides {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
