/**
 * Product Lightbox — fullscreen galeria z pinch-to-zoom
 * Aktywowane trybem /dev/
 */

/* Overlay fullscreen */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    -webkit-user-select: none;
    user-select: none;
}

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

.lightbox-overlay.opening {
    display: flex;
    opacity: 0;
}

/* Top bar */
.lightbox-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.lightbox-counter {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.lightbox-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 1;
}

/* Kontener na zdjęcie główne */
.lightbox-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none; /* Wyłącz domyślne gesty przeglądarki */
    -webkit-user-select: none;
    user-select: none;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: none; /* Brak transition — zarządzane przez JS */
    cursor: default;
    will-change: transform;
    -webkit-user-drag: none; /* Prevent image drag in Safari/Chrome */
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-image.zoomed {
    cursor: grab;
}

.lightbox-image.zoomed:active {
    cursor: grabbing;
}

/* Strzałki nawigacji — desktop */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s;
    z-index: 5;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-nav-prev {
    left: 16px;
}

.lightbox-nav-next {
    right: 16px;
}

/* Miniaturki na dole */
.lightbox-thumbs {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 5;
}

.lightbox-thumb {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
}

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

.lightbox-thumb:hover {
    opacity: 0.85;
}

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

/* Wskaźniki zoom */
.lightbox-zoom-hint {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 20px;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 6;
    white-space: nowrap;
    display: flex;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Desktop hint: ukryj na mobile */
@media (max-width: 768px) {
    .lightbox-zoom-hint-desktop {
        display: none !important;
    }
}

/* Mobile hint: ukryj na desktop */
@media (min-width: 769px) {
    [data-lb-hint-mobile] {
        display: none !important;
    }
}

/* Cursor na głównym zdjęciu produktu w dev mode */
.dev-mode-gallery .main-image-zoom-container {
    cursor: zoom-in;
}

/* Mobile: ukryj strzałki nawigacji, pokaż swipe */
@media (max-width: 768px) {
    .lightbox-nav {
        display: none;
    }

    .lightbox-image {
        max-width: 100vw;
        max-height: 85vh;
    }

    .lightbox-thumb {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}

/* Ukrycie scrollbar na body gdy lightbox aktywny */
body.lightbox-open {
    overflow: hidden;
}
