/* ==========================================================================
   1. PRZYCISK POWROTU DO GALERII NADRZĘDNEJ
   ========================================================================== */
.gallery-parent-nav {
    width: 100% !important;
    margin-top: 15px !important;
    margin-bottom: 25px !important;
    text-align: left;
    clear: both !important;
}

.gallery-parent-nav .parentlink {
    display: block !important;
}

.gallery-parent-nav .parentlink a {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    background: #ffffff;
    color: #000000 !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 500;
    text-decoration: none !important;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.gallery-parent-nav .parentlink a::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='19' y1='12' x2='5' y2='12'%3E%3C/line%3E%3Cpolyline points='12 19 5 12 12 5'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center center;
    background-size: contain;
}

.gallery-parent-nav .parentlink a:hover {
    background: #f4f4f4;
    transform: translateX(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* ==========================================================================
   2. SIATKA GALERII (DOKŁADNIE 3 KOLUMNY I BRAK NACHODZENIA NA SZUKAJKĘ)
   ========================================================================== */
.gallery {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important; /* Siatka 3 kolumn */
    gap: 20px !important;
    clear: both !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 15px !important;
    margin-bottom: 30px !important;
    isolation: isolate !important;
    position: relative !important;
    z-index: 1 !important;
}

.gallery .img {
    width: 100% !important;
    max-width: 370px !important;
    margin: 0 auto !important;
    float: none !important; /* Likwiduje układy pionowe */
    clear: none !important;
    text-align: center;
    color: #000;
    font-size: 22px;
    font-family: 'Cormorant Infant', Arial, cursive !important;
}

.gallery .img a {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 370 / 278 !important; /* Proporcje kadru 370x278px */
    text-decoration: none;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    background: #f8f8f8;
    transform: translateZ(0); 
    will-change: transform;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery .img a:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2) !important;
}

.gallery .img a:hover img {
    transform: scale(1.03) !important;
    filter: brightness(1.05);
}

.gallery img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border: none;
    transition: transform 0.4s ease, filter 0.4s ease;
}

/* Responsywność */
@media (max-width: 900px) {
    .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 550px) {
    .gallery { grid-template-columns: 1fr !important; }
}

/* ==========================================================================
   3. LIGHTBOX 2.8.2 - WARSTWY, NAWIGACJA ORAZ PODPIS
   ========================================================================== */

/* Usunięcie domyślnych ramek i tła wokół obrazka */
.lb-outerContainer, 
.lb-container, 
.lb-dataContainer,
#lightbox .lb-outerContainer, 
#lightbox .lb-container {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#lightbox .lb-image {
    background-color: transparent !important;
    border: none !important;
    border-radius: 15px !important;
    display: block !important;  
    box-shadow: 0 10px 50px rgba(0,0,0,0.8) !important;
}

.lb-outerContainer {
    overflow: visible !important;
}

body.lb-disable-scrolling {
    overflow: hidden;
}

/* Nakładka przyciemniająca - PONAD PASIEM WYSZUKIWANIA */
.lightboxOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483646 !important;
    background-color: #000000 !important;
    opacity: 0.8 !important;
}

/* Okno Lightboxa - Zawsze w najwyższej warstwie */
.lightbox {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2147483647 !important;
    text-align: center;
    line-height: 0;
    outline: none;
}

/* STREFA NAWIGACJI DALEJ / WSTECZ */
.lb-nav {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    width: 100% !important;
    z-index: 10 !important;
}

.lb-nav a.lb-prev {
    width: 45% !important;
    height: 100% !important;
    left: 0 !important;
    float: left !important;
    background: url(/modules/Gallery/templates/lightbox/images/prev.png) left 48% no-repeat !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.lb-nav a.lb-prev:hover {
    opacity: 1 !important;
}

.lb-nav a.lb-next {
    width: 45% !important;
    height: 100% !important;
    right: 0 !important;
    float: right !important;
    background: url(/modules/Gallery/templates/lightbox/images/next.png) right 48% no-repeat !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.lb-nav a.lb-next:hover {
    opacity: 1 !important;
}

/* KONTENER PODPISU - DOKŁADNA SZEROKOŚĆ ZDJĘCIA */
.lb-dataContainer {
    position: relative !important;
    z-index: 2147483647 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-top: 12px !important;
    margin: 0 auto !important;
}

.lb-data {
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
}

.lb-data .lb-details {
    width: 100% !important;
    float: none !important;
    text-align: center !important;
    line-height: 1.4em !important;
    box-sizing: border-box !important;
}

/* PODPIS W BIAŁEJ PIGUŁCE NA SZEROKOŚĆ ZDJĘCIA */
.lb-data .lb-caption {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400 !important;
    font-size: 0.95rem !important;
    line-height: 1.4em !important;
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 15px !important;
    padding: 10px 18px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    margin: 0 0 8px 0 !important;
    text-align: center !important;
}

.lb-data .lb-number {
    display: block !important;
    color: #ffffff !important;
    font-size: 13px !important;
    margin-bottom: 5px !important;
    clear: both !important;
}

/* PRZYCISK ZAMKNIĘCIA (X) */
.lb-data .lb-close {
    display: block !important;
    position: absolute !important;
    top: -45px !important;
    right: 0 !important;
    width: 35px !important;
    height: 35px !important;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E") no-repeat center center !important;
    background-size: 20px 20px !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
    cursor: pointer !important;
    opacity: 0.9 !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
    z-index: 2147483647 !important;
}

.lb-data .lb-close:hover {
    opacity: 1 !important;
    transform: scale(1.1) !important;
}

/* NAWIGACJA STRON */
.gallery .pagenavigation {
    height: 50px;
    grid-column: 1 / -1;
}

.galleryclear {
    clear: both;
}