/* ==========================================================================
   Fotobedna Gallery — custom replacement for UniteGallery
   Justified flexbox layout + GLightbox overrides + hover effects + share buttons
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. JUSTIFIED FLEXBOX LAYOUT
   -------------------------------------------------------------------------- */

.fb-gallery {
    --row-height: 200px;
    --gap: 4px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding: 8px 0;
    margin: 0;
    width: 100%;
}

.fb-gallery-row {
    display: flex;
    gap: var(--gap);
    width: 100%;
}

.fb-gallery-item {
    height: var(--row-height);
    flex: 1 1 0%;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    line-height: 0;
}

.fb-gallery-item.fb-justified {
    flex: 0 0 auto;
}

.fb-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --------------------------------------------------------------------------
   2. HOVER EFFECTS
   -------------------------------------------------------------------------- */

.fb-gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(170, 141, 63, 0.6);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 1;
}

.fb-gallery-item:hover::after {
    opacity: 1;
}

.fb-gallery-item .fb-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 32px;
    height: 32px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 2;
    fill: #fff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.fb-gallery-item:hover .fb-icon {
    opacity: 1;
}

@media (hover: none) {
    .fb-gallery-item::after {
        display: none;
    }
    .fb-gallery-item .fb-icon {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   3. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .fb-gallery {
        --row-height: 160px;
        --gap: 3px;
    }
}

@media (max-width: 600px) {
    .fb-gallery {
        --row-height: 120px;
        --gap: 2px;
    }
    .fb-gallery-item {
        min-width: 80px;
    }
}

@media (max-width: 400px) {
    .fb-gallery {
        --row-height: 100px;
    }
}

/* --------------------------------------------------------------------------
   4. PRELOADER / LOADING STATE
   -------------------------------------------------------------------------- */

.fb-gallery-loading {
    text-align: center;
    padding: 40px 0;
    color: #aa8d3f;
    font-size: 16px;
}

/* --------------------------------------------------------------------------
   5. GLIGHTBOX THEME OVERRIDES
   -------------------------------------------------------------------------- */

body.fb-lightbox-open #header #headerBottomCont {
    z-index: 0 !important;
}

.glightbox-clean .goverlay {
    background: rgba(0, 0, 0, 0.65) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.glightbox-clean .gslide-description {
    background: transparent !important;
    z-index: 3 !important;
}

.glightbox-clean .gslide-title {
    display: none !important;
}

.glightbox-clean .gnext,
.glightbox-clean .gprev {
    width: 50px;
    height: 55px;
}

.glightbox-clean .gclose {
    z-index: 4;
}

.gslide-media {
    max-height: calc(100vh - 100px) !important;
}

.gslide-media img.zoomable {
    cursor: default !important;
}

.glightbox-mobile .gslide-description {
    display: none !important;
}

.fb-lightbox-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 1000000;
    padding: 10px 16px calc(env(safe-area-inset-bottom, 8px) + 8px);
    box-sizing: border-box;
    text-align: center;
}

/* Slide counter */
.fb-lightbox-counter {
    position: fixed;
    top: 14px;
    left: 12px;
    color: #fff;
    font-family: 'Open Sans Condensed', sans-serif;
    font-size: 14px;
    z-index: 100001;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* --------------------------------------------------------------------------
   6. SHARE BUTTONS (in lightbox)
   -------------------------------------------------------------------------- */

.fb-share-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 0 4px;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

@media (hover: none) and (pointer: coarse) {
    .fb-share-buttons {
        gap: 16px;
        padding: 12px 0 4px;
    }
    .fb-share-btn {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
}

.fb-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    color: #fff;
    fill: #fff;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.fb-share-btn i,
.fb-share-btn svg {
    color: #fff;
    fill: #fff;
}

.fb-share-btn:hover {
    transform: scale(1.12);
    opacity: 1;
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
}

.fb-share-btn:active {
    transform: scale(.95);
}

.fb-share-facebook {
    background: #1877f2;
}

.fb-share-facebook:hover {
    background: #1565d8;
}

.fb-share-instagram {
    display: none;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
}

.fb-share-instagram:hover {
    background: linear-gradient(135deg, #7232a0, #e01a1a, #e5a03e);
}

@media (hover: none) and (pointer: coarse) {
    .fb-share-instagram {
        display: inline-flex;
    }
}

.fb-share-download {
    background: #aa8d3f;
}

.fb-share-download:hover {
    background: #9a7f38;
}

/* --------------------------------------------------------------------------
   7. TOAST NOTIFICATION
   -------------------------------------------------------------------------- */

.fb-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,.82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 999999;
    opacity: 0;
    transition: opacity .3s ease, transform .3s ease;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

.fb-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
