/**
 * Image Lightbox Styles
 * File: assets/css/lightbox.css
 * 
 * Premium lightbox with glass-morphism design
 * Fully responsive for all devices
 */

/* ====== OVERLAY ====== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ====== BACKDROP ====== */
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ====== CLOSE BUTTON ====== */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.lightbox-close:hover {
    background: #ff5757;
    color: white;
    transform: scale(1.1);
}

.lightbox-close:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ====== NAVIGATION BUTTONS ====== */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-nav:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ====== CONTENT ====== */
.lightbox-content {
    position: relative;
    z-index: 5;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* ====== LOADER ====== */
.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.lightbox-loader.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: lightbox-spin 0.8s linear infinite;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}

/* ====== COUNTER ====== */
.lightbox-counter {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.lightbox-current {
    color: #667eea;
    font-weight: 700;
}

/* ====== THUMBNAILS ====== */
.lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    max-width: 90vw;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.lightbox-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 45px;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 0;
    background: none;
}

.lightbox-thumb:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.lightbox-thumb.active {
    border-color: #667eea;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.4);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ====== ZOOM CONTROLS ====== */
.lightbox-zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lightbox-zoom-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.lightbox-zoom-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-zoom-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ====== RESPONSIVE ====== */

/* Tablet */
@media (max-width: 1024px) {
    .lightbox-nav {
        width: 50px;
        height: 50px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-image {
        max-width: 95vw;
        max-height: 70vh;
    }
    
    .lightbox-thumbnails {
        display: none;
    }
    
    .lightbox-counter {
        bottom: 30px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.15);
    }
    
    .lightbox-prev {
        left: 5px;
    }
    
    .lightbox-next {
        right: 5px;
    }
    
    .lightbox-image {
        max-width: 100vw;
        max-height: 75vh;
        border-radius: 0;
    }
    
    .lightbox-zoom-controls {
        top: 15px;
        left: 15px;
        flex-direction: row;
    }
    
    .lightbox-zoom-btn {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-counter {
        bottom: 25px;
        font-size: 0.85rem;
        padding: 6px 14px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .lightbox-image {
        max-height: 70vh;
    }
    
    .lightbox-zoom-controls {
        gap: 5px;
    }
    
    .lightbox-zoom-btn {
        width: 36px;
        height: 36px;
    }
    
    .lightbox-zoom-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Touch hint for mobile */
@media (hover: none) and (pointer: coarse) {
    .lightbox-nav {
        opacity: 0.7;
    }
    
    .lightbox-image-wrapper::after {
        content: '';
        position: absolute;
        bottom: -50px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.5);
        font-size: 0.75rem;
        white-space: nowrap;
    }
}

/* Dark mode enhancement */
@media (prefers-color-scheme: dark) {
    .lightbox-backdrop {
        background: rgba(0, 0, 0, 0.95);
    }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .lightbox-overlay,
    .lightbox-image,
    .lightbox-nav,
    .lightbox-close,
    .lightbox-thumb,
    .lightbox-zoom-btn {
        transition: none;
    }
    
    .lightbox-spinner {
        animation: none;
    }
}
