/* ─── Galeria Ładuj więcej v1.17 ─────────────────────────────── */

.pg-gallery-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.pg-item {
    box-sizing: border-box;
    overflow: hidden;
    display: block;
}

.pg-item > a {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Zdjęcia */
.pg-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    transition: transform 400ms ease;
}

/* Zoom */
.pg-zoom-enabled .pg-item:not(.pg-item--video):hover img {
    transform: scale(1.07);
}

/* Overlay */
.pg-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.pg-item:hover .pg-item-overlay { opacity: 1; }

/* Lazy placeholder */
img.pg-lazy { background: #ebebeb; }

/* Ukryj wszystkie pg-item zanim JS przejmie kontrolę (zapobiega FOUC) */
.pg-gallery-wrap:not(.pg-ready) .pg-item {
    display: none;
}

/* Po inicjalizacji JS dodaje .pg-ready — od tej chwili JS kontroluje display */
.pg-hidden {
    display: none !important;
    pointer-events: none !important;
}

/* ─── WIDEO ───────────────────────────────────────────────────── */

.pg-item--video {
    cursor: pointer;
}

/* Kursor "pointer" dla wszystkich klikalnych elementów galerii */
.pg-item > a,
.pg-item[data-pg-lb-index],
.pg-item[data-pg-video] {
    cursor: pointer;
}

.pg-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.pg-video-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.pg-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Ikona Play */
.pg-video-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 2;
}

/* Rozmiar ikony — wartość domyślna, nadpisywana przez Elementor selectors */
.pg-video-play-icon svg,
.pg-video-play-icon img.pg-play-custom {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.55));
}

/* Domyślna SVG — kolory przez Elementor selectors */
.pg-play-default circle   { fill: rgba(0,0,0,0.45); }
.pg-play-default polygon  { fill: rgba(255,255,255,0.92); }

/* Własna ikona SVG */
.pg-play-custom {
    object-fit: contain;
    display: block;
}

/* Edytor: ikona zawsze widoczna */
.pg-play-always { opacity: 1 !important; }

/* Front: ikona przy hover */
.pg-item--video:hover .pg-video-play-icon { opacity: 1; }

/* ─── MODAL WIDEO (styl Elementor) ──────────────────────────── */

.pg-video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.pg-video-modal.is-active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay jak w Elementor */
.pg-vm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    z-index: 0;
    animation: pg-fade-in 0.3s ease;
}

.pg-vm-wrap {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 1200px;
    max-height: 90vh;
    animation: pg-scale-in 0.25s ease;
    /* overflow:visible - kluczowe, żeby przycisk X był widoczny ponad kontenerem */
    overflow: visible;
}

.pg-vm-container {
    position: relative;
    background: #000;
    border-radius: 3px;
    overflow: hidden;
}

/* Przycisk zamknięcia — poza kontenerem, w pg-vm-wrap */
.pg-vm-close {
    position: absolute !important;
    bottom: 100% !important;
    margin-bottom: 8px !important;
    right: 0 !important;
    top: auto !important;
    width: 30px !important;
    height: 30px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    padding: 5px !important;
    color: rgba(237, 237, 237, 0.9) !important;
    opacity: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    transition: color 0.15s ease !important;
    box-shadow: none !important;
    text-decoration: none !important;
}
.pg-vm-close:hover {
    color: #fff !important;
    background: transparent !important;
    transform: none !important;
}
.pg-vm-close svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    display: block !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    fill: none !important;
    max-width: none !important;
}

.pg-vm-video-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 domyślnie */
}

.pg-vm-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    outline: none;
    background: #000;
}

@keyframes pg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pg-scale-in {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── UNIFIED LIGHTBOX (styl Elementora) ────────────────────── */

.pg-lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.pg-lb.is-active {
    display: flex;
}

/* Overlay */
.pg-lb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 0;
    cursor: pointer;
    animation: pg-fade-in 0.25s ease;
}

/* Obszar treści (zdjęcie lub wideo) */
.pg-lb-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pg-scale-in 0.22s ease;
}

.pg-lb-media {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}

/* Zdjęcie */
.pg-lb-image {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px !important;
}

/* Wideo */
.pg-lb-video-wrap {
    position: relative;
    /* Dla poziomego: max 90vw, dla pionowego: max 90vh wysokości */
    width: min(90vw, calc(90vh * var(--pg-lb-ratio, 1.778)));
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
    border-radius: 10px !important;
    overflow: hidden;
}
.pg-lb-player {
    display: block;
    width: 100%;
    height: auto;
    max-height: 90vh;
    outline: none;
    background: #000;
}

/* Przycisk zamknij — Elementor styl */
.pg-lb-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 30px !important;
    height: 30px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    padding: 5px !important;
    color: rgba(237, 237, 237, 0.9) !important;
    opacity: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    transition: color 0.15s ease !important;
    box-shadow: none !important;
}
.pg-lb-close:hover { color: #fff !important; background: transparent !important; }
.pg-lb-close svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    display: block !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    fill: none !important;
    max-width: none !important;
}

/* Strzałki nawigacji — Elementor styl */
.pg-lb-prev,
.pg-lb-next {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 44px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    padding: 8px !important;
    color: rgba(237, 237, 237, 0.9) !important;
    opacity: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    transition: color 0.15s ease !important;
    box-shadow: none !important;
}
.pg-lb-prev { left: 10px !important; }
.pg-lb-next { right: 10px !important; }
.pg-lb-prev:hover,
.pg-lb-next:hover { color: #fff !important; }
.pg-lb-prev svg,
.pg-lb-next svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    display: block !important;
    stroke: currentColor !important;
    stroke-width: 2.5 !important;
    fill: none !important;
    max-width: none !important;
}

/* Licznik slajdów — ukryty */
.pg-lb-counter {
    display: none !important;
}

@media (max-width: 767px) {
    .pg-lb-prev { left: 4px !important; }
    .pg-lb-next { right: 4px !important; }
    .pg-lb-close { top: 10px !important; right: 10px !important; }
}
